• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

/Users/jmonk/Physics/ForIA/ForIA/IHistogrammer.hh

Go to the documentation of this file.
00001 
00011 #ifndef FORIA_IHISTOGRAMMER_HH
00012 #define FORIA_IHISTOGRAMMER_HH
00013 
00014 #include <string>
00015 #include <vector>
00016 #include <stdexcept>
00017 #include <ostream>
00018 #include <iostream>
00019 
00020 namespace ForIA{
00021  
00022   using std::string;
00023   using std::vector;
00024   using std::runtime_error;
00025   
00027   class IHistogrammer {
00028     
00029   public:
00030     
00031     virtual ~IHistogrammer(){};
00032     
00034     virtual const string &outputName()const =0;
00035     
00037     void bookHistogram1D(const string &name, const string &title, 
00038                          int nBins, double xMin, double xMax);
00039     
00041     void bookHistogram1D(const string &name, const string &title, 
00042                          int nBins, double xMin, double xMax, bool divideBinWidths);
00043 
00045     void bookHistogram1D(const string &path, const string &name, const string &title, 
00046                                  int nBins, double xMin, double xMax);
00047     
00049     virtual void bookHistogram1D(const string &path, const string &name, const string &title, 
00050                                  int nBins, double xMin, double xMax, bool divideBinWidths)=0;
00051     
00053     void bookHistogram1D(const string &name, const string &title, const vector<double> &bins);   
00054     
00056     void bookHistogram1D(const string &name, const string &title, const vector<double> &bins, bool divideBinWidths);
00057  
00059     void bookHistogram1D(const string &path, const string &name, const string &title, 
00060                          const vector<double> &bins);
00061     
00063     virtual void bookHistogram1D(const string &path, const string &name, const string &title, 
00064                                  const vector<double> &bins, bool divideBinWidths)=0;
00065     
00066 
00068     void bookProfile1D(const string &name, const string &title,
00069                        int nBins, double xMin, double xMax);
00070 
00072     virtual void bookProfile1D(const string &path, const string &name, const string &title,
00073                        int nBins, double xMin, double xMax)=0;
00074     
00076     void bookHistogram2D(const string &name, const string &title, 
00077                          int nBinsX, double xMin, double xMax,
00078                          int nBinsY, double yMin, double yMax);
00079     
00081     void bookHistogram2D(const string &name, const string &title, 
00082                          int nBinsX, double xMin, double xMax,
00083                          int nBinsY, double yMin, double yMax,
00084                          bool divideBinWidths);
00085 
00087     void bookHistogram2D(const string &path, const string &name, const string &title, 
00088                                  int nBinsX, double xMin, double xMax,
00089                                  int nBinsY, double yMin, double yMax);
00090     
00092     virtual void bookHistogram2D(const string &path, const string &name, const string &title, 
00093                                  int nBinsX, double xMin, double xMax,
00094                                  int nBinsY, double yMin, double yMax,
00095                                  bool divideBinWidths)=0;
00096     
00098     void bookHistogram2D(const string &name, const string &title, 
00099                          const vector<double>& xbins, const vector<double> &ybins);
00100 
00102     void bookHistogram2D(const string &name, const string &title, 
00103                          const vector<double>& xbins, const vector<double> &ybins,
00104                          bool divideBinWidths);
00105 
00107     void bookHistogram2D(const string &path, const string &name, const string &title,
00108                          const vector<double> &xbins, const vector<double> &ybins);
00109     
00111     virtual void bookHistogram2D(const string &path, const string &name, const string &title,
00112                                  const vector<double> &xbins, const vector<double> &ybins,
00113                                  bool divideBinWidths)=0;
00114     
00116     void bookHistogram3D(const string &name, const string &title,
00117                          int nBinsX, double xMin, double xMax,
00118                          int nBinsY, double yMin, double yMax,
00119                          int nBinsZ, double zMin, double zMax);
00120     
00122     void bookHistogram3D(const string &name, const string &title,
00123                          int nBinsX, double xMin, double xMax,
00124                          int nBinsY, double yMin, double yMax,
00125                          int nBinsZ, double zMin, double zMax,
00126                          bool divideBinWidths);
00127     
00129     void bookHistogram3D(const string &path, const string &name, const string &title,
00130                          int nBinsX, double xMin, double xMax,
00131                          int nBinsY, double yMin, double yMax,
00132                          int nBinsZ, double zMin, double zMax);
00133     
00135     virtual void bookHistogram3D(const string &path, const string &name, const string &title,
00136                                  int nBinsX, double xMin, double xMax,
00137                                  int nBinsY, double yMin, double yMax,
00138                                  int nBinsZ, double zMin, double zMax,
00139                                  bool divideBinWidths) = 0;
00140     
00141     
00143     //virtual bool bookProfile1D(const string &name, const string &title, int nBns, double xMin, double xMax)=0;
00144     
00146     //virtual bool bookProfile1D(const string &path, const string &name, const string &title, int nBns, double xMin, double xMax)=0;    
00147     
00149     virtual void fillHistogram1D(const string &path, const string &name, double value, double weight)=0;
00150     
00152     void fillHistogram1D(const string &name, double value, double weight);
00153     
00155     virtual void fillProfile1D(const string &path, const string &name, double xVal, double yVal, double weight)=0;
00156     
00158     void fillProfile1D(const string &name, double xVal, double yVal, double weight);
00159     
00161     virtual void fillHistogram2D(const string &path, const string &name, double xVal, double yVal, double weight)=0;
00162     
00164     void fillHistogram2D(const string &name, double xVal, double yVal, double weight);
00165     
00167     virtual void fillHistogram3D(const string &path, const string &name, double xVal, double yVal, double zVal, double weight) = 0;
00168     
00170     void fillHistogram3D(const string &name, double xVal, double yVal, double zVal, double weight);
00171     
00173     virtual void finalise()=0;
00174     
00176     virtual void normaliseHistogram1D(const string &path, const string &name, double norm=1.) = 0;
00177     
00179     void normaliseHistogram1D(const string &name, double norm=1.);
00180     
00182     virtual void scaleHistogram1D(const string &path, const string &name, double scale=1.)=0;
00183     
00185     void scaleHistogram1D(const string &name, double scale=1.);
00186     
00188     virtual void normaliseHistogram2D(const string &path, const string &name, double norm=1.) = 0;
00189     
00191     void normaliseHistogram2D(const string &name, double norm = 1.);
00192     
00194     virtual void scaleHistogram2D(const string &path, const string &name, double scale=1.)=0;
00195     
00197     void scaleHistogram2D(const string &name, double scale=1.);
00198     
00200     virtual void showHistograms(std::ostream &out)const = 0;
00201     
00202   private:
00203     
00204   };
00205   
00207   class NoSuchHistogramException: public runtime_error{
00208   public:
00209     NoSuchHistogramException(const string &path, const string & name): 
00210     runtime_error(name + ": No such histogram exists at " + path){};
00211     
00212     NoSuchHistogramException(const string &path, const string & name, const IHistogrammer *histogrammer): 
00213     runtime_error(name + ": No such histogram exists at " + path){
00214       
00215       std::cout<<"Existing histograms are:"<<std::endl;
00216       histogrammer->showHistograms(std::cout);
00217       
00218     };
00219     
00220   };
00221   
00223   class DuplicateHistogramException: public runtime_error{
00224   public:
00225     DuplicateHistogramException(const string &path, const string &name):
00226     runtime_error(name + ": Histogram already exists at " + path){}
00227   };
00228   
00229 }
00230 
00231 #endif

Generated on Mon Jul 30 2012 16:56:35 for ForIA by  doxygen 1.7.2