Logo ROOT  
Reference Guide
RooAddModel.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 RooAddModel
19 ///
20 /// RooAddModel is an efficient implementation of a sum of PDFs of the form
21 /// \f[
22 /// c_1 \cdot \mathrm{PDF}_1 + c_2 \cdot \mathrm{PDF}_2 + ... + c_n \cdot \mathrm{PDF}_n
23 /// \f]
24 /// or
25 /// \f[
26 /// c_1 \cdot \mathrm{PDF}_1 + c_2 \cdot \mathrm{PDF}_2 + ... + \left( 1-\sum_{i=1}^{n-1} c_i \right) \cdot \mathrm{PDF}_n
27 /// \f]
28 /// The first form is for extended likelihood fits, where the
29 /// expected number of events is \f$ \sum_i c_i \f$. The coefficients \f$ c_i \f$
30 /// can either be explicitly provided, or, if all components support
31 /// extended likelihood fits, they can be calculated from the contribution
32 /// of each PDF to the total number of expected events.
33 ///
34 /// In the second form, the sum of the coefficients is enforced to be one,
35 /// and the coefficient of the last PDF is calculated from that condition.
36 ///
37 /// RooAddModel relies on each component PDF to be normalized, and will perform
38 /// no normalization other than calculating the proper last coefficient \f$ c_n \f$, if requested.
39 /// An (enforced) condition for this assumption is that each \f$ \mathrm{PDF}_i \f$ is independent
40 /// of each coefficient \f$ i \f$.
41 ///
42 ///
43 
44 #include "RooAddModel.h"
45 
46 #include "RooFit.h"
47 #include "RooMsgService.h"
48 #include "RooDataSet.h"
49 #include "RooRealProxy.h"
50 #include "RooPlot.h"
51 #include "RooRealVar.h"
52 #include "RooAddGenContext.h"
53 #include "RooRealConstant.h"
54 #include "RooNameReg.h"
55 #include "RooRealIntegral.h"
56 
57 using namespace std;
58 
60 ;
61 
62 
63 ////////////////////////////////////////////////////////////////////////////////
64 
66  _refCoefNorm("!refCoefNorm","Reference coefficient normalization set",this,kFALSE,kFALSE),
67  _refCoefRangeName(0),
68  _projectCoefs(false),
69  _codeReg(10),
70  _snormList(0),
71  _haveLastCoef(false),
72  _allExtendable(false)
73 {
74  _coefCache = new Double_t[10] ;
76 }
77 
78 
79 
80 ////////////////////////////////////////////////////////////////////////////////
81 /// Generic constructor from list of PDFs and list of coefficients.
82 /// Each pdf list element (i) is paired with coefficient list element (i).
83 /// The number of coefficients must be either equal to the number of PDFs,
84 /// in which case extended MLL fitting is enabled, or be one less.
85 ///
86 /// All PDFs must inherit from RooAbsPdf. All coefficients must inherit from RooAbsReal.
87 
88 RooAddModel::RooAddModel(const char *name, const char *title, const RooArgList& inPdfList, const RooArgList& inCoefList, Bool_t ownPdfList) :
89  RooResolutionModel(name,title,(static_cast<RooResolutionModel*>(inPdfList.at(0)))->convVar()),
90  _refCoefNorm("!refCoefNorm","Reference coefficient normalization set",this,kFALSE,kFALSE),
91  _refCoefRangeName(0),
92  _projectCoefs(kFALSE),
93  _projCacheMgr(this,10),
94  _intCacheMgr(this,10),
95  _codeReg(10),
96  _pdfList("!pdfs","List of PDFs",this),
97  _coefList("!coefficients","List of coefficients",this),
98  _haveLastCoef(kFALSE),
99  _allExtendable(kFALSE)
100 {
101  if (inPdfList.getSize()>inCoefList.getSize()+1) {
102  std::stringstream msgSs;
103  msgSs << "RooAddModel::RooAddModel(" << GetName()
104  << ") number of pdfs and coefficients inconsistent, must have Npdf=Ncoef or Npdf=Ncoef+1";
105  const std::string msgStr = msgSs.str();
106  coutE(InputArguments) << msgStr << endl;
107  throw std::runtime_error(msgStr);
108  }
109 
110  // Constructor with N PDFs and N or N-1 coefs
111  auto pdfIter = inPdfList.fwdIterator() ;
112 
113  for(auto const& coef : inCoefList) {
114  auto pdf = pdfIter.next() ;
115  if (!pdf) {
116  std::stringstream msgSs;
117  msgSs << "RooAddModel::RooAddModel(" << GetName()
118  << ") number of pdfs and coefficients inconsistent, must have Npdf=Ncoef or Npdf=Ncoef+1";
119  const std::string msgStr = msgSs.str();
120  coutE(InputArguments) << msgStr << endl;
121  throw std::runtime_error(msgStr);
122  }
123  if (!dynamic_cast<RooAbsReal*>(coef)) {
124  coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") coefficient " << coef->GetName() << " is not of type RooAbsReal, ignored" << endl ;
125  continue ;
126  }
127  if (!dynamic_cast<RooAbsPdf*>(pdf)) {
128  coutE(InputArguments) << "RooAddModel::RooAddModel(" << GetName() << ") pdf " << pdf->GetName() << " is not of type RooAbsPdf, ignored" << endl ;
129  continue ;
130  }
131  _pdfList.add(*pdf) ;
132  _coefList.add(*coef) ;
133  }
134 
135  if (auto pdf = pdfIter.next()) {
136  if (!dynamic_cast<RooAbsPdf*>(pdf)) {
137  std::stringstream msgSs;
138  msgSs << "RooAddModel::RooAddModel(" << GetName() << ") last pdf " << pdf->GetName() << " is not of type RooAbsPdf, fatal error";
139  const std::string msgStr = msgSs.str();
140  coutE(InputArguments) << msgStr << endl;
141  throw std::runtime_error(msgStr);
142  }
143  _pdfList.add(*pdf) ;
144  } else {
146  }
147 
150 
151  if (ownPdfList) {
153  }
154 
155 }
156 
157 
158 
159 ////////////////////////////////////////////////////////////////////////////////
160 /// Copy constructor
161 
162 RooAddModel::RooAddModel(const RooAddModel& other, const char* name) :
163  RooResolutionModel(other,name),
164  _refCoefNorm("!refCoefNorm",this,other._refCoefNorm),
165  _refCoefRangeName((TNamed*)other._refCoefRangeName),
166  _projectCoefs(other._projectCoefs),
167  _projCacheMgr(other._projCacheMgr,this),
168  _intCacheMgr(other._intCacheMgr,this),
169  _codeReg(other._codeReg),
170  _pdfList("!pdfs",this,other._pdfList),
171  _coefList("!coefficients",this,other._coefList),
172  _haveLastCoef(other._haveLastCoef),
173  _allExtendable(other._allExtendable)
174 {
177 }
178 
179 
180 
181 ////////////////////////////////////////////////////////////////////////////////
182 /// Destructor
183 
185 {
186  if (_coefCache) delete[] _coefCache ;
187 }
188 
189 
190 
191 ////////////////////////////////////////////////////////////////////////////////
192 /// By default the interpretation of the fraction coefficients is
193 /// performed in the contextual choice of observables. This makes the
194 /// shape of the p.d.f explicitly dependent on the choice of
195 /// observables. This method instructs RooAddModel to freeze the
196 /// interpretation of the coefficients to be done in the given set of
197 /// observables. If frozen, fractions are automatically transformed
198 /// from the reference normalization set to the contextual normalization
199 /// set by ratios of integrals
200 
202 {
203  if (refCoefNorm.getSize()==0) {
205  return ;
206  }
207  _projectCoefs = kTRUE ;
208 
210  _refCoefNorm.add(refCoefNorm) ;
211 
212  _projCacheMgr.reset() ;
213 }
214 
215 
216 
217 ////////////////////////////////////////////////////////////////////////////////
218 /// By default the interpretation of the fraction coefficients is
219 /// performed in the default range. This make the shape of a RooAddModel
220 /// explicitly dependent on the range of the observables. To allow
221 /// a range independent definition of the fraction this function
222 /// instructs RooAddModel to freeze its interpretation in the given
223 /// named range. If the current normalization range is different
224 /// from the reference range, the appropriate fraction coefficients
225 /// are automically calculation from the reference fractions using
226 /// ratios if integrals
227 
228 void RooAddModel::fixCoefRange(const char* rangeName)
229 {
230  _refCoefRangeName = (TNamed*)RooNameReg::ptr(rangeName) ;
232 }
233 
234 
235 
236 ////////////////////////////////////////////////////////////////////////////////
237 /// Instantiate a clone of this resolution model representing a convolution with given
238 /// basis function. The owners object name is incorporated in the clones name
239 /// to avoid multiple convolution objects with the same name in complex PDF structures.
240 ///
241 /// RooAddModel will clone all the component models to create a composite convolution object
242 
244 {
245  // Check that primary variable of basis functions is our convolution variable
246  if (inBasis->getParameter(0) != x.absArg()) {
247  coutE(InputArguments) << "RooAddModel::convolution(" << GetName()
248  << ") convolution parameter of basis function and PDF don't match" << endl ;
249  ccoutE(InputArguments) << "basis->findServer(0) = " << inBasis->findServer(0) << " " << inBasis->findServer(0)->GetName() << endl ;
250  ccoutE(InputArguments) << "x.absArg() = " << x.absArg() << " " << x.absArg()->GetName() << endl ;
251  inBasis->Print("v") ;
252  return 0 ;
253  }
254 
255  TString newName(GetName()) ;
256  newName.Append("_conv_") ;
257  newName.Append(inBasis->GetName()) ;
258  newName.Append("_[") ;
259  newName.Append(owner->GetName()) ;
260  newName.Append("]") ;
261 
262  TString newTitle(GetTitle()) ;
263  newTitle.Append(" convoluted with basis function ") ;
264  newTitle.Append(inBasis->GetName()) ;
265 
266  RooArgList modelList ;
267  for (auto obj : _pdfList) {
268  auto model = static_cast<RooResolutionModel*>(obj);
269  // Create component convolution
270  RooResolutionModel* conv = model->convolution(inBasis,owner) ;
271  modelList.add(*conv) ;
272  }
273 
274  RooArgList theCoefList ;
275  for (auto coef : _coefList) {
276  theCoefList.add(*coef) ;
277  }
278 
279  RooAddModel* convSum = new RooAddModel(newName,newTitle,modelList,theCoefList,kTRUE) ;
280  for (std::set<std::string>::const_iterator attrIt = _boolAttrib.begin();
281  attrIt != _boolAttrib.end(); ++attrIt) {
282  convSum->setAttribute((*attrIt).c_str()) ;
283  }
284  for (std::map<std::string,std::string>::const_iterator attrIt = _stringAttrib.begin();
285  attrIt != _stringAttrib.end(); ++attrIt) {
286  convSum->setStringAttribute((attrIt->first).c_str(), (attrIt->second).c_str()) ;
287  }
288  convSum->changeBasis(inBasis) ;
289  return convSum ;
290 }
291 
292 
293 
294 ////////////////////////////////////////////////////////////////////////////////
295 /// Return code for basis function representing by 'name' string.
296 /// The basis code of the first component model will be returned,
297 /// if the basis is supported by all components. Otherwise 0
298 /// is returned
299 
300 Int_t RooAddModel::basisCode(const char* name) const
301 {
302  Bool_t first(kTRUE), code(0) ;
303  for (auto obj : _pdfList) {
304  auto model = static_cast<RooResolutionModel*>(obj);
305  Int_t subCode = model->basisCode(name) ;
306  if (first) {
307  code = subCode ;
308  first = kFALSE ;
309  } else if (subCode==0) {
310  code = 0 ;
311  }
312  }
313 
314  return code ;
315 }
316 
317 
318 
319 ////////////////////////////////////////////////////////////////////////////////
320 /// Retrieve cache element with for calculation of p.d.f value with normalization set nset and integrated over iset
321 /// in range 'rangeName'. If cache element does not exist, create and fill it on the fly. The cache contains
322 /// suplemental normalization terms (in case not all added p.d.f.s have the same observables), projection
323 /// integrals to calculated transformed fraction coefficients when a frozen reference frame is provided
324 /// and projection integrals for similar transformations when a frozen reference range is provided.
325 
326 RooAddModel::CacheElem* RooAddModel::getProjCache(const RooArgSet* nset, const RooArgSet* iset, const char* rangeName) const
327 {
328  // Check if cache already exists
329  CacheElem* cache = (CacheElem*) _projCacheMgr.getObj(nset,iset,0,RooNameReg::ptr(rangeName)) ;
330  if (cache) {
331  return cache ;
332  }
333 
334  //Create new cache
335  cache = new CacheElem ;
336 
337  // *** PART 1 : Create supplemental normalization list ***
338 
339  // Retrieve the combined set of dependents of this PDF ;
340  RooArgSet *fullDepList = getObservables(nset) ;
341  if (iset) {
342  fullDepList->remove(*iset,kTRUE,kTRUE) ;
343  }
344 
345  // Fill with dummy unit RRVs for now
346  for (unsigned int i = 0; i < _pdfList.size(); ++i) {
347  auto pdf = static_cast<RooAbsPdf*>(&_pdfList[i]);
348  auto coef = i < _coefList.size() ? &_coefList[i] : nullptr;
349 
350  // Start with full list of dependents
351  RooArgSet supNSet(*fullDepList) ;
352 
353  // Remove PDF dependents
354  RooArgSet* pdfDeps = pdf->getObservables(nset) ;
355  if (pdfDeps) {
356  supNSet.remove(*pdfDeps,kTRUE,kTRUE) ;
357  delete pdfDeps ;
358  }
359 
360  // Remove coef dependents
361  if (coef) {
362  RooArgSet* coefDeps = coef->getObservables(nset);
363  supNSet.remove(*coefDeps,kTRUE,kTRUE) ;
364  delete coefDeps ;
365  }
366 
367  RooAbsReal* snorm ;
368  TString name(GetName()) ;
369  name.Append("_") ;
370  name.Append(pdf->GetName()) ;
371  name.Append("_SupNorm") ;
372  if (supNSet.getSize()>0) {
373  snorm = new RooRealIntegral(name,"Supplemental normalization integral",RooRealConstant::value(1.0),supNSet) ;
374  } else {
375  snorm = new RooRealVar(name,"Unit Supplemental normalization integral",1.0) ;
376  }
377  cache->_suppNormList.addOwned(*snorm) ;
378  }
379 
380  delete fullDepList ;
381 
382  if (_verboseEval>1) {
383  cxcoutD(Caching) << "RooAddModel::syncSuppNormList(" << GetName() << ") synching supplemental normalization list for norm" << (nset?*nset:RooArgSet()) << endl ;
384  if (dologD(Caching)) {
385  cache->_suppNormList.Print("v") ;
386  }
387  }
388 
389 
390  // *** PART 2 : Create projection coefficients ***
391 
392  // If no projections required stop here
393  if (!_projectCoefs || _basis!=0 ) {
394  _projCacheMgr.setObj(nset,iset,cache,RooNameReg::ptr(rangeName)) ;
395  return cache ;
396  }
397 
398 
399  // Reduce iset/nset to actual dependents of this PDF
400  RooArgSet* nset2 = nset ? getObservables(nset) : new RooArgSet() ;
401 
402  // Check if requested transformation is not identity
403  if (!nset2->equals(_refCoefNorm) || _refCoefRangeName !=0 || rangeName !=0 ) {
404 
405  coutI(Caching) << "RooAddModel::syncCoefProjList(" << GetName() << ") creating coefficient projection integrals" << endl ;
406  ccoutI(Caching) << " from current normalization: " ; nset2->Print("1") ;
407  ccoutI(Caching) << " with current range: " << (rangeName?rangeName:"<none>") << endl ;
408  ccoutI(Caching) << " to reference normalization: " ; _refCoefNorm.Print("1") ;
409  ccoutI(Caching) << " with reference range: " << (_refCoefRangeName?RooNameReg::str(_refCoefRangeName):"<none>") << endl ;
410 
411  // Recalculate projection integrals of PDFs
412  for (const auto obj : _pdfList) {
413  const auto thePdf = static_cast<RooAbsPdf*>(obj);
414 
415  // Calculate projection integral
416  RooAbsReal* pdfProj ;
417  if (!nset2->equals(_refCoefNorm)) {
418  pdfProj = thePdf->createIntegral(*nset2,_refCoefNorm) ;
419  pdfProj->setOperMode(operMode()) ;
420  } else {
421  TString name(GetName()) ;
422  name.Append("_") ;
423  name.Append(thePdf->GetName()) ;
424  name.Append("_ProjectNorm") ;
425  pdfProj = new RooRealVar(name,"Unit Projection normalization integral",1.0) ;
426  }
427 
428  cache->_projList.addOwned(*pdfProj) ;
429 
430  // Calculation optional supplemental normalization term
431  RooArgSet supNormSet(_refCoefNorm) ;
432  RooArgSet* deps = thePdf->getParameters(RooArgSet()) ;
433  supNormSet.remove(*deps,kTRUE,kTRUE) ;
434  delete deps ;
435 
436  RooAbsReal* snorm ;
437  TString name(GetName()) ;
438  name.Append("_") ;
439  name.Append(thePdf->GetName()) ;
440  name.Append("_ProjSupNorm") ;
441  if (supNormSet.getSize()>0) {
442  snorm = new RooRealIntegral(name,"Projection Supplemental normalization integral",
443  RooRealConstant::value(1.0),supNormSet) ;
444  } else {
445  snorm = new RooRealVar(name,"Unit Projection Supplemental normalization integral",1.0) ;
446  }
447  cache->_suppProjList.addOwned(*snorm) ;
448 
449  // Calculate reference range adjusted projection integral
450  RooAbsReal* rangeProj1 ;
453  rangeProj1->setOperMode(operMode()) ;
454  } else {
455  TString theName(GetName()) ;
456  theName.Append("_") ;
457  theName.Append(thePdf->GetName()) ;
458  theName.Append("_RangeNorm1") ;
459  rangeProj1 = new RooRealVar(theName,"Unit range normalization integral",1.0) ;
460  }
461  cache->_refRangeProjList.addOwned(*rangeProj1) ;
462 
463 
464  // Calculate range adjusted projection integral
465  RooAbsReal* rangeProj2 ;
466  if (rangeName && _refCoefNorm.getSize()>0) {
467  rangeProj2 = thePdf->createIntegral(_refCoefNorm,_refCoefNorm,rangeName) ;
468  rangeProj2->setOperMode(operMode()) ;
469  } else {
470  TString theName(GetName()) ;
471  theName.Append("_") ;
472  theName.Append(thePdf->GetName()) ;
473  theName.Append("_RangeNorm2") ;
474  rangeProj2 = new RooRealVar(theName,"Unit range normalization integral",1.0) ;
475  }
476  cache->_rangeProjList.addOwned(*rangeProj2) ;
477 
478  }
479 
480  }
481 
482  delete nset2 ;
483 
484  _projCacheMgr.setObj(nset,iset,cache,RooNameReg::ptr(rangeName)) ;
485 
486  return cache ;
487 }
488 
489 
490 
491 ////////////////////////////////////////////////////////////////////////////////
492 /// Update the coefficient values in the given cache element: calculate new remainder
493 /// fraction, normalize fractions obtained from extended ML terms to unity and
494 /// multiply these the various range and dimensional corrections needed in the
495 /// current use context
496 
497 void RooAddModel::updateCoefficients(CacheElem& cache, const RooArgSet* nset) const
498 {
499  // cxcoutD(ChangeTracking) << "RooAddModel::updateCoefficients(" << GetName() << ") update coefficients" << endl ;
500 
501  Int_t i ;
502 
503  // Straight coefficients
504  if (_allExtendable) {
505 
506  // coef[i] = expectedEvents[i] / SUM(expectedEvents)
507  Double_t coefSum(0) ;
508  for (i=0 ; i<_pdfList.getSize() ; i++) {
510  coefSum += _coefCache[i] ;
511  }
512  if (coefSum==0.) {
513  coutW(Eval) << "RooAddModel::updateCoefCache(" << GetName() << ") WARNING: total number of expected events is 0" << endl ;
514  } else {
515  for (i=0 ; i<_pdfList.getSize() ; i++) {
516  _coefCache[i] /= coefSum ;
517  }
518  }
519 
520  } else {
521  if (_haveLastCoef) {
522 
523  // coef[i] = coef[i] / SUM(coef)
524  Double_t coefSum(0) ;
525  for (i=0 ; i<_coefList.getSize() ; i++) {
526  _coefCache[i] = ((RooAbsPdf*)_coefList.at(i))->getVal(nset) ;
527  coefSum += _coefCache[i] ;
528  }
529  for (i=0 ; i<_coefList.getSize() ; i++) {
530  _coefCache[i] /= coefSum ;
531  }
532  } else {
533 
534  // coef[i] = coef[i] ; coef[n] = 1-SUM(coef[0...n-1])
535  Double_t lastCoef(1) ;
536  for (i=0 ; i<_coefList.getSize() ; i++) {
537  _coefCache[i] = ((RooAbsPdf*)_coefList.at(i))->getVal(nset) ;
538  cxcoutD(Caching) << "SYNC: orig coef[" << i << "] = " << _coefCache[i] << endl ;
539  lastCoef -= _coefCache[i] ;
540  }
541  _coefCache[_coefList.getSize()] = lastCoef ;
542  cxcoutD(Caching) << "SYNC: orig coef[" << _coefList.getSize() << "] = " << _coefCache[_coefList.getSize()] << endl ;
543 
544 
545  // Warn about coefficient degeneration
546  if ((lastCoef<-1e-05 || (lastCoef-1)>1e-5) && _coefErrCount-->0) {
547  coutW(Eval) << "RooAddModel::updateCoefCache(" << GetName()
548  << " WARNING: sum of PDF coefficients not in range [0-1], value="
549  << 1-lastCoef << endl ;
550  if (_coefErrCount==0) {
551  coutW(Eval) << " (no more will be printed)" << endl ;
552  }
553  }
554  }
555  }
556 
557 
558 
559  // Stop here if not projection is required or needed
560  if ((!_projectCoefs) || cache._projList.getSize()==0) {
561  // cout << "SYNC no projection required rangeName = " << (rangeName?rangeName:"<none>") << endl ;
562  return ;
563  }
564 
565  // Adjust coefficients for given projection
566  Double_t coefSum(0) ;
567  for (i=0 ; i<_pdfList.getSize() ; i++) {
568  GlobalSelectComponentRAII compRAII(true);
569 
570  RooAbsReal* pp = ((RooAbsReal*)cache._projList.at(i)) ;
571  RooAbsReal* sn = ((RooAbsReal*)cache._suppProjList.at(i)) ;
572  RooAbsReal* r1 = ((RooAbsReal*)cache._refRangeProjList.at(i)) ;
573  RooAbsReal* r2 = ((RooAbsReal*)cache._rangeProjList.at(i)) ;
574 
575  if (dologD(Eval)) {
576  cxcoutD(Eval) << "pp = " << pp->GetName() << endl
577  << "sn = " << sn->GetName() << endl
578  << "r1 = " << r1->GetName() << endl
579  << "r2 = " << r2->GetName() << endl ;
582  }
583 
584  Double_t proj = pp->getVal()/sn->getVal()*(r2->getVal()/r1->getVal()) ;
585 
586  _coefCache[i] *= proj ;
587  coefSum += _coefCache[i] ;
588  }
589  for (i=0 ; i<_pdfList.getSize() ; i++) {
590  _coefCache[i] /= coefSum ;
591 // cout << "POST-SYNC coef[" << i << "] = " << _coefCache[i] << endl ;
592  }
593 
594 
595 
596 }
597 
598 
599 
600 ////////////////////////////////////////////////////////////////////////////////
601 /// Calculate the current value
602 
604 {
605  const RooArgSet* nset = _normSet ;
606  CacheElem* cache = getProjCache(nset) ;
607 
608  updateCoefficients(*cache,nset) ;
609 
610 
611  // Do running sum of coef/pdf pairs, calculate lastCoef.
612  Double_t snormVal ;
613  Double_t value(0) ;
614  Int_t i(0) ;
615  for (auto obj : _pdfList) {
616  auto pdf = static_cast<RooAbsPdf*>(obj);
617 
618  if (_coefCache[i]!=0.) {
619  snormVal = nset ? ((RooAbsReal*)cache->_suppNormList.at(i))->getVal() : 1.0 ;
620  Double_t pdfVal = pdf->getVal(nset) ;
621  // Double_t pdfNorm = pdf->getNorm(nset) ;
622  if (pdf->isSelectedComp()) {
623  value += pdfVal*_coefCache[i]/snormVal ;
624  cxcoutD(Eval) << "RooAddModel::evaluate(" << GetName() << ") value += ["
625  << pdf->GetName() << "] " << pdfVal << " * " << _coefCache[i] << " / " << snormVal << endl ;
626  }
627  }
628  i++ ;
629  }
630 
631  return value ;
632 }
633 
634 
635 
636 ////////////////////////////////////////////////////////////////////////////////
637 /// Reset error counter to given value, limiting the number
638 /// of future error messages for this pdf to 'resetValue'
639 
641 {
642  RooAbsPdf::resetErrorCounters(resetValue) ;
643  _coefErrCount = resetValue ;
644 }
645 
646 
647 
648 ////////////////////////////////////////////////////////////////////////////////
649 /// Check if PDF is valid for given normalization set.
650 /// Coeffient and PDF must be non-overlapping, but pdf-coefficient
651 /// pairs may overlap each other
652 
654 {
655  Bool_t ret(kFALSE) ;
656 
657  for (unsigned int i = 0; i < _coefList.size(); ++i) {
658  auto pdf = &_pdfList[i];
659  auto coef = &_coefList[i];
660 
661  if (pdf->observableOverlaps(nset,*coef)) {
662  coutE(InputArguments) << "RooAddModel::checkObservables(" << GetName() << "): ERROR: coefficient " << coef->GetName()
663  << " and PDF " << pdf->GetName() << " have one or more dependents in common" << endl ;
664  ret = kTRUE ;
665  }
666  }
667 
668  return ret ;
669 }
670 
671 
672 
673 ////////////////////////////////////////////////////////////////////////////////
674 
676  const RooArgSet* normSet, const char* rangeName) const
677 {
678  if (_forceNumInt) return 0 ;
679 
680  // Declare that we can analytically integrate all requested observables
681  analVars.add(allVars) ;
682 
683  // Retrieve (or create) the required component integral list
684  Int_t code ;
685  RooArgList *cilist ;
686  getCompIntList(normSet,&allVars,cilist,code,rangeName) ;
687 
688  return code+1 ;
689 
690 }
691 
692 
693 
694 ////////////////////////////////////////////////////////////////////////////////
695 /// Check if this configuration was created before
696 
697 void RooAddModel::getCompIntList(const RooArgSet* nset, const RooArgSet* iset, pRooArgList& compIntList, Int_t& code, const char* isetRangeName) const
698 {
699  Int_t sterileIdx(-1) ;
700 
701  IntCacheElem* cache = (IntCacheElem*) _intCacheMgr.getObj(nset,iset,&sterileIdx,RooNameReg::ptr(isetRangeName)) ;
702  if (cache) {
703  code = _intCacheMgr.lastIndex() ;
704  compIntList = &cache->_intList ;
705 
706  return ;
707  }
708 
709  // Create containers for partial integral components to be generated
710  cache = new IntCacheElem ;
711 
712  // Fill Cache
713  for (auto obj : _pdfList) {
714  auto model = static_cast<RooResolutionModel*>(obj);
715 
716  RooAbsReal* intPdf = model->createIntegral(*iset,nset,0,isetRangeName) ;
717  cache->_intList.addOwned(*intPdf) ;
718  }
719 
720  // Store the partial integral list and return the assigned code ;
721  code = _intCacheMgr.setObj(nset,iset,(RooAbsCacheElement*)cache,RooNameReg::ptr(isetRangeName)) ;
722 
723  // Fill references to be returned
724  compIntList = &cache->_intList ;
725 }
726 
727 
728 
729 ////////////////////////////////////////////////////////////////////////////////
730 /// Return analytical integral defined by given scenario code
731 
732 Double_t RooAddModel::analyticalIntegralWN(Int_t code, const RooArgSet* normSet, const char* rangeName) const
733 {
734  // No integration scenario
735  if (code==0) {
736  return getVal(normSet) ;
737  }
738 
739  // Partial integration scenarios
741 
742  RooArgList* compIntList ;
743 
744  // If cache has been sterilized, revive this slot
745  if (cache==0) {
746  std::unique_ptr<RooArgSet> vars{getParameters(RooArgSet())} ;
747  RooArgSet nset = _intCacheMgr.selectFromSet1(*vars, code-1) ;
748  RooArgSet iset = _intCacheMgr.selectFromSet2(*vars, code-1) ;
749 
750  int code2 = -1 ;
751  getCompIntList(&nset,&iset,compIntList,code2,rangeName) ;
752  } else {
753 
754  compIntList = &cache->_intList ;
755 
756  }
757 
758  // Calculate the current value
759  const RooArgSet* nset = _normSet ;
760  CacheElem* pcache = getProjCache(nset) ;
761 
762  updateCoefficients(*pcache,nset) ;
763 
764  // Do running sum of coef/pdf pairs, calculate lastCoef.
765  Double_t snormVal ;
766  Double_t value(0) ;
767  Int_t i(0) ;
768  for (const auto obj : *compIntList) {
769  auto pdfInt = static_cast<const RooAbsReal*>(obj);
770  if (_coefCache[i]!=0.) {
771  snormVal = nset ? ((RooAbsReal*)pcache->_suppNormList.at(i))->getVal() : 1.0 ;
772  Double_t intVal = pdfInt->getVal(nset) ;
773  value += intVal*_coefCache[i]/snormVal ;
774  cxcoutD(Eval) << "RooAddModel::evaluate(" << GetName() << ") value += ["
775  << pdfInt->GetName() << "] " << intVal << " * " << _coefCache[i] << " / " << snormVal << endl ;
776  }
777  i++ ;
778  }
779 
780  return value ;
781 
782 }
783 
784 
785 
786 ////////////////////////////////////////////////////////////////////////////////
787 /// Return the number of expected events, which is either the sum of all coefficients
788 /// or the sum of the components extended terms
789 
791 {
792  Double_t expectedTotal(0.0);
793 
794  if (_allExtendable) {
795 
796  // Sum of the extended terms
797  for (auto obj : _pdfList) {
798  auto pdf = static_cast<RooAbsPdf*>(obj);
799  expectedTotal += pdf->expectedEvents(nset) ;
800  }
801 
802  } else {
803 
804  // Sum the coefficients
805  for (const auto obj : _coefList) {
806  auto coef = static_cast<RooAbsReal*>(obj);
807  expectedTotal += coef->getVal() ;
808  }
809  }
810 
811  return expectedTotal;
812 }
813 
814 
815 
816 ////////////////////////////////////////////////////////////////////////////////
817 /// Interface function used by test statistics to freeze choice of observables
818 /// for interpretation of fraction coefficients
819 
821 {
822  if (!force && _refCoefNorm.getSize()!=0) {
823  return ;
824  }
825 
826  if (!depSet) {
828  return ;
829  }
830 
831  RooArgSet* myDepSet = getObservables(depSet) ;
832  fixCoefNormalization(*myDepSet) ;
833  delete myDepSet ;
834 }
835 
836 
837 
838 ////////////////////////////////////////////////////////////////////////////////
839 /// Interface function used by test statistics to freeze choice of range
840 /// for interpretation of fraction coefficients
841 
842 void RooAddModel::selectNormalizationRange(const char* rangeName, Bool_t force)
843 {
844  if (!force && _refCoefRangeName) {
845  return ;
846  }
847 
848  fixCoefRange(rangeName) ;
849 }
850 
851 
852 
853 ////////////////////////////////////////////////////////////////////////////////
854 /// Return specialized context to efficiently generate toy events from RooAddModels.
855 
857  const RooArgSet* auxProto, Bool_t verbose) const
858 {
859  return new RooAddGenContext(*this,vars,prototype,auxProto,verbose) ;
860 }
861 
862 
863 
864 ////////////////////////////////////////////////////////////////////////////////
865 /// Direct generation is safe if all components say so
866 
868 {
869  for (auto obj : _pdfList) {
870  auto pdf = static_cast<RooAbsPdf*>(obj);
871 
872  if (!pdf->isDirectGenSafe(arg)) {
873  return kFALSE ;
874  }
875  }
876  return kTRUE ;
877 }
878 
879 
880 
881 ////////////////////////////////////////////////////////////////////////////////
882 /// Return pseud-code that indicates if all components can do internal generation (1) or not (0)
883 
884 Int_t RooAddModel::getGenerator(const RooArgSet& directVars, RooArgSet &/*generateVars*/, Bool_t /*staticInitOK*/) const
885 {
886  for (auto obj : _pdfList) {
887  auto pdf = static_cast<RooAbsPdf*>(obj);
888 
889  RooArgSet tmp ;
890  if (pdf->getGenerator(directVars,tmp)==0) {
891  return 0 ;
892  }
893  }
894  return 1 ;
895 }
896 
897 
898 
899 
900 ////////////////////////////////////////////////////////////////////////////////
901 /// This function should never be called as RooAddModel implements a custom generator context
902 
904 {
905  assert(0) ;
906 }
907 
908 
909 
910 
911 ////////////////////////////////////////////////////////////////////////////////
912 /// List all RooAbsArg derived contents in this cache element
913 
915 {
916  RooArgList allNodes;
917  allNodes.add(_projList) ;
918  allNodes.add(_suppProjList) ;
919  allNodes.add(_refRangeProjList) ;
920  allNodes.add(_rangeProjList) ;
921 
922  return allNodes ;
923 }
924 
925 
926 
927 ////////////////////////////////////////////////////////////////////////////////
928 /// List all RooAbsArg derived contents in this cache element
929 
931 {
932  RooArgList allNodes(_intList) ;
933  return allNodes ;
934 }
935 
936 
937 ////////////////////////////////////////////////////////////////////////////////
938 /// Customized printing of arguments of a RooAddModel to more intuitively reflect the contents of the
939 /// product operator construction
940 
941 void RooAddModel::printMetaArgs(ostream& os) const
942 {
943  Bool_t first(kTRUE) ;
944 
945  os << "(" ;
946  for (unsigned int i=0; i < _coefList.size(); ++i) {
947  auto coef = &_coefList[i];
948  auto pdf = &_pdfList[i];
949  if (!first) {
950  os << " + " ;
951  } else {
952  first = kFALSE ;
953  }
954  os << coef->GetName() << " * " << pdf->GetName() ;
955  }
956  if (_pdfList.size() > _coefList.size()) {
957  os << " + [%] * " << _pdfList[_pdfList.size()-1].GetName() ;
958  }
959  os << ") " ;
960 }
961 
RooCacheManager::reset
void reset()
Clear the cache.
Definition: RooCacheManager.h:193
RooAbsPdf::_normSet
RooArgSet * _normSet
Normalization integral (owned by _normMgr)
Definition: RooAbsPdf.h:325
RooCacheManager::setObj
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
Definition: RooCacheManager.h:50
RooAbsPdf::CacheElem
friend class CacheElem
Definition: RooAbsPdf.h:336
first
Definition: first.py:1
RooAddModel::_haveLastCoef
Bool_t _haveLastCoef
List of supplemental normalization factors.
Definition: RooAddModel.h:132
RooAddModel::_coefCache
Double_t * _coefCache
Definition: RooAddModel.h:94
RooAbsArg::operMode
OperMode operMode() const
Query the operation mode of this node.
Definition: RooAbsArg.h:484
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:100
e
#define e(i)
Definition: RSha256.hxx:103
RooAddModel.h
RooMsgService.h
ccoutD
#define ccoutD(a)
Definition: RooMsgService.h:37
RooNameReg::ptr
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Definition: RooNameReg.cxx:93
RooAbsArg::_boolAttrib
std::set< std::string > _boolAttrib
Definition: RooAbsArg.h:633
RooFit.h
RooFit::InputArguments
@ InputArguments
Definition: RooGlobalFunc.h:61
RooAddModel::checkObservables
virtual Bool_t checkObservables(const RooArgSet *nset) const
Check if PDF is valid for given normalization set.
Definition: RooAddModel.cxx:653
RooAbsArg::getParameters
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...
Definition: RooAbsArg.cxx:578
RooCacheManager::getObj
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
Definition: RooCacheManager.h:45
RooResolutionModel::_basis
RooFormulaVar * _basis
Definition: RooResolutionModel.h:74
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:548
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
RooAddModel::_refCoefRangeName
TNamed * _refCoefRangeName
Reference observable set for coefficient interpretation.
Definition: RooAddModel.h:91
RooAbsArg::Print
virtual void Print(Option_t *options=0) const
Print the object to the defaultPrintStream().
Definition: RooAbsArg.h:322
RooAddModel::fixCoefRange
void fixCoefRange(const char *rangeName)
By default the interpretation of the fraction coefficients is performed in the default range.
Definition: RooAddModel.cxx:228
RooAddModel::_coefList
RooListProxy _coefList
Definition: RooAddModel.h:129
RooAbsCollection::fwdIterator
RooFIter fwdIterator() const
One-time forward iterator.
Definition: RooAbsCollection.h:193
RooAddModel::_pdfList
RooListProxy _pdfList
Registry of component analytical integration codes.
Definition: RooAddModel.h:128
coutE
#define coutE(a)
Definition: RooMsgService.h:33
coutW
#define coutW(a)
Definition: RooMsgService.h:32
RooArgList
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:21
RooRealConstant::value
static RooConstVar & value(Double_t value)
Return a constant value object with given value.
Definition: RooRealConstant.cxx:52
RooAddModel::_refCoefNorm
RooSetProxy _refCoefNorm
Definition: RooAddModel.h:90
RooAddModel::basisCode
virtual Int_t basisCode(const char *name) const
Return code for basis function representing by 'name' string.
Definition: RooAddModel.cxx:300
RooAbsReal::getVal
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:91
RooAddModel::analyticalIntegralWN
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Return analytical integral defined by given scenario code.
Definition: RooAddModel.cxx:732
RooAddModel::~RooAddModel
virtual ~RooAddModel()
Destructor.
Definition: RooAddModel.cxx:184
RooAbsCollection::remove
virtual Bool_t remove(const RooAbsArg &var, Bool_t silent=kFALSE, Bool_t matchByNameOnly=kFALSE)
Remove the specified argument from our list.
Definition: RooAbsCollection.cxx:585
RooAbsArg::setOperMode
void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE)
Set the operation mode of this node.
Definition: RooAbsArg.cxx:1817
RooAddModel::CacheElem::_suppNormList
RooArgList _suppNormList
Definition: RooAddModel.h:99
RooAddModel::expectedEvents
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events for extended likelihood calculation, which is the sum of all coeffic...
Definition: RooAddModel.cxx:790
RooAbsReal::_forceNumInt
Bool_t _forceNumInt
Definition: RooAbsReal.h:480
coutI
#define coutI(a)
Definition: RooMsgService.h:30
RooAbsArg::printCompactTree
void printCompactTree(const char *indent="", const char *fileName=0, const char *namePat=0, RooAbsArg *client=0)
Print tree structure of expression tree on stdout, or to file if filename is specified.
Definition: RooAbsArg.cxx:1844
RooAbsReal
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:61
RooArgList::at
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
Definition: RooArgList.h:72
RooCacheManager::selectFromSet2
RooArgSet selectFromSet2(RooArgSet const &argSet, int index) const
Create RooArgSet contatining the objects that are both in the cached set 2.
Definition: RooCacheManager.h:333
RooAbsCacheElement
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Definition: RooAbsCacheElement.h:26
TString
Basic string class.
Definition: TString.h:136
RooAbsCollection::GetName
const char * GetName() const
Returns name of object.
Definition: RooAbsCollection.h:286
RooDataSet.h
bool
RooAbsReal::GlobalSelectComponentRAII
Definition: RooAbsReal.h:562
RooAddModel::getGenerator
Int_t getGenerator(const RooArgSet &directVars, RooArgSet &generateVars, Bool_t staticInitOK=kTRUE) const
Return pseud-code that indicates if all components can do internal generation (1) or not (0)
Definition: RooAddModel.cxx:884
RooAddModel::printMetaArgs
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooAddModel to more intuitively reflect the contents of the pro...
Definition: RooAddModel.cxx:941
RooAbsPdf::_errorCount
Int_t _errorCount
Definition: RooAbsPdf.h:346
RooResolutionModel::convolution
virtual RooResolutionModel * convolution(RooFormulaVar *basis, RooAbsArg *owner) const
Instantiate a clone of this resolution model representing a convolution with given basis function.
Definition: RooResolutionModel.cxx:154
ccoutI
#define ccoutI(a)
Definition: RooMsgService.h:38
RooAddModel::IntCacheElem::containedArgs
virtual RooArgList containedArgs(Action)
List all RooAbsArg derived contents in this cache element.
Definition: RooAddModel.cxx:930
RooAbsArg::setStringAttribute
void setStringAttribute(const Text_t *key, const Text_t *value)
Associate string 'value' to this object under key 'key'.
Definition: RooAbsArg.cxx:323
RooAddModel::getCompIntList
void getCompIntList(const RooArgSet *nset, const RooArgSet *iset, pRooArgList &compIntList, Int_t &code, const char *isetRangeName) const
Check if this configuration was created before.
Definition: RooAddModel.cxx:697
RooPrintable::kName
@ kName
Definition: RooPrintable.h:33
RooCacheManager::getObjByIndex
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
Definition: RooCacheManager.h:310
RooFormulaVar
A RooFormulaVar is a generic implementation of a real-valued object, which takes a RooArgList of serv...
Definition: RooFormulaVar.h:30
RooResolutionModel::x
RooTemplateProxy< RooAbsRealLValue > x
Definition: RooResolutionModel.h:65
RooResolutionModel
RooResolutionModel is the base class for PDFs that represent a resolution model that can be convolute...
Definition: RooResolutionModel.h:26
RooAddModel::genContext
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t verbose=kFALSE) const
Return specialized context to efficiently generate toy events from RooAddModels.
Definition: RooAddModel.cxx:856
RooAddModel::evaluate
Double_t evaluate() const
Calculate the current value.
Definition: RooAddModel.cxx:603
RooAddModel::CacheElem::_rangeProjList
RooArgList _rangeProjList
Definition: RooAddModel.h:106
RooAddGenContext.h
RooFormulaVar::getParameter
RooAbsArg * getParameter(const char *name) const
Return pointer to parameter with given name.
Definition: RooFormulaVar.h:42
Double_t
TNamed
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
RooAddModel::updateCoefficients
void updateCoefficients(CacheElem &cache, const RooArgSet *nset) const
Update the coefficient values in the given cache element: calculate new remainder fraction,...
Definition: RooAddModel.cxx:497
RooArgProxy::absArg
RooAbsArg * absArg() const
Definition: RooArgProxy.h:37
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:101
TString::Append
TString & Append(const char *cs)
Definition: TString.h:564
RooAddModel::selectNormalization
virtual void selectNormalization(const RooArgSet *depSet=0, Bool_t force=kFALSE)
Interface function used by test statistics to freeze choice of observables for interpretation of frac...
Definition: RooAddModel.cxx:820
RooPlot.h
RooFIter::next
RooAbsArg * next()
Return next element or nullptr if at end.
Definition: RooLinkedListIter.h:49
RooPrintable::kArgs
@ kArgs
Definition: RooPrintable.h:33
RooRealProxy.h
RooAbsArg::RooArgSet
friend class RooArgSet
Definition: RooAbsArg.h:599
RooAbsGenContext
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
Definition: RooAbsGenContext.h:26
RooAbsCollection::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:455
RooAbsCollection::size
Storage_t::size_type size() const
Definition: RooAbsCollection.h:214
RooPrintable::kValue
@ kValue
Definition: RooPrintable.h:33
RooAddModel::_ownedComps
RooArgSet _ownedComps
Coefficient error counter.
Definition: RooAddModel.h:137
RooRealVar.h
RooAddModel::getProjCache
CacheElem * getProjCache(const RooArgSet *nset, const RooArgSet *iset=0, const char *rangeName=0) const
Retrieve cache element with for calculation of p.d.f value with normalization set nset and integrated...
Definition: RooAddModel.cxx:326
RooAddModel::CacheElem::_refRangeProjList
RooArgList _refRangeProjList
Definition: RooAddModel.h:105
RooAbsCollection::addOwned
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Definition: RooAbsCollection.cxx:403
ccoutE
#define ccoutE(a)
Definition: RooMsgService.h:41
RooAddModel::IntCacheElem::_intList
RooArgList _intList
Definition: RooAddModel.h:119
RooAddModel::convolution
virtual RooResolutionModel * convolution(RooFormulaVar *basis, RooAbsArg *owner) const
Instantiate a clone of this resolution model representing a convolution with given basis function.
Definition: RooAddModel.cxx:243
RooSetProxy::removeAll
virtual void removeAll() override
Remove all argument inset using remove(const RooAbsArg&).
Definition: RooSetProxy.cxx:229
RooAddModel::CacheElem
Transiet cache with transformed values of coefficients.
Definition: RooAddModel.h:97
RooAddModel::CacheElem::containedArgs
virtual RooArgList containedArgs(Action)
List all RooAbsArg derived contents in this cache element.
Definition: RooAddModel.cxx:914
RooAddModel::RooAddGenContext
friend class RooAddGenContext
Definition: RooAddModel.h:83
RooAddModel::_projectCoefs
Bool_t _projectCoefs
Reference range name for coefficient interpreation.
Definition: RooAddModel.h:93
RooAbsArg::getObservables
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:295
RooAddModel::IntCacheElem
Definition: RooAddModel.h:117
RooAddModel::RooAddModel
RooAddModel()
Definition: RooAddModel.cxx:65
RooAbsCollection::equals
Bool_t equals(const RooAbsCollection &otherColl) const
Check if this and other collection have identically-named contents.
Definition: RooAbsCollection.cxx:775
RooAddModel::_intCacheMgr
RooObjCacheManager _intCacheMgr
Definition: RooAddModel.h:124
RooAddModel::_coefErrCount
Int_t _coefErrCount
Definition: RooAddModel.h:135
RooAddModel::isDirectGenSafe
Bool_t isDirectGenSafe(const RooAbsArg &arg) const
Direct generation is safe if all components say so.
Definition: RooAddModel.cxx:867
RooAddModel
RooAddModel is an efficient implementation of a sum of PDFs of the form.
Definition: RooAddModel.h:26
RooAbsCacheElement::Action
Action
Definition: RooAbsCacheElement.h:39
RooAbsArg::_stringAttrib
std::map< std::string, std::string > _stringAttrib
Definition: RooAbsArg.h:634
RooAddModel::resetErrorCounters
virtual void resetErrorCounters(Int_t resetValue=10)
Reset error counter to given value, limiting the number of future error messages for this pdf to 'res...
Definition: RooAddModel.cxx:640
RooAbsArg::setAttribute
void setAttribute(const Text_t *name, Bool_t value=kTRUE)
Set (default) or clear a named boolean attribute of this object.
Definition: RooAbsArg.cxx:291
RooNameReg::str
static const char * str(const TNamed *ptr)
Return C++ string corresponding to given TNamed pointer.
Definition: RooNameReg.cxx:103
RooAbsPdf::_verboseEval
static Int_t _verboseEval
Definition: RooAbsPdf.h:318
RooAddModel::generateEvent
void generateEvent(Int_t code)
This function should never be called as RooAddModel implements a custom generator context.
Definition: RooAddModel.cxx:903
name
char name[80]
Definition: TGX11.cxx:110
RooPrintable::printStream
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
Definition: RooPrintable.cxx:75
genreflex::verbose
bool verbose
Definition: rootcling_impl.cxx:133
RooPrintable::kSingleLine
@ kSingleLine
Definition: RooPrintable.h:34
RooAddModel::_projCacheMgr
RooObjCacheManager _projCacheMgr
Definition: RooAddModel.h:111
RooFit::Caching
@ Caching
Definition: RooGlobalFunc.h:61
RooDataSet
RooDataSet is a container class to hold unbinned data.
Definition: RooDataSet.h:33
RooCacheManager::lastIndex
Int_t lastIndex() const
Definition: RooCacheManager.h:66
dologD
#define dologD(a)
Definition: RooMsgService.h:65
RooAbsArg
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:72
RooListProxy::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Reimplementation of standard RooArgList::add()
Definition: RooListProxy.cxx:104
RooResolutionModel::changeBasis
virtual void changeBasis(RooFormulaVar *basis)
Change the basis function we convolute with.
Definition: RooResolutionModel.cxx:196
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:259
RooAbsPdf
Definition: RooAbsPdf.h:41
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
RooAddModel::_allExtendable
Bool_t _allExtendable
Definition: RooAddModel.h:133
RooAbsArg::findServer
RooAbsArg * findServer(const char *name) const
Return server of this with name name. Returns nullptr if not found.
Definition: RooAbsArg.h:203
RooAddModel::fixCoefNormalization
void fixCoefNormalization(const RooArgSet &refCoefNorm)
By default the interpretation of the fraction coefficients is performed in the contextual choice of o...
Definition: RooAddModel.cxx:201
RooRealVar
RooRealVar represents a variable that can be changed from the outside.
Definition: RooRealVar.h:39
RooFit::Eval
@ Eval
Definition: RooGlobalFunc.h:61
RooAddModel::selectNormalizationRange
virtual void selectNormalizationRange(const char *rangeName=0, Bool_t force=kFALSE)
Interface function used by test statistics to freeze choice of range for interpretation of fraction c...
Definition: RooAddModel.cxx:842
RooAddModel::CacheElem::_projList
RooArgList _projList
Definition: RooAddModel.h:103
RooNameReg.h
RooAbsPdf::resetErrorCounters
virtual void resetErrorCounters(Int_t resetValue=10)
Reset error counter to given value, limiting the number of future error messages for this pdf to 'res...
Definition: RooAbsPdf.cxx:623
RooAbsPdf::RooRealIntegral
friend class RooRealIntegral
Definition: RooAbsPdf.h:317
RooAddModel::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: RooAddModel.cxx:675
RooAddModel::CacheElem::_suppProjList
RooArgList _suppProjList
Definition: RooAddModel.h:104
RooCacheManager::selectFromSet1
RooArgSet selectFromSet1(RooArgSet const &argSet, int index) const
Create RooArgSet contatining the objects that are both in the cached set 1.
Definition: RooCacheManager.h:324
RooAbsCollection::getSize
Int_t getSize() const
Definition: RooAbsCollection.h:231
RooRealConstant.h
RooSetProxy::add
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Overloaded RooArgSet::add() method inserts 'var' into set and registers 'var' as server to owner with...
Definition: RooSetProxy.cxx:165
RooArgSet
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:33
cxcoutD
#define cxcoutD(a)
Definition: RooMsgService.h:81
int