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