00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ROO_BINNING
00017 #define ROO_BINNING
00018
00019 #include "Rtypes.h"
00020 #include "TList.h"
00021 #include "RooDouble.h"
00022 #include "RooAbsBinning.h"
00023 #include "RooNumber.h"
00024 #include <set>
00025 class RooAbsPdf ;
00026 class RooRealVar ;
00027
00028
00029 class RooBinning : public RooAbsBinning {
00030 public:
00031
00032 RooBinning(Double_t xlo=-RooNumber::infinity(), Double_t xhi=RooNumber::infinity(), const char* name=0) ;
00033 RooBinning(Int_t nBins, Double_t xlo, Double_t xhi, const char* name=0) ;
00034 RooBinning(Int_t nBins, const Double_t* boundaries, const char* name=0) ;
00035 RooBinning(const RooBinning& other, const char* name=0) ;
00036 RooAbsBinning* clone(const char* name=0) const { return new RooBinning(*this,name?name:GetName()) ; }
00037 ~RooBinning() ;
00038
00039 virtual Int_t numBoundaries() const {
00040
00041 return _nbins+1 ;
00042 }
00043 virtual Int_t binNumber(Double_t x) const ;
00044 virtual Int_t rawBinNumber(Double_t x) const ;
00045 virtual Double_t nearestBoundary(Double_t x) const ;
00046
00047 virtual void setRange(Double_t xlo, Double_t xhi) ;
00048
00049 virtual Double_t lowBound() const {
00050
00051 return _xlo ;
00052 }
00053 virtual Double_t highBound() const {
00054
00055 return _xhi ;
00056 }
00057 virtual Double_t averageBinWidth() const {
00058
00059 return (highBound()-lowBound())/numBins() ;
00060 }
00061 virtual Double_t* array() const ;
00062
00063 virtual Double_t binCenter(Int_t bin) const ;
00064 virtual Double_t binWidth(Int_t bin) const ;
00065 virtual Double_t binLow(Int_t bin) const ;
00066 virtual Double_t binHigh(Int_t bin) const ;
00067
00068 Bool_t addBoundary(Double_t boundary) ;
00069 void addBoundaryPair(Double_t boundary, Double_t mirrorPoint=0) ;
00070 void addUniform(Int_t nBins, Double_t xlo, Double_t xhi) ;
00071 Bool_t removeBoundary(Double_t boundary) ;
00072
00073 Bool_t hasBoundary(Double_t boundary) ;
00074
00075 protected:
00076
00077 Bool_t binEdges(Int_t bin, Double_t& xlo, Double_t& xhi) const ;
00078 void updateBinCount() ;
00079
00080 Double_t _xlo ;
00081 Double_t _xhi ;
00082 Bool_t _ownBoundLo ;
00083 Bool_t _ownBoundHi ;
00084 Int_t _nbins ;
00085
00086 std::set<Double_t> _boundaries ;
00087 mutable Double_t* _array ;
00088
00089 ClassDef(RooBinning,2)
00090 };
00091
00092 #endif