72 _depList(
"depList",
"List of dependents",this),
86 coutE(InputArguments) <<
"RooHistFunc::ctor(" <<
GetName()
87 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
88 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
91 for (
const auto arg : vars) {
92 if (!dvars->
find(arg->GetName())) {
93 coutE(InputArguments) <<
"RooHistFunc::ctor(" <<
GetName()
94 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
95 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
114 _depList(
"depList",
"List of dependents",this),
128 coutE(InputArguments) <<
"RooHistFunc::ctor(" <<
GetName()
129 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
130 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
133 for (
const auto arg : histObs) {
134 if (!dvars->
find(arg->GetName())) {
135 coutE(InputArguments) <<
"RooHistFunc::ctor(" <<
GetName()
136 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
137 throw std::invalid_argument(
"RooHistFunc: ERROR variable list and RooDataHist must contain the same variables.");
151 _depList(
"depList",this,other._depList),
152 _dataHist(other._dataHist),
153 _codeReg(other._codeReg),
154 _intOrder(other._intOrder),
155 _cdfBoundaries(other._cdfBoundaries),
156 _totVolume(other._totVolume),
157 _unitNorm(other._unitNorm)
191 harg->copyCache(parg,
kTRUE) ;
192 if (!harg->inRange(0)) {
205 std::vector<RooSpan<const double>> inputValues;
207 auto realObs =
dynamic_cast<const RooAbsReal*
>(obs);
209 auto inputs = dataMap.
at(realObs);
210 inputValues.push_back(std::move(inputs));
212 inputValues.emplace_back();
216 for (std::size_t i = 0; i <
size; ++i) {
222 if (i < inputValues[j].
size()) {
223 histObs->setCachedValue(inputValues[j][i],
false);
224 if (!histObs->inRange(
nullptr)) {
260 if (wgt>max) max=wgt ;
334 if (
string(parg->GetName())==obs.
GetName()) {
352 list<Double_t>* hint =
new list<Double_t> ;
355 xlo = xlo - 0.01*(xhi-xlo) ;
356 xhi = xhi + 0.01*(xhi-xlo) ;
363 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
364 hint->push_back(boundaries[i]-delta) ;
365 hint->push_back(boundaries[i]+delta) ;
390 if (
string(parg->GetName())==obs.
GetName()) {
406 if (
string(harg->GetName())==obs.
GetName()) {
414 cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") obs = " << obs.
GetName() <<
" hobs is not found, returning null" << endl ;
430 cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") hobs = " << hobs->
GetName() <<
" is not found in dataset?" << endl ;
436 cout <<
"RooHistFunc::binBoundaries(" <<
GetName() <<
") hobs = " << hobs->
GetName() <<
" but is not an LV, returning null" << endl ;
444 list<Double_t>* hint =
new list<Double_t> ;
451 if (boundaries[i]>xlo-delta && boundaries[i]<xhi+delta) {
455 transform->
setVal(boundary) ;
457 hint->push_back(obs.
getVal()) ;
459 hint->push_back(boundary) ;
496 coutE(ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << endl ;
508 coutE(ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << endl ;
538 if (getColonSeparatedNameString(*dh1.
get()) != getColonSeparatedNameString(*dh2.
get()))
return kFALSE ;
584 harg->copyCache(parg,
kTRUE) ;
585 if (!harg->inRange(
nullptr)) {
600 std::vector<RooSpan<const double>> depData;
602 auto real =
dynamic_cast<const RooAbsReal*
>(dep);
604 depData.push_back(dataMap.
at(real));
606 depData.emplace_back(
nullptr, 0);
610 const auto batchSize = std::max_element(depData.begin(), depData.end(),
612 std::vector<Int_t> results;
614 for (std::size_t evt = 0; evt < batchSize; ++evt) {
619 if (evt < depData[i].
size())
620 harg->setCachedValue(depData[i][evt],
false);
622 if (!harg->inRange(
nullptr)) {
623 results.push_back(-1);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Bool_t dependsOn(const RooAbsCollection &serverList, const RooAbsArg *ignoreArg=0, Bool_t valueOnly=kFALSE) const
Test whether we depend on (ie, are served by) any object in the specified collection.
void registerProxy(RooArgProxy &proxy)
Register an RooArgProxy in the proxy list.
friend void RooRefArray::Streamer(TBuffer &)
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Double_t * array() const =0
virtual Int_t numBoundaries() const =0
Int_t numTypes(const char *=0) const
Return number of types defined (in range named rangeName if rangeName!=0)
RooAbsCollection is an abstract container object that can hold multiple RooAbsArg objects.
virtual RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE)
Add a clone of the specified argument to list.
Storage_t::size_type size() const
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
bool selectCommon(const RooAbsCollection &refColl, RooAbsCollection &outColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsData is the common abstract base class for binned and unbinned datasets.
Abstract base class for objects that are lvalues, i.e.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const =0
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
virtual Double_t getMax(const char *name=0) const
Get maximum of currently defined range.
virtual void setVal(Double_t value)=0
Set the current value of the object. Needs to be overridden by implementations.
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
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.
The RooDataHist is a container class to hold N-dimensional binned data.
Int_t getIndex(const RooAbsCollection &coord, Bool_t fast=false) const
Calculate bin number of the given coordinates.
double weight(std::size_t i) const
Return weight of i-th bin.
Double_t sumEntries() const override
Sum the weights of all bins.
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...
Int_t numEntries() const override
Return the number of bins.
const RooArgSet * get() const override
Get bin centre of current bin.
auto & at(RooAbsArg const *arg, RooAbsArg const *=nullptr)
RooHistFunc implements a real-valued function sampled from a multidimensional histogram.
virtual Int_t getMaxVal(const RooArgSet &vars) const
Only handle case of maximum in all variables.
double evaluate() const
Return the current value: The value of the bin enclosing the current coordinates of the dependents,...
Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName=0) const
Determine integration scenario.
Bool_t importWorkspaceHook(RooWorkspace &ws)
Check if our datahist is already in the workspace.
std::vector< Int_t > getBins(RooFit::Detail::DataMap const &dataMap) const
Compute bin numbers corresponding to all coordinates in evalData.
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
RooHistFunc()
Default constructor.
Double_t totVolume() const
Get total bin volume spanned by this hist function.
Double_t analyticalIntegral(Int_t code, const char *rangeName=0) const
Return integral identified by 'code'.
virtual void ioStreamerPass2()
Schema evolution: if histObsList wasn't filled from persistence (v1) then fill it here.
Bool_t areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
Int_t getBin() const
Compute bin number corresponding to current coordinates.
virtual Double_t maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
void computeBatch(cudaStream_t *, double *output, size_t size, RooFit::Detail::DataMap const &) const
Base function for computing multiple values of a RooAbsReal.
Int_t _intOrder
Auxiliary class keeping tracking of analytical integration code.
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Return sampling hint for making curves of (projections) of this function as the recursive division st...
static Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, Int_t intOrder)
static Double_t analyticalIntegral(Int_t code, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, RooDataHist &dataHist, bool histFuncMode)
RooRealVar represents a variable that can be changed from the outside.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...
A simple container to hold a batch of data values.
The RooWorkspace is a persistable container for RooFit projects.
Buffer base class used for serializing objects.
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
virtual const char * GetName() const
Returns name of object.
virtual void Clear(Option_t *option="")
Remove all objects from the array.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
const char * Data() const
RooCmdArg Embedded(Bool_t flag=kTRUE)
RooCmdArg Rename(const char *suffix)
std::string getColonSeparatedNameString(RooArgSet const &argSet)
Create a string with all sorted names of RooArgSet elements separated by colons.
static void output(int code)