Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Paper Class Reference

Inheritance diagram for Paper:

Inheritance graph
[legend]
Collaboration diagram for Paper:

Collaboration graph
[legend]
List of all members.

Detailed Description

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).

Author:
Jon Butterworth
Version:
Date
2006-12-14 19:12:11 +0000 (Thu, 14 Dec 2006)
Revision
1337

Definition at line 44 of file Paper.java.


Public Member Functions

 Paper (int paperId) throws JetWebException
 Paper (boolean realData)
 Paper (Paper dataPaper, Model model) throws JetWebException
boolean retrieve () throws JetWebException
int getIRN ()
void setIRN (int newirn)
boolean isReal ()
boolean isAvailable ()
int getId ()
void setID (int newid)
int getSpiresId ()
Paper setSpiresId (int id)
String getDirName ()
void setDirName (String s)
String getTitle ()
void setTitle (String newtitle)
String getCollaboration ()
void setCollaboration (String newcollab)
String getReference ()
void setReference (String newreference)
String getCodeAuthor ()
void setCodeAuthor (String newcodeAuthor)
String getContact ()
String getCodeContact ()
void setContact (String newcontact)
void setCodeContact (String newcontact)
int getNPlots ()
void setNPlots (int newnplots)
Collection<?extends DataPlotgetPlots ()
Map< Integer,?extends DataPlotgetIndexedPlots ()
String getAccelerator ()
void setAccelerator (String newaccelerator)
void setDirectory (String newDir)
void addPlot (DataPlot plot)
void setFrom (Paper paper, boolean comp) throws JetWebException
void add (Paper paper2) throws JetWebException
DataPlot getPlot (int csnId)
Paper fit (final Paper dataPaper, double scale, PlotSelection selection, boolean scaleall) throws JetWebException
boolean store () throws JetWebException
void fixFit (Fit fit) throws JetWebException
double[] getSumChi2 ()
double[] getFitChi2 ()
double getChi2 (int fitId)
double getDOF (int fitId)
void delete () throws JetWebException
boolean containsDataFor (MCProcessType proc) throws JetWebException
boolean containsDataFor (Collision coll) throws JetWebException

Private Member Functions

void createFileStructure ()
void setChi2DOF (int fitId)

Private Attributes

boolean isRealData
boolean available = true
double[] sumChi2
double[] fitChi2
int id = 0
String directory = null
String title
String reference
String codeAuthor
String contact
int nplots = 0
Map< Integer, DataPlotplots = new HashMap<IntegerDataPlot>()
String collaboration
String accelerator
int irn
double chi2
double dof

Constructor & Destructor Documentation

Paper int  paperId  )  throws JetWebException
 

Constructor to instantiate a paper from the DB.

Parameters:
paperId the id of the paper wanted.
Exceptions:
JetWebException 

Definition at line 80 of file Paper.java.

References Paper.retrieve().

Referenced by Paper.fit().

00080                                                      {
00081     this(true);
00082     id = paperId;
00083     retrieve();
00084     }

Paper boolean  realData  ) 
 

Constructor to create blank paper.

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

Definition at line 92 of file Paper.java.

00092                                     {
00093 
00094     this.isRealData = realData;
00095 
00096     }

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
Exceptions:
JetWebException 

Definition at line 107 of file Paper.java.

References Paper.accelerator, Paper.addPlot(), Paper.codeAuthor, Paper.collaboration, Paper.contact, Paper.directory, PredictedPlot.hasData(), Paper.irn, Paper.reference, PredictedPlot.setCompPlot(), and Paper.title.

