jetweb is hosted by Hepforge, IPPP Durham

cedar.jetweb.model.paper
Class Paper

java.lang.Object
  extended by cedar.jetweb.model.paper.Paper
All Implemented Interfaces:
Storeable

public class Paper
extends java.lang.Object
implements Storeable

Object representing a single paper. The paper will be either a "real" paper (that is, the associated plots are the actual measurements) or an MC paper (the associated plots are the results of a model simulation).

Version:
$Date: 2006-06-14 19:59:37 +0100 (Wed, 14 Jun 2006) $ $Revision: 1185 $
Author:
Jon Butterworth

Constructor Summary
Paper(boolean realData)
          Constructor to create blank paper.
Paper(int paperId)
          Constructor to instantiate a paper from the DB.
Paper(Paper dataPaper, Model model)
          Constructor using a paper as a template and a model to extract a MC paper from the DB.
 
Method Summary
 void add(Paper paper2)
          Add plots in paper2 to those in this paper.
 void addPlot(DataPlot plot)
          Add a DataPlot to this Paper.
 boolean containsDataFor(MCProcessType proc)
          Return true if this paper has a plot or more predicted by the input MCProcessType.
 void delete()
          Delete this paper and all its plots from the data base.
 Paper fit(Paper dataPaper, double scale, PlotSelection selection, boolean scaleall)
          Returns a version of this paper which has been scaled by the input scale and has had the Chi2 calculated.
 void fixFit(Fit fit)
          Convert the PredictedPlots for this paper into FittingPlots.
 java.lang.String getAccelerator()
          Get the accelerator (the accelerator name, for now)
 double getChi2(int fitId)
          Get the total Chi2 for all distributions in this paper, regardless over whether they are used in the fit.
 java.lang.String getCodeAuthor()
          Get Journal CodeAuthor of the paper.
 java.lang.String getCodeContact()
           
 java.lang.String getCollaboration()
          Get the collaboration responsible for the paper.
 java.lang.String getContact()
          Get Journal Contact of the paper.
 java.lang.String getDirName()
          get the directory name (relative, no path) to which the files for this paper will be written
 double getDOF(int fitId)
          Get the total DoF for all distributions in this paper, regardless over whether they are used in the fit.
 double[] getFitChi2()
          Get the chi2 and DoF for all the plots in this paper which were requested to be used in the fit to determine the normalisation.
 int getId()
          Get the unique ID of this paper.
 java.util.Map<java.lang.Integer,DataPlot> getIndexedPlots()
          get Copy of the DataPlots stored in this paper, indexed by paperId
 int getIRN()
          Get the spires reference number.
 int getNPlots()
          Get number of plots in the paper
 DataPlot getPlot(int csnId)
          Retrieves a plot from the plots collection with the specified csnId
 java.util.Collection<DataPlot> getPlotCollection()
          get Collection of DataPlots in the paper
 java.util.Collection<DataPlot> getPlots()
          get Iterator of DataPlots in the paper
 java.lang.String getReference()
          Get Journal Reference of the paper.
 RunSeries getRunSeries()
           
 int getSpiresId()
           
 double[] getSumChi2()
          Get the chi2 and DoF for all the plots in this paper which were requested to be in the Summed chi2 for this fit.
 java.lang.String getTitle()
          Get title of the paper.
 boolean isAvailable()
          Tell you whether plots (xml) for this paper exist at all
 boolean isReal()
          Is this a paper of real data (true) or MC (false).
 boolean retrieve()
          Constructor using a paper as a template and a fit to extract a MC paper from the DB.
 void setAccelerator(java.lang.String newaccelerator)
          Set the accelerator (the accelerator name, for now)
 void setCodeAuthor(java.lang.String newcodeAuthor)
          Set Journal CodeAuthor of the paper.
 void setCodeContact(java.lang.String newcontact)
           
 void setCollaboration(java.lang.String newcollab)
          Set collaboration responsible for the paper.
 void setContact(java.lang.String newcontact)
          Set Journal Contact of the paper.
 void setDirectory(java.lang.String newDir)
          Set the directory path (relative to the root)
 void setDirName(java.lang.String s)
          set the directory name (relative, no path) to which the files for this paper will be written
 void setFrom(Paper paper, boolean comp)
          Sets the title, reference, etc of this paper to be equal to those of the input paper.
 void setID(int newid)
          Set the unique ID of this paper.
 void setIRN(int newirn)
          Set the spires reference number.
 void setNPlots(int newnplots)
          Set number of plots in the paper
 void setReference(java.lang.String newreference)
          Set Journal Reference of the paper.
 Paper setSpiresId(int id)
           
 void setTitle(java.lang.String newtitle)
          Set title of the paper.
 boolean store()
          Write the object in memory to the database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Paper

