ROOT  6.07/01
Reference Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 //
19 // Class RooRealSumPdf 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 
31 #include "RooFit.h"
32 #include "Riostream.h"
33 
34 #include "TIterator.h"
35 #include "TList.h"
36 #include "RooRealSumPdf.h"
37 #include "RooRealProxy.h"
38 #include "RooPlot.h"
39 #include "RooRealVar.h"
40 #include "RooAddGenContext.h"
41 #include "RooRealConstant.h"
42 #include "RooRealIntegral.h"
43 #include "RooMsgService.h"
44 #include "RooNameReg.h"
45 #include <memory>
46 #include <algorithm>
47 
48 #include "TError.h"
49 
50 using namespace std;
51 
53 ;
54 
56 
57 ////////////////////////////////////////////////////////////////////////////////
58 /// Default constructor
59 /// coverity[UNINIT_CTOR]
60 
62 {
63  _funcIter = _funcList.createIterator() ;
64  _coefIter = _coefList.createIterator() ;
65  _extended = kFALSE ;
66  _doFloor = kFALSE ;
67 }
68 
69 
70 
71 ////////////////////////////////////////////////////////////////////////////////
72 /// Constructor with name and title
73 
74 RooRealSumPdf::RooRealSumPdf(const char *name, const char *title) :
75  RooAbsPdf(name,title),
76  _normIntMgr(this,10),
77  _haveLastCoef(kFALSE),
78  _funcList("!funcList","List of functions",this),
79  _coefList("!coefList","List of coefficients",this),
80  _extended(kFALSE),
81  _doFloor(kFALSE)
82 {
85 }
86 
87 
88 
89 ////////////////////////////////////////////////////////////////////////////////
90 /// Construct p.d.f consisting of coef1*func1 + (1-coef1)*func2
91 /// The input coefficients and functions are allowed to be negative
92 /// but the resulting sum is not, which is enforced at runtime
93 
94 RooRealSumPdf::RooRealSumPdf(const char *name, const char *title,
95  RooAbsReal& func1, RooAbsReal& func2, RooAbsReal& coef1) :
96  RooAbsPdf(name,title),
97  _normIntMgr(this,10),
98  _haveLastCoef(kFALSE),
99  _funcList("!funcList","List of functions",this),
100  _coefList("!coefList","List of coefficients",this),
101  _extended(kFALSE),
102  _doFloor(kFALSE)
103 {
104  // Special constructor with two functions and one coefficient
107 
108  _funcList.add(func1) ;
109  _funcList.add(func2) ;
110  _coefList.add(coef1) ;
111 
112 }
113 
114 
115 ////////////////////////////////////////////////////////////////////////////////
116 /// Constructor p.d.f implementing sum_i [ coef_i * func_i ], if N_coef==N_func
117 /// or sum_i [ coef_i * func_i ] + (1 - sum_i [ coef_i ] )* func_N if Ncoef==N_func-1
118 ///
119 /// All coefficients and functions are allowed to be negative
120 /// but the sum is not, which is enforced at runtime.
121 
122 RooRealSumPdf::RooRealSumPdf(const char *name, const char *title, const RooArgList& inFuncList, const RooArgList& inCoefList, Bool_t extended) :
123  RooAbsPdf(name,title),
124  _normIntMgr(this,10),
125  _haveLastCoef(kFALSE),
126  _funcList("!funcList","List of functions",this),
127  _coefList("!coefList","List of coefficients",this),
128  _extended(extended),
129  _doFloor(kFALSE)
130 {
131  if (!(inFuncList.getSize()==inCoefList.getSize()+1 || inFuncList.getSize()==inCoefList.getSize())) {
132  coutE(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName()
133  << ") number of pdfs and coefficients inconsistent, must have Nfunc=Ncoef or Nfunc=Ncoef+1" << endl ;
134  assert(0) ;
135  }
136 
139 
140  // Constructor with N functions and N or N-1 coefs
141  TIterator* funcIter = inFuncList.createIterator() ;
142  TIterator* coefIter = inCoefList.createIterator() ;
143  RooAbsArg* func ;
144  RooAbsArg* coef ;
145 
146  while((coef = (RooAbsArg*)coefIter->Next())) {
147  func = (RooAbsArg*) funcIter->Next() ;
148 
149  if (!dynamic_cast<RooAbsReal*>(coef)) {
150  coutW(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") coefficient " << coef->GetName() << " is not of type RooAbsReal, ignored" << endl ;
151  continue ;
152  }
153  if (!dynamic_cast<RooAbsReal*>(func)) {
154  coutW(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") func " << func->GetName() << " is not of type RooAbsReal, ignored" << endl ;
155  continue ;
156  }
157  _funcList.add(*func) ;
158  _coefList.add(*coef) ;
159  }
160 
161  func = (RooAbsReal*) funcIter->Next() ;
162  if (func) {
163  if (!dynamic_cast<RooAbsReal*>(func)) {
164  coutE(InputArguments) << "RooRealSumPdf::RooRealSumPdf(" << GetName() << ") last func " << coef->GetName() << " is not of type RooAbsReal, fatal error" << endl ;
165  assert(0) ;
166  }
167  _funcList.add(*func) ;
168  } else {
169  _haveLastCoef = kTRUE ;
170  }
171 
172  delete funcIter ;
173  delete coefIter ;
174 }
175 
176 
177 
178 
179 ////////////////////////////////////////////////////////////////////////////////
180 /// Copy constructor
181 
182 RooRealSumPdf::RooRealSumPdf(const RooRealSumPdf& other, const char* name) :
183  RooAbsPdf(other,name),
184  _normIntMgr(other._normIntMgr,this),
185  _haveLastCoef(other._haveLastCoef),
186  _funcList("!funcList",this,other._funcList),
187  _coefList("!coefList",this,other._coefList),
188  _extended(other._extended),
189  _doFloor(other._doFloor)
190 {
193 }
194 
195 
196 
197 ////////////////////////////////////////////////////////////////////////////////
198 /// Destructor
199 
201 {
202  delete _funcIter ;
203  delete _coefIter ;
204 }
205 
206 
207 
208 
209 
210 ////////////////////////////////////////////////////////////////////////////////
211 
213 {
215 }
216 
217 
218 
219 
220 ////////////////////////////////////////////////////////////////////////////////
221 /// Calculate the current value
222 
224 {
225  Double_t value(0) ;
226 
227  // Do running sum of coef/func pairs, calculate lastCoef.
228  RooFIter funcIter = _funcList.fwdIterator() ;
229  RooFIter coefIter = _coefList.fwdIterator() ;
230  RooAbsReal* coef ;
231  RooAbsReal* func ;
232 
233  // N funcs, N-1 coefficients
234  Double_t lastCoef(1) ;
235  while((coef=(RooAbsReal*)coefIter.next())) {
236  func = (RooAbsReal*)funcIter.next() ;
237  Double_t coefVal = coef->getVal() ;
238  if (coefVal) {
239  cxcoutD(Eval) << "RooRealSumPdf::eval(" << GetName() << ") coefVal = " << coefVal << " funcVal = " << func->IsA()->GetName() << "::" << func->GetName() << " = " << func->getVal() << endl ;
240  if (func->isSelectedComp()) {
241  value += func->getVal()*coefVal ;
242  }
243  lastCoef -= coef->getVal() ;
244  }
245  }
246 
247  if (!_haveLastCoef) {
248  // Add last func with correct coefficient
249  func = (RooAbsReal*) funcIter.next() ;
250  if (func->isSelectedComp()) {
251  value += func->getVal()*lastCoef ;
252  }
253 
254  cxcoutD(Eval) << "RooRealSumPdf::eval(" << GetName() << ") lastCoef = " << lastCoef << " funcVal = " << func->getVal() << endl ;
255 
256  // Warn about coefficient degeneration
257  if (lastCoef<0 || lastCoef>1) {
258  coutW(Eval) << "RooRealSumPdf::evaluate(" << GetName()
259  << " WARNING: sum of FUNC coefficients not in range [0-1], value="
260  << 1-lastCoef << endl ;
261  }
262  }
263 
264  // Introduce floor if so requested
265  if (value<0 && (_doFloor || _doFloorGlobal)) {
266  value = 0 ;
267  }
268 
269  return value ;
270 }
271 
272 
273 
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 /// Check if FUNC is valid for given normalization set.
277 /// Coeffient and FUNC must be non-overlapping, but func-coefficient
278 /// pairs may overlap each other
279 ///
280 /// In the present implementation, coefficients may not be observables or derive
281 /// from observables
282 
284 {
285  Bool_t ret(kFALSE) ;
286 
287  _funcIter->Reset() ;
288  _coefIter->Reset() ;
289  RooAbsReal* coef ;
290  RooAbsReal* func ;
291  while((coef=(RooAbsReal*)_coefIter->Next())) {
292  func = (RooAbsReal*)_funcIter->Next() ;
293  if (func->observableOverlaps(nset,*coef)) {
294  coutE(InputArguments) << "RooRealSumPdf::checkObservables(" << GetName() << "): ERROR: coefficient " << coef->GetName()
295  << " and FUNC " << func->GetName() << " have one or more observables in common" << endl ;
296  ret = kTRUE ;
297  }
298  if (coef->dependsOn(*nset)) {
299  coutE(InputArguments) << "RooRealPdf::checkObservables(" << GetName() << "): ERROR coefficient " << coef->GetName()
300  << " depends on one or more of the following observables" ; nset->Print("1") ;
301  ret = kTRUE ;
302  }
303  }
304 
305  return ret ;
306 }
307 
308 
309 
310 
311 ////////////////////////////////////////////////////////////////////////////////
312 ///cout << "RooRealSumPdf::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<",analVars,"<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << endl;
313 /// Advertise that all integrals can be handled internally.
314 
316  const RooArgSet* normSet2, const char* rangeName) const
317 {
318  // Handle trivial no-integration scenario
319  if (allVars.getSize()==0) return 0 ;
320  if (_forceNumInt) return 0 ;
321 
322  // Select subset of allVars that are actual dependents
323  analVars.add(allVars) ;
324  RooArgSet* normSet = normSet2 ? getObservables(normSet2) : 0 ;
325 
326 
327  // Check if this configuration was created before
328  Int_t sterileIdx(-1) ;
329  CacheElem* cache = (CacheElem*) _normIntMgr.getObj(normSet,&analVars,&sterileIdx,RooNameReg::ptr(rangeName)) ;
330  if (cache) {
331  //cout << "RooRealSumPdf("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << " -> " << _normIntMgr.lastIndex()+1 << " (cached)" << endl;
332  return _normIntMgr.lastIndex()+1 ;
333  }
334 
335  // Create new cache element
336  cache = new CacheElem ;
337 
338  // Make list of function projection and normalization integrals
339  _funcIter->Reset() ;
340  RooAbsReal *func ;
341  while((func=(RooAbsReal*)_funcIter->Next())) {
342  RooAbsReal* funcInt = func->createIntegral(analVars,rangeName) ;
343  cache->_funcIntList.addOwned(*funcInt) ;
344  if (normSet && normSet->getSize()>0) {
345  RooAbsReal* funcNorm = func->createIntegral(*normSet) ;
346  cache->_funcNormList.addOwned(*funcNorm) ;
347  }
348  }
349 
350  // Store cache element
351  Int_t code = _normIntMgr.setObj(normSet,&analVars,(RooAbsCacheElement*)cache,RooNameReg::ptr(rangeName)) ;
352 
353  if (normSet) {
354  delete normSet ;
355  }
356 
357  //cout << "RooRealSumPdf("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << " -> " << code+1 << endl;
358  return code+1 ;
359 }
360 
361 
362 
363 
364 ////////////////////////////////////////////////////////////////////////////////
365 ///cout << "RooRealSumPdf::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << endl;
366 /// Implement analytical integrations by deferring integration of component
367 /// functions to integrators of components
368 
369 Double_t RooRealSumPdf::analyticalIntegralWN(Int_t code, const RooArgSet* normSet2, const char* rangeName) const
370 {
371  // Handle trivial passthrough scenario
372  if (code==0) return getVal(normSet2) ;
373 
374 
375  // WVE needs adaptation for rangeName feature
376  CacheElem* cache = (CacheElem*) _normIntMgr.getObjByIndex(code-1) ;
377  if (cache==0) { // revive the (sterilized) cache
378  //cout << "RooRealSumPdf("<<this<<")::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << ": reviving cache "<< endl;
379  std::auto_ptr<RooArgSet> vars( getParameters(RooArgSet()) );
380  std::auto_ptr<RooArgSet> iset( _normIntMgr.nameSet2ByIndex(code-1)->select(*vars) );
381  std::auto_ptr<RooArgSet> nset( _normIntMgr.nameSet1ByIndex(code-1)->select(*vars) );
383  Int_t code2 = getAnalyticalIntegralWN(*iset,dummy,nset.get(),rangeName);
384  R__ASSERT(code==code2); // must have revived the right (sterilized) slot...
385  cache = (CacheElem*) _normIntMgr.getObjByIndex(code-1) ;
386  R__ASSERT(cache!=0);
387  }
388 
389  RooFIter funcIntIter = cache->_funcIntList.fwdIterator() ;
390  RooFIter coefIter = _coefList.fwdIterator() ;
391  RooFIter funcIter = _funcList.fwdIterator() ;
392  RooAbsReal *coef(0), *funcInt(0), *func(0) ;
393  Double_t value(0) ;
394 
395  // N funcs, N-1 coefficients
396  Double_t lastCoef(1) ;
397  while((coef=(RooAbsReal*)coefIter.next())) {
398  funcInt = (RooAbsReal*)funcIntIter.next() ;
399  func = (RooAbsReal*)funcIter.next() ;
400  Double_t coefVal = coef->getVal(normSet2) ;
401  if (coefVal) {
402  assert(func);
403  if (normSet2 ==0 || func->isSelectedComp()) {
404  assert(funcInt);
405  value += funcInt->getVal()*coefVal ;
406  }
407  lastCoef -= coef->getVal(normSet2) ;
408  }
409  }
410 
411  if (!_haveLastCoef) {
412  // Add last func with correct coefficient
413  funcInt = (RooAbsReal*) funcIntIter.next() ;
414  if (normSet2 ==0 || func->isSelectedComp()) {
415  assert(funcInt);
416  value += funcInt->getVal()*lastCoef ;
417  }
418 
419  // Warn about coefficient degeneration
420  if (lastCoef<0 || lastCoef>1) {
421  coutW(Eval) << "RooRealSumPdf::evaluate(" << GetName()
422  << " WARNING: sum of FUNC coefficients not in range [0-1], value="
423  << 1-lastCoef << endl ;
424  }
425  }
426 
427  Double_t normVal(1) ;
428  if (normSet2 && normSet2->getSize()>0) {
429  normVal = 0 ;
430 
431  // N funcs, N-1 coefficients
432  RooAbsReal* funcNorm ;
433  RooFIter funcNormIter = cache->_funcNormList.fwdIterator() ;
434  RooFIter coefIter2 = _coefList.fwdIterator() ;
435  while((coef=(RooAbsReal*)coefIter2.next())) {
436  funcNorm = (RooAbsReal*)funcNormIter.next() ;
437  Double_t coefVal = coef->getVal(normSet2) ;
438  if (coefVal) {
439  assert(funcNorm);
440  normVal += funcNorm->getVal()*coefVal ;
441  }
442  }
443 
444  // Add last func with correct coefficient
445  if (!_haveLastCoef) {
446  funcNorm = (RooAbsReal*) funcNormIter.next() ;
447  assert(funcNorm);
448  normVal += funcNorm->getVal()*lastCoef ;
449  }
450  }
451 
452  return value / normVal;
453 }
454 
455 
456 ////////////////////////////////////////////////////////////////////////////////
457 
459 {
460  Double_t n = getNorm(nset) ;
461  if (n<0) {
462  logEvalError("Expected number of events is negative") ;
463  }
464  return n ;
465 }
466 
467 
468 ////////////////////////////////////////////////////////////////////////////////
469 
470 std::list<Double_t>* RooRealSumPdf::binBoundaries(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
471 {
472  list<Double_t>* sumBinB = 0 ;
473  Bool_t needClean(kFALSE) ;
474 
476  RooAbsReal* func ;
477  // Loop over components pdf
478  while((func=(RooAbsReal*)iter.next())) {
479 
480  list<Double_t>* funcBinB = func->binBoundaries(obs,xlo,xhi) ;
481 
482  // Process hint
483  if (funcBinB) {
484  if (!sumBinB) {
485  // If this is the first hint, then just save it
486  sumBinB = funcBinB ;
487  } else {
488 
489  list<Double_t>* newSumBinB = new list<Double_t>(sumBinB->size()+funcBinB->size()) ;
490 
491  // Merge hints into temporary array
492  merge(funcBinB->begin(),funcBinB->end(),sumBinB->begin(),sumBinB->end(),newSumBinB->begin()) ;
493 
494  // Copy merged array without duplicates to new sumBinBArrau
495  delete sumBinB ;
496  delete funcBinB ;
497  sumBinB = newSumBinB ;
498  needClean = kTRUE ;
499  }
500  }
501  }
502 
503  // Remove consecutive duplicates
504  if (needClean) {
505  list<Double_t>::iterator new_end = unique(sumBinB->begin(),sumBinB->end()) ;
506  sumBinB->erase(new_end,sumBinB->end()) ;
507  }
508 
509  return sumBinB ;
510 }
511 
512 
513 
514 //_____________________________________________________________________________B
516 {
517  // If all components that depend on obs are binned that so is the product
518 
520  RooAbsReal* func ;
521  while((func=(RooAbsReal*)iter.next())) {
522  if (func->dependsOn(obs) && !func->isBinnedDistribution(obs)) {
523  return kFALSE ;
524  }
525  }
526 
527  return kTRUE ;
528 }
529 
530 
531 
532 
533 
534 ////////////////////////////////////////////////////////////////////////////////
535 
536 std::list<Double_t>* RooRealSumPdf::plotSamplingHint(RooAbsRealLValue& obs, Double_t xlo, Double_t xhi) const
537 {
538  list<Double_t>* sumHint = 0 ;
539  Bool_t needClean(kFALSE) ;
540 
542  RooAbsReal* func ;
543  // Loop over components pdf
544  while((func=(RooAbsReal*)iter.next())) {
545 
546  list<Double_t>* funcHint = func->plotSamplingHint(obs,xlo,xhi) ;
547 
548  // Process hint
549  if (funcHint) {
550  if (!sumHint) {
551 
552  // If this is the first hint, then just save it
553  sumHint = funcHint ;
554 
555  } else {
556 
557  list<Double_t>* newSumHint = new list<Double_t>(sumHint->size()+funcHint->size()) ;
558 
559  // Merge hints into temporary array
560  merge(funcHint->begin(),funcHint->end(),sumHint->begin(),sumHint->end(),newSumHint->begin()) ;
561 
562  // Copy merged array without duplicates to new sumHintArrau
563  delete sumHint ;
564  sumHint = newSumHint ;
565  needClean = kTRUE ;
566  }
567  }
568  }
569 
570  // Remove consecutive duplicates
571  if (needClean) {
572  list<Double_t>::iterator new_end = unique(sumHint->begin(),sumHint->end()) ;
573  sumHint->erase(new_end,sumHint->end()) ;
574  }
575 
576  return sumHint ;
577 }
578 
579 
580 
581 
582 ////////////////////////////////////////////////////////////////////////////////
583 /// Label OK'ed components of a RooRealSumPdf with cache-and-track
584 
586 {
587  RooFIter siter = funcList().fwdIterator() ;
588  RooAbsArg* sarg ;
589  while ((sarg=siter.next())) {
590  if (sarg->canNodeBeCached()==Always) {
591  trackNodes.add(*sarg) ;
592  //cout << "tracking node RealSumPdf component " << sarg->IsA()->GetName() << "::" << sarg->GetName() << endl ;
593  }
594  }
595 }
596 
597 
598 
599 ////////////////////////////////////////////////////////////////////////////////
600 /// Customized printing of arguments of a RooRealSumPdf to more intuitively reflect the contents of the
601 /// product operator construction
602 
603 void RooRealSumPdf::printMetaArgs(ostream& os) const
604 {
605  _funcIter->Reset() ;
606  _coefIter->Reset() ;
607 
608  Bool_t first(kTRUE) ;
609 
610  RooAbsArg* coef, *func ;
611  if (_coefList.getSize()!=0) {
612  while((coef=(RooAbsArg*)_coefIter->Next())) {
613  if (!first) {
614  os << " + " ;
615  } else {
616  first = kFALSE ;
617  }
618  func=(RooAbsArg*)_funcIter->Next() ;
619  os << coef->GetName() << " * " << func->GetName() ;
620  }
621  func = (RooAbsArg*) _funcIter->Next() ;
622  if (func) {
623  os << " + [%] * " << func->GetName() ;
624  }
625  } else {
626 
627  while((func=(RooAbsArg*)_funcIter->Next())) {
628  if (!first) {
629  os << " + " ;
630  } else {
631  first = kFALSE ;
632  }
633  os << func->GetName() ;
634  }
635  }
636 
637  os << " " ;
638 }
#define coutE(a)
Definition: RooMsgService.h:35
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooAbsReal.h:278
virtual void Reset()=0
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Definition: RooAbsReal.h:277
const RooNameSet * nameSet2ByIndex(Int_t index) const
Double_t getNorm(const RooArgSet &nset) const
Definition: RooAbsPdf.h:190
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
Bool_t isSelectedComp() const
If true, the current pdf is a selected component (for use in plotting)
RooFIter fwdIterator() const
#define cxcoutD(a)
Definition: RooMsgService.h:80
#define assert(cond)
Definition: unittest.h:542
const RooNameSet * nameSet1ByIndex(Int_t index) const
RooArgSet * getObservables(const RooArgSet &set, Bool_t valueOnly=kTRUE) const
Definition: RooAbsArg.h:194
virtual Bool_t checkObservables(const RooArgSet *nset) const
Check if FUNC is valid for given normalization set.
#define R__ASSERT(e)
Definition: TError.h:98
Int_t lastIndex() const
int Int_t
Definition: RtypesCore.h:41
static Bool_t _doFloorGlobal
Definition: RooRealSumPdf.h:94
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TIterator * _coefIter
Iterator over FUNC list.
Definition: RooRealSumPdf.h:90
#define coutW(a)
Definition: RooMsgService.h:34
RooObjCacheManager _normIntMgr
Definition: RooRealSumPdf.h:82
Iterator abstract base class.
Definition: TIterator.h:32
friend class CacheElem
Definition: RooAbsPdf.h:314
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
std::map< std::string, std::string >::const_iterator iter
Definition: TAlienJob.cxx:54
TIterator * createIterator(Bool_t dir=kIterForward) const
if on multiple lines(like in C++).**The" * configuration fragment. * * The "import myobject continue
Parses the configuration file.
Definition: HLFactory.cxx:368
virtual void setCacheAndTrackHints(RooArgSet &)
Label OK'ed components of a RooRealSumPdf with cache-and-track.
friend class RooArgSet
Definition: RooAbsArg.h:469
Double_t getVal(const RooArgSet *set=0) const
Definition: RooAbsReal.h:64
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Reimplementation of standard RooArgList::add()
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:560
Bool_t _extended
Iterator over coefficient list.
Definition: RooRealSumPdf.h:91
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
TIterator * _funcIter
Definition: RooRealSumPdf.h:89
RooListProxy _coefList
Definition: RooRealSumPdf.h:88
Bool_t _forceNumInt
Definition: RooAbsReal.h:392
RooListProxy _funcList
Definition: RooRealSumPdf.h:87
TPaveLabel title(3, 27.1, 15, 28.7,"ROOT Environment and Tools")
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Definition: RooNameReg.cxx:125
Double_t evaluate() const
Calculate the current value.
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
bool first
Definition: line3Dfit.C:48
ClassImp(RooRealSumPdf)
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Definition: RooAbsReal.h:279
Bool_t isBinnedDistribution(const RooArgSet &obs) const
RooAbsArg * next()
void printMetaArgs(std::ostream &os) const
Customized printing of arguments of a RooRealSumPdf to more intuitively reflect the contents of the p...
RooRealSumPdf()
Default constructor coverity[UNINIT_CTOR].
double Double_t
Definition: RtypesCore.h:55
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:53
static RooMathCoreReg dummy
double func(double *x, double *p)
Definition: stressTF1.cxx:213
virtual CacheMode canNodeBeCached() const
Definition: RooAbsArg.h:317
virtual Double_t expectedEvents(const RooArgSet *nset) const
Return expected number of events from this p.d.f for use in extended likelihood calculations.
const RooArgList & funcList() const
Definition: RooRealSumPdf.h:43
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual ~RooRealSumPdf()
Destructor.
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:817
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
T * getObjByIndex(Int_t index) const
RooAbsPdf is the abstract interface for all probability density functions The class provides hybrid a...
Definition: RooAbsPdf.h:41
Bool_t _haveLastCoef
Definition: RooRealSumPdf.h:85
virtual TObject * Next()=0
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &numVars, const RooArgSet *normSet, const char *rangeName=0) const
cout << "RooRealSumPdf::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<",analVars,"<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << endl; Advertise that all integrals can be handled internally.
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:744
virtual ExtendMode extendMode() const
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Int_t getSize() const
RooAbsArg is the common abstract base class for objects that represent a value (of arbitrary type) an...
Definition: RooAbsArg.h:66
const Bool_t kTRUE
Definition: Rtypes.h:91
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:189
void logEvalError(const char *message, const char *serverValueString=0) const
Log evaluation error message.
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
cout << "RooRealSumPdf::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>") << endl; Implement analytical integrations by deferring integration of component functions to integrators of components
float value
Definition: math.cpp:443
const Int_t n
Definition: legend1.C:16
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add element to non-owning set.
Definition: RooArgSet.cxx:448
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:503