28#include <unordered_map>
66 void set(std::size_t binNumber,
double weight,
double wgtErr);
88 Double_t sum(
bool correctForBinSize,
bool inverseCorr=
false)
const ;
92 bool correctForBinSize,
94 const std::map<
const RooAbsArg*, std::pair<double, double> >& ranges,
95 std::function<
double(
int)> getBinScale = [](
int){
return 1.0; } );
122 void reset()
override;
125 virtual void printArgs(std::ostream& os)
const override;
126 virtual void printValue(std::ostream& os)
const override;
202 std::size_t nStart=0, std::size_t nStop=std::numeric_limits<std::size_t>::max(),
Bool_t copyCache=
kTRUE)
override;
239 mutable std::size_t
_curIndex{std::numeric_limits<std::size_t>::max()};
243 std::vector<std::unique_ptr<const RooAbsBinning>>
_lvbins ;
#define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
#define ClassDefOverride(name, id)
static void indent(ostringstream &buf, int indent_level)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
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()...
RooAbsData is the common abstract base class for binned and unbinned datasets.
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
Abstract base class for objects that are lvalues, i.e.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooCategory is an object to represent discrete states.
RooCmdArg is a named container for two doubles, two integers two object points and three string point...
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.
void dump2()
Debug stuff, should go...
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...
Double_t weightError(ErrorType etype=Poisson) const override
Return the error of the weight of the last-retrieved entry. See also weightError(Double_t&,...
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.
std::vector< double > _maskedWeights
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
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().
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
void checkBinBounds() 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).
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.
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().
virtual void add(const RooArgSet &row, Double_t wgt=1.0)
Add wgt to the bin content enclosed by the coordinates passed in row.
RooDataHist()
Default constructor.
Double_t get_curWgtErrLo() const
double weightSquared(std::size_t i) const
Return squared weight sum of i-th bin.
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.
RooPlot * plotOn(RooPlot *frame, PlotOpt o) const override
Back end function to plotting functionality.
Double_t get_curSumW2() const
Double_t get_errHi(std::size_t idx) const
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.
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...
bool valid(std::size_t i) const
Return true if bin i is considered valid within the current range definitions of all observables.
void _adjustBinning(RooRealVar &theirVar, const TAxis &axis, RooRealVar *ourVar, Int_t *offset)
Cache for sum of entries ;.
std::vector< std::vector< Double_t > > _binbounds
List of used binnings associated with lvalues.
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.
Bool_t isWeighted() const override
Always returns true as all histograms use event weights.
Int_t calcTreeIndex() const
Legacy overload to calculate the tree index from the current value of _vars.
Double_t get_curWgtErrHi() const
~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
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.
double binVolume(std::size_t i) const
Return bin volume of i-th bin.
std::vector< RooAbsLValue * > _lvvars
Cache for arrays of partial bin volumes.
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.
Int_t get_curIndex() const
bool valid() const override
Return true if currently loaded coordinate is considered valid within the current range definitions o...
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_t get_errLo(std::size_t idx) const
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 ...
CacheSumState_t
list of bin bounds per dimension
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.
Double_t binVolume() const
Return volume of current bin.
const RooArgSet * get() const override
Get bin centre of current bin.
Double_t get_sumw2(std::size_t idx) const
void weightError(Double_t &lo, Double_t &hi, ErrorType etype=Poisson) const override
Return the error of current weight.
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.
void removeFromDir(TObject *obj)
Remove object from directory it was added to.
A RooPlot is a plot frame and a container for graphics objects within that frame.
RooRealVar represents a variable that can be changed from the outside.
A simple container to hold a batch of data values.
Class to manage histogram axis.
TH1 is the base class of all histogram classes in ROOT.
Iterator abstract base class.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
Mother of all ROOT objects.
This struct enables passing computation data around between elements of a computation graph.