library: libRooFit #include "RooDataHist.h"

# RooDataHist

class description - source file - inheritance tree (.pdf)

## class RooDataHist : public RooTreeData, public RooDirItem

| Inheritance Chart:
`TObject`
| <- | `TNamed`
`RooPrintable`
| <- | `RooAbsData`
| <- | `RooTreeData`
`RooDirItem`
| <- | `RooDataHist` |

        protected:

                              RooDataHist(const char* name, const char* title, RooDataHist* h, const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange, Int_t nStart, Int_t nStop, Bool_t copyCache)
          virtual RooAbsData* cacheClone(const RooArgSet* newCacheVars, const char* newName = "0")
                        Int_t calcTreeIndex() const
                         void calculatePartialBinVolume(const RooArgSet& dimSet) const
                         void initialize(Bool_t fillTree = kTRUE)
                     Double_t interpolateDim(RooRealVar& dim, Double_t xval, Int_t intOrder, Bool_t correctForBinSize)
          virtual RooAbsData* reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange = "0", Int_t nStart = 0, Int_t nStop = 2000000000, Bool_t copyCache = kTRUE)

        public:

                                   RooDataHist()
                                   RooDataHist(const char* name, const char* title, const RooArgSet& vars)
                                   RooDataHist(const char* name, const char* title, const RooArgSet& vars, const RooAbsData& data, Double_t initWgt = 1.0)
                                   RooDataHist(const char* name, const char* title, const RooArgList& vars, const TH1* hist, Double_t initWgt = 1.0)
                                   RooDataHist(const RooDataHist& other, const char* newname = "0")
                           virtual ~RooDataHist()
                      virtual void add(const RooArgSet& row, Double_t weight = 1.0)
                      virtual void add(const RooArgSet& row, Double_t weight, Double_t sumw2)
                              void add(const RooAbsData& dset, const RooFormulaVar* cutVar = 0, Double_t weight = 1.0)
                              void add(const RooAbsData& dset, const char* cut, Double_t weight = 1.0)
                          Double_t binVolume() const
                          Double_t binVolume(const RooArgSet& bin)
                    static TClass* Class()
                  virtual TObject* Clone(const char* newname = "0") const
                              void dump2()
               virtual RooAbsData* emptyClone(const char* newName = "0", const char* newTitle = "0") const
          virtual const RooArgSet* get() const
          virtual const RooArgSet* get(Int_t masterIdx) const
          virtual const RooArgSet* get(const RooArgSet& coord) const
                   virtual TClass* IsA() const
                    virtual Bool_t isWeighted() const
                     virtual Int_t numEntries(Bool_t useWeights = kFALSE) const
                      RooDataHist& operator=(const RooDataHist&)
                  virtual RooPlot* plotOn(RooPlot* frame, RooTreeData::PlotOpt o) const
                      virtual void reset()
                              void set(const RooArgSet& row, Double_t weight, Double_t wgtErr = -1)
                              void set(const RooArgSet& row, Double_t weight, Double_t wgtErrLo, Double_t wgtErrHi)
                      virtual void ShowMembers(TMemberInspector& insp, char* parent)
                      virtual void Streamer(TBuffer& b)
                              void StreamerNVirtual(TBuffer& b)
                          Double_t sum(Bool_t correctForBinSize) const
                          Double_t sum(const RooArgSet& sumSet, const RooArgSet& sliceSet, Bool_t correctForBinSize)
                  virtual Double_t sumEntries(const char* cutSpec = "0", const char* cutRange = "0") const
                  virtual Double_t weight() const
                          Double_t weight(const RooArgSet& bin, Int_t intOrder = 1, Bool_t correctForBinSize = kFALSE)
                      virtual void weightError(Double_t& lo, Double_t& hi, RooAbsData::ErrorType etype = Poisson) const
                  virtual Double_t weightError(RooAbsData::ErrorType etype = Poisson) const