00107                                                                       {
00108 
00109     id=dataPaper.getId();
00110         this.isRealData = false;
00111 
00112     irn = dataPaper.getIRN();
00113     reference = dataPaper.getReference();
00114     collaboration = dataPaper.getCollaboration();
00115     title     = dataPaper.getTitle();
00116     accelerator = dataPaper.getAccelerator();
00117     contact   = dataPaper.getContact();
00118     codeAuthor= dataPaper.getCodeAuthor();
00119     directory = dataPaper.getDirName();
00120 
00121     for (DataPlot compPlot : dataPaper.getPlots()){
00122         
00123         //System.out.println("instantiating predicted plot");
00124         try { 
00125 
00126         RunSeries runSeries = 
00127             model.getRunSeriesCollection().getRunSeries(compPlot);
00128 
00129         PredictedPlot plot = new PredictedPlot(compPlot,runSeries);
00130         //System.out.println("instantiated predicted plot");
00131         if (plot.hasData()){
00132             //System.out.println("Paper: found a plot with data "+plot.getId());
00133             plot.setCompPlot(compPlot);
00134             addPlot(plot);
00135         }
00136         } catch (JetWebException jwe) {
00137         // No need to do anything here. This DataPlot simply 
00138         // doesn't have a prediction
00139         // yet with this Model.     
00140         }
00141     }
00142     }


Member Function Documentation

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.

Definition at line 422 of file Paper.java.

References PredictedPlot.add(), and Paper.getPlots().

Referenced by PaperBank.getPlots().

00422                                                          {
00423     
00424     for (DataPlot one : getPlots() ){
00425 
00426         PredictedPlot onep = (PredictedPlot)one;
00427         PredictedPlot two = (PredictedPlot)paper2.getPlot(one.getId());
00428         onep.add(two);
00429     }
00430     }

void addPlot DataPlot  plot  ) 
 

Add a DataPlot to this Paper.

Definition at line 337 of file Paper.java.

References DataPlot.getId(), Paper.nplots, and Paper.plots.

Referenced by DBPlotManager.getPredictedPapers(), and Paper.Paper().

00337                                       {
00338     try {            
00339         this.plots.put(plot.getId(),plot);
00340     } catch (Exception e){
00341         System.out.println("Paper.addPlot - can't add plot id:"+plot.getId());
00342     }
00343     nplots=plots.size();
00344         //System.out.println("no of plots= " + plots.size());
00345     }

boolean containsDataFor Collision  coll  )  throws JetWebException
 

Return true if this paper has a plot or more for the input Collision

Definition at line 910 of file Paper.java.

References Paper.getPlots().

00910                                                                           {
00911 
00912     for (DataPlot plot : getPlots()) {
00913 
00914         if (plot.getMCProcessType().getCollision().equals(coll)){
00915         return true;
00916         }
00917         
00918     }
00919     return false;
00920     }

boolean containsDataFor MCProcessType  proc  )  throws JetWebException
 

Return true if this paper has a plot or more predicted by the input MCProcessType.

Definition at line 895 of file Paper.java.

References Paper.getPlots().

00895                                                                               {
00896 
00897     for (DataPlot plot : getPlots()) {
00898 
00899         if (plot.getMCProcessType().equals(proc)){
00900         return true;
00901         }
00902         
00903     }
00904     return false;
00905     }

void createFileStructure  )  [private]
 

Definition at line 322 of file Paper.java.

References Paper.available, and Paper.directory.

Referenced by Paper.setDirectory().

00322                                       {
00323 
00324     File dirFile = new File(JetWebConfig.rootDirectory+directory);
00325     if (!dirFile.exists()){
00326         dirFile.mkdir();
00327     }
00328 
00329     File afile = new File(directory+"/UNAVAILABLE");
00330     if (afile.exists()){
00331         available = false;
00332     }
00333     }

void delete  )  throws JetWebException
 

Delete this paper and all its plots from the data base.

Definition at line 871 of file Paper.java.

References RealPlot.delete(), and Paper.getPlots().

Referenced by ServletUtils.deletePaper().

