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

DataPoint Class Reference

List of all members.

Detailed Description

Represents a point in a JetWeb plot. A data point has the following properties;

Author:
J. Monk from S. Butterworth, UCL.
Version:
Date
2006-11-28 15:43:42 +0000 (Tue, 28 Nov 2006)
Revision
1322

Definition at line 20 of file DataPoint.java.


Public Member Functions

 DataPoint ()
int compareTo (Object dpo) throws ClassCastException
double[] toArray ()
double getX ()
double getY ()
double getYUp ()
double getYDown ()
double getBinWidth ()
double getChi2 ()
DataPoint setX (double d)
DataPoint setY (double d)
DataPoint setYUp (double d)
DataPoint setYDown (double d)
DataPoint setBinWidth (double d)
Integer getNumber ()
DataPoint setNumber (Integer number)
DataPoint setChi2 (double d)
Object clone ()
double getXMax ()
double getXMin ()
String toString ()
void add (DataPoint p2)
void fixZeroError (double lumi)

Private Attributes

double x_
double y_
double yUp_
double yDown_
double binWidth_
double chi2_
Integer pointNumber_

Constructor & Destructor Documentation

DataPoint  ) 
 

construct point data from array of doubles

Parameters:
pointArray 
  • point[X] = x value
  • point[Y] = y value
  • point[YUP] = y error (up)
  • point[YDOWN] = y error (down)
  • point[BINWIDTH] = bin width
  • point[CHI2] = pull (chi2)
Exceptions:
JetWebException 

Definition at line 46 of file DataPoint.java.

Referenced by DataPoint.clone().

00046                       {
00047     return;
00048     }


Member Function Documentation

void add DataPoint  p2  ) 
 

Add another DataPoint to this DataPoint.

  • If this point has no data, replace by data in input point.
  • If input point has no data, ignore it.
  • Otherwise add data and recalculate errors.

Parameters:
p2 point to add.

Definition at line 207 of file DataPoint.java.

References DataPoint.getX(), DataPoint.getY(), DataPoint.getYDown(), DataPoint.getYUp(), DataPoint.setX(), DataPoint.setY(), DataPoint.setYDown(), and DataPoint.setYUp().

Referenced by PredictedPlot.add(), JetWebAIDAXMLPlotReader.getDataPoints(), DBPlotManager.getDataPoints(), CombinedPaper.getFitChi2(), MergedPlot.mergePoints(), and JetWebPlotMLReader.populateDataPoints().

00207                                  {
00208 
00209     if (Math.abs(getX()-p2.getX())/(getX()+p2.getX())>0.001 ){
00210         System.out.println("x values not equal "+getX()+","+p2.getX());
00211     } else if (p2.getYUp()==0.0 && p2.getYDown()==0.0) {
00212     // No errors on new data - do nothing
00213     } else if (getYUp()==0.0 && getYDown()==0.0) {
00214         // No data in this point. Replace it by the new one
00215         setX(p2.getX());
00216         setY(p2.getY());
00217         setYUp(p2.getYUp());
00218         setYDown(p2.getYDown());
00219 
00220     } else {
00221         double sig1 = 0.5*(getYUp()+getYDown());
00222         //      double sig1sq = Math.pow( (getYUp()+getYDown())/2.0, 2);
00223         double sig1sq = sig1*sig1;
00224         double sig2 = 0.5 *(p2.getYUp()+p2.getYDown());
00225         double sig2sq = sig2 * sig2;;
00226         
00227         double w1 = 1.0/sig1sq;
00228         double w2 = 1.0/sig2sq;
00229 
00230         double invW1W2 = 1.0/(w1+w2);
00231 
00232         // Contents.
00233         double tmp1 = (getY()*w1+p2.getY()*w2) * invW1W2;
00234         // Errors
00235         //setYUp(1.0/Math.sqrt(w1+w2));
00236         setYUp(Math.sqrt(invW1W2));
00237         setYDown(getYUp());
00238         setY(tmp1);
00239     }                
00240 
00241     }

