Logo ROOT   6.18/05
Reference Guide
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
37
38
39*/
40
41#include "RooFit.h"
42#include "Riostream.h"
43
44#include "TError.h"
45#include "TIterator.h"
46#include "TList.h"
47#include "RooRealSumPdf.h"
48#include "RooRealProxy.h"
49#include "RooPlot.h"
50#include "RooRealVar.h"
51#include "RooAddGenContext.h"
52#include "RooRealConstant.h"
53#include "RooRealIntegral.h"
54#include "RooMsgService.h"
55#include "RooNameReg.h"
56
57#include <algorithm>
58#include <memory>
59
60using namespace std;
61
63;
64
66
67////////////////////////////////////////////////////////////////////////////////
68/// Default constructor
69/// coverity[UNINIT_CTOR]
70
72{
77}
78
79
80
81////////////////////////////////////////////////////////////////////////////////
82/// Constructor with name and title
83
84RooRealSumPdf::RooRealSumPdf(const char *name, const char *title) :
85 RooAbsPdf(name,title),
86 _normIntMgr(this,10),
87 _haveLastCoef(kFALSE),
88 _funcList("!funcList","List of functions",this),
89 _coefList("!coefList","List of coefficients",this),
90 _extended(kFALSE),
91 _doFloor(kFALSE)
92{
95}
96
97
98
99////////////////////////////////////////////////////////////////////////////////
100/// Construct p.d.f consisting of \f$ \mathrm{coef}_1 * \mathrm{func}_1 + (1-\mathrm{coef}_1) * \mathrm{func}_2 \f$.
101/// The input coefficients and functions are allowed to be negative
102/// but the resulting sum is not, which is enforced at runtime.
103
104RooRealSumPdf::RooRealSumPdf(const char *name, const char *title,
105 RooAbsReal& func1, RooAbsReal& func2, RooAbsReal& coef1) :
106 RooAbsPdf(name,title),
107 _normIntMgr(this,10),
108 _haveLastCoef(kFALSE),
109 _funcList("!funcList","List of functions",this),
110 _coefList("!coefList","List of coefficients",this),
111 _extended(kFALSE),
112 _doFloor(kFALSE)
113{
114 // Special constructor with two functions and one coefficient
117
118 _funcList.add(func1) ;
119 _funcList.add(func2) ;
120 _coefList.add(coef1) ;
121
122}
123
124
125////////////////////////////////////////////////////////////////////////////////
126/// Constructor for a PDF implementing
127/// \f[
128/// \sum_i \mathrm{coef}_i \cdot \mathrm{func}_i,
129/// \f]
130/// if \f$ N_\mathrm{coef} = N_\mathrm{func} \f$. With `extended=true`, the coefficients can take any values. With `extended=false`,
131/// there is the danger of getting a degenerate minimisation problem because a PDF has to be normalised, which needs one degree
132/// of freedom less.
133///
134/// A plain (normalised) PDF can therefore be implemented with one less coefficient. RooFit then computes
135/// \f[
136/// \sum_i^{N-1} \mathrm{coef}_i \cdot \mathrm{func}_i + (1 - \sum_i \mathrm{coef}_i ) \cdot \mathrm{func}_N,
137/// \f]
138/// if \f$ N_\mathrm{coef} = N_\mathrm{func} - 1 \f$.
139///
140/// All coefficients and functions are allowed to be negative
141/// but the sum (*i.e.* the PDF) is not, which is enforced at runtime.
142
143RooRealSumPdf::RooRealSumPdf(const char *name, const char *title, const RooArgList& inFuncList, const RooArgList& inCoefList, Bool_t extended) :
144 RooAbsPdf(name,title),
145 _normIntMgr(this,10),
146 _haveLastCoef(kFALSE),
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 assert(0) ;
156 }
157
160
161 // Constructor with N functions and N or N-1 coefs
162 TIterator* funcIter = inFuncList.createIterator() ;
163 TIterator* coefIter = inCoefList.createIterator() ;
164 RooAbsArg* func ;
165 RooAbsArg* coef ;
166
167 while((coef = (RooAbsArg*)coefIter->Next())) {
168 func = (RooAbsArg*) funcIter->Next() ;
169
170 if (!dynamic_cast<RooAbsReal*>(coef)) {
171 coutW(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") coefficient " << coef->GetName() << " is not of type RooAbsReal, ignored" << endl ;
172 continue ;
173 }
174 if (!dynamic_cast<RooAbsReal*>(func)) {
175 coutW(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") func " << func->GetName() << " is not of type RooAbsReal, ignored" << endl ;
176 continue ;
177 }
178 _funcList.add(*func) ;
179 _coefList.add(*coef) ;
180 }
181
182 func = (RooAbsReal*) funcIter->Next() ;
183 if (func) {
184 if (!dynamic_cast<RooAbsReal*>(func)) {
185 coutE(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") last func " << coef->GetName() << " is not of type RooAbsReal, fatal error" << endl ;
186 assert(0) ;
187 }
188 _funcList.add(*func) ;
189 } else {
191 }
192
193 delete funcIter ;
194 delete coefIter ;
195}
196
197
198
199
200////////////////////////////////////////////////////////////////////////////////
201/// Copy constructor
202
204 RooAbsPdf(other,name),
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)
211{
214}
215
216
217
218////////////////////////////////////////////////////////////////////////////////
219/// Destructor
220
222{
223 delete _funcIter ;
224 delete _coefIter ;
225}
226
227
228
229
230
231////////////////////////////////////////////////////////////////////////////////
232
234{
236}
237
238
239
240
241////////////////////////////////////////////////////////////////////////////////
242/// Calculate the current value
243
245{
246 Double_t value(0) ;
247
248 // Do running sum of coef/func pairs, calculate lastCoef.
249
250 // N funcs, N-1 coefficients
251 Double_t lastCoef(1) ;
252 auto funcIt = _funcList.begin();
253 for (const auto coefArg : _coefList) {
254 assert(funcIt != _funcList.end());
255 auto func = static_cast<const RooAbsReal*>(*funcIt++);
256 auto coef = static_cast<const RooAbsReal*>(coefArg);
257
258 Double_t coefVal = coef->getVal() ;
259 if (coefVal) {
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 ;
263 }
264 lastCoef -= coef->getVal() ;
265 }
266 }
267
268 if (!_haveLastCoef) {
269 assert(funcIt != _funcList.end());
270 // Add last func with correct coefficient
271 auto func = static_cast<const RooAbsReal*>(*funcIt);
272 if (func->isSelectedComp()) {
273 value += func->getVal()*lastCoef ;
274 }
275
276 cxcoutD(Eval) << "RooRealSumPdf::eval(" << GetName() << ") lastCoef = " << lastCoef << " funcVal = " << func->getVal() << endl ;
277
278 // Warn about coefficient degeneration
279 if (lastCoef<0 || lastCoef>1) {
280 coutW(Eval) << "RooRealSumPdf::evaluate(" << GetName()
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 ;
283 }
284 }
285
286 // Introduce floor if so requested
287 if (value<0 && (_doFloor || _doFloorGlobal)) {
288 value = 0 ;
289 }
290
291 return value ;
292}
293
294
295
296
297////////////////////////////////////////////////////////////////////////////////
298/// Check if FUNC is valid for given normalization set.
299/// Coeffient and FUNC must be non-overlapping, but func-coefficient
300/// pairs may overlap each other
301///
302/// In the present implementation, coefficients may not be observables or derive
303/// from observables
304
306{
307 Bool_t ret(kFALSE) ;
308
309 _funcIter->Reset() ;
310 _coefIter->Reset() ;
311 RooAbsReal* coef ;
312 RooAbsReal* func ;
313 while((coef=(RooAbsReal*)_coefIter->Next())) {
314 func = (RooAbsReal*)_funcIter->Next() ;
315 if (func->observableOverlaps(nset,*coef)) {
316 coutE(InputArguments) << "RooRealSumPdf::checkObservables(" << GetName() << "): ERROR: coefficient " << coef->GetName()
317 << " and FUNC " << func->GetName() << " have one or more observables in common" << endl ;
318 ret = kTRUE ;
319 }
320 if (coef->dependsOn(*nset)) {
321 coutE(InputArguments) << "RooRealPdf::checkObservables(" << GetName() << "): ERROR coefficient " << coef->GetName()
322 << " depends on one or more of the following observables" ; nset->Print("1") ;
323 ret = kTRUE ;
324 }
325 }
326
327 return ret ;
328}
329
330
331
332
333////////////////////////////////////////////////////////////////////////////////
334/// Advertise that all integrals can be handled internally.
335
337 const RooArgSet* normSet2, const char* rangeName) const
338{
339 // Handle trivial no-integration scenario
340 if (allVars.getSize()==0) return 0 ;
341 if (_forceNumInt) return 0 ;
342
343 // Select subset of allVars that are actual dependents
344 analVars.add(allVars) ;
345 RooArgSet* normSet = normSet2 ? getObservables(normSet2) : 0 ;
346
347
348 // Check if this configuration was created before
349 Int_t sterileIdx(-1) ;
350 CacheElem* cache = (CacheElem*) _normIntMgr.getObj(normSet,&analVars,&sterileIdx,RooNameReg::ptr(rangeName)) ;
351 if (cache) {
352 //cout << "RooRealSumPdf("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << " -> " << _normIntMgr.lastIndex()+1 << " (cached)" << endl;
353 return _normIntMgr.lastIndex()+1 ;
354 }
355
356 // Create new cache element
357 cache = new CacheElem ;
358
359 // Make list of function projection and normalization integrals
360 _funcIter->Reset() ;
361 RooAbsReal *func ;
362 while((func=(RooAbsReal*)_funcIter->Next())) {
363 RooAbsReal* funcInt = func->createIntegral(analVars,rangeName) ;
364 if(funcInt->InheritsFrom(RooRealIntegral::Class())) ((RooRealIntegral*)funcInt)->setAllowComponentSelection(true);
365 cache->_funcIntList.addOwned(*funcInt) ;
366 if (normSet && normSet->getSize()>0) {
367 RooAbsReal* funcNorm = func->createIntegral(*normSet) ;
368 cache->_funcNormList.addOwned(*funcNorm) ;
369 }
370 }
371
372 // Store cache element
373 Int_t code = _normIntMgr.setObj(normSet,&analVars,(RooAbsCacheElement*)cache,RooNameReg::ptr(rangeName)) ;
374
375 if (normSet) {
376 delete normSet ;
377 }
378
379 //cout << "RooRealSumPdf("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << " -> " << code+1 << endl;
380 return code+1 ;
381}
382
383
384
385
386////////////////////////////////////////////////////////////////////////////////
387/// Implement analytical integrations by deferring integration of component
388/// functions to integrators of components.
389
390Double_t RooRealSumPdf::analyticalIntegralWN(Int_t code, const RooArgSet* normSet2, const char* rangeName) const
391{
392 // Handle trivial passthrough scenario
393 if (code==0) return getVal(normSet2) ;
394
395
396 // WVE needs adaptation for rangeName feature
397 CacheElem* cache = (CacheElem*) _normIntMgr.getObjByIndex(code-1) ;
398 if (cache==0) { // revive the (sterilized) cache
399 //cout << "RooRealSumPdf("<<this<<")::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << ": reviving cache "<< endl;
400 std::unique_ptr<RooArgSet> vars( getParameters(RooArgSet()) );
401 std::unique_ptr<RooArgSet> iset( _normIntMgr.nameSet2ByIndex(code-1)->select(*vars) );
402 std::unique_ptr<RooArgSet> nset( _normIntMgr.nameSet1ByIndex(code-1)->select(*vars) );
404 Int_t code2 = getAnalyticalIntegralWN(*iset,dummy,nset.get(),rangeName);
405 R__ASSERT(code==code2); // must have revived the right (sterilized) slot...
406 cache = (CacheElem*) _normIntMgr.getObjByIndex(code-1) ;
407 R__ASSERT(cache!=0);
408 }
409
410 RooFIter funcIntIter = cache->_funcIntList.fwdIterator() ;
411 RooFIter coefIter = _coefList.fwdIterator() ;
412 RooFIter funcIter = _funcList.fwdIterator() ;
413 RooAbsReal *coef(0), *funcInt(0), *func(0) ;
414 Double_t value(0) ;
415
416 // N funcs, N-1 coefficients
417 Double_t lastCoef(1) ;
418 while((coef=(RooAbsReal*)coefIter.next())) {
419 funcInt = (RooAbsReal*)funcIntIter.next() ;
420 func = (RooAbsReal*)funcIter.next() ;
421 Double_t coefVal = coef->getVal(normSet2) ;
422 if (coefVal) {
423 assert(func);
424 if (normSet2 ==0 || func->isSelectedComp()) {
425 assert(funcInt);
426 value += funcInt->getVal()*coefVal ;
427 }
428 lastCoef -= coef->getVal(normSet2) ;
429 }
430 }
431
432 if (!_haveLastCoef) {
433 // Add last func with correct coefficient
434 funcInt = (RooAbsReal*) funcIntIter.next() ;
435 if (normSet2 ==0 || func->isSelectedComp()) {
436 assert(funcInt);
437 value += funcInt->getVal()*lastCoef ;
438 }
439
440 // Warn about coefficient degeneration
441 if (lastCoef<0 || lastCoef>1) {
442 coutW(Eval) << "RooRealSumPdf::evaluate(" << GetName()
443 << " WARNING: sum of FUNC coefficients not in range [0-1], value="
444 << 1-lastCoef << endl ;
445 }
446 }
447
448 Double_t normVal(1) ;
449 if (normSet2 && normSet2->getSize()>0) {
450 normVal = 0 ;
451
452 // N funcs, N-1 coefficients
453 RooAbsReal* funcNorm ;
454 RooFIter funcNormIter = cache->_funcNormList.fwdIterator() ;
455 RooFIter coefIter2 = _coefList.fwdIterator() ;
456 while((coef=(RooAbsReal*)coefIter2.next())) {
457 funcNorm = (RooAbsReal*)funcNormIter.next() ;
458 Double_t coefVal = coef->getVal(normSet2) ;
459 if (coefVal) {
460 assert(funcNorm);
461 normVal += funcNorm->getVal()*coefVal ;
462 }
463 }
464
465 // Add last func with correct coefficient
466 if (!_haveLastCoef) {
467 funcNorm = (RooAbsReal*) funcNormIter.next() ;
468 assert(funcNorm);
469 normVal += funcNorm->getVal()*lastCoef ;
470 }
471 }
472
473 return value / normVal;
474}
475
476
477////////////////////////////////////////////////////////////////////////////////
478
480{
481 Double_t n = getNorm(nset) ;
482 if (n<0) {
483 logEvalError("Expected number of events is negative") ;
484 }
485 return n ;
486}
487
488
489////////////////////////////////////////////////////////////////////////////////
490
491std::list<Double_t>* RooRealSumPdf::binBoundaries(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
492{
493 list<Double_t>* sumBinB = 0 ;
494 Bool_t needClean(kFALSE) ;
495
497 RooAbsReal* func ;
498 // Loop over components pdf
499 while((func=(RooAbsReal*)iter.next())) {
500
501 list<Double_t>* funcBinB = func->binBoundaries(obs,xlo,xhi) ;
502
503 // Process hint
504 if (funcBinB) {
505 if (!sumBinB) {
506 // If this is the first hint, then just save it
507 sumBinB = funcBinB ;
508 } else {
509
510 list<Double_t>* newSumBinB = new list<Double_t>(sumBinB->size()+funcBinB->size()) ;
511
512 // Merge hints into temporary array
513 merge(funcBinB->begin(),funcBinB->end(),sumBinB->begin(),sumBinB->end(),newSumBinB->begin()) ;
514
515 // Copy merged array without duplicates to new sumBinBArrau
516 delete sumBinB ;
517 delete funcBinB ;
518 sumBinB = newSumBinB ;
519 needClean = kTRUE ;
520 }
521 }
522 }
523
524 // Remove consecutive duplicates
525 if (needClean) {
526 list<Double_t>::iterator new_end = unique(sumBinB->begin(),sumBinB->end()) ;
527 sumBinB->erase(new_end,sumBinB->end()) ;
528 }
529
530 return sumBinB ;
531}
532
533
534
535//_____________________________________________________________________________B
537{
538 // If all components that depend on obs are binned that so is the product
539
541 RooAbsReal* func ;
542 while((func=(RooAbsReal*)iter.next())) {
543 if (func->dependsOn(obs) && !func->isBinnedDistribution(obs)) {
544 return kFALSE ;
545 }
546 }
547
548 return kTRUE ;
549}
550
551
552
553
554
555////////////////////////////////////////////////////////////////////////////////
556
557std::list<Double_t>* RooRealSumPdf::plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
558{
559 list<Double_t>* sumHint = 0 ;
560 Bool_t needClean(kFALSE) ;
561
563 RooAbsReal* func ;
564 // Loop over components pdf
565 while((func=(RooAbsReal*)iter.next())) {
566
567 list<Double_t>* funcHint = func->plotSamplingHint(obs,xlo,xhi) ;
568
569 // Process hint
570 if (funcHint) {
571 if (!sumHint) {
572
573 // If this is the first hint, then just save it
574 sumHint = funcHint ;
575
576 } else {
577
578 list<Double_t>* newSumHint = new list<Double_t>(sumHint->size()+funcHint->size()) ;
579
580 // Merge hints into temporary array
581 merge(funcHint->begin(),funcHint->end(),sumHint->begin(),sumHint->end(),newSumHint->begin()) ;
582
583 // Copy merged array without duplicates to new sumHintArrau
584 delete sumHint ;
585 sumHint = newSumHint ;
586 needClean = kTRUE ;
587 }
588 }
589 }
590
591 // Remove consecutive duplicates
592 if (needClean) {
593 list<Double_t>::iterator new_end = unique(sumHint->begin(),sumHint->end()) ;
594 sumHint->erase(new_end,sumHint->end()) ;
595 }
596
597 return sumHint ;
598}
599
600
601
602
603////////////////////////////////////////////////////////////////////////////////
604/// Label OK'ed components of a RooRealSumPdf with cache-and-track
605
607{
608 RooFIter siter = funcList().fwdIterator() ;
609 RooAbsArg* sarg ;
610 while ((sarg=siter.next())) {
611 if (sarg->canNodeBeCached()==Always) {
612 trackNodes.add(*sarg) ;
613 //cout << "tracking node RealSumPdf component " << sarg->IsA()->GetName() << "::" << sarg->GetName() << endl ;
614 }
615 }
616}
617
618
619
620////////////////////////////////////////////////////////////////////////////////
621/// Customized printing of arguments of a RooRealSumPdf to more intuitively reflect the contents of the
622/// product operator construction
623
624void RooRealSumPdf::printMetaArgs(ostream& os) const
625{
626 _funcIter->Reset() ;
627 _coefIter->Reset() ;
628
630
631 RooAbsArg* coef, *func ;
632 if (_coefList.getSize()!=0) {
633 while((coef=(RooAbsArg*)_coefIter->Next())) {
634 if (!first) {
635 os << " + " ;
636 } else {
637 first = kFALSE ;
638 }
639 func=(RooAbsArg*)_funcIter->Next() ;
640 os << coef->GetName() << " * " << func->GetName() ;
641 }
642 func = (RooAbsArg*) _funcIter->Next() ;
643 if (func) {
644 os << " + [%] * " << func->GetName() ;
645 }
646 } else {
647
648 while((func=(RooAbsArg*)_funcIter->Next())) {
649 if (!first) {
650 os << " + " ;
651 } else {
652 first = kFALSE ;
653 }
654 os << func->GetName() ;
655 }
656 }
657
658 os << " " ;
659}
void Class()
Definition: Class.C:29
static RooMathCoreReg dummy
#define cxcoutD(a)
Definition: RooMsgService.h:79
#define coutW(a)
Definition: RooMsgService.h:33
#define coutE(a)
Definition: RooMsgService.h:34
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:87
#define ClassImp(name)
Definition: Rtypes.h:365
#define R__ASSERT(e)
Definition: TError.h:96
char name[80]
Definition: TGX11.cxx:109
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:70
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Return the observables of this pdf given a set of observables.
Definition: RooAbsArg.h:240
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.
Definition: RooAbsArg.cxx:729
virtual CacheMode canNodeBeCached() const
Definition: RooAbsArg.h:362
friend class RooArgSet
Definition: RooAbsArg.h:516
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...
Definition: RooAbsArg.cxx:543
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...
Definition: RooAbsArg.cxx:798
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.
Int_t getSize() const
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
Definition: RooAbsPdf.h:204
friend class CacheElem
Definition: RooAbsPdf.h:328
@ CanBeExtended
Definition: RooAbsPdf.h:223
@ CanNotBeExtended
Definition: RooAbsPdf.h:223
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:53
Bool_t _forceNumInt
Definition: RooAbsReal.h:411
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
Definition: RooAbsReal.h:297
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooAbsReal.h:296
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:81
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 ...
Definition: RooAbsReal.cxx:531
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Definition: RooAbsReal.h:295
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:28
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...
Definition: RooArgSet.h:88
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
Int_t lastIndex() 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.
Definition: RooNameReg.cxx:104
RooArgSet * select(const RooArgSet &list) const
Construct a RooArgSet of objects in input 'list' whose names match to those in the internal name list...
Definition: RooNameSet.cxx:187
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
The class RooRealSumPdf implements a PDF constructed from a sum of functions:
Definition: RooRealSumPdf.h:24
virtual ExtendMode extendMode() const
const RooArgList & funcList() const
Definition: RooRealSumPdf.h:43
RooObjCacheManager _normIntMgr
Definition: RooRealSumPdf.h:82
Double_t evaluate() const
Calculate the current value.
RooListProxy _coefList
Definition: RooRealSumPdf.h:88
RooListProxy _funcList
Definition: RooRealSumPdf.h:87
Bool_t _haveLastCoef
Definition: RooRealSumPdf.h:85
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
Definition: RooRealSumPdf.h:94
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
virtual ~RooRealSumPdf()
Destructor.
TIterator * _funcIter
Definition: RooRealSumPdf.h:89
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.
Definition: RooRealSumPdf.h:91
TIterator * _coefIter
Iterator over FUNC list.
Definition: RooRealSumPdf.h:90
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.
Definition: TIterator.h:30
virtual void Reset()=0
virtual TObject * Next()=0
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:443
const Int_t n
Definition: legend1.C:16
@ InputArguments
Definition: RooGlobalFunc.h:58
Definition: first.py:1