public Paper(int paperId)
      throws JetWebException
Constructor to instantiate a paper from the DB.

Parameters:
paperId - the id of the paper wanted.
Throws:
JetWebException


Paper

public Paper(boolean realData)
Constructor to create blank paper.

Parameters:
realData - boolean to say whether this is a paper of real data or not.


Paper

public Paper(Paper dataPaper,
             Model model)
      throws JetWebException
Constructor using a paper as a template and a model to extract a MC paper from the DB. Retain the plots from the template as comparison plots.

Parameters:
dataPaper - - template paper
model - to extract MC paper
Throws:
JetWebException

Method Detail

retrieve

public boolean retrieve()
                 throws JetWebException
Constructor using a paper as a template and a fit to extract a MC paper from the DB. Retain the plots from the template as comparison plots.

Specified by:
retrieve in interface Storeable
Parameters:
dataPaper - - template paper
fit - to extract MC paper
Throws:
JetWebException - public Paper(Paper dataPaper, Fit fit) throws JetWebException { id=dataPaper.getId(); this.isRealData = false; irn = dataPaper.getIRN(); reference = dataPaper.getReference(); collaboration = dataPaper.getCollaboration(); title = dataPaper.getTitle(); accelerator = dataPaper.getAccelerator(); contact = dataPaper.getContact(); codeAuthor= dataPaper.getCodeAuthor(); directory = dataPaper.getDirName(); Collection oldplots = dataPaper.getPlots(); for (DataPlot compPlot : oldplots){ //System.out.println("instantiating predicted plot"); try { runSeries = model.getRunSeriesCollection().getRunSeries(compPlot); FittedPlot plot = new FittedPlot(compPlot,fit); if (plot.hasData()){ System.out.println("Paper: found a plot with data "+plot.getId()); plot.setCompPlot(compPlot); addPlot(plot); } } catch (JetWebException jwe) { // No need to do anything here. This DataPlot simply // doesn't have a prediction // yet with this Model. } } }


getRunSeries

public RunSeries getRunSeries()

getIRN

public int getIRN()
Get the spires reference number.


setIRN

public void setIRN(int newirn)
Set the spires reference number.


isReal

public boolean isReal()
Is this a paper of real data (true) or MC (false).


isAvailable

public boolean isAvailable()
Tell you whether plots (xml) for this paper exist at all


getId

public int getId()
Get the unique ID of this paper. Corresponds to paper_id in the DB.

Specified by:
getId in interface Storeable


setID

public void setID(int newid)
Set the unique ID of this paper. Corresponds to paper_id in the DB.


getSpiresId

public int getSpiresId()

setSpiresId

public Paper setSpiresId(int id)

getDirName

public java.lang.String getDirName()
get the directory name (relative, no path) to which the files for this paper will be written


setDirName

public void setDirName(java.lang.String s)
set the directory name (relative, no path) to which the files for this paper will be written


getTitle

public java.lang.String getTitle()
Get title of the paper.


setTitle

public void setTitle(java.lang.String newtitle)
Set title of the paper.


getCollaboration

public java.lang.String getCollaboration()
Get the collaboration responsible for the paper.


setCollaboration

public void setCollaboration(java.lang.String newcollab)
Set collaboration responsible for the paper.


getReference

public java.lang.String getReference()
Get Journal Reference of the paper.


setReference

public void setReference(java.lang.String newreference)
Set Journal Reference of the paper.


getCodeAuthor

public java.lang.String getCodeAuthor()
Get Journal CodeAuthor of the paper.


setCodeAuthor

public void setCodeAuthor(java.lang.String newcodeAuthor)
Set Journal CodeAuthor of the paper.


getContact

public java.lang.String getContact()
Get Journal Contact of the paper.


getCodeContact

public java.lang.String getCodeContact()

setContact

public void setContact(java.lang.String newcontact)
Set Journal Contact of the paper.


setCodeContact

public void setCodeContact(java.lang.String newcontact)

getNPlots

public int getNPlots()
Get number of plots in the paper


setNPlots

public void setNPlots(int newnplots)
Set number of plots in the paper


getPlots

public java.util.Collection<DataPlot> getPlots()
get Iterator of DataPlots in the paper


getPlotCollection

public java.util.Collection<DataPlot> getPlotCollection()
get Collection of DataPlots in the paper


getIndexedPlots

public java.util.Map<java.lang.Integer,DataPlot> getIndexedPlots()
get Copy of the DataPlots stored in this paper, indexed by paperId


getAccelerator

public java.lang.String getAccelerator()
Get the accelerator (the accelerator name, for now)


setAccelerator

public void setAccelerator(java.lang.String newaccelerator)
Set the accelerator (the accelerator name, for now)


setDirectory

public void setDirectory(java.lang.String newDir)
Set the directory path (relative to the root)


addPlot

public void addPlot(DataPlot plot)
Add a DataPlot to this Paper.


setFrom

public void setFrom(Paper paper,
                    boolean comp)
             throws JetWebException
Sets the title, reference, etc of this paper to be equal to those of the input paper. Builds a list of data plots for this paper either from XML files or from the plots of the old paper.

Parameters:
comp - boolean, if true the data from the old paper is retained as a comparison data set for this plot. If false, the comparison plot is set to the comparison plot for the old paper's plots . (NB Real Data sets do not have comparison data, so comp=false is an error if the old paper has real data)
Throws:
JetWebException


add

public void add(Paper paper2)
         throws JetWebException
Add plots in paper2 to those in this paper. The plot number and xml subdirectory are checked and should be equal.

Throws:
JetWebException


getPlot

public DataPlot getPlot(int csnId)
Retrieves a plot from the plots collection with the specified csnId

Parameters:
csnId -
Returns:
DataPlot


fit

public Paper fit(Paper dataPaper,
                 double scale,
                 PlotSelection selection,
                 boolean scaleall)
          throws JetWebException
Returns a version of this paper which has been scaled by the input scale and has had the Chi2 calculated.

Parameters:
dataPaper - - the Paper to which this paper is being fitted to.
scale -
selection - - only plots in the selection contribute to Chi2.
scaleall - - if set true, it scales all plots. If not, it just scales those in the selection.
Throws:
JetWebException


store

public boolean store()
              throws JetWebException
Description copied from interface: Storeable
Write the object in memory to the database. If the ID does not exist in the DB the object is inserted as a new entry. If the ID exists, that entry is updated.

Specified by:
store in interface Storeable
Returns:
true if the object was inserted, false otherwise.
Throws:
JetWebException


fixFit

public void fixFit(Fit fit)
            throws JetWebException
Convert the PredictedPlots for this paper into FittingPlots.

Parameters:
fitId - for new FittedPlot
Throws:
JetWebException


getSumChi2

public double[] getSumChi2()
Get the chi2 and DoF for all the plots in this paper which were requested to be in the Summed chi2 for this fit. double[2] array;


getFitChi2

public double[] getFitChi2()
Get the chi2 and DoF for all the plots in this paper which were requested to be used in the fit to determine the normalisation. double[2] array;


getChi2

public double getChi2(int fitId)
Get the total Chi2 for all distributions in this paper, regardless over whether they are used in the fit.


getDOF

public double getDOF(int fitId)
Get the total DoF for all distributions in this paper, regardless over whether they are used in the fit.


delete

public void delete()
            throws JetWebException
Delete this paper and all its plots from the data base.

Throws:
JetWebException


containsDataFor

public boolean containsDataFor(MCProcessType proc)
                        throws JetWebException
Return true if this paper has a plot or more predicted by the input MCProcessType.

Throws:
JetWebException