Object clone  ) 
 

Definition at line 159 of file DataPoint.java.

References DataPoint.DataPoint(), DataPoint.getBinWidth(), DataPoint.getChi2(), DataPoint.getX(), DataPoint.getY(), DataPoint.getYDown(), DataPoint.getYUp(), DataPoint.setBinWidth(), DataPoint.setChi2(), DataPoint.setX(), DataPoint.setY(), DataPoint.setYDown(), and DataPoint.setYUp().

Referenced by CombinedPaper.getFitChi2().

00159                          {
00160 
00161     DataPoint newPoint=new DataPoint();
00162     newPoint.setX(getX());
00163     newPoint.setY(getY());
00164     newPoint.setYUp(getYUp());
00165     newPoint.setYDown(getYDown());
00166     newPoint.setBinWidth(getBinWidth());
00167     newPoint.setChi2(getChi2());
00168 
00169     return newPoint;
00170     }

int compareTo Object  dpo  )  throws ClassCastException
 

compareTo method for easy sorting with Collections.sort(Comparable); Uses the pointNumber to sort.

Definition at line 56 of file DataPoint.java.

References DataPoint.getNumber(), DataPoint.getX(), DataPoint.pointNumber_, and DataPoint.x_.

00057                              {
00058     
00059     if(! (dpo instanceof DataPoint)) {
00060         throw new ClassCastException
00061         ("DataPoint.compareTo: cannot compare object " + dpo + 
00062          " with DataPoint "+this.toString());
00063     }
00064 
00065     DataPoint dp = (DataPoint) dpo;
00066 
00067     if(pointNumber_ < dp.getNumber()) return -1;
00068     if(pointNumber_ > dp.getNumber()) return 1;
00069 
00070     if(x_<dp.getX()) return -1;
00071     if(x_>dp.getX()) return 1;
00072     return 0;
00073     } 

void fixZeroError double  lumi  ) 
 

Set zero errors to upper limits. If you can tell the point how much integrated lumi it was generated from, and if the point has a zero value and zero errors, it will set it errors to the 1 sigma upper limit.

Definition at line 249 of file DataPoint.java.

References DataPoint.getBinWidth(), DataPoint.getY(), DataPoint.getYDown(), DataPoint.getYUp(), DataPoint.setYDown(), and DataPoint.setYUp().

Referenced by PredictedPlot.fixZeroErrors().

00249                                          {
00250 
00251     if (lumi<=0.0) {
00252         System.out.println("DataPoint: attempt to fix errors with illegal lumi value="+lumi);
00253         return;
00254     }
00255 
00256     if (getY()==0.0 && getYUp()==0.0 && getYDown()==0.0) {
00257         setYUp(1.3/(getBinWidth()*lumi));
00258         setYDown(1.3/(getBinWidth()*lumi));
00259     }
00260     }

double getBinWidth  ) 
 

binwidth

Definition at line 108 of file DataPoint.java.

Referenced by DataPoint.clone(), DataPoint.fixZeroError(), DataPoint.getXMax(), and DataPoint.getXMin().

00108                                {
00109     return binWidth_;
00110     }

double getChi2  ) 
 

Chi squared

Definition at line 112 of file DataPoint.java.

Referenced by DataPoint.clone().

00112                            {
00113     return chi2_;
00114     }

Integer getNumber  ) 
 

Definition at line 141 of file DataPoint.java.

Referenced by DataPoint.compareTo(), JetWebAIDAXMLPlotReader.fillPlot(), and DBPlotManager.getDataPoints().

00141                               {
00142     return pointNumber_;
00143     }

double getX  ) 
 

x co-ordinate

Definition at line 92 of file DataPoint.java.

Referenced by DataPoint.add(), JetWebHist.buildHist(), DataPoint.clone(), DataPoint.compareTo(), DataPoint.getXMax(), DataPoint.getXMin(), and DBPlotManager.insertData().

00092                         {
00093     return x_;
00094     }

double getXMax  ) 
 