00871                                                 {
00872 
00873     try {
00874         if (getPlots()!=null){
00875         for (DataPlot plot : getPlots() ){
00876             
00877             RealPlot rplot = (RealPlot)plot;
00878             rplot.delete();
00879             
00880         }
00881         getPlots().clear();
00882         }
00883         
00884         DBPlotManager.delete(this);
00885     } catch (Exception e) {
00886         throw new JetWebException(e);
00887     }
00888 
00889     }

Paper fit final 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.
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.
Exceptions:
JetWebException 

Definition at line 460 of file Paper.java.

References Paper.chi2, Paper.fitChi2, DataPlot.getChi2(), DataPlot.getDataPoints(), DataPlot.getId(), Paper.getId(), DataPlot.getNumber(), Paper.getPlot(), Paper.getPlots(), DataPlot.getSysScale(), DataPoint.getY(), DataPoint.getYDown(), DataPoint.getYUp(), PredictedPlot.hasData(), Paper.isReal(), DataPlot.isShape(), Paper.Paper(), DataPlot.setChi2(), DataPoint.setChi2(), Paper.setFrom(), DataPlot.setSysScale(), DataPoint.setY(), DataPoint.setYDown(), DataPoint.setYUp(), Paper.sumChi2, DataPoint.toString(), and PredictedPlot.validMCProcessType().

Referenced by Fit.doFit(), and Paper.fixFit().

00461                                                        {
00462     if (isReal()){
00463         throw new JetWebPlotException("Attempt to run a fit on Real Data: only valid for Predicted Data",
00464                       "PaperId:"+this.getId());
00465     }
00466     Paper scaled = new Paper(false);    
00467     boolean useOldPlots = false;
00468     scaled.setFrom(this,useOldPlots);
00469 
00470     //need to add all matching data points to the fit at this point
00471 
00472 
00473     scaled.sumChi2 = new double[2];
00474     scaled.fitChi2 = new double[2];
00475 
00476     Collection<? extends DataPlot> scaledPlots = scaled.getPlots();
00477 
00478     for (DataPlot mcPlot1 : scaledPlots){
00479         double chi2=0;
00480         PredictedPlot mcPlot = (PredictedPlot)mcPlot1;
00481         Vector<DataPoint> mcPoints = new Vector<DataPoint>();
00482         RealPlot dataPlot = (RealPlot)dataPaper.getPlot(mcPlot.getId());
00483         if (mcPlot.validMCProcessType()){
00484 
00485         if (selection.getSumPlots().contains(dataPlot) || scaleall){
00486             
00487             if (mcPlot.hasData()){
00488             mcPoints   = mcPlot.getDataPoints();
00489             
00490             double local_scale;
00491             // Shape plots never get scaled (they are ratios).
00492             if (mcPlot.isShape()){
00493                 local_scale = 1;
00494             } else {
00495                 local_scale = scale;
00496             }
00497             double sysScale = dataPlot.getSysScale();
00498             Vector<DataPoint> dataPoints = dataPlot.getDataPoints();
00499             
00500             if (mcPoints.size()!=dataPoints.size()){
00501                 System.out.println("Error: attempt to fit unlike histograms: plot"
00502                            +mcPlot.getNumber()+": "+dataPoints.size()
00503                            +" "+mcPoints.size());
00504                 
00505             } else {
00506                 
00507                 int missing=0;
00508                 for (int pointnum=0; pointnum<mcPoints.size(); pointnum++){
00509                 DataPoint mcp = (DataPoint)mcPoints.elementAt(pointnum);
00510                 DataPoint dp = (DataPoint)dataPoints.elementAt(pointnum);
00511                 
00512                 // Skip points with no errors.
00513                 if ( (mcp.getYUp()!=0.0) && 
00514                      (dp.getYUp()!=0.0) ){
00515 
00516                     // Scale the x value.
00517                     double error2 = Math.pow(local_scale*(mcp.getYUp()+mcp.getYDown())/2.0,2)
00518                     +Math.pow(sysScale*(dp.getYUp()+dp.getYDown())/2.0,2);
00519                     // Calculate the chi2
00520                     double cont = Math.pow(mcp.getY()*local_scale-sysScale*dp.getY(),2)/error2;   
00521                     Double testing = new Double(cont);
00522                     if (testing.isNaN() || testing.isInfinite()){
00523                     System.out.println("Error: plot"+mcPlot.getNumber());
00524                     System.out.println(error2+" , "+ mcp.toString()+":"+dp.toString());
00525                     } else {
00526                     chi2 = chi2+cont;
00527                     }
00528                     mcp.setY(mcp.getY()*local_scale);
00529                     mcp.setYUp(mcp.getYUp()*local_scale);
00530                     mcp.setYDown(mcp.getYDown()*local_scale);
00531                     mcp.setChi2(cont);
00532                     
00533                 } else {
00534                     missing++;
00535                 }
00536                 }
00537                 double[] tmp = new double[] {chi2, mcPoints.size()-missing};
00538                 mcPlot.setChi2(tmp);
00539                 mcPlot.setSysScale(local_scale);
00540             }
00541             } else {
00542             System.out.println("No data for plot");
00543             }
00544         }
00545         
00546 
00547         if (selection.getSumPlots().contains(dataPlot)){
00548             scaled.sumChi2[0] = scaled.sumChi2[0]+mcPlot.getChi2()[0];
00549             scaled.sumChi2[1] = scaled.sumChi2[1]+mcPlot.getChi2()[1];
00550         }
00551         if (selection.getFitPlots().contains(dataPlot)){
00552             scaled.fitChi2[0] = scaled.fitChi2[0]+mcPlot.getChi2()[0];
00553             scaled.fitChi2[1] = scaled.fitChi2[1]+mcPlot.getChi2()[1];
00554         }
00555         }
00556     }
00557     return scaled;
00558      
00559     }

