88 _funcList(
"!funcList",
"List of functions",this),
89 _coefList(
"!coefList",
"List of coefficients",this),
107 _normIntMgr(this,10),
109 _funcList(
"!funcList",
"List of functions",this),
110 _coefList(
"!coefList",
"List of coefficients",this),
145 _normIntMgr(this,10),
147 _funcList(
"!funcList",
"List of functions",this),
148 _coefList(
"!coefList",
"List of coefficients",this),
154 <<
") number of pdfs and coefficients inconsistent, must have Nfunc=Ncoef or Nfunc=Ncoef+1" << endl ;
185 coutE(
InputArguments) <<
"RooRealSumPdf::RooRealSumPdf(" <<
GetName() <<
") last func " << coef->
GetName() <<
" is not of type RooAbsReal, fatal error" << endl ;
205 _normIntMgr(other._normIntMgr,this),
206 _haveLastCoef(other._haveLastCoef),
207 _funcList(
"!funcList",this,other._funcList),
208 _coefList(
"!coefList",this,other._coefList),
209 _extended(other._extended),
210 _doFloor(other._doFloor)
255 auto func =
static_cast<const RooAbsReal*
>(*funcIt++);
256 auto coef =
static_cast<const RooAbsReal*
>(coefArg);
260 cxcoutD(
Eval) <<
"RooRealSumPdf::eval(" <<
GetName() <<
") coefVal = " << coefVal <<
" funcVal = " << func->IsA()->GetName() <<
"::" << func->GetName() <<
" = " << func->getVal() << endl ;
261 if (func->isSelectedComp()) {
262 value += func->getVal()*coefVal ;
264 lastCoef -= coef->getVal() ;
271 auto func =
static_cast<const RooAbsReal*
>(*funcIt);
272 if (func->isSelectedComp()) {
273 value += func->
getVal()*lastCoef ;
276 cxcoutD(
Eval) <<
"RooRealSumPdf::eval(" <<
GetName() <<
") lastCoef = " << lastCoef <<
" funcVal = " << func->getVal() << endl ;
279 if (lastCoef<0 || lastCoef>1) {
281 <<
") WARNING: sum of FUNC coefficients not in range [0-1], value="
282 << 1-lastCoef <<
". This means that the PDF is not properly normalised. If the PDF was meant to be extended, provide as many coefficients as functions." << endl ;
317 <<
" and FUNC " << func->
GetName() <<
" have one or more observables in common" << endl ;
322 <<
" depends on one or more of the following observables" ; nset->
Print(
"1") ;
337 const RooArgSet* normSet2,
const char* rangeName)
const
340 if (allVars.
getSize()==0)
return 0 ;
344 analVars.
add(allVars) ;
349 Int_t sterileIdx(-1) ;
366 if (normSet && normSet->
getSize()>0) {
393 if (code==0)
return getVal(normSet2) ;
421 Double_t coefVal = coef->getVal(normSet2) ;
426 value += funcInt->getVal()*coefVal ;
428 lastCoef -= coef->getVal(normSet2) ;
437 value += funcInt->getVal()*lastCoef ;
441 if (lastCoef<0 || lastCoef>1) {
443 <<
" WARNING: sum of FUNC coefficients not in range [0-1], value="
444 << 1-lastCoef << endl ;
449 if (normSet2 && normSet2->
getSize()>0) {
458 Double_t coefVal = coef->getVal(normSet2) ;
461 normVal += funcNorm->
getVal()*coefVal ;
469 normVal += funcNorm->
getVal()*lastCoef ;
473 return value / normVal;
493 list<Double_t>* sumBinB = 0 ;
501 list<Double_t>* funcBinB = func->
binBoundaries(obs,xlo,xhi) ;
510 list<Double_t>* newSumBinB =
new list<Double_t>(sumBinB->size()+funcBinB->size()) ;
513 merge(funcBinB->begin(),funcBinB->end(),sumBinB->begin(),sumBinB->end(),newSumBinB->begin()) ;
518 sumBinB = newSumBinB ;
526 list<Double_t>::iterator new_end = unique(sumBinB->begin(),sumBinB->end()) ;
527 sumBinB->erase(new_end,sumBinB->end()) ;
559 list<Double_t>* sumHint = 0 ;
578 list<Double_t>* newSumHint =
new list<Double_t>(sumHint->size()+funcHint->size()) ;
581 merge(funcHint->begin(),funcHint->end(),sumHint->begin(),sumHint->end(),newSumHint->begin()) ;
585 sumHint = newSumHint ;
593 list<Double_t>::iterator new_end = unique(sumHint->begin(),sumHint->end()) ;
594 sumHint->erase(new_end,sumHint->end()) ;
610 while ((sarg=siter.
next())) {
612 trackNodes.
add(*sarg) ;
644 os <<
" + [%] * " << func->
GetName() ;
static RooMathCoreReg dummy
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Return the observables of this pdf given a set of observables.
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.
virtual CacheMode canNodeBeCached() const
RooArgSet * getParameters(const RooAbsData *data, Bool_t stripDisconnected=kTRUE) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
Bool_t observableOverlaps(const RooAbsData *dset, const RooAbsArg &testArg) const
Test if any of the dependents of the arg tree (as determined by getObservables) overlaps with those o...
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
RooFIter fwdIterator() const R__SUGGEST_ALTERNATIVE("begin()
One-time forward iterator.
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
const_iterator begin() const
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
TIterator * createIterator(Bool_t dir=kIterForward) const R__SUGGEST_ALTERNATIVE("begin()
TIterator-style iteration over contained elements.
TIterator end() and range-based for loops.")
Double_t getNorm(const RooArgSet &nset) const
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Bool_t isSelectedComp() const
If true, the current pdf is a selected component (for use in plotting)
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
RooAbsReal * createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, 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
Create an object that represents the integral of the function over one or more observables listed in ...
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
void logEvalError(const char *message, const char *serverValueString=0) const
Log evaluation error message.
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
const RooNameSet * nameSet2ByIndex(Int_t index) const
T * getObjByIndex(Int_t index) const
const RooNameSet * nameSet1ByIndex(Int_t index) const
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
RooArgSet * select(const RooArgSet &list) const
Construct a RooArgSet of objects in input 'list' whose names match to those in the internal name list...
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
The class RooRealSumPdf implements a PDF constructed from a sum of functions:
virtual ExtendMode extendMode() const
const RooArgList & funcList() const
RooObjCacheManager _normIntMgr
Double_t evaluate() const
Calculate the current value.
RooRealSumPdf()
Default constructor coverity[UNINIT_CTOR].
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
Bool_t isBinnedDistribution(const RooArgSet &obs) const
static Bool_t _doFloorGlobal
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
virtual ~RooRealSumPdf()
Destructor.
virtual Bool_t checkObservables(const RooArgSet *nset) const
Check if FUNC is valid for given normalization set.
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooRealSumPdf to more intuitively reflect the contents of the p...
virtual void setCacheAndTrackHints(RooArgSet &)
Label OK'ed components of a RooRealSumPdf with cache-and-track.
Bool_t _extended
Iterator over coefficient list.
TIterator * _coefIter
Iterator over FUNC list.
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=0) const
Advertise that all integrals can be handled internally.
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implement analytical integrations by deferring integration of component functions to integrators of c...
Iterator abstract base class.
virtual TObject * Next()=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".