Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

BinningFun.h

Go to the documentation of this file.
00001 
00004 #ifndef __BINNINGFUN_H
00005 #define __BINNINGFUN_H
00006 
00007 #include "jbltools/sfh/Binning.h"
00008 #include "jbltools/sfh/IntFunBase.h"
00009 
00010 //  Class BinningFun:
00012 
00075 class BinningFun: public Binning, public IntFun {
00076   public:
00078     BinningFun () {}
00080 
00083     BinningFun (int nbins,            
00084                 float xlow,           
00085                 float xup,            
00086                 const char *name = 0  
00087                ) 
00088       : Binning (nbins, xlow, xup),
00089         IntFun (name ? std::string(name) : std::string("Binning(")+str(nbins)+','+str(xlow)+','+str(xup)+')')
00090         {}
00092 
00095     BinningFun (int nbins,               
00096                 float xlow,              
00097                 float xup,               
00098                 const std::string& name  
00099                ) 
00100       : Binning (nbins, xlow, xup),
00101         IntFun (name)
00102         {}
00104 
00112     BinningFun (int nbins,               
00113                 const float binedges[],  
00114                 const char *name = 0  
00115                ) 
00116       : Binning (nbins, binedges),
00117         IntFun (name ? std::string(name) : std::string("Binning(")+str(nbins)+','+str(binedges[0])+"..."+str(binedges[nbins])+')')
00118       {}
00120 
00128     BinningFun (int nbins,               
00129                 const float binedges[],  
00130                 const std::string& name  
00131                ) 
00132       : Binning (nbins, binedges),
00133         IntFun (name)
00134       {}
00135                
00137 
00145     BinningFun (int nbins,                
00146                 const double binedges[],  
00147                 const char *name = 0      
00148                ) 
00149       : Binning (nbins, binedges),
00150         IntFun (name ? std::string(name) : std::string("Binning(")+str(nbins)+','+str(binedges[0])+"..."+str(binedges[nbins])+')')
00151        {}
00152                
00154 
00162     BinningFun (int nbins,                
00163                 const double binedges[],  
00164                 const std::string& name   
00165                ) 
00166       : Binning (nbins, binedges),
00167         IntFun (name)
00168        {}
00169                
00171     BinningFun  (const Binning& binning_,  
00172                  const char *name = 0      
00173                  ) 
00174       : Binning (binning_),
00175         IntFun (name ? std::string(name) : 
00176                 std::string("Binning(")
00177                 +str(binning_.getNBins())+','
00178                 +str(binning_.getLowerEdge())+"..."
00179                 +str(binning_.getUpperEdge())+')')
00180        {}
00181     
00183     virtual int operator() () const = 0; 
00184     
00186 
00191     virtual bool operator()(int i        
00192                            ) const {
00193       return i == (*this)(); 
00194     }                    
00195     
00197     virtual bool isExclusive() const {
00198       return true;
00199     }                    
00200     
00202 
00209     virtual const char *getBinName(int i        
00210                                    ) const = 0;
00212 
00219     virtual const char *getBinTitle(int i       
00220                                    ) const = 0;
00221                                    
00223     /*
00224      * A BinningFun is used typically e.g. by a SetOfHistograms.
00225      * The client will normally book histograms for numbers 
00226      * 0...getNBins()-1.
00227      * In certain cases it may be useful to use e.g.  getBinTitle(i) 
00228      * with a number higher than getNBins()-1.
00229      * The maximal sensible number is given by getMaxBins().
00230      */
00231     virtual int getMaxBins() const { return getNBins(); }                               
00232   protected:  
00234     virtual ~BinningFun() {}
00235 };
00236 
00237 
00238 #endif /* #ifndef __BINNINGFUN_H */

Generated on Thu Oct 26 12:52:55 2006 for SFH by doxygen 1.3.2