void fixFit Fit  fit  )  throws JetWebException
 

Convert the PredictedPlots for this paper into FittingPlots.

Parameters:
fitId for new FittedPlot
Exceptions:
JetWebException 

Definition at line 790 of file Paper.java.

References Paper.fit(), DataPlot.getId(), Paper.getPlots(), and Paper.plots.

Referenced by Fit.doFit().

00790                                                       {
00791 
00792     Map<Integer,DataPlot> fittedPlots = new HashMap<Integer,DataPlot>();
00793     //Iterator<DataPlot> plotList = getPlots().iterator();
00794 
00795     Collection<? extends DataPlot> plotList = getPlots();
00796 
00797     for (DataPlot plot : getPlots()){    
00798 
00799         try {
00800         FittedPlot fittedPlot = new FittedPlot((PredictedPlot)plot, fit );
00801         fittedPlots.put(new Integer(fittedPlot.getId()),fittedPlot);
00802         } catch (Exception e){
00803         System.out.println("Paper.fixFit() cannot add plotId:"+plot.getId());
00804         throw new JetWebException(e);
00805         }
00806 
00807     }
00808     plots = fittedPlots;
00809     }

String getAccelerator  ) 
 

Get the accelerator (the accelerator name, for now)

Definition at line 308 of file Paper.java.

Referenced by Paper.setFrom(), and HTMLPaperWriter.writePaperForm().

00308 { return accelerator; }

double getChi2 int  fitId  ) 
 

Get the total Chi2 for all distributions in this paper, regardless over whether they are used in the fit.

Definition at line 839 of file Paper.java.

References Paper.chi2, and Paper.setChi2DOF().

Referenced by HTMLFitWriter.comparePlots(), and Paper.setChi2DOF().

00839                                     {
00840 
00841     if (chi2>0) return chi2;
00842     setChi2DOF(fitId);
00843     return chi2;
00844     }

String getCodeAuthor  ) 
 

Get Journal CodeAuthor of the paper.

Definition at line 272 of file Paper.java.

Referenced by Paper.setFrom(), and HTMLPaperWriter.writePaperForm().