maximum x value, incorporating bin width

Definition at line 174 of file DataPoint.java.

References DataPoint.getBinWidth(), and DataPoint.getX().

Referenced by PlotDataSource.PlotDataSource(), VariableBinSource.VariableBinSource(), and HTMLPlotWriter.writeDataPointText().

00174                            {
00175     return getX() + 0.5*getBinWidth();
00176     }

double getXMin  ) 
 

minimum x value, incorporating bin width

Definition at line 180 of file DataPoint.java.

References DataPoint.getBinWidth(), and DataPoint.getX().

Referenced by PlotDataSource.PlotDataSource(), VariableBinSource.VariableBinSource(), and HTMLPlotWriter.writeDataPointText().

00180                            {
00181     return getX() - 0.5*getBinWidth();
00182     }

double getY  ) 
 

y co-ordinate

Definition at line 96 of file DataPoint.java.

Referenced by DataPoint.add(), JetWebHist.buildHist(), DataPoint.clone(), Paper.fit(), DataPoint.fixZeroError(), CombinedPaper.getFitChi2(), PlotDataSource.PlotDataSource(), VariableBinSource.VariableBinSource(), and HTMLPlotWriter.writeDataPointText().

00096                         {
00097     return y_;
00098     }

double getYDown  ) 
 

error on y co-ordinate (down)

Definition at line 104 of file DataPoint.java.

Referenced by DataPoint.add(), JetWebHist.buildHist(), DataPoint.clone(), Paper.fit(), DataPoint.fixZeroError(), CombinedPaper.getFitChi2(), PlotDataSource.PlotDataSource(), JetWebPlotMLReader.populateDataPoints(), and VariableBinSource.VariableBinSource().

00104                             {
00105     return yDown_;
00106     }

double getYUp  ) 
 

error on y co-ordinate (up)

Definition at line 100 of file DataPoint.java.

Referenced by DataPoint.add(), JetWebHist.buildHist(), DataPoint.clone(), Paper.fit(), DataPoint.fixZeroError(), CombinedPaper.getFitChi2(), PlotDataSource.PlotDataSource(), VariableBinSource.VariableBinSource(), and HTMLPlotWriter.writeDataPointText().

00100                           {
00101     return yUp_;
00102     }

DataPoint setBinWidth double  d  ) 
 

binwidth

Definition at line 136 of file DataPoint.java.

References DataPoint.binWidth_.

Referenced by DataPoint.clone(), JetWebAIDAXMLPlotReader.getDataPoints(), DBPlotManager.getDataPoints(), and JetWebPlotMLReader.populateDataPoints().

00136                                            {
00137     binWidth_ = d;
00138     return this;
00139     }

DataPoint setChi2 double  d  ) 
 

Chi squared

Definition at line 151 of file DataPoint.java.

References DataPoint.chi2_.

Referenced by DataPoint.clone(), Paper.fit(), JetWebAIDAXMLPlotReader.getDataPoints(), DBPlotManager.getDataPoints(), and CombinedPaper.getFitChi2().

00151                                       {
00152     chi2_ = d;
00153     return this;
00154     }

DataPoint setNumber Integer  number  ) 
 

Definition at line 145 of file DataPoint.java.

References DataPoint.pointNumber_.

Referenced by DBPlotManager.getDataPoints().

00145                                               {
00146     pointNumber_ = number;
00147     return this;
00148     }

DataPoint setX double  d  ) 
 

x co-ordinate

Definition at line 116 of file DataPoint.java.

References DataPoint.x_.

Referenced by DataPoint.add(), DataPoint.clone(), JetWebAIDAXMLPlotReader.getDataPoints(), DBPlotManager.getDataPoints(), and JetWebPlotMLReader.populateDataPoints().

00116                                    {
00117         x_ = d;
00118     return this;
00119     }

DataPoint setY double  d  ) 
 

y co-ordinate

Definition at line 121 of file DataPoint.java.

References DataPoint.y_.

