Logo ROOT  
Reference Guide
RooDataHist.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooDataHist.h,v 1.37 2007/05/11 09:11:30 verkerke Exp $
5  * Authors: *
6  * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7  * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8  * *
9  * Copyright (c) 2000-2005, Regents of the University of California *
10  * and Stanford University. All rights reserved. *
11  * *
12  * Redistribution and use in source and binary forms, *
13  * with or without modification, are permitted according to the terms *
14  * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15  *****************************************************************************/
16 #ifndef ROO_DATA_HIST
17 #define ROO_DATA_HIST
18 
19 #include "RooAbsData.h"
20 #include "RooDirItem.h"
21 #include "RooArgSet.h"
22 
23 #include <map>
24 #include <vector>
25 #include <string>
26 #include <functional>
27 #include <memory>
28 #include <unordered_map>
29 
30 class TAxis ;
31 class TObject ;
32 class RooAbsArg;
33 class RooCategory ;
34 class RooPlot;
35 class RooAbsLValue ;
36 
37 class RooDataHist : public RooAbsData, public RooDirItem {
38 public:
39 
40  // Constructors, factory methods etc.
41  RooDataHist() ;
42  RooDataHist(const char *name, const char *title, const RooArgSet& vars, const char* binningName=0) ;
43  RooDataHist(const char *name, const char *title, const RooArgSet& vars, const RooAbsData& data, Double_t initWgt=1.0) ;
44  RooDataHist(const char *name, const char *title, const RooArgList& vars, const TH1* hist, Double_t initWgt=1.0) ;
45  RooDataHist(const char *name, const char *title, const RooArgList& vars, RooCategory& indexCat, std::map<std::string,TH1*> histMap, Double_t initWgt=1.0) ;
46  RooDataHist(const char *name, const char *title, const RooArgList& vars, RooCategory& indexCat, std::map<std::string,RooDataHist*> dhistMap, Double_t wgt=1.0) ;
47  //RooDataHist(const char *name, const char *title, const RooArgList& vars, Double_t initWgt=1.0) ;
48  RooDataHist(const char *name, const char *title, const RooArgList& vars, const RooCmdArg& arg1, const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(),
49  const RooCmdArg& arg4=RooCmdArg(),const RooCmdArg& arg5=RooCmdArg(),const RooCmdArg& arg6=RooCmdArg(),const RooCmdArg& arg7=RooCmdArg(),const RooCmdArg& arg8=RooCmdArg()) ;
50  RooDataHist& operator=(const RooDataHist&) = delete;
51 
52  RooDataHist(const RooDataHist& other, const char* newname = 0) ;
53  TObject* Clone(const char* newname="") const override {
54  return new RooDataHist(*this, newname && newname[0] != '\0' ? newname : GetName());
55  }
56  ~RooDataHist() override ;
57 
58  /// Return empty clone of this RooDataHist.
59  RooAbsData* emptyClone(const char* newName=0, const char* newTitle=0, const RooArgSet*vars=0, const char* /*wgtVarName*/=0) const override {
60  return new RooDataHist(newName?newName:GetName(),newTitle?newTitle:GetTitle(),vars?*vars:*get()) ;
61  }
62 
63  /// Add `wgt` to the bin content enclosed by the coordinates passed in `row`.
64  virtual void add(const RooArgSet& row, Double_t wgt=1.0) { add(row,wgt,-1.); }
65  void add(const RooArgSet& row, Double_t weight, Double_t sumw2) override ;
66  void set(std::size_t binNumber, double weight, double wgtErr);
67  void set(const RooArgSet& row, Double_t weight, Double_t wgtErr=-1.) ;
68  void set(const RooArgSet& row, Double_t weight, Double_t wgtErrLo, Double_t wgtErrHi) ;
69 
70  void add(const RooAbsData& dset, const RooFormulaVar* cutVar=0, Double_t weight=1.0 ) ;
71  void add(const RooAbsData& dset, const char* cut, Double_t weight=1.0 ) ;
72 
73  /// Get bin centre of current bin.
74  const RooArgSet* get() const override { return &_vars; }
75  const RooArgSet* get(Int_t binNumber) const override;
76  virtual const RooArgSet* get(const RooArgSet& coord) const;
77  Int_t numEntries() const override;
78  Double_t sumEntries() const override;
79  Double_t sumEntries(const char* cutSpec, const char* cutRange=0) const override;
80 
81  /// Always returns true as all histograms use event weights.
82  Bool_t isWeighted() const override { return true; }
83  Bool_t isNonPoissonWeighted() const override ;
84 
85  RooSpan<const double> getWeightBatch(std::size_t first, std::size_t len) const override;
86  void getBatches(RooBatchCompute::RunContext& evalData, std::size_t begin, std::size_t len) const override;
87 
88  Double_t sum(bool correctForBinSize, bool inverseCorr=false) const ;
89  Double_t sum(const RooArgSet& sumSet, const RooArgSet& sliceSet, bool correctForBinSize, bool inverseCorr=false) ;
90  Double_t sum(const RooArgSet& sumSet,
91  const RooArgSet& sliceSet,
92  bool correctForBinSize,
93  bool inverseCorr,
94  const std::map<const RooAbsArg*, std::pair<double, double> >& ranges,
95  std::function<double(int)> getBinScale = [](int){ return 1.0; } );
96 
97  /// Return weight of i-th bin. \see getIndex()
98  double weight(std::size_t i) const { return _wgt[i]; }
99  Double_t weight(const RooArgSet& bin, Int_t intOrder=1, Bool_t correctForBinSize=kFALSE, Bool_t cdfBoundaries=kFALSE, Bool_t oneSafe=kFALSE);
100  /// Return squared weight sum of i-th bin. \see getIndex()
101  double weightSquared(std::size_t i) const { return get_sumw2(i); }
102  /// Return bin volume of i-th bin. \see getIndex()
103  double binVolume(std::size_t i) const { return _binv[i]; }
104  double binVolume(const RooArgSet& bin) const;
105  /// Return true if bin `i` is considered valid within the current range definitions of all observables. \see getIndex()
106  bool valid(std::size_t i) const { return i <= static_cast<std::size_t>(_arrSize) && (_maskedWeights.empty() || _maskedWeights[i] != 0.);}
107 
108  TIterator* sliceIterator(RooAbsArg& sliceArg, const RooArgSet& otherArgs) ;
109 
110  void weightError(Double_t& lo, Double_t& hi, ErrorType etype=Poisson) const override;
111  /// Return the error of the weight of the last-retrieved entry. See also weightError(Double_t&,Double_t&,ErrorType) const.
112  Double_t weightError(ErrorType etype=Poisson) const override {
113  // Return symmetric error on current bin calculated either from Poisson statistics or from SumOfWeights
114  Double_t lo,hi ;
115  weightError(lo,hi,etype) ;
116  return (lo+hi)/2 ;
117  }
118 
119  using RooAbsData::plotOn ;
120  RooPlot *plotOn(RooPlot *frame, PlotOpt o) const override;
121 
122  void reset() override;
123 
124  virtual void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const override;
125  virtual void printArgs(std::ostream& os) const override;
126  virtual void printValue(std::ostream& os) const override;
127  void printDataHistogram(std::ostream& os, RooRealVar* obs) const;
128 
129  void SetName(const char *name) override;
130  void SetNameTitle(const char *name, const char* title) override;
131 
132  Int_t getIndex(const RooAbsCollection& coord, Bool_t fast = false) const;
133  /// \copydoc getIndex(const RooAbsCollection&,Bool_t) const
134  ///
135  /// \note This overload only exists because there is an implicit conversion from RooAbsArg
136  /// to RooArgSet, and this needs to remain supported. This enables code like
137  /// ```
138  /// RooRealVar x(...);
139  /// dataHist.getIndex(x);
140  /// ```
141  /// It is, however, recommended to use
142  /// ```
143  /// dataHist.getIndex(RooArgSet(x));
144  /// ```
145  /// in this case.
146  Int_t getIndex(const RooArgSet& coord, Bool_t fast = false) const {
147  return getIndex(static_cast<const RooAbsCollection&>(coord), fast);
148  }
149 
150  void removeSelfFromDir() { removeFromDir(this) ; }
151 
152  // A shortcut function only for RooAbsOptTestStatistic.
153  void cacheValidEntries();
154 
155 
156  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
157  /// @name Deprecated functions
158  /// These functions rely on the fact that an event has been loaded before they are called. It is advised
159  /// to switch to their counterparts that take bin numbers as arguments. In this way, code like,
160  /// ```
161  /// const RooArgSet* coordinates = dataHist.get(i); // Need this to achieve side effect on next call of weight() - bad.
162  /// const double weight = dataHist.weight();
163  /// processEvent(coordinates, weight);
164  /// ```
165  /// becomes
166  /// ```
167  /// processEvent(dataHist.get(i), dataHist.weight(i));
168  /// ```
169  /// The index of a set of coordinates can be computed using getIndex().
170  /// @{
171 
172  /// Return weight of last bin that was requested with get().
173  /// \deprecated Use the safer weight(std::size_t) const.
174  Double_t weight() const override
175  R__SUGGEST_ALTERNATIVE("Use the safer weight(std::size_t) const.")
176  { return get_curWeight(); }
177  /// Return squared weight of last bin that was requested with get().
178  /// \deprecated Use the safer weightSquared(std::size_t) const.
179  Double_t weightSquared() const override
180  R__SUGGEST_ALTERNATIVE("Use the safer weightSquared(std::size_t) const.")
181  { return get_curSumW2(); }
182  /// Return volume of current bin. \deprecated Use binVolume(std::size_t) const.
184  R__SUGGEST_ALTERNATIVE("Use binVolume(std::size_t) const.")
185  { return _binv[_curIndex]; }
186  /// Write `weight` into current bin. \deprecated Use set(std::size_t,double,double)
187  void set(Double_t weight, Double_t wgtErr=-1)
188  R__SUGGEST_ALTERNATIVE("Use set(std::size_t,double,double).");
189 
190  /// Return true if currently loaded coordinate is considered valid within
191  /// the current range definitions of all observables.
192  /// \deprecated Use the safer valid(std::size_t) const.
193  bool valid() const override
194  R__SUGGEST_ALTERNATIVE("Use valid(std::size_t).")
195  { return _curIndex <= static_cast<std::size_t>(_arrSize) && (_maskedWeights.empty() || _maskedWeights[_curIndex] != 0.);}
196 
197  void dump2();
198 
199  ///@}
200  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
201 
202 protected:
203 
204  friend class RooAbsCachedPdf ;
205  friend class RooAbsCachedReal ;
206  friend class RooDataHistSliceIter ;
207 
208  std::size_t calcTreeIndex(const RooAbsCollection& coords, bool fast) const;
209  /// Legacy overload to calculate the tree index from the current value of `_vars`.
210  /// \deprecated Use calcTreeIndex(const RooArgSet&,bool) const.
211  Int_t calcTreeIndex() const { return static_cast<Int_t>(calcTreeIndex(_vars, true)); }
212 
213  void setAllWeights(Double_t value) ;
214 
215  void initialize(const char* binningName=0,Bool_t fillTree=kTRUE) ;
216  RooDataHist(const char* name, const char* title, RooDataHist* h, const RooArgSet& varSubset,
217  const RooFormulaVar* cutVar, const char* cutRange, Int_t nStart, Int_t nStop, Bool_t copyCache) ;
218  RooAbsData* reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=0,
219  std::size_t nStart=0, std::size_t nStop=std::numeric_limits<std::size_t>::max(), Bool_t copyCache=kTRUE) override;
220  Double_t interpolateDim(RooRealVar& dim, const RooAbsBinning* binning, Double_t xval, Int_t intOrder, Bool_t correctForBinSize, Bool_t cdfBoundaries) ;
221  const std::vector<double>& calculatePartialBinVolume(const RooArgSet& dimSet) const ;
222  void checkBinBounds() const;
223 
224  void adjustBinning(const RooArgList& vars, const TH1& href, Int_t* offset=0) ;
225  void importTH1(const RooArgList& vars, const TH1& histo, Double_t initWgt, Bool_t doDensityCorrection) ;
226  void importTH1Set(const RooArgList& vars, RooCategory& indexCat, std::map<std::string,TH1*> hmap, Double_t initWgt, Bool_t doDensityCorrection) ;
227  void importDHistSet(const RooArgList& vars, RooCategory& indexCat, std::map<std::string,RooDataHist*> dmap, Double_t initWgt) ;
228 
229  RooAbsData* cacheClone(const RooAbsArg* newCacheOwner, const RooArgSet* newCacheVars, const char* newName=0) override ;
230 
231  Double_t get_wgt(std::size_t idx) const { return _wgt[idx]; }
232  Double_t get_errLo(std::size_t idx) const { return _errLo ? _errLo[idx] : -1.; }
233  Double_t get_errHi(std::size_t idx) const { return _errHi ? _errHi[idx] : -1.; }
234  // If sumw2 is not being tracked, assume that all previous fill operations had a weight of 1, i.e., return the bare weight of the bin.
235  Double_t get_sumw2(std::size_t idx) const { return _sumw2 ? _sumw2[idx] : _wgt[idx]; }
236 
241 
242  Int_t get_curIndex() const { return _curIndex; }
243 
244  Int_t _arrSize{0}; // Size of member arrays.
245  std::vector<Int_t> _idxMult ; // Multiplier jump table for index calculation
246 
247  double* _wgt {nullptr}; //[_arrSize] Weight array
248  mutable double* _errLo{nullptr}; //[_arrSize] Low-side error on weight array
249  mutable double* _errHi{nullptr}; //[_arrSize] High-side error on weight array
250  mutable double* _sumw2{nullptr}; //[_arrSize] Sum of weights^2
251  double* _binv {nullptr}; //[_arrSize] Bin volume array
252 
253  RooArgSet _realVars ; // Real dimensions of the dataset
254  mutable std::vector<double> _maskedWeights; //! Copy of _wgtVec, but masked events have a weight of zero.
255 
256  mutable std::size_t _curIndex{std::numeric_limits<std::size_t>::max()}; // Current index
257 
258  mutable std::unordered_map<int,std::vector<double>> _pbinvCache ; //! Cache for arrays of partial bin volumes
259  std::vector<RooAbsLValue*> _lvvars ; //! List of observables casted as RooAbsLValue
260  std::vector<std::unique_ptr<const RooAbsBinning>> _lvbins ; //! List of used binnings associated with lvalues
261  mutable std::vector<std::vector<Double_t> > _binbounds; //! list of bin bounds per dimension
262 
264  mutable Int_t _cache_sum_valid{kInvalid}; //! Is cache sum valid? Needs to be Int_t instead of CacheSumState_t for subclasses.
265  mutable Double_t _cache_sum{0.}; //! Cache for sum of entries ;
266 
267 private:
268  void _adjustBinning(RooRealVar &theirVar, const TAxis &axis, RooRealVar *ourVar, Int_t *offset);
269  void registerWeightArraysToDataStore() const;
270 
271  ClassDefOverride(RooDataHist, 5) // Binned data set
272 };
273 
274 #endif
275 
RooDirItem::removeFromDir
void removeFromDir(TObject *obj)
Remove object from directory it was added to.
Definition: RooDirItem.cxx:43
RooDataHist::_binbounds
std::vector< std::vector< Double_t > > _binbounds
List of used binnings associated with lvalues.
Definition: RooDataHist.h:261
TAxis
Class to manage histogram axis.
Definition: TAxis.h:30
RooCmdArg
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27
first
Definition: first.py:1
RooDataHist::kInvalid
@ kInvalid
Definition: RooDataHist.h:263
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
RooDataHist::setAllWeights
void setAllWeights(Double_t value)
Set all the event weight of all bins to the specified value.
Definition: RooDataHist.cxx:1856
RooDataHist::operator=
RooDataHist & operator=(const RooDataHist &)=delete
RooDataHist::get_curIndex
Int_t get_curIndex() const
Definition: RooDataHist.h:242
RooDataHist::cacheClone
RooAbsData * cacheClone(const RooAbsArg *newCacheOwner, const RooArgSet *newCacheVars, const char *newName=0) override
Construct a clone of this dataset that contains only the cached variables.
Definition: RooDataHist.cxx:880
RooDataHist::kInverseBinCorr
@ kInverseBinCorr
Definition: RooDataHist.h:263
RooAbsData
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:49
RooDataHist::weight
double weight(std::size_t i) const
Return weight of i-th bin.
Definition: RooDataHist.h:98
RooDataHist::get_errLo
Double_t get_errLo(std::size_t idx) const
Definition: RooDataHist.h:232
RooArgSet.h
RooDataHist::_errLo
double * _errLo
Definition: RooDataHist.h:248
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
RooDataHist::kNoBinCorrection
@ kNoBinCorrection
Definition: RooDataHist.h:263
RooDataHist::get_errHi
Double_t get_errHi(std::size_t idx) const
Definition: RooDataHist.h:233
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooDirItem
RooDirItem is a utility base class for RooFit objects that are to be attached to ROOT directories.
Definition: RooDirItem.h:22
RooDataHist::importTH1Set
void importTH1Set(const RooArgList &vars, RooCategory &indexCat, std::map< std::string, TH1 * > hmap, Double_t initWgt, Bool_t doDensityCorrection)
Import data from given set of TH1/2/3 into this RooDataHist.
Definition: RooDataHist.cxx:450
RooDataHist::sumEntries
Double_t sumEntries() const override
Sum the weights of all bins.
Definition: RooDataHist.cxx:1750
RooDataHist::emptyClone
RooAbsData * emptyClone(const char *newName=0, const char *newTitle=0, const RooArgSet *vars=0, const char *=0) const override
Return empty clone of this RooDataHist.
Definition: RooDataHist.h:59
RooDataHist::importTH1
void importTH1(const RooArgList &vars, const TH1 &histo, Double_t initWgt, Bool_t doDensityCorrection)
Import data from given TH1/2/3 into this RooDataHist.
Definition: RooDataHist.cxx:371
R__SUGGEST_ALTERNATIVE
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
Definition: RConfig.hxx:519
RooDataHist::getWeightBatch
RooSpan< const double > getWeightBatch(std::size_t first, std::size_t len) const override
Return event weights of all events in range [first, first+len).
Definition: RooDataHist.cxx:2086
RooDataHistSliceIter
RooDataHistSliceIter iterates over all bins in a RooDataHist that occur in a slice defined by the bin...
Definition: RooDataHistSliceIter.h:26
RooDataHist::_binv
double * _binv
Definition: RooDataHist.h:251
indent
static void indent(ostringstream &buf, int indent_level)
Definition: TClingCallFunc.cxx:87
RooDataHist::valid
bool valid() const override
Return true if currently loaded coordinate is considered valid within the current range definitions o...
Definition: RooDataHist.h:193
RooDataHist::weightError
void weightError(Double_t &lo, Double_t &hi, ErrorType etype=Poisson) const override
Return the error of current weight.
Definition: RooDataHist.cxx:1191
TString
Basic string class.
Definition: TString.h:136
RooDataHist::importDHistSet
void importDHistSet(const RooArgList &vars, RooCategory &indexCat, std::map< std::string, RooDataHist * > dmap, Double_t initWgt)
Import data from given set of TH1/2/3 into this RooDataHist.
Definition: RooDataHist.cxx:553
ClassDefOverride
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
RooDataHist::SetNameTitle
void SetNameTitle(const char *name, const char *title) override
Change the title of this RooDataHist.
Definition: RooDataHist.cxx:1900
RooDataHist::getBatches
void getBatches(RooBatchCompute::RunContext &evalData, std::size_t begin, std::size_t len) const override
Write information to retrieve data columns into evalData.spans.
Definition: RooDataHist.cxx:2101
RooAbsData::ErrorType
ErrorType
Definition: RooAbsData.h:99
RooDataHist::sum
Double_t sum(bool correctForBinSize, bool inverseCorr=false) const
Return the sum of the weights of all bins in the histogram.
Definition: RooDataHist.cxx:1479
RooDataHist::_cache_sum
Double_t _cache_sum
Is cache sum valid? Needs to be Int_t instead of CacheSumState_t for subclasses.
Definition: RooDataHist.h:265
bool
TIterator
Iterator abstract base class.
Definition: TIterator.h:30
RooDataHist::registerWeightArraysToDataStore
void registerWeightArraysToDataStore() const
Hand over pointers to our weight arrays to the data store implementation.
Definition: RooDataHist.cxx:2109
RooDataHist::weightSquared
Double_t weightSquared() const override
Return squared weight of last bin that was requested with get().
Definition: RooDataHist.h:179
RooDataHist::kCorrectForBinSize
@ kCorrectForBinSize
Definition: RooDataHist.h:263
RooDataHist::add
virtual void add(const RooArgSet &row, Double_t wgt=1.0)
Add wgt to the bin content enclosed by the coordinates passed in row.
Definition: RooDataHist.h:64
RooDataHist::weightSquared
double weightSquared(std::size_t i) const
Return squared weight sum of i-th bin.
Definition: RooDataHist.h:101
RooDataHist::get_curWgtErrLo
Double_t get_curWgtErrLo() const
Definition: RooDataHist.h:238
RooDataHist::checkBinBounds
void checkBinBounds() const
Definition: RooDataHist.cxx:791
RooDataHist::_idxMult
std::vector< Int_t > _idxMult
Definition: RooDataHist.h:245
RooDataHist::_arrSize
Int_t _arrSize
Definition: RooDataHist.h:244
RooDataHist::_realVars
RooArgSet _realVars
Definition: RooDataHist.h:253
hi
float type_of_call hi(const int &, const int &)
RooDataHist::binVolume
Double_t binVolume() const
Return volume of current bin.
Definition: RooDataHist.h:183
RooDataHist::_sumw2
double * _sumw2
Definition: RooDataHist.h:250
RooDataHist::interpolateDim
Double_t interpolateDim(RooRealVar &dim, const RooAbsBinning *binning, Double_t xval, Int_t intOrder, Bool_t correctForBinSize, Bool_t cdfBoundaries)
Perform boundary safe 'intOrder'-th interpolation of weights in dimension 'dim' at current value 'xva...
Definition: RooDataHist.cxx:1248
RooAbsData::_vars
RooArgSet _vars
Definition: RooAbsData.h:291
RooDataHist::calcTreeIndex
Int_t calcTreeIndex() const
Legacy overload to calculate the tree index from the current value of _vars.
Definition: RooDataHist.h:211
RooDataHist
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:37
RooDataHist::Clone
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
Definition: RooDataHist.h:53
RooFormulaVar
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Definition: RooFormulaVar.h:30
RooDataHist::dump2
void dump2()
Debug stuff, should go...
Definition: RooDataHist.cxx:1033
RooDataHist::get
const RooArgSet * get() const override
Get bin centre of current bin.
Definition: RooDataHist.h:74
RooDataHist::removeSelfFromDir
void removeSelfFromDir()
Definition: RooDataHist.h:150
RooDataHist::weightError
Double_t weightError(ErrorType etype=Poisson) const override
Return the error of the weight of the last-retrieved entry. See also weightError(Double_t&,...
Definition: RooDataHist.h:112
RooDataHist::_lvvars
std::vector< RooAbsLValue * > _lvvars
Cache for arrays of partial bin volumes.
Definition: RooDataHist.h:259
RooDataHist::reduceEng
RooAbsData * reduceEng(const RooArgSet &varSubset, const RooFormulaVar *cutVar, const char *cutRange=0, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max(), Bool_t copyCache=kTRUE) override
Implementation of RooAbsData virtual method that drives the RooAbsData::reduce() methods.
Definition: RooDataHist.cxx:898
RooDataHist::get_curWeight
Double_t get_curWeight() const
Definition: RooDataHist.h:237
RooDataHist::getIndex
Int_t getIndex(const RooArgSet &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
Definition: RooDataHist.h:146
h
#define h(i)
Definition: RSha256.hxx:106
RooDataHist::_adjustBinning
void _adjustBinning(RooRealVar &theirVar, const TAxis &axis, RooRealVar *ourVar, Int_t *offset)
Cache for sum of entries ;.
Definition: RooDataHist.cxx:591
RooDataHist::initialize
void initialize(const char *binningName=0, Bool_t fillTree=kTRUE)
Initialization procedure: allocate weights array, calculate multipliers needed for N-space to 1-dim a...
Definition: RooDataHist.cxx:703
RooAbsData::plotOn
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Definition: RooAbsData.cxx:544
RooDataHist::reset
void reset() override
Reset all bin weights to zero.
Definition: RooDataHist.cxx:1803
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
RooDataHist::printArgs
virtual void printArgs(std::ostream &os) const override
Print argument of dataset, i.e. the observable names.
Definition: RooDataHist.cxx:1922
ROOT::R::function
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:151
RooDataHist::printValue
virtual void printValue(std::ostream &os) const override
Print value of the dataset, i.e. the sum of weights contained in the dataset.
Definition: RooDataHist.cxx:1911
RooAbsBinning
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
Definition: RooAbsBinning.h:26
RooDataHist::getIndex
Int_t getIndex(const RooAbsCollection &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
Definition: RooDataHist.cxx:975
RooDirItem.h
RooAbsCollection
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
Definition: RooAbsCollection.h:31
RooPlot
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:44
RooDataHist::RooDataHist
RooDataHist()
Default constructor.
Definition: RooDataHist.cxx:85
RooDataHist::_lvbins
std::vector< std::unique_ptr< const RooAbsBinning > > _lvbins
List of observables casted as RooAbsLValue.
Definition: RooDataHist.h:260
RooDataHist::adjustBinning
void adjustBinning(const RooArgList &vars, const TH1 &href, Int_t *offset=0)
Adjust binning specification on first and optionally second and third observable to binning in given ...
Definition: RooDataHist.cxx:657
RooDataHist::cacheValidEntries
void cacheValidEntries()
Compute which bins of the dataset are part of the currently set fit range.
Definition: RooDataHist.cxx:1941
RooDataHist::_maskedWeights
std::vector< double > _maskedWeights
Definition: RooDataHist.h:254
RooDataHist::isNonPoissonWeighted
Bool_t isNonPoissonWeighted() const override
Returns true if dataset contains entries with a non-integer weight.
Definition: RooDataHist.cxx:1965
RooDataHist::weight
Double_t weight() const override
Return weight of last bin that was requested with get().
Definition: RooDataHist.h:174
RooAbsCachedPdf
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
Definition: RooAbsCachedPdf.h:25
RooDataHist::valid
bool valid(std::size_t i) const
Return true if bin i is considered valid within the current range definitions of all observables.
Definition: RooDataHist.h:106
RooDataHist::_curIndex
std::size_t _curIndex
Copy of _wgtVec, but masked events have a weight of zero.
Definition: RooDataHist.h:256
RooAbsData::Poisson
@ Poisson
Definition: RooAbsData.h:99
RooDataHist::printMultiline
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const override
Print the details on the dataset contents.
Definition: RooDataHist.cxx:1981
RooDataHist::binVolume
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
Definition: RooDataHist.h:103
RooDataHist::SetName
void SetName(const char *name) override
Change the name of the RooDataHist.
Definition: RooDataHist.cxx:1889
RooDataHist::calculatePartialBinVolume
const std::vector< double > & calculatePartialBinVolume(const RooArgSet &dimSet) const
Fill the transient cache with partial bin volumes with up-to-date values for the partial volume speci...
Definition: RooDataHist.cxx:1691
RooDataHist::sliceIterator
TIterator * sliceIterator(RooAbsArg &sliceArg, const RooArgSet &otherArgs)
Create an iterator over all bins in a slice defined by the subset of observables listed in sliceArg.
Definition: RooDataHist.cxx:1871
RooDataHist::numEntries
Int_t numEntries() const override
Return the number of bins.
Definition: RooDataHist.cxx:1741
RooDataHist::_wgt
double * _wgt
Definition: RooDataHist.h:247
RooAbsData.h
Double_t
double Double_t
Definition: RtypesCore.h:59
RooDataHist::isWeighted
Bool_t isWeighted() const override
Always returns true as all histograms use event weights.
Definition: RooDataHist.h:82
RooCategory
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:27
TObject
Mother of all ROOT objects.
Definition: TObject.h:37
TH1
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
name
char name[80]
Definition: TGX11.cxx:110
RooDataHist::get_sumw2
Double_t get_sumw2(std::size_t idx) const
Definition: RooDataHist.h:235
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooDataHist::~RooDataHist
~RooDataHist() override
Destructor.
Definition: RooDataHist.cxx:953
RooDataHist::plotOn
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1=RooCmdArg::none(), const RooCmdArg &arg2=RooCmdArg::none(), const RooCmdArg &arg3=RooCmdArg::none(), const RooCmdArg &arg4=RooCmdArg::none(), const RooCmdArg &arg5=RooCmdArg::none(), const RooCmdArg &arg6=RooCmdArg::none(), const RooCmdArg &arg7=RooCmdArg::none(), const RooCmdArg &arg8=RooCmdArg::none()) const
Definition: RooAbsData.cxx:544
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooAbsLValue
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:26
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooDataHist::get_wgt
Double_t get_wgt(std::size_t idx) const
Definition: RooDataHist.h:231
RooDataHist::_errHi
double * _errHi
Definition: RooDataHist.h:249
RooDataHist::get_curWgtErrHi
Double_t get_curWgtErrHi() const
Definition: RooDataHist.h:239
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooDataHist::CacheSumState_t
CacheSumState_t
list of bin bounds per dimension
Definition: RooDataHist.h:263
RooDataHist::_cache_sum_valid
Int_t _cache_sum_valid
Definition: RooDataHist.h:264
RooDataHist::printDataHistogram
void printDataHistogram(std::ostream &os, RooRealVar *obs) const
Definition: RooDataHist.cxx:2002
RooDataHist::set
void set(std::size_t binNumber, double weight, double wgtErr)
Set bin content of bin that was last loaded with get(std::size_t).
Definition: RooDataHist.cxx:1375
RooBatchCompute::RunContext
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:31
RooDataHist::get_curSumW2
Double_t get_curSumW2() const
Definition: RooDataHist.h:240
RooAbsCachedReal
RooAbsCachedReal is the abstract base class for functions that need or want to cache their evaluate()...
Definition: RooAbsCachedReal.h:24
RooSpan
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:29
RooDataHist::_pbinvCache
std::unordered_map< int, std::vector< double > > _pbinvCache
Definition: RooDataHist.h:258
int