00272 {return codeAuthor;}

String getCodeContact  ) 
 

Definition at line 280 of file Paper.java.

References Paper.getContact().

00280 {return(getContact());}

String getCollaboration  ) 
 

Get the collaboration responsible for the paper.

Definition at line 262 of file Paper.java.

Referenced by Paper.setFrom(), and HTMLPaperWriter.writePaperForm().

00262 {return collaboration;}

String getContact  ) 
 

Get Journal Contact of the paper.

Definition at line 278 of file Paper.java.

Referenced by Paper.getCodeContact(), Paper.setFrom(), and HTMLPaperWriter.writePaperForm().

00278 {return contact;}

String getDirName  ) 
 

get the directory name (relative, no path) to which the files for this paper will be written

Definition at line 245 of file Paper.java.

Referenced by HTMLPlotWriter.display(), PaperBank.mkdirs(), Paper.setFrom(), JetWebHist.writeGraphics(), and HTMLPaperWriter.writePaperForm().

00245 { return directory; }

double getDOF int  fitId  ) 
 

Get the total DoF for all distributions in this paper, regardless over whether they are used in the fit.

Definition at line 849 of file Paper.java.

References Paper.dof, and Paper.setChi2DOF().

00849                                    {
00850 
00851     if (dof>0) return dof;
00852     setChi2DOF(fitId);
00853     return dof;
00854     }

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;

  • [0]: Chi2
  • [1]: DegreesOfFreedom

Definition at line 832 of file Paper.java.

Referenced by Fit.doFit().

00832 {return fitChi2;}

int getId  ) 
 

Get the unique ID of this paper. Corresponds to paper_id in the DB.

Implements Storeable.

Definition at line 226 of file Paper.java.

Referenced by ServletUtils.deletePaper(), Fit.doFit(), Paper.fit(), Paper.setFrom(), and HTMLPaperWriter.writePaperForm().

00226 { return id; }

Map<Integer,? extends DataPlot> getIndexedPlots  ) 
 

get Copy of the DataPlots stored in this paper, indexed by paperId

Definition at line 301 of file Paper.java.

References Paper.plots.

Referenced by HTMLFitWriter.comparePlots().

00301                                                             {
00302     Map<Integer,DataPlot> retn = new HashMap<Integer,DataPlot>();
00303     retn.putAll(plots);
00304     return retn;
00305     }

int getIRN  ) 
 

Get the spires reference number.

Definition at line 204 of file Paper.java.

Referenced by HTMLPaperWriter.getLink(), Paper.getSpiresId(), Paper.setFrom(), and HTMLPaperWriter.writePaperForm().

00204                        {
00205     return irn;
00206     }

int getNPlots  ) 
 

Get number of plots in the paper

Definition at line 291 of file Paper.java.

00291 {return nplots;}

DataPlot getPlot int  csnId  ) 
 

Retrieves a plot from the plots collection with the specified csnId

Parameters:
csnId 
Returns:
DataPlot

Definition at line 437 of file Paper.java.

References Paper.plots.

Referenced by Paper.fit().

00437                                       {
00438     DataPlot ret = null;
00439     try {
00440         Integer i = new Integer(csnId);
00441         ret = (DataPlot)plots.get(i);
00442     } catch (Exception e){
00443         System.out.println("Paper.getPlot(): Attempt to retreive plot failed, plot id:"+csnId);
00444     }
00445 
00446     return ret;
00447     }

Collection<? extends DataPlot> getPlots  ) 
 

get Collection of DataPlots in the paper

Definition at line 296 of file Paper.java.

References Paper.plots.

Referenced by Paper.add(), Paper.containsDataFor(), Paper.delete(), Searcher.doGet(), Paper.fit(), Paper.fixFit(), Paper.setChi2DOF(), and JetWebHist.writeGraphics().

00296                                                     {
00297     return plots.values();
00298     }

