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

JetWebAIDAXMLPlotReader Class Reference

Inheritance diagram for JetWebAIDAXMLPlotReader:

Inheritance graph
[legend]
Collaboration diagram for JetWebAIDAXMLPlotReader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 JetWebAIDAXMLPlotReader (String filename) throws JetWebXMLException
void setDirectory (String dir) throws JetWebException
void fillPlot (DataPlot plot) throws JetWebException

Package Attributes

IDataPointSet m_data_ = null
ITree tree_ = null
String directory_ = ""
IDataPointSetFactory dpsf_ = null
IHistogram1D hist_ = null

Private Member Functions

Vector< DataPointgetDataPoints ()

Constructor & Destructor Documentation

JetWebAIDAXMLPlotReader String  filename  )  throws JetWebXMLException
 

Creates a new instance of JetWebAIDAXMLPlotReader

Definition at line 24 of file JetWebAIDAXMLPlotReader.java.

References JetWebAIDAXMLPlotReader.dpsf_, and JetWebAIDAXMLPlotReader.tree_.

00024                                                                              {
00025        
00026         //filename is an absolute path apparently
00027         try{
00028             IAnalysisFactory af = IAnalysisFactory.create();
00029             
00030             tree_ = af.createTreeFactory().create(filename,"xml",false,false);
00031             dpsf_ = af.createDataPointSetFactory(tree_);
00032 
00033         /*
00034      * This needs to reflect the directory structure of the tree created with the 
00035      * datapoints. Dont think the JAIDA xml stores this info so work needs to be done
00036 
00037         m_data = dpsf.create("/data","",2);
00038      */
00039         }catch (Exception e) {
00040             throw new JetWebXMLException(e);
00041         }
00042     }


Member Function Documentation

void fillPlot DataPlot  plot  )  throws JetWebException
 

Implements JetWebPlotReader.

Definition at line 99 of file JetWebAIDAXMLPlotReader.java.

References JetWebAIDAXMLPlotReader.directory_, JetWebAIDAXMLPlotReader.dpsf_, JetWebAIDAXMLPlotReader.getDataPoints(), DataPoint.getNumber(), JetWebAIDAXMLPlotReader.hist_, JetWebAIDAXMLPlotReader.m_data_, and JetWebAIDAXMLPlotReader.tree_.

00099                                                                {
00100     //set the title - already set by plotfactory
00101     //set xlabel - same
00102     //set ylabel -same
00103     
00104     try {
00105 
00106         String location = directory_ + "/h" + plot.getNumber();
00107 
00108         System.out.println("using histogram at " + location);
00109 
00110         hist_ = (IHistogram1D) tree_.find(directory_+"/h"+plot.getNumber());
00111                
00112         // Create IDataPointSets from the the above AIDA objects.
00113         m_data_   = dpsf_.create("histogram",hist_);
00114         
00115         plot.setDataPoints(getDataPoints());
00116         
00117         if(plot instanceof PredictedPlot) {
00118         PredictedPlot.adjustErrors((PredictedPlot)plot);
00119         }
00120 
00121         plot.setHasData(true);
00122 
00123     } catch (IllegalArgumentException e) {
00124         System.out.println("JetWebAIDAPlotReader: couldnt find "+directory_+"/h"+plot.getNumber());
00125         throw new JetWebException(e,
00126                       "JetWebAIDAPlotReader: couldnt find "
00127                       +directory_+"/h"+plot.getNumber());
00128     }
00129 
00130 
00131     }

Vector<DataPoint> getDataPoints  )  [private]
 

Definition at line 44 of file JetWebAIDAXMLPlotReader.java.

References DataPoint.add(), JetWebAIDAXMLPlotReader.hist_, DataPoint.setBinWidth(), DataPoint.setChi2(), DataPoint.setX(), DataPoint.setY(), DataPoint.setYDown(), and DataPoint.setYUp().

Referenced by JetWebAIDAXMLPlotReader.fillPlot().

00044                                               {
00045             
00046     Vector<DataPoint> dps = new Vector();
00047 
00048     /*
00049     int size = m_data_.size();
00050 
00051         
00052     for(int i=0;i<size;i++) {
00053         IDataPoint p = m_data_.point(i);
00054         double x = p.coordinate(0).value();
00055         double y = p.coordinate(1).value();
00056         double xerrup = p.coordinate(0).errorPlus();
00057         double xerrdown = p.coordinate(0).errorMinus();
00058         double yerrup = p.coordinate(1).errorPlus();
00059         double yerrdown = p.coordinate(1).errorMinus();
00060 
00061         System.out.println("x "+x+" xerr "+xerrup);
00062         System.out.println("y "+x+" yerr "+yerrup);
00063         
00064         DataPoint dp = new DataPoint();
00065         dp.setX(x);
00066         dp.setY(y);
00067         dp.setYUp(yerrup);
00068         dp.setYDown(yerrdown);
00069         dp.setBinWidth(1.0);
00070         dp.setChi2(0.0);
00071         dps.add(dp);
00072 
00073     }
00074     */
00075 
00076     IAxis axis = hist_.axis();
00077     for (int iBin=0 ; iBin<axis.bins(); iBin++){
00078 
00079         DataPoint dp = new DataPoint();
00080         dp.setX( (axis.binUpperEdge(iBin)+axis.binLowerEdge(iBin))/2.0 );
00081         dp.setY(hist_.binHeight(iBin + 1 ));//iBin));
00082         dp.setYUp(hist_.binError(iBin+1));
00083         dp.setYDown(hist_.binError(iBin+1));
00084         dp.setBinWidth(axis.binWidth(iBin));
00085         dp.setChi2(0.0);
00086 
00087         //System.out.println("adding data point: " + dp);
00088 
00089         dps.add(dp);
00090     }
00091         
00092     return dps;
00093     }

void setDirectory String  dir  )  throws JetWebException
 

Implements JetWebPlotReader.

Definition at line 95 of file JetWebAIDAXMLPlotReader.java.

References JetWebAIDAXMLPlotReader.directory_.

00095                                                                 {
00096     directory_ = dir;
00097     }


Member Data Documentation

String directory_ = "" [package]
 

Definition at line 19 of file JetWebAIDAXMLPlotReader.java.

Referenced by JetWebAIDAXMLPlotReader.fillPlot(), and JetWebAIDAXMLPlotReader.setDirectory().

IDataPointSetFactory dpsf_ = null [package]
 

Definition at line 20 of file JetWebAIDAXMLPlotReader.java.

Referenced by JetWebAIDAXMLPlotReader.fillPlot(), and JetWebAIDAXMLPlotReader.JetWebAIDAXMLPlotReader().

IHistogram1D hist_ = null [package]
 

Definition at line 21 of file JetWebAIDAXMLPlotReader.java.

Referenced by JetWebAIDAXMLPlotReader.fillPlot(), and JetWebAIDAXMLPlotReader.getDataPoints().

IDataPointSet m_data_ = null [package]
 

Definition at line 17 of file JetWebAIDAXMLPlotReader.java.

Referenced by JetWebAIDAXMLPlotReader.fillPlot().

ITree tree_ = null [package]
 

Definition at line 18 of file JetWebAIDAXMLPlotReader.java.

Referenced by JetWebAIDAXMLPlotReader.fillPlot(), and JetWebAIDAXMLPlotReader.JetWebAIDAXMLPlotReader().


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

Generated Wed Jan 17 09:14:27 GMT 2007