### Data Members

        protected:

               Int_t _arrSize      Size of the weight array
              Int_t* _idxMult      ! Multiplier jump table for index calculation
           Double_t* _wgt          [_arrSize] Weight array
           Double_t* _errLo        [_arrSize] Low-side error on weight array
           Double_t* _errHi        [_arrSize] High-side error on weight array
           Double_t* _sumw2        [_arrSize] Sum of weights^2
           Double_t* _binv         [_arrSize] Bin volume array
           RooArgSet _realVars     Real dimensions of the dataset
          TIterator* _realIter     ! Iterator over realVars
            Double_t _curWeight    Weight associated with the current coordinate
            Double_t _curWgtErrLo  Error on weight associated with the current coordinate
            Double_t _curWgtErrHi  Error on weight associated with the current coordinate
            Double_t _curSumW2     Current sum of weights^2
            Double_t _curVolume    Volume of bin enclosing current coordinate
               Int_t _curIndex     Current index
           Double_t* _pbinv        ! Partial bin volume array
          RooNameSet _pbinvCache   ! Partial bin volume definition currently cached

## Class Description

RooDataHist()

     Default constructor

RooDataHist(const char *name, const char *title, const RooArgSet& vars) : RooTreeData(name,title,vars), _curWeight(0), _curVolume(1), _pbinv(0)

     Constructor of an empty data hist from a RooArgSet defining the dimensions
     of the data space. The range and number of bins in each dimensions are taken
     from getMin()getMax(),getBins() of each RooAbsArg representing that
     dimension.

     For real dimensions, the fit range and number of bins can be set independently
     of the plot range and number of bins, but it is advisable to keep the
     ratio of the plot bin width and the fit bin width an integer value.
     For category dimensions, the fit ranges always comprises all defined states
     and each state is always has its individual bin

     To effective achive binning of real dimensions with variable bins sizes,
     construct a RooThresholdCategory of the real dimension to be binned variably.
     Set the thresholds at the desired bin boundaries, and construct the
     data hist as function of the threshold category instead of the real variable.

RooDataHist(const char *name, const char *title, const RooArgSet& vars, const RooAbsData& data, Double_t weight) : RooTreeData(name,title,vars), _curWeight(0), _curVolume(1), _pbinv(0)

     Constructor of a data hist from an existing data collection (binned or unbinned)
     The RooArgSet 'vars' defines the dimensions of the histogram.
     The range and number of bins in each dimensions are taken
     from getMin()getMax(),getBins() of each RooAbsArg representing that
     dimension.

     For real dimensions, the fit range and number of bins can be set independently
     of the plot range and number of bins, but it is advisable to keep the
     ratio of the plot bin width and the fit bin width an integer value.
     For category dimensions, the fit ranges always comprises all defined states
     and each state is always has its individual bin

     To effective achive binning of real dimensions with variable bins sizes,
     construct a RooThresholdCategory of the real dimension to be binned variably.
     Set the thresholds at the desired bin boundaries, and construct the
     data hist as function of the threshold category instead of the real variable.

     If the constructed data hist has less dimensions that in source data collection,
     all missing dimensions will be projected.

RooDataHist(const char *name, const char *title, const RooArgList& vars, const TH1* hist, Double_t weight) : RooTreeData(name,title,vars), _curWeight(0), _curVolume(1), _pbinv(0)

     Constructor of a data hist from an TH1,TH2 or TH3
     The RooArgSet 'vars' defines the dimensions of the histogram. The ranges
     and number of bins are taken from the input histogram, and the corresponding
     values are set accordingly on the arguments in 'vars'

void initialize(Bool_t fillTree)

     Initialization procedure: allocate weights array, calculate
     multipliers needed for N-space to 1-dim array jump table,
     and fill the internal tree with all bin center coordinates

RooDataHist(const RooDataHist& other, const char* newname) : RooTreeData(other,newname), RooDirItem(), _curWeight(0), _curVolume(1), _pbinv(0)

     Copy constructor

RooDataHist(const char* name, const char* title, RooDataHist* h, const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange, Int_t nStart, Int_t nStop, Bool_t copyCache) : RooTreeData(name,title,h,varSubset,cutVar,cutRange,nStart,nStop,copyCache), _curWeight(0), _curVolume(1), _pbinv(0)

     Constructor of a data hist from (part of) an existing data hist. The dimensions
     of the data set are defined by the 'vars' RooArgSet, which can be identical
     to 'dset' dimensions, or a subset thereof. Reduced dimensions will be projected
     in the output data hist. The optional 'cutVar' formula variable can used to
     select the subset of bins to be copied.

     For most uses the RooAbsData::reduce() wrapper function, which uses this constructor,
     is the most convenient way to create a subset of an existing data

RooAbsData* cacheClone(const RooArgSet* newCacheVars, const char* newName)

RooAbsData* reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange, Int_t nStart, Int_t nStop, Bool_t /*copyCache*/)

     Implementation of RooAbsData virtual method that drives the RooAbsData::reduce() methods

