Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooRealSumPdf.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
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
17//////////////////////////////////////////////////////////////////////////////
18/** \class RooRealSumPdf
19 \ingroup Roofitcore
20
21
22The class RooRealSumPdf implements a PDF constructed from a sum of functions:
23\f[
24 \mathrm{PDF}(x) = \frac{ \sum_{i=1}^{n-1} \mathrm{coef}_i * \mathrm{func}_i(x) + \left[ 1 - \sum_{i=1}^{n-1} \mathrm{coef}_i \right] * \mathrm{func}_n(x) }
25 {\sum_{i=1}^{n-1} \mathrm{coef}_i * \int \mathrm{func}_i(x)dx + \left[ 1 - \sum_{i=1}^{n-1} \mathrm{coef}_i \right] * \int \mathrm{func}_n(x) dx }
26\f]
27
28where \f$\mathrm{coef}_i\f$ and \f$\mathrm{func}_i\f$ are RooAbsReal objects, and \f$ x \f$ is the collection of dependents.
29In the present version \f$\mathrm{coef}_i\f$ may not depend on \f$ x \f$, but this limitation could be removed should the need arise.
30
31If the number of coefficients is one less than the number of functions, the PDF is assumed to be normalised. Due to this additional constraint,
32\f$\mathrm{coef}_n\f$ is computed from the other coefficients.
33
34### Extending the PDF
35If an \f$ n^\mathrm{th} \f$ coefficient is provided, the PDF **can** be used as an extended PDF, *i.e.* the total number of events will be measured in addition
36to the fractions of the various functions. **This requires setting the last argument of the constructor to `true`.**
37\note For the RooAddPdf, the extension happens automatically.
38
39### Difference to RooAddPdf / RooRealSumFunc
40- RooAddPdf is a PDF of PDFs, *i.e.* its components need to be normalised and non-negative.
41- RooRealSumPdf is a PDF of functions, *i.e.*, its components can be negative, but their sum cannot be. The normalisation
42 is computed automatically, unless the PDF is extended (see above).
43- RooRealSumFunc is a sum of functions. It is neither normalised, nor need it be positive.
44
45*/
46
47#include "RooRealSumPdf.h"
48
49#include "RooRealIntegral.h"
50#include "RooRealProxy.h"
51#include "RooRealVar.h"
52#include "RooMsgService.h"
53#include "RooNaNPacker.h"
54
55#include <TError.h>
56
57#include <algorithm>
58#include <memory>
59#include <stdexcept>
60
61using namespace std;
62
64
66
67////////////////////////////////////////////////////////////////////////////////
68/// Default constructor
69/// coverity[UNINIT_CTOR]
70
72{
75}
76
77
78
79////////////////////////////////////////////////////////////////////////////////
80/// Constructor with name and title
81
82RooRealSumPdf::RooRealSumPdf(const char *name, const char *title) :
83 RooAbsPdf(name,title),
84 _normIntMgr(this,10),
85 _funcList("!funcList","List of functions",this),
86 _coefList("!coefList","List of coefficients",this),
87 _extended(kFALSE),
88 _doFloor(kFALSE)
89{
90
91}
92
93
94
95////////////////////////////////////////////////////////////////////////////////
96/// Construct p.d.f consisting of \f$ \mathrm{coef}_1 * \mathrm{func}_1 + (1-\mathrm{coef}_1) * \mathrm{func}_2 \f$.
97/// The input coefficients and functions are allowed to be negative
98/// but the resulting sum is not, which is enforced at runtime.
99
100RooRealSumPdf::RooRealSumPdf(const char *name, const char *title,
101 RooAbsReal& func1, RooAbsReal& func2, RooAbsReal& coef1) :
102 RooAbsPdf(name,title),
103 _normIntMgr(this,10),
104 _funcList("!funcList","List of functions",this),
105 _coefList("!coefList","List of coefficients",this),
106 _extended(kFALSE),
107 _doFloor(kFALSE)
108{
109 // Special constructor with two functions and one coefficient
110
111 _funcList.add(func1) ;
112 _funcList.add(func2) ;
113 _coefList.add(coef1) ;
114
115}
116
117
118////////////////////////////////////////////////////////////////////////////////
119/// Constructor for a PDF from a list of functions and coefficients.
120/// It implements
121/// \f[
122/// \sum_i \mathrm{coef}_i \cdot \mathrm{func}_i,
123/// \f]
124/// if \f$ N_\mathrm{coef} = N_\mathrm{func} \f$. With `extended=true`, the coefficients can take any values. With `extended=false`,
125/// there is the danger of getting a degenerate minimisation problem because a PDF has to be normalised, which needs one degree
126/// of freedom less.
127///
128/// A plain (normalised) PDF can therefore be implemented with one less coefficient. RooFit then computes
129/// \f[
130/// \sum_i^{N-1} \mathrm{coef}_i \cdot \mathrm{func}_i + (1 - \sum_i \mathrm{coef}_i ) \cdot \mathrm{func}_N,
131/// \f]
132/// if \f$ N_\mathrm{coef} = N_\mathrm{func} - 1 \f$.
133///
134/// All coefficients and functions are allowed to be negative
135/// but the sum (*i.e.* the PDF) is not, which is enforced at runtime.
136///
137/// \param name Name of the PDF
138/// \param title Title (for plotting)
139/// \param inFuncList List of functions to sum
140/// \param inCoefList List of coefficients
141/// \param extended Interpret as extended PDF (requires equal number of functions and coefficients)
142
143RooRealSumPdf::RooRealSumPdf(const char *name, const char *title,
144 const RooArgList& inFuncList, const RooArgList& inCoefList, Bool_t extended) :
145 RooAbsPdf(name,title),
146 _normIntMgr(this,10),
147 _funcList("!funcList","List of functions",this),
148 _coefList("!coefList","List of coefficients",this),
149 _extended(extended),
150 _doFloor(kFALSE)
151{
152 if (!(inFuncList.getSize()==inCoefList.getSize()+1 || inFuncList.getSize()==inCoefList.getSize())) {
153 coutE(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName()
154 << ") number of pdfs and coefficients inconsistent, must have Nfunc=Ncoef or Nfunc=Ncoef+1" << endl ;
155 throw std::invalid_argument("RooRealSumPdf: Number of PDFs and coefficients is inconsistent.");
156 }
157
158 // Constructor with N functions and N or N-1 coefs
159 for (unsigned int i = 0; i < inCoefList.size(); ++i) {
160 const auto& func = inFuncList[i];
161 const auto& coef = inCoefList[i];
162
163 if (!dynamic_cast<const RooAbsReal*>(&coef)) {
164 coutW(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") coefficient " << coef.GetName() << " is not of type RooAbsReal, ignored" << endl ;
165 continue ;
166 }
167 if (!dynamic_cast<const RooAbsReal*>(&func)) {
168 coutW(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") func " << func.GetName() << " is not of type RooAbsReal, ignored" << endl ;
169 continue ;
170 }
171 _funcList.add(func) ;
172 _coefList.add(coef) ;
173 }
174
175 if (inFuncList.size() == inCoefList.size() + 1) {
176 const auto& func = inFuncList[inFuncList.size()-1];
177 if (!dynamic_cast<const RooAbsReal*>(&func)) {
178 coutE(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") last func " << func.GetName() << " is not of type RooAbsReal, fatal error" << endl ;
179 throw std::invalid_argument("RooRealSumPdf: Function passed as is not of type RooAbsReal.");
180 }
181 _funcList.add(func);
182 }
183
184}
185
186
187
188
189////////////////////////////////////////////////////////////////////////////////
190/// Copy constructor
191
193 RooAbsPdf(other,name),
194 _normIntMgr(other._normIntMgr,this),
195 _funcList("!funcList",this,other._funcList),
196 _coefList("!coefList",this,other._coefList),
197 _extended(other._extended),
198 _doFloor(other._doFloor)
199{
200
201}
202
203
204
205////////////////////////////////////////////////////////////////////////////////
206/// Destructor
207
209{
210
211}
212
213
214
215
216
217////////////////////////////////////////////////////////////////////////////////
218
220{
222}
223
224
225
226
227////////////////////////////////////////////////////////////////////////////////
228/// Calculate the current value
229
231{
232 // Do running sum of coef/func pairs, calculate lastCoef.
233 double value = 0;
234 double sumCoeff = 0.;
235 for (unsigned int i = 0; i < _funcList.size(); ++i) {
236 const auto func = static_cast<RooAbsReal*>(&_funcList[i]);
237 const auto coef = static_cast<RooAbsReal*>(i < _coefList.size() ? &_coefList[i] : nullptr);
238 const double coefVal = coef != nullptr ? coef->getVal() : (1. - sumCoeff);
239
240 // Warn about degeneration of last coefficient
241 if (coef == nullptr && (coefVal < 0 || coefVal > 1.)) {
242 if (!_haveWarned) {
243 coutW(Eval) << "RooRealSumPdf::evaluate(" << GetName()
244 << ") WARNING: sum of FUNC coefficients not in range [0-1], value="
245 << sumCoeff << ". This means that the PDF is not properly normalised. If the PDF was meant to be extended, provide as many coefficients as functions." << endl ;
246 _haveWarned = true;
247 }
248 // Signal that we are in an undefined region:
249 value = RooNaNPacker::packFloatIntoNaN(100.f * (coefVal < 0. ? -coefVal : coefVal - 1.));
250 }
251
252 if (func->isSelectedComp()) {
253 value += func->getVal() * coefVal;
254 }
255
256 sumCoeff += coefVal;
257 }
258
259 // Introduce floor if so requested
260 if (value<0 && (_doFloor || _doFloorGlobal)) {
261 value = 0 ;
262 }
263
264 return value ;
265}
266
267
268
269
270////////////////////////////////////////////////////////////////////////////////
271/// Check if FUNC is valid for given normalization set.
272/// Coefficient and FUNC must be non-overlapping, but func-coefficient
273/// pairs may overlap each other.
274///
275/// In the present implementation, coefficients may not be observables or derive
276/// from observables.
277
279{
280 Bool_t ret(kFALSE) ;
281
282 for (unsigned int i=0; i < _coefList.size(); ++i) {
283 const auto& coef = _coefList[i];
284 const auto& func = _funcList[i];
285
286 if (func.observableOverlaps(nset, coef)) {
287 coutE(InputArguments) << "RooRealSumPdf::checkObservables(" << GetName() << "): ERROR: coefficient " << coef.GetName()
288 << " and FUNC " << func.GetName() << " have one or more observables in common" << endl ;
289 ret = kTRUE ;
290 }
291 if (coef.dependsOn(*nset)) {
292 coutE(InputArguments) << "RooRealPdf::checkObservables(" << GetName() << "): ERROR coefficient " << coef.GetName()
293 << " depends on one or more of the following observables" ; nset->Print("1") ;
294 ret = kTRUE ;
295 }
296 }
297
298 return ret ;
299}
300
301
302
303
304////////////////////////////////////////////////////////////////////////////////
305/// Advertise that all integrals can be handled internally.
306
308 const RooArgSet* normSet2, const char* rangeName) const
309{
310 // Handle trivial no-integration scenario
311 if (allVars.getSize()==0) return 0 ;
312 if (_forceNumInt) return 0 ;
313
314 // Select subset of allVars that are actual dependents
315 analVars.add(allVars) ;
316 RooArgSet* normSet = normSet2 ? getObservables(normSet2) : 0 ;
317
318
319 // Check if this configuration was created before
320 Int_t sterileIdx(-1) ;
321 CacheElem* cache = (CacheElem*) _normIntMgr.getObj(normSet,&analVars,&sterileIdx,RooNameReg::ptr(rangeName)) ;
322 if (cache) {
323 //cout << "RooRealSumPdf("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << " -> " << _normIntMgr.lastIndex()+1 << " (cached)" << endl;
324 return _normIntMgr.lastIndex()+1 ;
325 }
326
327 // Create new cache element
328 cache = new CacheElem ;
329
330 // Make list of function projection and normalization integrals
331 for (const auto elm : _funcList) {
332 const auto func = static_cast<RooAbsReal*>(elm);
333
334 RooAbsReal* funcInt = func->createIntegral(analVars,rangeName) ;
335 if(funcInt->InheritsFrom(RooRealIntegral::Class())) ((RooRealIntegral*)funcInt)->setAllowComponentSelection(true);
336 cache->_funcIntList.addOwned(*funcInt) ;
337 if (normSet && normSet->getSize()>0) {
338 RooAbsReal* funcNorm = func->createIntegral(*normSet) ;
339 cache->_funcNormList.addOwned(*funcNorm) ;
340 }
341 }
342
343 // Store cache element
344 Int_t code = _normIntMgr.setObj(normSet,&analVars,(RooAbsCacheElement*)cache,RooNameReg::ptr(rangeName)) ;
345
346 if (normSet) {
347 delete normSet ;
348 }
349
350 //cout << "RooRealSumPdf("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << " -> " << code+1 << endl;
351 return code+1 ;
352}
353
354
355
356
357////////////////////////////////////////////////////////////////////////////////
358/// Implement analytical integrations by deferring integration of component
359/// functions to integrators of components.
360
361Double_t RooRealSumPdf::analyticalIntegralWN(Int_t code, const RooArgSet* normSet2, const char* rangeName) const
362{
363 // Handle trivial passthrough scenario
364 if (code==0) return getVal(normSet2) ;
365
366
367 // WVE needs adaptation for rangeName feature
368 CacheElem* cache = (CacheElem*) _normIntMgr.getObjByIndex(code-1) ;
369 if (cache==0) { // revive the (sterilized) cache
370 //cout << "RooRealSumPdf("<<this<<")::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << ": reviving cache "<< endl;
371 std::unique_ptr<RooArgSet> vars( getParameters(RooArgSet()) );
372 std::unique_ptr<RooArgSet> iset( _normIntMgr.nameSet2ByIndex(code-1)->select(*vars) );
373 std::unique_ptr<RooArgSet> nset( _normIntMgr.nameSet1ByIndex(code-1)->select(*vars) );
374 RooArgSet dummy;
375 Int_t code2 = getAnalyticalIntegralWN(*iset,dummy,nset.get(),rangeName);
376 R__ASSERT(code==code2); // must have revived the right (sterilized) slot...
377 cache = (CacheElem*) _normIntMgr.getObjByIndex(code-1) ;
378 R__ASSERT(cache!=0);
379 }
380
381 Double_t value(0) ;
382
383 // N funcs, N-1 coefficients
384 Double_t lastCoef(1) ;
385 auto funcIt = _funcList.begin();
386 auto funcIntIt = cache->_funcIntList.begin();
387 for (const auto coefArg : _coefList) {
388 assert(funcIt != _funcList.end());
389 const auto coef = static_cast<const RooAbsReal*>(coefArg);
390 const auto func = static_cast<const RooAbsReal*>(*funcIt++);
391 const auto funcInt = static_cast<RooAbsReal*>(*funcIntIt++);
392
393 Double_t coefVal = coef->getVal(normSet2) ;
394 if (coefVal) {
395 assert(func);
396 if (normSet2 ==0 || func->isSelectedComp()) {
397 assert(funcInt);
398 value += funcInt->getVal()*coefVal ;
399 }
400 lastCoef -= coef->getVal(normSet2) ;
401 }
402 }
403
404 if (!haveLastCoef()) {
405 // Add last func with correct coefficient
406 const auto func = static_cast<const RooAbsReal*>(*funcIt);
407 const auto funcInt = static_cast<RooAbsReal*>(*funcIntIt);
408 assert(func);
409
410 if (normSet2 ==0 || func->isSelectedComp()) {
411 assert(funcInt);
412 value += funcInt->getVal()*lastCoef ;
413 }
414
415 // Warn about coefficient degeneration
416 if (!_haveWarned && (lastCoef<0 || lastCoef>1)) {
417 coutW(Eval) << "RooRealSumPdf::evaluate(" << GetName()
418 << " WARNING: sum of FUNC coefficients not in range [0-1], value="
419 << 1-lastCoef << endl ;
420 _haveWarned = true;
421 }
422 }
423
424 Double_t normVal(1) ;
425 if (normSet2 && normSet2->getSize()>0) {
426 normVal = 0 ;
427
428 // N funcs, N-1 coefficients
429 auto funcNormIter = cache->_funcNormList.begin();
430 for (const auto coefAsArg : _coefList) {
431 auto coef = static_cast<RooAbsReal*>(coefAsArg);
432 auto funcNorm = static_cast<RooAbsReal*>(*funcNormIter++);
433
434 Double_t coefVal = coef->getVal(normSet2);
435 if (coefVal) {
436 assert(funcNorm);
437 normVal += funcNorm->getVal()*coefVal ;
438 }
439 }
440
441 // Add last func with correct coefficient
442 if (!haveLastCoef()) {
443 auto funcNorm = static_cast<RooAbsReal*>(*funcNormIter);
444 assert(funcNorm);
445
446 normVal += funcNorm->getVal()*lastCoef;
447 }
448 }
449
450 return value / normVal;
451}
452
453
454////////////////////////////////////////////////////////////////////////////////
455
457{
458 Double_t n = getNorm(nset) ;
459 if (n<0) {
460 logEvalError("Expected number of events is negative") ;
461 }
462 return n ;
463}
464
465
466////////////////////////////////////////////////////////////////////////////////
467
468std::list<Double_t>* RooRealSumPdf::binBoundaries(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
469{
470 list<Double_t>* sumBinB = 0 ;
471 Bool_t needClean(kFALSE) ;
472
473 // Loop over components pdf
474 for (const auto elm : _funcList) {
475 auto func = static_cast<RooAbsReal*>(elm);
476
477 list<Double_t>* funcBinB = func->binBoundaries(obs,xlo,xhi) ;
478
479 // Process hint
480 if (funcBinB) {
481 if (!sumBinB) {
482 // If this is the first hint, then just save it
483 sumBinB = funcBinB ;
484 } else {
485
486 list<Double_t>* newSumBinB = new list<Double_t>(sumBinB->size()+funcBinB->size()) ;
487
488 // Merge hints into temporary array
489 merge(funcBinB->begin(),funcBinB->end(),sumBinB->begin(),sumBinB->end(),newSumBinB->begin()) ;
490
491 // Copy merged array without duplicates to new sumBinBArrau
492 delete sumBinB ;
493 delete funcBinB ;
494 sumBinB = newSumBinB ;
495 needClean = kTRUE ;
496 }
497 }
498 }
499
500 // Remove consecutive duplicates
501 if (needClean) {
502 list<Double_t>::iterator new_end = unique(sumBinB->begin(),sumBinB->end()) ;
503 sumBinB->erase(new_end,sumBinB->end()) ;
504 }
505
506 return sumBinB ;
507}
508
509
510
511//_____________________________________________________________________________B
513{
514 // If all components that depend on obs are binned that so is the product
515
516 for (const auto elm : _funcList) {
517 auto func = static_cast<RooAbsReal*>(elm);
518
519 if (func->dependsOn(obs) && !func->isBinnedDistribution(obs)) {
520 return kFALSE ;
521 }
522 }
523
524 return kTRUE ;
525}
526
527
528
529
530
531////////////////////////////////////////////////////////////////////////////////
532
533std::list<Double_t>* RooRealSumPdf::plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
534{
535 list<Double_t>* sumHint = 0 ;
536 Bool_t needClean(kFALSE) ;
537
538 // Loop over components pdf
539 for (const auto elm : _funcList) {
540 auto func = static_cast<RooAbsReal*>(elm);
541
542 list<Double_t>* funcHint = func->plotSamplingHint(obs,xlo,xhi) ;
543
544 // Process hint
545 if (funcHint) {
546 if (!sumHint) {
547
548 // If this is the first hint, then just save it
549 sumHint = funcHint ;
550
551 } else {
552
553 list<Double_t>* newSumHint = new list<Double_t>(sumHint->size()+funcHint->size()) ;
554
555 // Merge hints into temporary array
556 merge(funcHint->begin(),funcHint->end(),sumHint->begin(),sumHint->end(),newSumHint->begin()) ;
557
558 // Copy merged array without duplicates to new sumHintArrau
559 delete sumHint ;
560 sumHint = newSumHint ;
561 needClean = kTRUE ;
562 }
563 }
564 }
565
566 // Remove consecutive duplicates
567 if (needClean) {
568 list<Double_t>::iterator new_end = unique(sumHint->begin(),sumHint->end()) ;
569 sumHint->erase(new_end,sumHint->end()) ;
570 }
571
572 return sumHint ;
573}
574
575
576
577
578////////////////////////////////////////////////////////////////////////////////
579/// Label OK'ed components of a RooRealSumPdf with cache-and-track
580
582{
583 for (const auto sarg : _funcList) {
584 if (sarg->canNodeBeCached()==Always) {
585 trackNodes.add(*sarg) ;
586 //cout << "tracking node RealSumPdf component " << sarg->IsA()->GetName() << "::" << sarg->GetName() << endl ;
587 }
588 }
589}
590
591
592
593////////////////////////////////////////////////////////////////////////////////
594/// Customized printing of arguments of a RooRealSumPdf to more intuitively reflect the contents of the
595/// product operator construction
596
597void RooRealSumPdf::printMetaArgs(ostream& os) const
598{
599
601
602 if (_coefList.getSize()!=0) {
603 auto funcIter = _funcList.begin();
604
605 for (const auto coef : _coefList) {
606 if (!first) {
607 os << " + " ;
608 } else {
609 first = kFALSE ;
610 }
611 const auto func = *(funcIter++);
612 os << coef->GetName() << " * " << func->GetName();
613 }
614
615 if (funcIter != _funcList.end()) {
616 os << " + [%] * " << (*funcIter)->GetName() ;
617 }
618 } else {
619
620 for (const auto func : _funcList) {
621 if (!first) {
622 os << " + " ;
623 } else {
624 first = kFALSE ;
625 }
626 os << func->GetName() ;
627 }
628 }
629
630 os << " " ;
631}
#define coutW(a)
#define coutE(a)
const Bool_t kFALSE
Definition RtypesCore.h:92
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:91
#define ClassImp(name)
Definition Rtypes.h:364
#define R__ASSERT(e)
Definition TError.h:120
char name[80]
Definition TGX11.cxx:110
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Given a set of possible observables, return the observables that this PDF depends on.
Definition RooAbsArg.h:313
friend class RooArgSet
Definition RooAbsArg.h:606
RooArgSet * getParameters(const RooAbsData *data, bool stripDisconnected=true) const
Create a list of leaf nodes in the arg tree starting with ourself as top node that don't match any of...
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Int_t getSize() const
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
const_iterator end() const
Storage_t::size_type size() const
const_iterator begin() const
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
const char * GetName() const
Returns name of object.
Double_t getNorm(const RooArgSet &nset) const
Get normalisation term needed to normalise the raw values returned by getVal().
Definition RooAbsPdf.h:211
@ CanBeExtended
Definition RooAbsPdf.h:232
@ CanNotBeExtended
Definition RooAbsPdf.h:232
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...
Definition RooAbsReal.h:61
Bool_t _forceNumInt
Definition RooAbsReal.h:478
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition RooAbsReal.h:91
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 std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
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.
Definition RooArgList.h:21
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition RooArgSet.h:29
Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Add element to non-owning set.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
const RooNameSet * nameSet2ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
Int_t lastIndex() const
const RooNameSet * nameSet1ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
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
Returns ability of PDF to provide extended likelihood terms.
RooObjCacheManager _normIntMgr
Double_t evaluate() const
Calculate the current value.
RooListProxy _coefList
RooListProxy _funcList
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
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
static Bool_t _doFloorGlobal
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
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.
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Retrieve bin boundaries if this distribution is binned in obs.
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...
bool haveLastCoef() const
virtual const char * GetName() const
Returns name of object.
Definition TNamed.h:47
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition TObject.cxx:445
const Int_t n
Definition legend1.C:16
Definition first.py:1
static double packFloatIntoNaN(float payload)
Pack float into mantissa of a NaN.