00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef ROO_GRID
00017 #define ROO_GRID
00018
00019 #include "TObject.h"
00020 #include "RooPrintable.h"
00021
00022 class RooAbsFunc;
00023
00024 class RooGrid : public TObject, public RooPrintable {
00025 public:
00026 RooGrid() ;
00027 RooGrid(const RooAbsFunc &function);
00028 virtual ~RooGrid();
00029
00030
00031 virtual void printName(ostream& os) const ;
00032 virtual void printTitle(ostream& os) const ;
00033 virtual void printClassName(ostream& os) const ;
00034 virtual void printMultiline(ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const;
00035
00036 inline virtual void Print(Option_t *options= 0) const {
00037 printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
00038 }
00039
00040 inline Bool_t isValid() const { return _valid; }
00041 inline UInt_t getDimension() const { return _dim; }
00042 inline Double_t getVolume() const { return _vol; }
00043 inline UInt_t getNBins() const { return _bins; }
00044 inline UInt_t getNBoxes() const { return _boxes; }
00045 inline void setNBoxes(UInt_t boxes) { _boxes= boxes; }
00046
00047 inline Double_t *createPoint() const { return _valid ? new Double_t[_dim] : 0; }
00048 inline UInt_t *createIndexVector() const { return _valid ? new UInt_t[_dim] : 0; }
00049
00050 Bool_t initialize(const RooAbsFunc &function);
00051 void resize(UInt_t bins);
00052 void resetValues();
00053 void generatePoint(const UInt_t box[], Double_t x[], UInt_t bin[],
00054 Double_t &vol, Bool_t useQuasiRandom= kTRUE) const;
00055 void accumulate(const UInt_t bin[], Double_t amount);
00056 void refine(Double_t alpha= 1.5);
00057
00058 void firstBox(UInt_t box[]) const;
00059 Bool_t nextBox(UInt_t box[]) const;
00060
00061 enum { maxBins = 50 };
00062
00063
00064 public:
00065 inline Double_t coord(Int_t i, Int_t j) const { return _xi[i*_dim + j]; }
00066 inline Double_t value(Int_t i,Int_t j) const { return _d[i*_dim + j]; }
00067 protected:
00068 inline Double_t& coord(Int_t i, Int_t j) { return _xi[i*_dim + j]; }
00069 inline Double_t& value(Int_t i,Int_t j) { return _d[i*_dim + j]; }
00070 inline Double_t& newCoord(Int_t i) { return _xin[i]; }
00071
00072 protected:
00073
00074 Bool_t _valid;
00075 UInt_t _dim,_bins,_boxes;
00076 Double_t _vol;
00077
00078 Double_t *_xl;
00079 Double_t *_xu;
00080 Double_t *_delx;
00081 Double_t *_d;
00082 Double_t *_xi;
00083 Double_t *_xin;
00084 Double_t *_weight;
00085
00086 ClassDef(RooGrid,1)
00087 };
00088
00089 #endif
00090
00091