RooBinning.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooBinning.h,v 1.9 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
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     // Return the number boundaries
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     // Return the lower bound value
00051     return _xlo ; 
00052   }
00053   virtual Double_t highBound() const { 
00054     // Return the upper bound value
00055     return _xhi ; 
00056   }
00057   virtual Double_t averageBinWidth() const { 
00058     // Return the average bin width
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 ;          // Lower bound
00081   Double_t _xhi ;          // Upper bound
00082   Bool_t _ownBoundLo ;     // Does the lower bound coincide with a bin boundary
00083   Bool_t _ownBoundHi ;     // Does the upper bound coincide with a bin boundary
00084   Int_t _nbins ;           // Numer of bins
00085 
00086   std::set<Double_t> _boundaries ;   // Boundaries
00087   mutable Double_t* _array ;         //! Array of boundaries
00088 
00089   ClassDef(RooBinning,2) // Generic binning specification
00090 };
00091 
00092 #endif

Generated on Tue Jul 5 14:26:05 2011 for ROOT_528-00b_version by  doxygen 1.5.1