Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 <RooArgSet.h>
21#include <RooDirItem.h>
22#include <RooGlobalFunc.h>
23
24#include <Rtypes.h>
25
26#include <functional>
27#include <map>
28#include <memory>
29#include <string>
30#include <string_view>
31#include <unordered_map>
32#include <vector>
33
34class TAxis ;
35class RooAbsArg;
36class RooCategory ;
37class RooPlot;
38class RooAbsLValue ;
39
40class RooDataHist : public RooAbsData, public RooDirItem {
41public:
42
43 // Constructors, factory methods etc.
44 RooDataHist() ;
45 RooDataHist(RooStringView name, RooStringView title, const RooArgSet& vars, const char* binningName=nullptr) ;
46 RooDataHist(RooStringView name, RooStringView title, const RooArgSet& vars, const RooAbsData& data, double initWgt=1.0) ;
47 RooDataHist(RooStringView name, RooStringView title, const RooArgList& vars, const TH1* hist, double initWgt=1.0) ;
48 RooDataHist(RooStringView name, RooStringView title, const RooArgList& vars, RooCategory& indexCat, std::map<std::string,TH1*> histMap, double initWgt=1.0) ;
49 RooDataHist(RooStringView name, RooStringView title, const RooArgList& vars, RooCategory& indexCat, std::map<std::string,RooDataHist*> dhistMap, double wgt=1.0) ;
50 RooDataHist(RooStringView name, RooStringView title, const RooArgList& vars, const RooCmdArg& arg1, const RooCmdArg& arg2={}, const RooCmdArg& arg3={},
51 const RooCmdArg& arg4={},const RooCmdArg& arg5={},const RooCmdArg& arg6={},const RooCmdArg& arg7={},const RooCmdArg& arg8={}) ;
52
53 /// For internal use in RooFit.
54 template<class Val_t>
55 inline RooDataHist(RooStringView name, RooStringView title, const RooArgList& vars, RooCategory& indexCat, RooFit::Detail::FlatMap<std::string,Val_t> const& histMap, double initWgt=1.0)
56 : RooDataHist(name, title, vars, indexCat, RooFit::Detail::flatMapToStdMap(histMap), initWgt) {}
57
59
60 RooDataHist(const RooDataHist& other, const char* newname = nullptr) ;
61 TObject* Clone(const char* newname="") const override {
62 return new RooDataHist(*this, newname && newname[0] != '\0' ? newname : GetName());
63 }
64 ~RooDataHist() override ;
65
66 /// Return empty clone of this RooDataHist.
67 RooFit::OwningPtr<RooAbsData> emptyClone(const char* newName=nullptr, const char* newTitle=nullptr, const RooArgSet*vars=nullptr, const char* /*wgtVarName*/=nullptr) const override {
68 return RooFit::makeOwningPtr(std::make_unique<RooDataHist>(newName?newName:GetName(),newTitle?newTitle:GetTitle(),vars?*vars:*get()));
69 }
70
71 /// Add `wgt` to the bin content enclosed by the coordinates passed in `row`.
72 void add(const RooArgSet& row, double wgt=1.0) override { add(row,wgt,-1.); }
73 void add(const RooArgSet& row, double weight, double sumw2);
74 void set(std::size_t binNumber, double weight, double wgtErr);
75 void set(const RooArgSet& row, double weight, double wgtErr=-1.) ;
76 void set(const RooArgSet& row, double weight, double wgtErrLo, double wgtErrHi) ;
77
78 void add(const RooAbsData& dset, const RooFormulaVar* cutVar=nullptr, double weight=1.0 ) ;
79 void add(const RooAbsData& dset, const char* cut, double weight=1.0 ) ;
80
81 /// Get bin centre of current bin.
82 const RooArgSet* get() const override { return &_vars; }
83 const RooArgSet* get(Int_t binNumber) const override;
84 virtual const RooArgSet* get(const RooArgSet& coord) const;
85 double sumEntries() const override;
86 double sumEntries(const char* cutSpec, const char* cutRange=nullptr) const override;
87
88 /// Always returns true as all histograms use event weights.
89 bool isWeighted() const override { return true; }
90 bool isNonPoissonWeighted() const override ;
91
92 std::span<const double> getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const override;
93
94 /// Retrieve all bin volumes. Bins are indexed according to getIndex().
95 std::span<const double> binVolumes(std::size_t first, std::size_t len) const {
96 return {_binv + first, len};
97 }
98
99 double sum(bool correctForBinSize, bool inverseCorr=false) const ;
100 double sum(const RooArgSet& sumSet, const RooArgSet& sliceSet, bool correctForBinSize, bool inverseCorr=false) ;
101 double sum(const RooArgSet& sumSet,
102 const RooArgSet& sliceSet,
103 bool correctForBinSize,
104 bool inverseCorr,
105 const std::map<const RooAbsArg*, std::pair<double, double> >& ranges,
106 std::function<double(int)> getBinScale = [](int){ return 1.0; } );
107
108 void weights(double* output, std::span<double const> xVals, int intOrder, bool correctForBinSize, bool cdfBoundaries);
109 /// Return weight of i-th bin. \see getIndex()
110 double weight(std::size_t i) const { return _wgt[i]; }
111 double weightFast(const RooArgSet& bin, int intOrder, bool correctForBinSize, bool cdfBoundaries);
112 double weight(const RooArgSet& bin, Int_t intOrder=1, bool correctForBinSize=false, bool cdfBoundaries=false, bool oneSafe=false);
113 /// Return squared weight sum of i-th bin. \see getIndex(). If sumw2 is not
114 /// being tracked, assume that all previous fill operations had a
115 /// weight of 1, i.e., return the bare weight of the bin.
116 double weightSquared(std::size_t i) const { return _sumw2 ? _sumw2[i] : _wgt[i]; }
117 /// Return bin volume of i-th bin. \see getIndex()
118 double binVolume(std::size_t i) const { return _binv[i]; }
119 double binVolume(const RooArgSet& bin) const;
120
121 TIterator* sliceIterator(RooAbsArg& sliceArg, const RooArgSet& otherArgs) ;
122
123 void weightError(double& lo, double& hi, ErrorType etype=Poisson) const override;
124 /// \copydoc RooAbsData::weightError(RooAbsData::ErrorType) const
125 double weightError(ErrorType etype=Poisson) const override {
126 // Return symmetric error on current bin calculated either from Poisson statistics or from SumOfWeights
127 double lo;
128 double 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 void printMultiline(std::ostream& os, Int_t content, bool verbose=false, TString indent="") const override;
139 void printArgs(std::ostream& os) const override;
140 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 fast = false) const;
147 /// \copydoc getIndex(const RooAbsCollection&,bool) 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 fast = false) const {
161 return getIndex(static_cast<const RooAbsCollection&>(coord), fast);
162 }
163
165
166
167 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
168 /// @name Deprecated functions
169 /// These functions rely on the fact that an event has been loaded before they are called. It is advised
170 /// to switch to their counterparts that take bin numbers as arguments. In this way, code like,
171 /// ```
172 /// const RooArgSet* coordinates = dataHist.get(i); // Need this to achieve side effect on next call of weight() - bad.
173 /// const double weight = dataHist.weight();
174 /// processEvent(coordinates, weight);
175 /// ```
176 /// becomes
177 /// ```
178 /// processEvent(dataHist.get(i), dataHist.weight(i));
179 /// ```
180 /// The index of a set of coordinates can be computed using getIndex().
181 /// @{
182
183 /// Return weight of last bin that was requested with get().
184 /// \deprecated Use the safer weight(std::size_t) const.
185 double weight() const override
186 R__SUGGEST_ALTERNATIVE("Use the safer weight(std::size_t) const.")
187 { return _wgt[_curIndex]; }
188 /// Return squared weight of last bin that was requested with get().
189 /// \deprecated Use the safer weightSquared(std::size_t) const.
190 double weightSquared() const override
191 R__SUGGEST_ALTERNATIVE("Use the safer weightSquared(std::size_t) const.")
192 { return weightSquared(_curIndex); }
193 /// Return volume of current bin. \deprecated Use binVolume(std::size_t) const.
194 double binVolume() const
195 R__SUGGEST_ALTERNATIVE("Use binVolume(std::size_t) const.")
196 { return _binv[_curIndex]; }
197 /// Write `weight` into current bin. \deprecated Use set(std::size_t,double,double)
198 void set(double wgt, double wgtErr=-1)
199 R__SUGGEST_ALTERNATIVE("Use set(std::size_t,double,double).");
200
201 ///@}
202 ////////////////////////////////////////////////////////////////////////////////////////////////////////////
203
204 /// Structure to cache information on the histogram variable that is
205 /// frequently used for histogram weights retrieval.
206 struct VarInfo {
207 size_t nRealVars = 0;
208 size_t realVarIdx1 = 0;
209 size_t realVarIdx2 = 0;
210 bool initialized = false;
211 };
212
213 std::vector<std::unique_ptr<const RooAbsBinning>> const& getBinnings() const { return _lvbins; }
214
215 int arraySize() const { return _arrSize; }
216 double const* weightArray() const { return _wgt; }
217 double const* wgtErrLoArray() const { return _errLo; }
218 double const* wgtErrHiArray() const { return _errHi; }
219 double const* sumW2Array() const { return _sumw2; }
220
222 const RooAbsCollection &coords, bool reverse = false) const;
224 bool correctForBinSize) const;
225
226 protected:
227 friend class RooDataHistSliceIter ;
228
229 std::size_t calcTreeIndex(const RooAbsCollection& coords, bool fast) const;
230 /// Legacy overload to calculate the tree index from the current value of `_vars`.
231 /// \deprecated Use calcTreeIndex(const RooArgSet&,bool) const.
232 Int_t calcTreeIndex() const { return static_cast<Int_t>(calcTreeIndex(_vars, true)); }
233
234 void initialize(const char* binningName=nullptr,bool fillTree=true) ;
235 std::unique_ptr<RooAbsData> reduceEng(const RooArgSet& varSubset, const RooFormulaVar* cutVar, const char* cutRange=nullptr,
236 std::size_t nStart=0, std::size_t nStop=std::numeric_limits<std::size_t>::max()) const override;
237 double interpolateDim(int iDim, double xval, size_t centralIdx, int intOrder, bool correctForBinSize, bool cdfBoundaries) ;
238 const std::vector<double>& calculatePartialBinVolume(const RooArgSet& dimSet) const ;
239 void checkBinBounds() const;
240
241 void adjustBinning(const RooArgList& vars, const TH1& href, Int_t* offset=nullptr) ;
242 void importTH1(const RooArgList& vars, const TH1& histo, double initWgt, bool doDensityCorrection) ;
243 void importTH1Set(const RooArgList& vars, RooCategory& indexCat, std::map<std::string,TH1*> hmap, double initWgt, bool doDensityCorrection) ;
244 void importDHistSet(const RooArgList& vars, RooCategory& indexCat, std::map<std::string,RooDataHist*> dmap, double initWgt) ;
245
246 Int_t _arrSize{0}; // Size of member arrays.
247 std::vector<Int_t> _idxMult ; // Multiplier jump table for index calculation
248
249 double* _wgt {nullptr}; ///<[_arrSize] Weight array
250 mutable double* _errLo{nullptr}; ///<[_arrSize] Low-side error on weight array
251 mutable double* _errHi{nullptr}; ///<[_arrSize] High-side error on weight array
252 mutable double* _sumw2{nullptr}; ///<[_arrSize] Sum of weights^2
253 double* _binv {nullptr}; ///<[_arrSize] Bin volume array
254
255 mutable ULong64_t _curIndex{std::numeric_limits<ULong64_t>::max()}; ///< Current index
256
257 mutable std::unordered_map<int,std::vector<double>> _pbinvCache ; ///<! Cache for arrays of partial bin volumes
258 std::vector<RooAbsLValue*> _lvvars ; ///<! List of observables casted as RooAbsLValue
259 std::vector<std::unique_ptr<const RooAbsBinning>> _lvbins ; ///<! List of used binnings associated with lvalues
260 mutable std::vector<std::vector<double> > _binbounds; ///<! list of bin bounds per dimension
261
263 mutable Int_t _cache_sum_valid{kInvalid}; ///<! Is cache sum valid? Needs to be Int_t instead of CacheSumState_t for subclasses.
264 mutable double _cache_sum{0.}; ///<! Cache for sum of entries ;
265
266private:
267 void interpolateQuadratic(double* output, std::span<const double> xVals, bool correctForBinSize, bool cdfBoundaries);
268 void interpolateLinear(double* output, std::span<const double> xVals, bool correctForBinSize, bool cdfBoundaries);
269 double weightInterpolated(const RooArgSet& bin, int intOrder, bool correctForBinSize, bool cdfBoundaries);
270
271 void _adjustBinning(RooRealVar &theirVar, const TAxis &axis, RooRealVar *ourVar, Int_t *offset);
273 void initializeAsymErrArrays() const;
274 VarInfo const& getVarInfo();
275
276 static std::unique_ptr<RooAbsDataStore>
278
280 std::vector<double> _interpolationBuffer; ///<! Buffer to contain values used for weight interpolation
281
282 ClassDefOverride(RooDataHist, 8) // Binned data set
283};
284
285#endif
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
Definition RConfig.hxx:520
unsigned long long ULong64_t
Definition RtypesCore.h:70
#define ClassDefOverride(name, id)
Definition Rtypes.h:346
static void indent(ostringstream &buf, int indent_level)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
char name[80]
Definition TGX11.cxx:110
#define hi
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:77
Abstract container object that can hold multiple RooAbsArg objects.
Abstract base class for binned and unbinned datasets.
Definition RooAbsData.h:57
RooArgSet _vars
Dimensions of this data set.
Definition RooAbsData.h:350
virtual RooPlot * plotOn(RooPlot *frame, const RooCmdArg &arg1={}, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Abstract base class for objects that are lvalues, i.e.
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:24
Object to represent discrete states.
Definition RooCategory.h:28
Named container for two doubles, two integers two object points and three string pointers that can be...
Definition RooCmdArg.h:26
Iterates over all bins in a RooDataHist that occur in a slice defined by the bin coordinates of the i...
Container class to hold N-dimensional binned data.
Definition RooDataHist.h:40
std::span< const double > getWeightBatch(std::size_t first, std::size_t len, bool sumW2=false) const override
Return event weights of all events in range [first, first+len).
void interpolateQuadratic(double *output, std::span< const double > xVals, bool correctForBinSize, bool cdfBoundaries)
A vectorized version of interpolateDim for boundary safe quadratic interpolation of one dimensional h...
double sum(bool correctForBinSize, bool inverseCorr=false) const
Return the sum of the weights of all bins in the histogram.
void weights(double *output, std::span< double const > xVals, int intOrder, bool correctForBinSize, bool cdfBoundaries)
A vectorized version of RooDataHist::weight() for one dimensional histograms with up to one dimension...
RooDataHist(RooStringView name, RooStringView title, const RooArgList &vars, RooCategory &indexCat, RooFit::Detail::FlatMap< std::string, Val_t > const &histMap, double initWgt=1.0)
For internal use in RooFit.
Definition RooDataHist.h:55
Int_t _cache_sum_valid
! Is cache sum valid? Needs to be Int_t instead of CacheSumState_t for subclasses.
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...
double weightSquared() const override
Return squared weight of last bin that was requested with get().
std::vector< std::unique_ptr< const RooAbsBinning > > const & getBinnings() const
void importTH1(const RooArgList &vars, const TH1 &histo, double initWgt, bool doDensityCorrection)
Import data from given TH1/2/3 into this RooDataHist.
void printDataHistogram(std::ostream &os, RooRealVar *obs) const
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:61
double _cache_sum
! Cache for sum of entries ;
double const * sumW2Array() const
double const * weightArray() const
void initialize(const char *binningName=nullptr, bool fillTree=true)
Initialization procedure: allocate weights array, calculate multipliers needed for N-space to 1-dim a...
VarInfo _varInfo
!
std::string declWeightArrayForCodeSquash(RooFit::Experimental::CodegenContext &ctx, bool correctForBinSize) const
Int_t getIndex(const RooAbsCollection &coord, bool fast=false) const
Calculate bin number of the given coordinates.
void add(const RooArgSet &row, double wgt=1.0) override
Add wgt to the bin content enclosed by the coordinates passed in row.
Definition RooDataHist.h:72
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...
static std::unique_ptr< RooAbsDataStore > makeDefaultDataStore(RooStringView name, RooStringView title, RooArgSet const &vars)
double weightInterpolated(const RooArgSet &bin, int intOrder, bool correctForBinSize, bool cdfBoundaries)
Return the weight at given coordinates with interpolation.
std::unordered_map< int, std::vector< double > > _pbinvCache
! Cache for arrays of partial bin volumes
void checkBinBounds() const
void initializeAsymErrArrays() const
double weight(std::size_t i) const
Return weight of i-th bin.
void set(std::size_t binNumber, double weight, double wgtErr)
Set bin content of bin that was last loaded with get(std::size_t).
void weightError(double &lo, double &hi, ErrorType etype=Poisson) const override
Return the asymmetric errors on the current weight.
double * _errHi
[_arrSize] High-side error on weight array
void importTH1Set(const RooArgList &vars, RooCategory &indexCat, std::map< std::string, TH1 * > hmap, double initWgt, bool doDensityCorrection)
Import data from given set of TH1/2/3 into this RooDataHist.
void adjustBinning(const RooArgList &vars, const TH1 &href, Int_t *offset=nullptr)
Adjust binning specification on first and optionally second and third observable to binning in given ...
double * _binv
[_arrSize] Bin volume array
RooDataHist()
Default constructor.
bool isWeighted() const override
Always returns true as all histograms use event weights.
Definition RooDataHist.h:89
void removeSelfFromDir()
double weightSquared(std::size_t i) const
Return squared weight sum of i-th bin.
double const * wgtErrHiArray() const
ULong64_t _curIndex
Current index.
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 weight() const override
Return weight of last bin that was requested with get().
RooFit::OwningPtr< RooAbsData > emptyClone(const char *newName=nullptr, const char *newTitle=nullptr, const RooArgSet *vars=nullptr, const char *=nullptr) const override
Return empty clone of this RooDataHist.
Definition RooDataHist.h:67
std::span< 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:95
std::vector< std::vector< double > > _binbounds
! list of bin bounds per dimension
std::string calculateTreeIndexForCodeSquash(RooAbsArg const *klass, RooFit::Experimental::CodegenContext &ctx, const RooAbsCollection &coords, bool reverse=false) const
void printArgs(std::ostream &os) const override
Print argument of dataset, i.e. the observable names.
void importDHistSet(const RooArgList &vars, RooCategory &indexCat, std::map< std::string, RooDataHist * > dmap, double initWgt)
Import data from given set of TH1/2/3 into this RooDataHist.
void _adjustBinning(RooRealVar &theirVar, const TAxis &axis, RooRealVar *ourVar, Int_t *offset)
Helper doing the actual work of adjustBinning().
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Print the details on the dataset contents.
double * _sumw2
[_arrSize] Sum of weights^2
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.
Int_t calcTreeIndex() const
Legacy overload to calculate the tree index from the current value of _vars.
~RooDataHist() override
Destructor.
bool isNonPoissonWeighted() const override
Returns true if dataset contains entries with a non-integer weight.
RooDataHist & operator=(const RooDataHist &)=delete
Int_t getIndex(const RooArgSet &coord, bool fast=false) const
Calculate bin number of the given coordinates.
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
std::vector< RooAbsLValue * > _lvvars
! List of observables casted as RooAbsLValue
double weightError(ErrorType etype=Poisson) const override
Return the symmetric error on the current weight.
double const * wgtErrLoArray() const
void SetName(const char *name) override
Change the name of the RooDataHist.
std::vector< std::unique_ptr< const RooAbsBinning > > _lvbins
! List of used binnings associated with lvalues
std::vector< double > _interpolationBuffer
! Buffer to contain values used for weight interpolation
std::vector< Int_t > _idxMult
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 * _errLo
[_arrSize] Low-side error on weight array
double * _wgt
[_arrSize] Weight array
int arraySize() const
void printValue(std::ostream &os) const override
Print value of the dataset, i.e. the sum of weights contained in the dataset.
VarInfo const & getVarInfo()
Return reference to VarInfo struct with cached histogram variable information that is frequently used...
std::unique_ptr< RooAbsData > reduceEng(const RooArgSet &varSubset, const RooFormulaVar *cutVar, const char *cutRange=nullptr, std::size_t nStart=0, std::size_t nStop=std::numeric_limits< std::size_t >::max()) const override
Implementation of RooAbsData virtual method that drives the RooAbsData::reduce() methods.
const RooArgSet * get() const override
Get bin centre of current bin.
Definition RooDataHist.h:82
void interpolateLinear(double *output, std::span< const double > xVals, bool correctForBinSize, bool cdfBoundaries)
A vectorized version of interpolateDim for boundary safe linear interpolation of one dimensional hist...
double binVolume() const
Return volume of current bin.
double sumEntries() const override
Sum the weights of all bins.
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.
A class to maintain the context for squashing of RooFit models into code.
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Plot frame and a container for graphics objects within that frame.
Definition RooPlot.h:43
Variable that can be changed from the outside.
Definition RooRealVar.h:37
The RooStringView is a wrapper around a C-style string that can also be constructed from a std::strin...
Class to manage histogram axis.
Definition TAxis.h:32
TH1 is the base class of all histogram classes in ROOT.
Definition TH1.h:59
Iterator abstract base class.
Definition TIterator.h:30
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:139
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
Definition CodegenImpl.h:64
OwningPtr< T > makeOwningPtr(std::unique_ptr< T > &&ptr)
Internal helper to turn a std::unique_ptr<T> into an OwningPtr.
Definition Config.h:40
T * OwningPtr
An alias for raw pointers for indicating that the return type of a RooFit function is an owning point...
Definition Config.h:35
Structure to cache information on the histogram variable that is frequently used for histogram weight...
static void output()