00001 #ifndef FORIA_ANALYSIS_HH 00002 #define FORIA_ANALYSIS_HH 00003 00004 #include "ForIA/Units.hh" 00005 00006 #include "boost/smart_ptr.hpp" 00007 00008 #include <string> 00009 #include <vector> 00010 00011 namespace ForIA { 00012 00013 class Event; 00014 class IHistogrammer; 00015 using std::string; 00016 using std::vector; 00017 00019 00023 class Analysis { 00024 00025 public: 00031 Analysis(IHistogrammer *histogrammer, const string &name); 00032 00034 virtual ~Analysis(){}; 00035 00037 const string &name()const; 00038 00044 virtual bool initialise()=0; 00049 void executeClear(const Event &evt); 00050 00056 virtual bool finalise()=0; 00057 00061 bool storesEvent()const; 00062 00063 protected: 00064 00070 virtual bool execute(const Event &evt)=0; 00071 00075 void storeEvent(bool doStore=true); 00076 00087 bool bookHistogram1D(const string &path, const string &name, const string &title, 00088 int nBins, double xMin, double xMax, bool divideBinWidths=true); 00089 00099 bool bookHistogram1D(const string &name, const string &title, 00100 int nBins, double xMin, double xMax, bool divideBinWidths=true); 00101 00110 bool bookHistogram1D(const string &path, const string &name, const string &title, 00111 const vector<double> &bins, bool divideBinWidths=true); 00112 00120 bool bookHistogram1D(const string &name, const string &title, 00121 const vector<double> &bins, bool divideBinWidths=true); 00122 00123 00133 void bookProfile1D(const string &path, const string &name, const string &title, 00134 int nBins, double xMin, double xMax); 00135 00144 void bookProfile1D(const string &name, const string &title, 00145 int nBins, double xMin, double xMax); 00146 00160 bool bookHistogram2D(const string &path, const string &name, const string &title, 00161 int nBinsX, double xMin, double xMax, 00162 int nBinsY, double yMin, double yMax, 00163 bool divideBinWidths=true); 00164 00177 bool bookHistogram2D(const string &name, const string &title, 00178 int nBinsX, double xMin, double xMax, 00179 int nBinsY, double yMin, double yMax, 00180 bool divideBinWidths=true); 00181 00191 bool bookHistogram2D(const string &path, const string &name, const string &title, 00192 const vector<double> &xbins, const vector<double> &ybins, 00193 bool divideBinWidths=true); 00194 00203 bool bookHistogram2D(const string &name, const string &title, 00204 const vector<double> &xbins, const vector<double> &ybins, 00205 bool divideBinWidths=true); 00206 00207 00224 void bookHistogram3D(const string &path, const string &name, const string &title, 00225 int nBinsX, double xMin, double xMax, 00226 int nBinsY, double yMin, double yMax, 00227 int nBinsZ, double zMin, double zMax, 00228 bool divideBinWidths=true); 00229 00245 void bookHistogram3D(const string &name, const string &title, 00246 int nBinsX, double xMin, double xMax, 00247 int nBinsY, double yMin, double yMax, 00248 int nBinsZ, double zMin, double zMax, 00249 bool divideBinWidths=true); 00250 00251 00259 bool fillHistogram1D(const string &path, const string &name, double value, double weight); 00260 00267 bool fillHistogram1D(const string &name, double value, double weight); 00268 00276 void fillProfile1D(const string &path, const string &name, double xVal, double yVal, double weight); 00277 00284 void fillProfile1D(const string &name, double xVal, double yVal, double weight); 00285 00294 bool fillHistogram2D(const string &path, const string &name, double xVal, double yVal, double weight); 00295 00303 bool fillHistogram2D(const string &name, double xVal, double yVal, double weight); 00304 00314 void fillHistogram3D(const string &path, const string &name, double xVal, double yVal, double zVal, double weight); 00315 00324 void fillHistogram3D(const string &name, double xVal, double yVal, double zVal, double weight); 00325 00332 void normaliseHistogram1D(const string &path, const string &name, double intgl); 00333 00339 void normaliseHistogram1D(const string &name, double intgl); 00340 00347 void scaleHistogram1D(const string &path, const string &name, double scale); 00348 00354 void scaleHistogram1D(const string &name, double scale); 00355 00359 IHistogrammer *histograms(); 00360 00364 string analysisPath(const std::string path){ 00365 return "/" + m_name + path; 00366 } 00367 00368 private: 00369 00372 Analysis(){} 00373 00374 IHistogrammer *m_histogrammer; 00375 string m_name; 00376 bool m_storeEvent; 00377 00378 }; 00379 00380 typedef boost::shared_ptr<Analysis> AnalysisPtr; 00381 typedef boost::shared_ptr<Analysis const> AnalysisConstPtr; 00382 00383 } 00384 00385 #endif