String getReference  ) 
 

Get Journal Reference of the paper.

Definition at line 267 of file Paper.java.

Referenced by Paper.setFrom(), and HTMLPaperWriter.writePaperForm().

00267 {return reference;}

int getSpiresId  ) 
 

Definition at line 233 of file Paper.java.

References Paper.getIRN().

00233                             {
00234     return(getIRN());
00235     }

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;

  • [0]: Chi2
  • [1]: DegreesOfFreedom

Definition at line 821 of file Paper.java.

00821 {return sumChi2;}

String getTitle  ) 
 

Get title of the paper.

Definition at line 257 of file Paper.java.

Referenced by Paper.setFrom(), HTMLFitWriter.startPaperComparison(), and HTMLPaperWriter.writePaperForm().

00257 {return title;}

boolean isAvailable  ) 
 

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

Definition at line 220 of file Paper.java.

00220 { return available; }

boolean isReal  ) 
 

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

Definition at line 217 of file Paper.java.

Referenced by Paper.fit().

00217 { return isRealData; }

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.

Parameters:
dataPaper - template paper
fit to extract MC paper
Exceptions:
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<DataPlot> 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. } } }

Implements Storeable.

Definition at line 192 of file Paper.java.

Referenced by Paper.Paper().

00192                                                      {
00193     DBPlotManager.fillPaper(this);
00194     return true;
00195     }

void setAccelerator String  newaccelerator  ) 
 

Set the accelerator (the accelerator name, for now)

Definition at line 310 of file Paper.java.

References Paper.accelerator.

Referenced by ServletUtils.changePaper(), and DBPlotManager.getPredictedPapers().

00310                                                      { 
00311     accelerator = newaccelerator; 
00312     }

void setChi2DOF int  fitId  )  [private]
 

Definition at line 857 of file Paper.java.

References Paper.chi2, Paper.dof, Paper.getChi2(), and Paper.getPlots().

Referenced by Paper.getChi2(), and Paper.getDOF().

00857                                       {
00858 
00859     if (!isRealData) { 
00860         for (DataPlot plot : getPlots()){
00861         double[] chi2d = plot.getChi2(fitId); 
00862         chi2+=chi2d[0];
00863         dof+=chi2d[1];
00864         }
00865     }
00866     }

void setCodeAuthor String  newcodeAuthor  ) 
 

Set Journal CodeAuthor of the paper.

Definition at line 274 of file Paper.java.

References Paper.codeAuthor.

Referenced by ServletUtils.changePaper(), and DBPlotManager.getPredictedPapers().

00275     {codeAuthor = newcodeAuthor;}

void setCodeContact String  newcontact  ) 
 

Definition at line 285 of file Paper.java.

References Paper.setContact().

00285                                                  {
00286     setContact(newcontact);
00287     return;
00288     };

void setCollaboration String  newcollab  ) 
 

Set collaboration responsible for the paper.

Definition at line 264 of file Paper.java.

References Paper.collaboration.

Referenced by ServletUtils.changePaper(), and DBPlotManager.getPredictedPapers().

00264 {collaboration = newcollab;}

void setContact String  newcontact  ) 
 

Set Journal Contact of the paper.

Definition at line 283 of file Paper.java.

References Paper.contact.

Referenced by ServletUtils.changePaper(), DBPlotManager.getPredictedPapers(), and Paper.setCodeContact().

00283 {contact = newcontact;}

void setDirectory String  newDir  ) 
 

Set the directory path (relative to the root)

Definition at line 316 of file Paper.java.

References Paper.createFileStructure(), and Paper.directory.

00316                                            { 
00317     directory = newDir;
00318     createFileStructure();
00319     }

void setDirName String  s  ) 
 

set the directory name (relative, no path) to which the files for this paper will be written

Definition at line 249 of file Paper.java.

References Paper.directory.

Referenced by ServletUtils.changePaper(), and DBPlotManager.getPredictedPapers().

