Logo ROOT  
Reference Guide
RooRealSumFunc.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 ///
19 /// Class RooRealSumFunc implements a PDF constructed from a sum of
20 /// functions:
21 /// ```
22 /// Sum(i=1,n-1) coef_i * func_i(x) + [ 1 - (Sum(i=1,n-1) coef_i ] * func_n(x)
23 /// pdf(x) = ------------------------------------------------------------------------------
24 /// Sum(i=1,n-1) coef_i * Int(func_i)dx + [ 1 - (Sum(i=1,n-1) coef_i ] * Int(func_n)dx
25 ///
26 /// ```
27 /// where coef_i and func_i are RooAbsReal objects, and x is the collection of dependents.
28 /// In the present version coef_i may not depend on x, but this limitation may be removed in the future
29 ///
30 /// ### Difference between RooAddPdf / RooRealSum{Func|Pdf}
31 /// - RooAddPdf is a PDF of PDFs, *i.e.* its components need to be normalised and non-negative.
32 /// - RooRealSumPdf is a PDF of functions, *i.e.*, its components can be negative, but their sum cannot be. The normalisation
33 /// is computed automatically, unless the PDF is extended (see above).
34 /// - RooRealSumFunc is a sum of functions. It is neither normalised, nor need it be positive.
35 
36 #include "RooFit.h"
37 #include "Riostream.h"
38 
39 #include "TIterator.h"
40 #include "TList.h"
41 #include "TClass.h"
42 #include "RooRealSumFunc.h"
43 #include "RooRealProxy.h"
44 #include "RooPlot.h"
45 #include "RooRealVar.h"
46 #include "RooAddGenContext.h"
47 #include "RooRealConstant.h"
48 #include "RooRealIntegral.h"
49 #include "RooMsgService.h"
50 #include "RooNameReg.h"
51 #include "RooTrace.h"
52 
53 #include <algorithm>
54 #include <memory>
55 
56 using namespace std;
57 
59 
61 
62 //_____________________________________________________________________________
64 {
65  // Default constructor
66  // coverity[UNINIT_CTOR]
67  _funcIter = _funcList.createIterator();
68  _coefIter = _coefList.createIterator();
69  _doFloor = kFALSE;
71 }
72 
73 //_____________________________________________________________________________
74 RooRealSumFunc::RooRealSumFunc(const char *name, const char *title)
75  : RooAbsReal(name, title), _normIntMgr(this, 10), _haveLastCoef(kFALSE),
76  _funcList("!funcList", "List of functions", this), _coefList("!coefList", "List of coefficients", this),
77  _doFloor(kFALSE)
78 {
79  // Constructor with name and title
83 }
84 
85 //_____________________________________________________________________________
86 RooRealSumFunc::RooRealSumFunc(const char *name, const char *title, RooAbsReal &func1, RooAbsReal &func2,
87  RooAbsReal &coef1)
88  : RooAbsReal(name, title), _normIntMgr(this, 10), _haveLastCoef(kFALSE),
89  _funcList("!funcList", "List of functions", this), _coefList("!coefList", "List of coefficients", this),
90  _doFloor(kFALSE)
91 {
92  // Construct p.d.f consisting of coef1*func1 + (1-coef1)*func2
93  // The input coefficients and functions are allowed to be negative
94  // but the resulting sum is not, which is enforced at runtime
95 
96  // Special constructor with two functions and one coefficient
99 
100  _funcList.add(func1);
101  _funcList.add(func2);
102  _coefList.add(coef1);
104 }
105 
106 //_____________________________________________________________________________
107 RooRealSumFunc::RooRealSumFunc(const char *name, const char *title, const RooArgList &inFuncList,
108  const RooArgList &inCoefList)
109  : RooAbsReal(name, title), _normIntMgr(this, 10), _haveLastCoef(kFALSE),
110  _funcList("!funcList", "List of functions", this), _coefList("!coefList", "List of coefficients", this),
111  _doFloor(kFALSE)
112 {
113  // Constructor p.d.f implementing sum_i [ coef_i * func_i ], if N_coef==N_func
114  // or sum_i [ coef_i * func_i ] + (1 - sum_i [ coef_i ] )* func_N if Ncoef==N_func-1
115  //
116  // All coefficients and functions are allowed to be negative
117  // but the sum is not, which is enforced at runtime.
118 
119  if (!(inFuncList.getSize() == inCoefList.getSize() + 1 || inFuncList.getSize() == inCoefList.getSize())) {
120  coutE(InputArguments) << "RooRealSumFunc::RooRealSumFunc(" << GetName()
121  << ") number of pdfs and coefficients inconsistent, must have Nfunc=Ncoef or Nfunc=Ncoef+1"
122  << endl;
123  assert(0);
124  }
125 
128 
129  // Constructor with N functions and N or N-1 coefs
130  TIterator *funcIter = inFuncList.createIterator();
131  TIterator *coefIter = inCoefList.createIterator();
132  RooAbsArg *func;
133  RooAbsArg *coef;
134 
135  while ((coef = (RooAbsArg *)coefIter->Next())) {
136  func = (RooAbsArg *)funcIter->Next();
137 
138  if (!dynamic_cast<RooAbsReal *>(coef)) {
139  coutW(InputArguments) << "RooRealSumFunc::RooRealSumFunc(" << GetName() << ") coefficient " << coef->GetName()
140  << " is not of type RooAbsReal, ignored" << endl;
141  continue;
142  }
143  if (!dynamic_cast<RooAbsReal *>(func)) {
144  coutW(InputArguments) << "RooRealSumFunc::RooRealSumFunc(" << GetName() << ") func " << func->GetName()
145  << " is not of type RooAbsReal, ignored" << endl;
146  continue;
147  }
148  _funcList.add(*func);
149  _coefList.add(*coef);
150  }
151 
152  func = (RooAbsReal *)funcIter->Next();
153  if (func) {
154  if (!dynamic_cast<RooAbsReal *>(func)) {
155  coutE(InputArguments) << "RooRealSumFunc::RooRealSumFunc(" << GetName() << ") last func " << coef->GetName()
156  << " is not of type RooAbsReal, fatal error" << endl;
157  assert(0);
158  }
159  _funcList.add(*func);
160  } else {
162  }
163 
164  delete funcIter;
165  delete coefIter;
167 }
168 
169 //_____________________________________________________________________________
171  : RooAbsReal(other, name), _normIntMgr(other._normIntMgr, this), _haveLastCoef(other._haveLastCoef),
172  _funcList("!funcList", this, other._funcList), _coefList("!coefList", this, other._coefList),
173  _doFloor(other._doFloor)
174 {
175  // Copy constructor
176 
180 }
181 
182 //_____________________________________________________________________________
184 {
185  // Destructor
186  delete _funcIter;
187  delete _coefIter;
188 
190 }
191 
192 //_____________________________________________________________________________
194 {
195  // Calculate the current value
196 
197  Double_t value(0);
198 
199  // Do running sum of coef/func pairs, calculate lastCoef.
200  RooFIter funcIter = _funcList.fwdIterator();
201  RooFIter coefIter = _coefList.fwdIterator();
202  RooAbsReal *coef;
203  RooAbsReal *func;
204 
205  // N funcs, N-1 coefficients
206  Double_t lastCoef(1);
207  while ((coef = (RooAbsReal *)coefIter.next())) {
208  func = (RooAbsReal *)funcIter.next();
209  Double_t coefVal = coef->getVal();
210  if (coefVal) {
211  cxcoutD(Eval) << "RooRealSumFunc::eval(" << GetName() << ") coefVal = " << coefVal
212  << " funcVal = " << func->IsA()->GetName() << "::" << func->GetName() << " = " << func->getVal()
213  << endl;
214  if (func->isSelectedComp()) {
215  value += func->getVal() * coefVal;
216  }
217  lastCoef -= coef->getVal();
218  }
219  }
220 
221  if (!_haveLastCoef) {
222  // Add last func with correct coefficient
223  func = (RooAbsReal *)funcIter.next();
224  if (func->isSelectedComp()) {
225  value += func->getVal() * lastCoef;
226  }
227 
228  cxcoutD(Eval) << "RooRealSumFunc::eval(" << GetName() << ") lastCoef = " << lastCoef
229  << " funcVal = " << func->getVal() << endl;
230 
231  // Warn about coefficient degeneration
232  if (lastCoef < 0 || lastCoef > 1) {
233  coutW(Eval) << "RooRealSumFunc::evaluate(" << GetName()
234  << " WARNING: sum of FUNC coefficients not in range [0-1], value=" << 1 - lastCoef << endl;
235  }
236  }
237 
238  // Introduce floor if so requested
239  if (value < 0 && (_doFloor || _doFloorGlobal)) {
240  value = 0;
241  }
242 
243  return value;
244 }
245 
246 //_____________________________________________________________________________
248 {
249  // Check if FUNC is valid for given normalization set.
250  // Coeffient and FUNC must be non-overlapping, but func-coefficient
251  // pairs may overlap each other
252  //
253  // In the present implementation, coefficients may not be observables or derive
254  // from observables
255 
256  Bool_t ret(kFALSE);
257 
258  _funcIter->Reset();
259  _coefIter->Reset();
260  RooAbsReal *coef;
261  RooAbsReal *func;
262  while ((coef = (RooAbsReal *)_coefIter->Next())) {
263  func = (RooAbsReal *)_funcIter->Next();
264  if (func->observableOverlaps(nset, *coef)) {
265  coutE(InputArguments) << "RooRealSumFunc::checkObservables(" << GetName() << "): ERROR: coefficient "
266  << coef->GetName() << " and FUNC " << func->GetName()
267  << " have one or more observables in common" << endl;
268  ret = kTRUE;
269  }
270  if (coef->dependsOn(*nset)) {
271  coutE(InputArguments) << "RooRealPdf::checkObservables(" << GetName() << "): ERROR coefficient "
272  << coef->GetName() << " depends on one or more of the following observables";
273  nset->Print("1");
274  ret = kTRUE;
275  }
276  }
277 
278  return ret;
279 }
280 
281 //_____________________________________________________________________________
283  const char *rangeName) const
284 {
285  // cout <<
286  // "RooRealSumFunc::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<",analVars,"<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
287  // << endl;
288  // Advertise that all integrals can be handled internally.
289 
290  // Handle trivial no-integration scenario
291  if (allVars.getSize() == 0)
292  return 0;
293  if (_forceNumInt)
294  return 0;
295 
296  // Select subset of allVars that are actual dependents
297  analVars.add(allVars);
298  RooArgSet *normSet = normSet2 ? getObservables(normSet2) : 0;
299 
300  // Check if this configuration was created before
301  Int_t sterileIdx(-1);
302  CacheElem *cache = (CacheElem *)_normIntMgr.getObj(normSet, &analVars, &sterileIdx, RooNameReg::ptr(rangeName));
303  if (cache) {
304  // cout <<
305  // "RooRealSumFunc("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
306  // << " -> " << _normIntMgr.lastIndex()+1 << " (cached)" << endl;
307  return _normIntMgr.lastIndex() + 1;
308  }
309 
310  // Create new cache element
311  cache = new CacheElem;
312 
313  // Make list of function projection and normalization integrals
314  _funcIter->Reset();
315  RooAbsReal *func;
316  while ((func = (RooAbsReal *)_funcIter->Next())) {
317  RooAbsReal *funcInt = func->createIntegral(analVars, rangeName);
318  if(funcInt->InheritsFrom(RooRealIntegral::Class())) ((RooRealIntegral*)funcInt)->setAllowComponentSelection(true);
319  cache->_funcIntList.addOwned(*funcInt);
320  if (normSet && normSet->getSize() > 0) {
321  RooAbsReal *funcNorm = func->createIntegral(*normSet);
322  cache->_funcNormList.addOwned(*funcNorm);
323  }
324  }
325 
326  // Store cache element
327  Int_t code = _normIntMgr.setObj(normSet, &analVars, (RooAbsCacheElement *)cache, RooNameReg::ptr(rangeName));
328 
329  if (normSet) {
330  delete normSet;
331  }
332 
333  // cout <<
334  // "RooRealSumFunc("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
335  // << " -> " << code+1 << endl;
336  return code + 1;
337 }
338 
339 //_____________________________________________________________________________
340 Double_t RooRealSumFunc::analyticalIntegralWN(Int_t code, const RooArgSet *normSet2, const char *rangeName) const
341 {
342  // cout <<
343  // "RooRealSumFunc::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
344  // << endl;
345  // Implement analytical integrations by deferring integration of component
346  // functions to integrators of components
347 
348  // Handle trivial passthrough scenario
349  if (code == 0)
350  return getVal(normSet2);
351 
352  // WVE needs adaptation for rangeName feature
353  CacheElem *cache = (CacheElem *)_normIntMgr.getObjByIndex(code - 1);
354  if (cache == 0) { // revive the (sterilized) cache
355  // cout <<
356  // "RooRealSumFunc("<<this<<")::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
357  // << ": reviving cache "<< endl;
358  std::unique_ptr<RooArgSet> vars(getParameters(RooArgSet()));
359  std::unique_ptr<RooArgSet> iset(_normIntMgr.nameSet2ByIndex(code - 1)->select(*vars));
360  std::unique_ptr<RooArgSet> nset(_normIntMgr.nameSet1ByIndex(code - 1)->select(*vars));
362  Int_t code2 = getAnalyticalIntegralWN(*iset, dummy, nset.get(), rangeName);
363  assert(code == code2); // must have revived the right (sterilized) slot...
364  (void)code2;
365  cache = (CacheElem *)_normIntMgr.getObjByIndex(code - 1);
366  assert(cache != 0);
367  }
368 
369  RooFIter funcIntIter = cache->_funcIntList.fwdIterator();
370  RooFIter coefIter = _coefList.fwdIterator();
371  RooFIter funcIter = _funcList.fwdIterator();
372  RooAbsReal *coef(0), *funcInt(0), *func(0);
373  Double_t value(0);
374 
375  // N funcs, N-1 coefficients
376  Double_t lastCoef(1);
377  while ((coef = (RooAbsReal *)coefIter.next())) {
378  funcInt = (RooAbsReal *)funcIntIter.next();
379  func = (RooAbsReal *)funcIter.next();
380  Double_t coefVal = coef->getVal(normSet2);
381  if (coefVal) {
382  assert(func);
383  if (normSet2 == 0 || func->isSelectedComp()) {
384  assert(funcInt);
385  value += funcInt->getVal() * coefVal;
386  }
387  lastCoef -= coef->getVal(normSet2);
388  }
389  }
390 
391  if (!_haveLastCoef) {
392  // Add last func with correct coefficient
393  funcInt = (RooAbsReal *)funcIntIter.next();
394  if (normSet2 == 0 || func->isSelectedComp()) {
395  assert(funcInt);
396  value += funcInt->getVal() * lastCoef;
397  }
398 
399  // Warn about coefficient degeneration
400  if (lastCoef < 0 || lastCoef > 1) {
401  coutW(Eval) << "RooRealSumFunc::evaluate(" << GetName()
402  << " WARNING: sum of FUNC coefficients not in range [0-1], value=" << 1 - lastCoef << endl;
403  }
404  }
405 
406  Double_t normVal(1);
407  if (normSet2 && normSet2->getSize() > 0) {
408  normVal = 0;
409 
410  // N funcs, N-1 coefficients
411  RooAbsReal *funcNorm;
412  RooFIter funcNormIter = cache->_funcNormList.fwdIterator();
413  RooFIter coefIter2 = _coefList.fwdIterator();
414  while ((coef = (RooAbsReal *)coefIter2.next())) {
415  funcNorm = (RooAbsReal *)funcNormIter.next();
416  Double_t coefVal = coef->getVal(normSet2);
417  if (coefVal) {
418  assert(funcNorm);
419  normVal += funcNorm->getVal() * coefVal;
420  }
421  }
422 
423  // Add last func with correct coefficient
424  if (!_haveLastCoef) {
425  funcNorm = (RooAbsReal *)funcNormIter.next();
426  assert(funcNorm);
427  normVal += funcNorm->getVal() * lastCoef;
428  }
429  }
430 
431  return value / normVal;
432 }
433 
434 //_____________________________________________________________________________
435 std::list<Double_t> *RooRealSumFunc::binBoundaries(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
436 {
437  list<Double_t> *sumBinB = 0;
438  Bool_t needClean(kFALSE);
439 
440  RooFIter iter = _funcList.fwdIterator();
441  RooAbsReal *func;
442  // Loop over components pdf
443  while ((func = (RooAbsReal *)iter.next())) {
444 
445  list<Double_t> *funcBinB = func->binBoundaries(obs, xlo, xhi);
446 
447  // Process hint
448  if (funcBinB) {
449  if (!sumBinB) {
450  // If this is the first hint, then just save it
451  sumBinB = funcBinB;
452  } else {
453 
454  list<Double_t> *newSumBinB = new list<Double_t>(sumBinB->size() + funcBinB->size());
455 
456  // Merge hints into temporary array
457  merge(funcBinB->begin(), funcBinB->end(), sumBinB->begin(), sumBinB->end(), newSumBinB->begin());
458 
459  // Copy merged array without duplicates to new sumBinBArrau
460  delete sumBinB;
461  delete funcBinB;
462  sumBinB = newSumBinB;
463  needClean = kTRUE;
464  }
465  }
466  }
467 
468  // Remove consecutive duplicates
469  if (needClean) {
470  list<Double_t>::iterator new_end = unique(sumBinB->begin(), sumBinB->end());
471  sumBinB->erase(new_end, sumBinB->end());
472  }
473 
474  return sumBinB;
475 }
476 
477 //_____________________________________________________________________________B
479 {
480  // If all components that depend on obs are binned that so is the product
481 
482  RooFIter iter = _funcList.fwdIterator();
483  RooAbsReal *func;
484  while ((func = (RooAbsReal *)iter.next())) {
485  if (func->dependsOn(obs) && !func->isBinnedDistribution(obs)) {
486  return kFALSE;
487  }
488  }
489 
490  return kTRUE;
491 }
492 
493 //_____________________________________________________________________________
494 std::list<Double_t> *RooRealSumFunc::plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
495 {
496  list<Double_t> *sumHint = 0;
497  Bool_t needClean(kFALSE);
498 
499  RooFIter iter = _funcList.fwdIterator();
500  RooAbsReal *func;
501  // Loop over components pdf
502  while ((func = (RooAbsReal *)iter.next())) {
503 
504  list<Double_t> *funcHint = func->plotSamplingHint(obs, xlo, xhi);
505 
506  // Process hint
507  if (funcHint) {
508  if (!sumHint) {
509 
510  // If this is the first hint, then just save it
511  sumHint = funcHint;
512 
513  } else {
514 
515  list<Double_t> *newSumHint = new list<Double_t>(sumHint->size() + funcHint->size());
516 
517  // Merge hints into temporary array
518  merge(funcHint->begin(), funcHint->end(), sumHint->begin(), sumHint->end(), newSumHint->begin());
519 
520  // Copy merged array without duplicates to new sumHintArrau
521  delete sumHint;
522  sumHint = newSumHint;
523  needClean = kTRUE;
524  }
525  }
526  }
527 
528  // Remove consecutive duplicates
529  if (needClean) {
530  list<Double_t>::iterator new_end = unique(sumHint->begin(), sumHint->end());
531  sumHint->erase(new_end, sumHint->end());
532  }
533 
534  return sumHint;
535 }
536 
537 //_____________________________________________________________________________
539 {
540  // Label OK'ed components of a RooRealSumFunc with cache-and-track
541  RooFIter siter = funcList().fwdIterator();
542  RooAbsArg *sarg;
543  while ((sarg = siter.next())) {
544  if (sarg->canNodeBeCached() == Always) {
545  trackNodes.add(*sarg);
546  // cout << "tracking node RealSumFunc component " << sarg->IsA()->GetName() << "::" << sarg->GetName() << endl
547  // ;
548  }
549  }
550 }
551 
552 //_____________________________________________________________________________
553 void RooRealSumFunc::printMetaArgs(ostream &os) const
554 {
555  // Customized printing of arguments of a RooRealSumFuncy to more intuitively reflect the contents of the
556  // product operator construction
557 
558  _funcIter->Reset();
559  _coefIter->Reset();
560 
561  Bool_t first(kTRUE);
562 
563  RooAbsArg *coef, *func;
564  if (_coefList.getSize() != 0) {
565  while ((coef = (RooAbsArg *)_coefIter->Next())) {
566  if (!first) {
567  os << " + ";
568  } else {
569  first = kFALSE;
570  }
571  func = (RooAbsArg *)_funcIter->Next();
572  os << coef->GetName() << " * " << func->GetName();
573  }
574  func = (RooAbsArg *)_funcIter->Next();
575  if (func) {
576  os << " + [%] * " << func->GetName();
577  }
578  } else {
579 
580  while ((func = (RooAbsArg *)_funcIter->Next())) {
581  if (!first) {
582  os << " + ";
583  } else {
584  first = kFALSE;
585  }
586  os << func->GetName();
587  }
588  }
589 
590  os << " ";
591 }
RooRealSumFunc::printMetaArgs
void printMetaArgs(std::ostream &os) const
Definition: RooRealSumFunc.cxx:553
RooCacheManager::setObj
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
Definition: RooCacheManager.h:49
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
RooRealSumFunc::_doFloor
Bool_t _doFloor
Iterator over coefficient list.
Definition: RooRealSumFunc.h:97
RooMsgService.h
RooNameReg::ptr
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Definition: RooNameReg.cxx:93
RooFit.h
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
RooRealSumFunc::_normIntMgr
RooObjCacheManager _normIntMgr
Definition: RooRealSumFunc.h:88
RooAbsReal::isBinnedDistribution
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Definition: RooAbsReal.h:313
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
RooRealSumFunc::binBoundaries
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooRealSumFunc.cxx:435
RooAbsCollection::fwdIterator
RooFIter fwdIterator() const
One-time forward iterator.
Definition: RooAbsCollection.h:133
coutE
#define coutE(a)
Definition: RooMsgService.h:33
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
RooCacheManager::nameSet2ByIndex
const RooNameSet * nameSet2ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
Definition: RooCacheManager.h:334
RooAbsReal::isSelectedComp
Bool_t isSelectedComp() const
If true, the current pdf is a selected component (for use in plotting)
Definition: RooAbsReal.cxx:3178
RooAbsReal::_forceNumInt
Bool_t _forceNumInt
Definition: RooAbsReal.h:454
TClass.h
RooRealSumFunc::_doFloorGlobal
static Bool_t _doFloorGlobal
Definition: RooRealSumFunc.h:98
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
RooAbsReal
Definition: RooAbsReal.h:61
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
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
RooRealSumFunc::CacheElem
Definition: RooRealSumFunc.h:75
bool
TIterator
Definition: TIterator.h:30
RooRealIntegral
Definition: RooRealIntegral.h:34
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
RooTrace.h
RooCacheManager::getObjByIndex
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
Definition: RooCacheManager.h:308
TRACE_DESTROY
#define TRACE_DESTROY
Definition: RooTrace.h:24
RooRealSumFunc
Definition: RooRealSumFunc.h:25
RooRealSumFunc::~RooRealSumFunc
virtual ~RooRealSumFunc()
Definition: RooRealSumFunc.cxx:183
RooAddGenContext.h
TIterator.h
RooAbsReal::binBoundaries
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooAbsReal.h:314
RooRealSumFunc::isBinnedDistribution
Bool_t isBinnedDistribution(const RooArgSet &obs) const
Definition: RooRealSumFunc.cxx:478
RooFIter
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
Definition: RooLinkedListIter.h:39
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
RooRealSumFunc::_funcList
RooListProxy _funcList
Definition: RooRealSumFunc.h:92
RooRealSumFunc::_coefList
RooListProxy _coefList
Definition: RooRealSumFunc.h:93
RooPlot.h
RooAbsCollection::createIterator
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
Definition: RooAbsCollection.h:118
RooRealSumFunc::checkObservables
virtual Bool_t checkObservables(const RooArgSet *nset) const
Overloadable function in which derived classes can implement consistency checks of the variables.
Definition: RooRealSumFunc.cxx:247
RooFIter::next
RooAbsArg * next()
Return next element or nullptr if at end.
Definition: RooLinkedListIter.h:49
RooRealProxy.h
RooAbsArg::RooArgSet
friend class RooArgSet
Definition: RooAbsArg.h:579
TRACE_CREATE
#define TRACE_CREATE
Definition: RooTrace.h:23
RooListProxy::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
Definition: RooListProxy.cxx:104
RooRealSumFunc.h
RooCacheManager::nameSet1ByIndex
const RooNameSet * nameSet1ByIndex(Int_t index) const
Retrieve RooNameSet associated with slot at given index.
Definition: RooCacheManager.h:321
RooRealVar.h
RooRealSumFunc::CacheElem::_funcNormList
RooArgList _funcNormList
Definition: RooRealSumFunc.h:86
void
typedef void((*Func_t)())
RooAbsCollection::addOwned
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:389
TIterator::Next
virtual TObject * Next()=0
TIterator::Reset
virtual void Reset()=0
RooRealSumFunc::evaluate
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Definition: RooRealSumFunc.cxx:193
RooRealSumFunc::setCacheAndTrackHints
virtual void setCacheAndTrackHints(RooArgSet &)
Definition: RooRealSumFunc.cxx:538
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
RooRealSumFunc::RooRealSumFunc
RooRealSumFunc()
Definition: RooRealSumFunc.cxx:63
dummy
static RooMathCoreReg dummy
Definition: RooMathCoreReg.cxx:27
RooRealSumFunc::_haveLastCoef
Bool_t _haveLastCoef
Definition: RooRealSumFunc.h:90
RooRealSumFunc::plotSamplingHint
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooRealSumFunc.cxx:494
RooRealSumFunc::getAnalyticalIntegralWN
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=0) const
Variant of getAnalyticalIntegral that is also passed the normalization set that should be applied to ...
Definition: RooRealSumFunc.cxx:282
name
char name[80]
Definition: TGX11.cxx:110
RooAbsArg::dependsOn
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:732
RooCacheManager::lastIndex
Int_t lastIndex() const
Definition: RooCacheManager.h:65
RooAbsArg
Definition: RooAbsArg.h:73
RooAbsArg::canNodeBeCached
virtual CacheMode canNodeBeCached() const
Definition: RooAbsArg.h:410
RooRealSumFunc::_coefIter
TIterator * _coefIter
Iterator over FUNC list.
Definition: RooRealSumFunc.h:95
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
RooRealSumFunc::CacheElem::_funcIntList
RooArgList _funcIntList
Definition: RooRealSumFunc.h:85
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:53
Class
void Class()
Definition: Class.C:29
RooRealSumFunc::_funcIter
TIterator * _funcIter
Definition: RooRealSumFunc.h:94
RooFit::Eval
@ Eval
Definition: RooGlobalFunc.h:68
RooRealSumFunc::funcList
const RooArgList & funcList() const
Definition: RooRealSumFunc.h:57
Riostream.h
RooAbsRealLValue
Definition: RooAbsRealLValue.h:31
RooAbsArg::observableOverlaps
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:801
RooNameReg.h
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
RooRealSumFunc::analyticalIntegralWN
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
Definition: RooRealSumFunc.cxx:340