~RooDataHist()

     Destructor

Int_t calcTreeIndex() const

     Calculate the index for the weights array corresponding to
     to the bin enclosing the current coordinates of the internal argset

void dump2()

     Debug stuff, should go...

RooPlot* plotOn(RooPlot *frame, PlotOpt o) const

Double_t weight(const RooArgSet& bin, Int_t intOrder, Bool_t correctForBinSize)

     Return the weight at given coordinates with optional
     interpolation. If intOrder is zero, the weight
     for the bin enclosing the coordinates
     contained in 'bin' is returned. For higher values,
     the result is interpolated in the real dimensions
     of the dataset

void weightError(Double_t& lo, Double_t& hi, ErrorType etype) const

     Return error on current weight

Double_t interpolateDim(RooRealVar& dim, Double_t xval, Int_t intOrder, Bool_t correctForBinSize)

     Perform boundary safe 'intOrder'-th interpolation of weights in dimension 'dim'
     at current value 'xval'

void add(const RooArgSet& row, Double_t weight, Double_t sumw2)

     Increment the weight of the bin enclosing the coordinates
     given by 'row' by the specified amount

void set(const RooArgSet& row, Double_t weight, Double_t wgtErrLo, Double_t wgtErrHi)

     Increment the weight of the bin enclosing the coordinates
     given by 'row' by the specified amount

void set(const RooArgSet& row, Double_t weight, Double_t wgtErr)

     Increment the weight of the bin enclosing the coordinates
     given by 'row' by the specified amount

void add(const RooAbsData& dset, const char* cut, Double_t weight)

     Add all data points contained in 'dset' to this data set with given weight.
     Optional cut string expression selects the data points to be added and can
     reference any variable contained in this data set

void add(const RooAbsData& dset, const RooFormulaVar* cutVar, Double_t weight)

     Add all data points contained in 'dset' to this data set with given weight.
     Optional RooFormulaVar pointer selects the data points to be added.

Double_t sum(Bool_t correctForBinSize) const

     Return the sum of the weights of all hist bins.

     If correctForBinSize is specified, the sum of weights
     is multiplied by the N-dimensional bin volume,
     making the return value the integral over the function
     represented by this histogram

Double_t sum(const RooArgSet& sumSet, const RooArgSet& sliceSet, Bool_t correctForBinSize)

     Return the sum of the weights of a multi-dimensional slice of the histogram
     by summing only over the dimensions specified in sumSet.

     The coordinates of all other dimensions are fixed to those given in sliceSet

     If correctForBinSize is specified, the sum of weights
     is multiplied by the M-dimensional bin volume, (M = N(sumSet)),
     making the return value the integral over the function
     represented by this histogram

void calculatePartialBinVolume(const RooArgSet& dimSet) const

     Allocate cache if not yet existing

Int_t numEntries(Bool_t useWeights) const

     Return the number of bins (useWeights=false) or
     the sum of the weights of all bins (useWeight=true)

Double_t sumEntries(const char* cutSpec, const char* cutRange) const

void reset()

     Reset all bin weights to zero

const RooArgSet* get(Int_t masterIdx) const

     Return an argset with the bin center coordinates for
     bin sequential number 'masterIdx'. For iterative use.

const RooArgSet* get(const RooArgSet& coord) const

Double_t binVolume(const RooArgSet& coord)

### Inline Functions

                    TObject* Clone(const char* newname = "0") const
                 RooAbsData* emptyClone(const char* newName = "0", const char* newTitle = "0") const
                        void add(const RooAbsData& dset, const char* cut, Double_t weight = 1.0)
            const RooArgSet* get(const RooArgSet& coord) const
                      Bool_t isWeighted() const
                    Double_t weight(const RooArgSet& bin, Int_t intOrder = 1, Bool_t correctForBinSize = kFALSE)
                    Double_t binVolume(const RooArgSet& bin)
                    Double_t weightError(RooAbsData::ErrorType etype = Poisson) const
                     TClass* Class()
                     TClass* IsA() const
                        void ShowMembers(TMemberInspector& insp, char* parent)
                        void Streamer(TBuffer& b)
                        void StreamerNVirtual(TBuffer& b)
                RooDataHist& operator=(const RooDataHist&)

Last update: Tue Jun 28 18:11:49 2005
Copyright (c) 2000-2005, Regents of the University of California *