69 _pdfObsList(
"pdfObs",
"List of p.d.f. observables",this),
83 coutE(InputArguments) <<
"RooHistPdf::ctor(" <<
GetName()
84 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
87 for (
const auto arg : vars) {
88 if (!dvars->
find(arg->GetName())) {
89 coutE(InputArguments) <<
"RooHistPdf::ctor(" <<
GetName()
90 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
121 _pdfObsList(
"pdfObs",
"List of p.d.f. observables",this),
135 coutE(InputArguments) <<
"RooHistPdf::ctor(" <<
GetName()
136 <<
") ERROR histogram variable list and RooDataHist must contain the same variables." << endl ;
137 throw(
string(
"RooHistPdf::ctor() ERROR: histogram variable list and RooDataHist must contain the same variables")) ;
140 for (
const auto arg : histObs) {
141 if (!dvars->
find(arg->GetName())) {
142 coutE(InputArguments) <<
"RooHistPdf::ctor(" <<
GetName()
143 <<
") ERROR variable list and RooDataHist must contain the same variables." << endl ;
144 throw(
string(
"RooHistPdf::ctor() ERROR: histogram variable list and RooDataHist must contain the same variables")) ;
146 if (!arg->isFundamental()) {
147 coutE(InputArguments) <<
"RooHistPdf::ctor(" <<
GetName()
148 <<
") ERROR all elements of histogram observables set must be of type RooRealVar or RooCategory." << endl ;
149 throw(
string(
"RooHistPdf::ctor() ERROR all elements of histogram observables set must be of type RooRealVar or RooCategory.")) ;
172 _pdfObsList(
"pdfObs",this,other._pdfObsList),
173 _dataHist(other._dataHist),
174 _codeReg(other._codeReg),
175 _intOrder(other._intOrder),
176 _cdfBoundaries(other._cdfBoundaries),
177 _totVolume(other._totVolume),
178 _unitNorm(other._unitNorm)
265 if (!_x || !_y)
return false;
266 if (!range || !strlen(range) || !_x->
hasRange(range) ||
281 const char* rangeName,
290 for (
unsigned int n=0;
n < pdfObsList.
size() &&
n < histObsList.
size(); ++
n) {
291 const auto pa = pdfObsList[
n];
292 const auto ha = histObsList[
n];
294 if (allVars.
find(*pa)) {
297 if (fullRange(*pa, *ha, rangeName)) {
303 if (code == frcode) {
312 if (intOrder > 1 && !(code & 1)) {
316 return (code >= 2) ? code : 0;
321 const char* rangeName,
327 if (((2 << histObsList.
getSize()) - 1) == code) {
334 std::map<const RooAbsArg*, std::pair<double, double> > ranges;
335 for (
unsigned int n=0;
n < pdfObsList.
size() &&
n < histObsList.
size(); ++
n) {
336 const auto pa = pdfObsList[
n];
337 const auto ha = histObsList[
n];
339 if (code & (2 <<
n)) {
349 ha->copyCache(pa,
kTRUE);
354 dataHist.
sum(intSet,histObsList,
true,!histFuncMode, ranges);
419 list<Double_t>* hint =
new list<Double_t> ;
422 xlo = xlo - 0.01*(xhi-xlo) ;
423 xhi = xhi + 0.01*(xhi-xlo) ;
430 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
431 hint->push_back(boundaries[i]-delta) ;
432 hint->push_back(boundaries[i]+delta) ;
463 list<Double_t>* hint =
new list<Double_t> ;
468 if (boundaries[i]>=xlo && boundaries[i]<=xhi) {
469 hint->push_back(boundaries[i]) ;
504 if (wgt>max) max=wgt ;
534 std::list<RooAbsData*> allData =
ws.allData() ;
535 std::list<RooAbsData*>::const_iterator iter ;
536 for (iter = allData.begin() ; iter != allData.end() ; ++iter) {
562 coutE(ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << endl ;
574 coutE(ObjectHandling) <<
" RooHistPdf::importWorkspaceHook(" <<
GetName() <<
") unable to import clone of underlying RooDataHist with unique name " << uniqueName <<
", abort" << endl ;
char * Form(const char *fmt,...)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
virtual void copyCache(const RooAbsArg *source, Bool_t valueOnly=kFALSE, Bool_t setValDirty=kTRUE)=0
friend void RooRefArray::Streamer(TBuffer &)
virtual void syncCache(const RooArgSet *nset=0)=0
virtual Bool_t inRange(const char *) const
RooAbsBinning is the abstract base class for RooRealVar binning definitions.
virtual Double_t * array() const =0
virtual Bool_t isParameterized() const
Interface function.
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 void removeAll()
Remove all arguments from our set, deleting them if we own them.
RooAbsCollection * selectCommon(const RooAbsCollection &refColl) const
Create a subset of the current collection, consisting only of those elements that are contained as we...
Storage_t::size_type size() const
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 Bool_t hasRange(const char *name) const
Check if variable has a binning with given name.
virtual const RooAbsBinning * getBinningPtr(const char *rangeName) const
virtual Double_t getMin(const char *name=0) const
Get miniminum of currently defined range.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
RooAbsArg * addClone(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add clone of specified element to an owning set.
RooCategory is an object to represent discrete states.
The RooDataHist is a container class to hold N-dimensional binned data.
double weight(std::size_t i) const
Return weight of i-th bin.
Double_t sumEntries() const override
Sum the weights of all bins.
Int_t numEntries() const override
Return the number of bins.
const RooArgSet * get() const override
Get bin centre of current bin.
Double_t sum(bool correctForBinSize, bool inverseCorr=false) const
Return the sum of the weights of all bins in the histogram.
RooHistPdf implements a probablity density function sampled from a multidimensional histogram.
Int_t _intOrder
Auxiliary class keeping tracking of analytical integration code.
RooHistPdf()
Default constructor coverity[UNINIT_CTOR].
virtual Int_t getMaxVal(const RooArgSet &vars) const
Only handle case of maximum in all variables.
virtual Double_t maxVal(Int_t code) const
Return maximum value for set of observables identified by code assigned in getMaxVal.
Bool_t _unitNorm
Total volume of space (product of ranges of observables)
Double_t evaluate() const
Return the current value: The value of the bin enclosing the current coordinates of the observables,...
virtual ~RooHistPdf()
Destructor.
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...
Bool_t areIdentical(const RooDataHist &dh1, const RooDataHist &dh2)
Double_t totVolume() const
Return the total volume spanned by the observables of the RooHistPdf.
Bool_t importWorkspaceHook(RooWorkspace &ws)
Check if our datahist is already in the workspace.
static Int_t getAnalyticalIntegral(RooArgSet &allVars, RooArgSet &analVars, const char *rangeName, RooArgSet const &histObsList, RooSetProxy const &pdfObsList, Int_t intOrder)
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...
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.
void setRange(const char *name, Double_t min, Double_t max)
Set a fit or plotting range.
RooSetProxy is the concrete proxy for RooArgSet objects.
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...
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 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::pair< double, double > getRangeOrBinningInterval(RooAbsArg const *arg, const char *rangeName)
Get the lower and upper bound of parameter range if arg can be casted to RooAbsRealLValue.