00249 { directory = s; }

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)
Exceptions:
JetWebException 

Definition at line 361 of file Paper.java.

References Paper.accelerator, Paper.codeAuthor, Paper.collaboration, Paper.contact, Paper.directory, Paper.getAccelerator(), Paper.getCodeAuthor(), Paper.getCollaboration(), Paper.getContact(), Paper.getDirName(), Paper.getId(), Paper.getIRN(), Paper.getReference(), Paper.getTitle(), Paper.id, Paper.irn, RunSeries.Maker(), Paper.reference, DataPlot.setDataPoints(), and Paper.title.

Referenced by Paper.fit().

00361                                                                          {
00362 
00363     //System.out.println("Called Paper.setFrom");
00364     //Exception e = new Exception();
00365     //e.printStackTrace();
00366     //this.runSeries = paper.getRunSeries();
00367     this.reference = paper.getReference();
00368     this.collaboration = paper.getCollaboration();
00369     this.title = paper.getTitle();
00370     this.accelerator = paper.getAccelerator();
00371     this.id=paper.getId();
00372     this.contact = paper.getContact();
00373     this.codeAuthor = paper.getCodeAuthor();
00374     this.irn = paper.getIRN();
00375     this.directory = paper.getDirName();
00376         //System.out.println("im here");
00377         
00378     for (DataPlot oldplot : paper.getPlots() ){
00379         DataPlot plot;
00380 
00381         //is this paper a real data paper?
00382         if (isRealData){
00383         // looks very wasteful.
00384         plot = new RealPlot(oldplot.getNumber(),id);
00385         } else {
00386         // not real data
00387         DataPlot compPlot;
00388         RunSeries runSeries;
00389         if(oldplot instanceof PredictedPlot){
00390             runSeries = ((PredictedPlot)oldplot).getRunSeries();
00391         }else if(oldplot instanceof FittedPlot){
00392             Integer rsId = ((FittedPlot)oldplot).getRunSeriesId();
00393             runSeries = RunSeries.Maker(rsId);
00394         }else{
00395             throw new JetWebException
00396             ("Paper.setFrom() ERROR:"+
00397              "Real data plot in predicted paper", 
00398              "Paper id:" + id + "  plot id:" + oldplot.getId());
00399         }
00400             if (comp) { 
00401                 compPlot = oldplot;
00402         } else {
00403             if (oldplot instanceof PredictedPlot){
00404             compPlot = ((PredictedPlot)oldplot).getCompPlot();
00405             } else if (oldplot instanceof FittedPlot){
00406             compPlot = ((FittedPlot)oldplot).getCompPlot();
00407             } else {
00408             throw new JetWebPlotException("Attempt to get comparison plots from real data paper","Old PaperId:"+paper.getId()+" New PaperId:"+this.getId());
00409             }
00410         }
00411         plot = new PredictedPlot(compPlot,runSeries);
00412         }
00413         plot.setDataPoints(oldplot.getDataPoints());
00414         this.addPlot(plot);
00415     }
00416     }

void setID int  newid  ) 
 

Set the unique ID of this paper. Corresponds to paper_id in the DB.

Definition at line 231 of file Paper.java.

Referenced by DBPlotManager.getPredictedPapers().

00231 { id=newid; }

void setIRN int  newirn  ) 
 

Set the spires reference number.

Definition at line 211 of file Paper.java.

References Paper.irn.

Referenced by ServletUtils.changePaper(), DBPlotManager.getPredictedPapers(), and Paper.setSpiresId().

00211                                   {
00212     irn = newirn;
00213     }

void setNPlots int  newnplots  ) 
 

Set number of plots in the paper

Definition at line 293 of file Paper.java.

References Paper.nplots.

00293 {nplots = newnplots;}

void setReference String  newreference  ) 
 

Set Journal Reference of the paper.

Definition at line 269 of file Paper.java.

References Paper.reference.

