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 "ROOT/RStringView.hxx"
24
25#include <map>
26#include <vector>
27#include <string>
28#include <functional>
29#include <memory>
30#include <unordered_map>
31
32class TAxis ;
33class TObject ;
34class RooAbsArg;
35class RooCategory ;
36class RooPlot;
37class RooAbsLValue ;
38namespace RooFit {
39namespace TestStatistics {
40class RooAbsL;
41}
42}
43
44class RooDataHist : public RooAbsData, public RooDirItem {
45public:
46
47 // Constructors, factory methods etc.
48 RooDataHist() ;
49 RooDataHist(std::string_view name, std::string_view title, const RooArgSet& vars, const char* binningName=0) ;
50 RooDataHist(std::string_view name, std::string_view title, const RooArgSet& vars, const RooAbsData& data, Double_t initWgt=1.0) ;
51 RooDataHist(std::string_view name, std::string_view title, const RooArgList& vars, const TH1* hist, Double_t initWgt=1.0) ;
52 RooDataHist(std::string_view name, std::string_view title, const RooArgList& vars, RooCategory& indexCat, std::map<std::string,TH1*> histMap, Double_t initWgt=1.0) ;
53 RooDataHist(std::string_view name, std::string_view title, const RooArgList& vars, RooCategory& indexCat, std::map<std::string,RooDataHist*> dhistMap, Double_t wgt=1.0) ;
54 //RooDataHist(const char *name, const char *title, const RooArgList& vars, Double_t initWgt=1.0) ;
55 RooDataHist(std::string_view name, std::string_view title, const RooArgList& vars, const RooCmdArg& arg1, const RooCmdArg& arg2=RooCmdArg(), const RooCmdArg& arg3=RooCmdArg(),
56 const RooCmdArg& arg4=RooCmdArg(),const RooCmdArg& arg5=RooCmdArg(),const RooCmdArg& arg6=RooCmdArg(),const RooCmdArg& arg7=RooCmdArg(),const RooCmdArg& arg8=RooCmdArg()) ;
58
60
61 RooDataHist(const RooDataHist& other, const char* newname = 0) ;
62 TObject* Clone(const char* newname="") const override {
63 return new RooDataHist(*this, newname && newname[0] != '\0' ? newname : GetName());
64 }
65 ~RooDataHist() override ;
66
67 /// Return empty clone of this RooDataHist.
68 RooAbsData* emptyClone(const char* newName=0, const char* newTitle=0, const RooArgSet*vars=0, const char* /*wgtVarName*/=0) const override {
69 return new RooDataHist(newName?newName:GetName(),newTitle?newTitle:GetTitle(),vars?*vars:*get()) ;
70 }
71
72 /// Add `wgt` to the bin content enclosed by the coordinates passed in `row`.
73 virtual void add(const RooArgSet& row, Double_t wgt=1.0) { add(row,wgt,-1.); }
74 void add(const RooArgSet& row, Double_t weight, Double_t sumw2) override ;
75 void set(std::size_t binNumber, double weight, double wgtErr);
76 void set(const RooArgSet& row, Double_t weight, Double_t wgtErr=-1.) ;
77 void set(const RooArgSet& row, Double_t weight, Double_t wgtErrLo, Double_t wgtErrHi) ;
78
79 void add(const RooAbsData& dset, const RooFormulaVar* cutVar=0, Double_t weight=1.0 ) ;
80 void add(const RooAbsData& dset, const char* cut, Double_t weight=1.0 ) ;
81
82 /// Get bin centre of current bin.
83 const RooArgSet* get() const override { return &_vars; }
84 const RooArgSet* get(Int_t binNumber) const override;
85 virtual const RooArgSet* get(const RooArgSet& coord) const;
86 Int_t numEntries() const override;
87 Double_t sumEntries() const override;
88 Double_t sumEntries(const char* cutSpec, const char* cutRange=0) const override;
89
90 /// Always returns true as all histograms use event weights.
91 Bool_t isWeighted() const override { return true; }
92 Bool_t isNonPoissonWeighted() const override ;
93
94 RooSpan<const double> getWeightBatch(std::size_t first, std::size_t len) const override;
95 void getBatches(RooBatchCompute::RunContext& evalData, std::size_t begin, std::size_t len) const override;
96 /// Retrieve all bin volumes. Bins are indexed according to getIndex().
97 RooSpan<const double> binVolumes(std::size_t first, std::size_t len) const {
98 return {_binv + first, len};
99 }
100
101 Double_t sum(bool correctForBinSize, bool inverseCorr=false) const ;
102 Double_t sum(const RooArgSet& sumSet, const RooArgSet& sliceSet, bool correctForBinSize, bool inverseCorr=false) ;
103 Double_t sum(const RooArgSet& sumSet,
104 const RooArgSet& sliceSet,
105 bool correctForBinSize,
106 bool inverseCorr,
107 const std::map<const RooAbsArg*, std::pair<double, double> >& ranges,
108 std::function<double(int)> getBinScale = [](int){ return 1.0; } );
109
110 /// Return weight of i-th bin. \see getIndex()
111 double weight(std::size_t i) const { return _wgt[i]; }
112 double weightFast(const RooArgSet& bin, int intOrder, bool correctForBinSize, bool cdfBoundaries);
113 Double_t weight(const RooArgSet& bin, Int_t intOrder=1, Bool_t correctForBinSize=kFALSE, Bool_t cdfBoundaries=kFALSE, Bool_t oneSafe=kFALSE);
114 /// Return squared weight sum of i-th bin. \see getIndex()
115 double weightSquared(std::size_t i) const { return get_sumw2(i); }
116 /// Return bin volume of i-th bin. \see getIndex()
117 double binVolume(std::size_t i) const { return _binv[i]; }
118 double binVolume(const RooArgSet& bin) const;
119 /// Return true if bin `i` is considered valid within the current range definitions of all observables. \see getIndex()
120 bool valid(std::size_t i) const { return i <= static_cast<std::size_t>(_arrSize) && (_maskedWeights.empty() || _maskedWeights[i] != 0.);}
121
122 TIterator* sliceIterator(RooAbsArg& sliceArg, const RooArgSet& otherArgs) ;
123
124 void weightError(double& lo, double& hi, ErrorType etype=Poisson) const override;
125 /// \copydoc RooAbsData::weightError(RooAbsData::ErrorType) const
126 double weightError(ErrorType etype=Poisson) const override {
127 // Return symmetric error on current bin calculated either from Poisson statistics or from SumOfWeights
128 Double_t lo,hi ;
129 weightError(lo,hi,etype) ;
130 return (lo+hi)/2 ;
131 }
132
133 using RooAbsData::plotOn ;
134 RooPlot *plotOn(RooPlot *frame, PlotOpt o) const override;
135
136 void reset() override;
137
138 virtual void printMultiline(std::ostream& os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const override;
139 virtual void printArgs(std::ostream& os) const override;
140 virtual void printValue(std::ostream& os) const override;
141 void printDataHistogram(std::ostream& os, RooRealVar* obs) const;
142
143 void SetName(const char *name) override;
144 void SetNameTitle(const char *name, const char* title) override;
145
146 Int_t getIndex(const RooAbsCollection& coord, Bool_t fast = false) const;
147 /// \copydoc getIndex(const RooAbsCollection&,Bool_t) const
148 ///
149 /// \note This overload only exists because there is an implicit conversion from RooAbsArg
150 /// to RooArgSet, and this needs to remain supported. This enables code like
151 /// ```
152 /// RooRealVar x(...);
153 /// dataHist.getIndex(x);
154 /// ```
155 /// It is, however, recommended to use
156 /// ```
157 /// dataHist.getIndex(RooArgSet(x));
158 /// ```
159 /// in this case.
160 Int_t getIndex(const RooArgSet& coord, Bool_t fast = false) const {
161 return getIndex(static_cast<const RooAbsCollection&>(coord), fast);
162 }
163
165
166 // A shortcut function only for RooAbsOptTestStatistic.
167 void cacheValidEntries();
168
169
170 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
171 /// @name Deprecated functions
172 /// These functions rely on the fact that an event has been loaded before they are called. It is advised
173 /// to switch to their counterparts that take bin numbers as arguments. In this way, code like,
174 /// ```
175 /// const RooArgSet* coordinates = dataHist.get(i); // Need this to achieve side effect on next call of weight() - bad.
176 /// const double weight = dataHist.weight();
177 /// processEvent(coordinates, weight);
178 /// ```
179 /// becomes
180 /// ```
181 /// processEvent(dataHist.get(i), dataHist.weight(i));
182 /// ```
183 /// The index of a set of coordinates can be computed using getIndex().
184 /// @{
185
186 /// Return weight of last bin that was requested with get().
187 /// \deprecated Use the safer weight(std::size_t) const.
188 Double_t weight() const override
189 R__SUGGEST_ALTERNATIVE("Use the safer weight(std::size_t) const.")
190 { return get_curWeight(); }
191 /// Return squared weight of last bin that was requested with get().
192 /// \deprecated Use the safer weightSquared(std::size_t) const.
193 Double_t weightSquared() const override
194 R__SUGGEST_ALTERNATIVE("Use the safer weightSquared(std::size_t) const.")
195 { return get_curSumW2(); }
196 /// Return volume of current bin. \deprecated Use binVolume(std::size_t) const.
198 R__SUGGEST_ALTERNATIVE("Use binVolume(std::size_t) const.")
199 { return _binv[_curIndex]; }
200 /// Write `weight` into current bin. \deprecated Use set(std::size_t,double,double)
201 void set(Double_t weight, Double_t wgtErr=-1)
202 R__SUGGEST_ALTERNATIVE("Use set(std::size_t,double,double).");
203
204 /// Return true if currently loaded coordinate is considered valid within
205 /// the current range definitions of all observables.
206 /// \deprecated Use the safer valid(std::size_t) const.
207 bool valid() const override
208 R__SUGGEST_ALTERNATIVE("Use valid(std::size_t).")
209 { return _curIndex <= static_cast<std::size_t>(_arrSize) && (_maskedWeights.empty() || _maskedWeights[_curIndex] != 0.);}
210
211 void dump2();
212
213 ///@}
214 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
215
216 /// Structure to cache information on the histogram variable that is
217 /// frequently used for histogram weights retrieval.
218 struct VarInfo {
219 size_t nRealVars = 0;
220 size_t realVarIdx1 = 0;
221 size_t realVarIdx2 = 0;
222 bool initialized = false;
223 };
224
225protected:
226
227 friend class RooAbsCachedPdf ;
228 friend class RooAbsCachedReal ;
229 friend class RooDataHistSliceIter ;
230 // for access into copied dataset:
232
233 std::size_t calcTreeIndex(const RooAbsCollection& coords, bool fast) const;
234 /// Legacy overload to calculate the tree index from the current value of `_vars`.
235 /// \deprecated Use calcTreeIndex(const RooArgSet&,bool) const.
236 Int_t calcTreeIndex() const { return static_cast<Int_t>(calcTreeIndex(_vars, true)); }
237
238 void setAllWeights(Double_t value) ;
239
240 void initialize(const char* binningName=0,Bool_t fillTree=kTRUE) ;
242 const RooFormulaVar* cutVar, const char* cutRange, Int_t nStart, Int_t nStop, Bool_t copyCache) ;
243 RooAbsData* reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=0,
244 std::size_t nStart=0, std::size_t nStop=std::numeric_limits<std::size_t>::max(), Bool_t copyCache=kTRUE) override;
245 double interpolateDim(int iDim, double xval, size_t centralIdx, int intOrder, bool correctForBinSize, bool cdfBoundaries) ;
246 const std::vector<double>& calculatePartialBinVolume(const RooArgSet& dimSet) const ;
247 void checkBinBounds() const;
248
249 void adjustBinning(const RooArgList& vars, const TH1& href, Int_t* offset=0) ;
250 void importTH1(const RooArgList& vars, const TH1& histo, Double_t initWgt, Bool_t doDensityCorrection) ;
251 void importTH1Set(const RooArgList& vars, RooCategory& indexCat, std::map<std::string,TH1*> hmap, Double_t initWgt, Bool_t doDensityCorrection) ;
252 void importDHistSet(const RooArgList& vars, RooCategory& indexCat, std::map<std::string,RooDataHist*> dmap, Double_t initWgt) ;
253
254 RooAbsData* cacheClone(const RooAbsArg* newCacheOwner, const RooArgSet* newCacheVars, const char* newName=0) override ;
255
256 Double_t get_wgt(std::size_t idx) const { return _wgt[idx]; }
257 Double_t get_errLo(std::size_t idx) const { return _errLo ? _errLo[idx] : -1.; }
258 Double_t get_errHi(std::size_t idx) const { return _errHi ? _errHi[idx] : -1.; }
259 // 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.
260 Double_t get_sumw2(std::size_t idx) const { return _sumw2 ? _sumw2[idx] : _wgt[idx]; }
261
266
267 Int_t get_curIndex() const { return _curIndex; }
268
269 Int_t _arrSize{0}; // Size of member arrays.
270 std::vector<Int_t> _idxMult ; // Multiplier jump table for index calculation
271
272 double* _wgt {nullptr}; //[_arrSize] Weight array
273 mutable double* _errLo{nullptr}; //[_arrSize] Low-side error on weight array
274 mutable double* _errHi{nullptr}; //[_arrSize] High-side error on weight array
275 mutable double* _sumw2{nullptr}; //[_arrSize] Sum of weights^2
276 double* _binv {nullptr}; //[_arrSize] Bin volume array
277
278 mutable std::vector<double> _maskedWeights; //! Copy of _wgtVec, but masked events have a weight of zero.
279
280 mutable std::size_t _curIndex{std::numeric_limits<std::size_t>::max()}; // Current index
281
282 mutable std::unordered_map<int,std::vector<double>> _pbinvCache ; //! Cache for arrays of partial bin volumes
283 std::vector<RooAbsLValue*> _lvvars ; //! List of observables casted as RooAbsLValue
284 std::vector<std::unique_ptr<const RooAbsBinning>> _lvbins ; //! List of used binnings associated with lvalues
285 mutable std::vector<std::vector<Double_t> > _binbounds; //! list of bin bounds per dimension
286
288 mutable Int_t _cache_sum_valid{kInvalid}; //! Is cache sum valid? Needs to be Int_t instead of CacheSumState_t for subclasses.
289 mutable Double_t _cache_sum{0.}; //! Cache for sum of entries ;
290
291private:
292 double weightInterpolated(const RooArgSet& bin, int intOrder, bool correctForBinSize, bool cdfBoundaries);
293
294 void _adjustBinning(RooRealVar &theirVar, const TAxis &axis, RooRealVar *ourVar, Int_t *offset);
296
298 VarInfo const& getVarInfo();
299
300 ClassDefOverride(RooDataHist, 6) // Binned data set
301};
302
303#endif
304
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
Definition: RConfig.hxx:521
#define h(i)
Definition: RSha256.hxx:106
#define WRITE_TSTRING_COMPATIBLE_CONSTRUCTOR(Class_t)
Definition: RooAbsData.h:66
int Int_t
Definition: RtypesCore.h:45
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
double Double_t
Definition: RtypesCore.h:59
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassDefOverride(name, id)
Definition: Rtypes.h:329
static void indent(ostringstream &buf, int indent_level)
char name[80]
Definition: TGX11.cxx:110
float type_of_call hi(const int &, const int &)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooAbsCachedPdf is the abstract base class for p.d.f.s that need or want to cache their evaluate() ou...
RooAbsCachedReal is the abstract base class for functions that need or want to cache their evaluate()...
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Definition: RooAbsData.h:79
RooArgSet _vars
Definition: RooAbsData.h:353
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:604
Abstract base class for objects that are lvalues, i.e.
Definition: RooAbsLValue.h:26
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:35
RooCategory is an object to represent discrete states.
Definition: RooCategory.h:27
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
Definition: RooCmdArg.h:27
RooDataHistSliceIter iterates over all bins in a RooDataHist that occur in a slice defined by the bin...
The RooDataHist is a container class to hold N-dimensional binned data.
Definition: RooDataHist.h:44
void dump2()
Debug stuff, should go...
Int_t getIndex(const RooAbsCollection &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
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...
Int_t _cache_sum_valid
Definition: RooDataHist.h:288
double interpolateDim(int iDim, double xval, size_t centralIdx, int intOrder, bool correctForBinSize, bool cdfBoundaries)
Perform boundary safe 'intOrder'-th interpolation of weights in dimension 'dim' at current value 'xva...
void printDataHistogram(std::ostream &os, RooRealVar *obs) const
void getBatches(RooBatchCompute::RunContext &evalData, std::size_t begin, std::size_t len) const override
Write information to retrieve data columns into evalData.spans.
void SetNameTitle(const char *name, const char *title) override
Change the title of this RooDataHist.
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
Definition: RooDataHist.h:62
std::vector< double > _maskedWeights
Definition: RooDataHist.h:278
VarInfo _varInfo
Definition: RooDataHist.h:297
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.
Double_t get_curWeight() const
Definition: RooDataHist.h:262
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...
Double_t weight() const override
Return weight of last bin that was requested with get().
Definition: RooDataHist.h:188
double weightInterpolated(const RooArgSet &bin, int intOrder, bool correctForBinSize, bool cdfBoundaries)
Cache for sum of entries ;.
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.
std::unordered_map< int, std::vector< double > > _pbinvCache
Definition: RooDataHist.h:282
void checkBinBounds() const
double weight(std::size_t i) const
Return weight of i-th bin.
Definition: RooDataHist.h:111
void set(std::size_t binNumber, double weight, double wgtErr)
Set bin content of bin that was last loaded with get(std::size_t).
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:68
Double_t sumEntries() const override
Sum the weights of all bins.
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).
Double_t weightSquared() const override
Return squared weight of last bin that was requested with get().
Definition: RooDataHist.h:193
RooSpan< const double > binVolumes(std::size_t first, std::size_t len) const
Retrieve all bin volumes. Bins are indexed according to getIndex().
Definition: RooDataHist.h:97
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:73
void weightError(double &lo, double &hi, ErrorType etype=Poisson) const override
Return the asymmetric errors on the current weight.
double * _errHi
Definition: RooDataHist.h:274
double * _binv
Definition: RooDataHist.h:276
RooDataHist()
Default constructor.
Definition: RooDataHist.cxx:86
Double_t get_curWgtErrLo() const
Definition: RooDataHist.h:263
void removeSelfFromDir()
Definition: RooDataHist.h:164
double weightSquared(std::size_t i) const
Return squared weight sum of i-th bin.
Definition: RooDataHist.h:115
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const override
Print the details on the dataset contents.
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.
Int_t getIndex(const RooArgSet &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
Definition: RooDataHist.h:160
double weightFast(const RooArgSet &bin, int intOrder, bool correctForBinSize, bool cdfBoundaries)
A faster version of RooDataHist::weight that assumes the passed arguments are aligned with the histog...
RooPlot * plotOn(RooPlot *frame, PlotOpt o) const override
Back end function to plotting functionality.
Double_t get_curSumW2() const
Definition: RooDataHist.h:265
Double_t get_errHi(std::size_t idx) const
Definition: RooDataHist.h:258
Bool_t isNonPoissonWeighted() const override
Returns true if dataset contains entries with a non-integer weight.
virtual void printArgs(std::ostream &os) const override
Print argument of dataset, i.e. the observable names.
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:120
void _adjustBinning(RooRealVar &theirVar, const TAxis &axis, RooRealVar *ourVar, Int_t *offset)
Helper doing the actual work of adjustBinning().
std::vector< std::vector< Double_t > > _binbounds
List of used binnings associated with lvalues.
Definition: RooDataHist.h:285
double * _sumw2
Definition: RooDataHist.h:275
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.
void importTH1(const RooArgList &vars, const TH1 &histo, Double_t initWgt, Bool_t doDensityCorrection)
Import data from given TH1/2/3 into this RooDataHist.
std::size_t _curIndex
Copy of _wgtVec, but masked events have a weight of zero.
Definition: RooDataHist.h:280
Bool_t isWeighted() const override
Always returns true as all histograms use event weights.
Definition: RooDataHist.h:91
Int_t calcTreeIndex() const
Legacy overload to calculate the tree index from the current value of _vars.
Definition: RooDataHist.h:236
Double_t get_curWgtErrHi() const
Definition: RooDataHist.h:264
~RooDataHist() override
Destructor.
void setAllWeights(Double_t value)
Set all the event weight of all bins to the specified value.
RooDataHist & operator=(const RooDataHist &)=delete
Double_t get_wgt(std::size_t idx) const
Definition: RooDataHist.h:256
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.
Int_t _arrSize
Definition: RooDataHist.h:269
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
Definition: RooDataHist.h:117
std::vector< RooAbsLValue * > _lvvars
Cache for arrays of partial bin volumes.
Definition: RooDataHist.h:283
double weightError(ErrorType etype=Poisson) const override
Return the symmetric error on the current weight.
Definition: RooDataHist.h:126
Int_t numEntries() const override
Return the number of bins.
void cacheValidEntries()
Compute which bins of the dataset are part of the currently set fit range.
void SetName(const char *name) override
Change the name of the RooDataHist.
std::vector< std::unique_ptr< const RooAbsBinning > > _lvbins
List of observables casted as RooAbsLValue.
Definition: RooDataHist.h:284
Int_t get_curIndex() const
Definition: RooDataHist.h:267
bool valid() const override
Return true if currently loaded coordinate is considered valid within the current range definitions o...
Definition: RooDataHist.h:207
std::vector< Int_t > _idxMult
Definition: RooDataHist.h:270
void registerWeightArraysToDataStore() const
Hand over pointers to our weight arrays to the data store implementation.
void reset() override
Reset all bin weights to zero.
Double_t get_errLo(std::size_t idx) const
Definition: RooDataHist.h:257
double * _errLo
Definition: RooDataHist.h:273
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 ...
double * _wgt
Definition: RooDataHist.h:272
CacheSumState_t
list of bin bounds per dimension
Definition: RooDataHist.h:287
@ kCorrectForBinSize
Definition: RooDataHist.h:287
virtual void printValue(std::ostream &os) const override
Print value of the dataset, i.e. the sum of weights contained in the dataset.
Double_t _cache_sum
Is cache sum valid? Needs to be Int_t instead of CacheSumState_t for subclasses.
Definition: RooDataHist.h:289
VarInfo const & getVarInfo()
Return reference to VarInfo struct with cached histogram variable information that is frequently used...
Double_t binVolume() const
Return volume of current bin.
Definition: RooDataHist.h:197
const RooArgSet * get() const override
Get bin centre of current bin.
Definition: RooDataHist.h:83
Double_t get_sumw2(std::size_t idx) const
Definition: RooDataHist.h:260
Double_t sum(bool correctForBinSize, bool inverseCorr=false) const
Return the sum of the weights of all bins in the histogram.
RooDirItem is a utility base class for RooFit objects that are to be attached to ROOT directories.
Definition: RooDirItem.h:22
void removeFromDir(TObject *obj)
Remove object from directory it was added to.
Definition: RooDirItem.cxx:43
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Definition: RooFormulaVar.h:30
A RooPlot is a plot frame and a container for graphics objects within that frame.
Definition: RooPlot.h:44
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
Class to manage histogram axis.
Definition: TAxis.h:30
TH1 is the base class of all histogram classes in ROOT.
Definition: TH1.h:58
Iterator abstract base class.
Definition: TIterator.h:30
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:136
basic_string_view< char > string_view
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
Definition: RExports.h:150
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition: first.py:1
This struct enables passing computation data around between elements of a computation graph.
Definition: RunContext.h:31
Structure to cache information on the histogram variable that is frequently used for histogram weight...
Definition: RooDataHist.h:218