Referenced by DataPoint.add(), DataPoint.clone(), Paper.fit(), JetWebAIDAXMLPlotReader.getDataPoints(), DBPlotManager.getDataPoints(), CombinedPaper.getFitChi2(), and JetWebPlotMLReader.populateDataPoints().

00121                                    {
00122     y_ = d;
00123     return this;
00124     }

DataPoint setYDown double  d  ) 
 

error on y co-ordinate (down)

Definition at line 131 of file DataPoint.java.

References DataPoint.yDown_.

Referenced by DataPoint.add(), DataPoint.clone(), Paper.fit(), DataPoint.fixZeroError(), JetWebAIDAXMLPlotReader.getDataPoints(), DBPlotManager.getDataPoints(), CombinedPaper.getFitChi2(), and JetWebPlotMLReader.populateDataPoints().

00131                                         {
00132     yDown_ = d;
00133     return this;
00134     }

DataPoint setYUp double  d  ) 
 

error on y co-ordinate (up)

Definition at line 126 of file DataPoint.java.

References DataPoint.yUp_.

Referenced by DataPoint.add(), DataPoint.clone(), Paper.fit(), DataPoint.fixZeroError(), JetWebAIDAXMLPlotReader.getDataPoints(), DBPlotManager.getDataPoints(), CombinedPaper.getFitChi2(), and JetWebPlotMLReader.populateDataPoints().

00126                                      {
00127     yUp_ = d;
00128     return this;
00129     }

double [] toArray  ) 
 

returns double[6] array of point data

  • point[X] = x value
  • point[Y] = y value
  • point[YUP] = y error (up)
  • point[YDOWN] = y error (down)
  • point[BINWIDTH] = bin width
  • point[CHI2] = pull (chi2)

Definition at line 87 of file DataPoint.java.

References DataPoint.chi2_.

00087                              {
00088     double[] array = {x_, y_, yUp_, yDown_, binWidth_, chi2_};
00089     return array;
00090     }

String toString  ) 
 

Outputs stringified point data

Definition at line 186 of file DataPoint.java.

References DataPoint.binWidth_, DataPoint.chi2_, DataPoint.x_, DataPoint.y_, DataPoint.yDown_, and DataPoint.yUp_.

Referenced by Paper.fit(), DBPlotManager.getDataPoints(), and CombinedPaper.getFitChi2().

00186                             {
00187     StringBuffer b = new StringBuffer("DataPoint");
00188     b.append("\nX:");b.append(x_);
00189     b.append("\nY:");b.append(y_);
00190     b.append("\nY ERROR UP:");b.append(yUp_);
00191     b.append("\nY ERROR DOWN:");b.append(yDown_);
00192     b.append("\nBINWIDTH:");b.append(binWidth_);
00193     b.append("\nCHI2:");b.append(chi2_);
00194     return b.toString();
00195     }


Member Data Documentation

double binWidth_ [private]
 

Definition at line 26 of file DataPoint.java.

Referenced by DataPoint.setBinWidth(), and DataPoint.toString().

double chi2_ [private]
 

Definition at line 27 of file DataPoint.java.

Referenced by DataPoint.setChi2(), DataPoint.toArray(), and DataPoint.toString().

Integer pointNumber_ [private]
 

Definition at line 28 of file DataPoint.java.

Referenced by DataPoint.compareTo(), and DataPoint.setNumber().

double x_ [private]
 

Definition at line 22 of file DataPoint.java.

Referenced by DataPoint.compareTo(), DataPoint.setX(), and DataPoint.toString().

double y_ [private]
 

Definition at line 23 of file DataPoint.java.

Referenced by DataPoint.setY(), and DataPoint.toString().

double yDown_ [private]
 

Definition at line 25 of file DataPoint.java.

Referenced by DataPoint.setYDown(), and DataPoint.toString().

double yUp_ [private]
 

Definition at line 24 of file DataPoint.java.

Referenced by DataPoint.setYUp(), and DataPoint.toString().


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

Generated Wed Jan 17 09:14:27 GMT 2007