Referenced by ServletUtils.changePaper(), and DBPlotManager.getPredictedPapers().

00269 {reference = newreference;}

Paper setSpiresId int  id  ) 
 

Definition at line 237 of file Paper.java.

References Paper.setIRN().

00237                                     {
00238     setIRN(id);
00239     return this;
00240     }

void setTitle String  newtitle  ) 
 

Set title of the paper.

Definition at line 259 of file Paper.java.

References Paper.title.

Referenced by ServletUtils.changePaper(), and DBPlotManager.getPredictedPapers().

00259 {title = newtitle;}

boolean store  )  throws JetWebException
 

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.

Returns:
true if the object was inserted, false otherwise.

Implements Storeable.

Definition at line 561 of file Paper.java.

Referenced by ServletUtils.changePaper().

00561                                                   {
00562     
00563     if (!this.isRealData) {
00564         System.out.println("Error: Attempt to write MC paper to DB");
00565         throw new JetWebException("Error: Attempt to write MC paper to DB",
00566                       "Paper ID "+id);
00567     }
00568     
00569     boolean paperExisted = DBPlotManager.addPaper(this);
00570     return !paperExisted;
00571     }


Member Data Documentation

String accelerator [private]
 

Definition at line 62 of file Paper.java.

Referenced by Paper.Paper(), Paper.setAccelerator(), and Paper.setFrom().

boolean available = true [private]
 

Definition at line 47 of file Paper.java.

Referenced by Paper.createFileStructure().

double chi2 [private]
 

Definition at line 69 of file Paper.java.

Referenced by Paper.fit(), Paper.getChi2(), and Paper.setChi2DOF().

String codeAuthor [private]
 

Definition at line 56 of file Paper.java.

Referenced by Paper.Paper(), Paper.setCodeAuthor(), and Paper.setFrom().

String collaboration [private]
 

Definition at line 61 of file Paper.java.

Referenced by Paper.Paper(), Paper.setCollaboration(), and Paper.setFrom().

String contact [private]
 

Definition at line 57 of file Paper.java.

Referenced by Paper.Paper(), Paper.setContact(), and Paper.setFrom().

String directory = null [private]
 

Definition at line 53 of file Paper.java.

Referenced by Paper.createFileStructure(), Paper.Paper(), Paper.setDirectory(), Paper.setDirName(), and Paper.setFrom().

double dof [private]
 

Definition at line 70 of file Paper.java.

Referenced by Paper.getDOF(), and Paper.setChi2DOF().

double [] fitChi2 [private]
 

Definition at line 50 of file Paper.java.

Referenced by Paper.fit().

int id = 0 [private]
 

Definition at line 52 of file Paper.java.

Referenced by Paper.setFrom().

int irn [private]
 

Definition at line 67 of file Paper.java.

Referenced by Paper.Paper(), Paper.setFrom(), and Paper.setIRN().

boolean isRealData [private]
 

Definition at line 46 of file Paper.java.

int nplots = 0 [private]
 

Definition at line 58 of file Paper.java.

Referenced by Paper.addPlot(), and Paper.setNPlots().

Map<Integer,DataPlot> plots = new HashMap<IntegerDataPlot>() [private]
 

Definition at line 59 of file Paper.java.

Referenced by Paper.addPlot(), Paper.fixFit(), Paper.getIndexedPlots(), Paper.getPlot(), and Paper.getPlots().

String reference [private]
 

Definition at line 55 of file Paper.java.

Referenced by Paper.Paper(), Paper.setFrom(), and Paper.setReference().

double [] sumChi2 [private]
 

Definition at line 49 of file Paper.java.

Referenced by Paper.fit().

String title [private]
 

Definition at line 54 of file Paper.java.

Referenced by Paper.Paper(), Paper.setFrom(), and Paper.setTitle().


The documentation for this class was generated from the following file:

Generated Wed Jan 17 09:14:27 GMT 2007