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
56using namespace std;
57
59
61
62//_____________________________________________________________________________
63RooRealSumFunc::RooRealSumFunc() : _normIntMgr(this, 10)
64{
65 // Default constructor
66 // coverity[UNINIT_CTOR]
71}
72
73//_____________________________________________________________________________
74RooRealSumFunc::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//_____________________________________________________________________________
86RooRealSumFunc::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//_____________________________________________________________________________
107RooRealSumFunc::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 = (RooAbsArg *)funcIter->Next();
153 if (func) {
154 if (!dynamic_cast<RooAbsReal *>(func)) {
155 coutE(InputArguments) << "RooRealSumFunc::RooRealSumFunc(" << GetName() << ") last func " << func->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
247void RooRealSumFunc::computeBatch(cudaStream_t* stream, double* output, size_t nEvents, RooBatchCompute::DataMap& dataMap) const {
248
249 // To evaluate this RooRealSumFunc, we have to undo the normalization of the
250 // pdf servers by convention. TODO: find a less hacky solution for this,
251 // which should be easy once the integrals are treated like separate nodes in
252 // the computation queue of the RooFit driver.
253
254 // remember copying a data map is cheap, because it only contains non-owning spans
255 RooBatchCompute::DataMap dataMapCopy = dataMap;
256
257 std::vector<std::vector<double>> buffers;
258
259 for(RooAbsArg const* func : _funcList) {
260 if(auto pdf = dynamic_cast<RooAbsPdf const*>(func)) {
261 auto pdfSpan = dataMapCopy.at(pdf);
262 std::size_t nEntries = pdfSpan.size();
263 auto integralSpan = dataMapCopy.at(pdf->getCachedLastIntegral());
264 buffers.emplace_back(nEntries);
265 auto& buffer = buffers.back();
266 for(std::size_t i = 0; i < nEntries; ++i) {
267 buffer[i] = pdfSpan[i] * integralSpan[integralSpan.size() == 1 ? 0 : i];
268 }
269 dataMapCopy[pdf] = RooSpan<const double>{buffer.begin(), buffer.end()};
270 }
271 }
272
273 RooAbsReal::computeBatch(stream, output, nEvents, dataMapCopy);
274}
275
276
277//_____________________________________________________________________________
279{
280 // Check if FUNC is valid for given normalization set.
281 // Coeffient and FUNC must be non-overlapping, but func-coefficient
282 // pairs may overlap each other
283 //
284 // In the present implementation, coefficients may not be observables or derive
285 // from observables
286
287 Bool_t ret(kFALSE);
288
289 _funcIter->Reset();
290 _coefIter->Reset();
291 RooAbsReal *coef;
292 RooAbsReal *func;
293 while ((coef = (RooAbsReal *)_coefIter->Next())) {
294 func = (RooAbsReal *)_funcIter->Next();
295 if (func->observableOverlaps(nset, *coef)) {
296 coutE(InputArguments) << "RooRealSumFunc::checkObservables(" << GetName() << "): ERROR: coefficient "
297 << coef->GetName() << " and FUNC " << func->GetName()
298 << " have one or more observables in common" << endl;
299 ret = kTRUE;
300 }
301 if (coef->dependsOn(*nset)) {
302 coutE(InputArguments) << "RooRealPdf::checkObservables(" << GetName() << "): ERROR coefficient "
303 << coef->GetName() << " depends on one or more of the following observables";
304 nset->Print("1");
305 ret = kTRUE;
306 }
307 }
308
309 return ret;
310}
311
312//_____________________________________________________________________________
314 const char *rangeName) const
315{
316 // cout <<
317 // "RooRealSumFunc::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<",analVars,"<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
318 // << endl;
319 // Advertise that all integrals can be handled internally.
320
321 // Handle trivial no-integration scenario
322 if (allVars.getSize() == 0)
323 return 0;
324 if (_forceNumInt)
325 return 0;
326
327 // Select subset of allVars that are actual dependents
328 analVars.add(allVars);
329 RooArgSet *normSet = normSet2 ? getObservables(normSet2) : 0;
330
331 // Check if this configuration was created before
332 Int_t sterileIdx(-1);
333 CacheElem *cache = (CacheElem *)_normIntMgr.getObj(normSet, &analVars, &sterileIdx, RooNameReg::ptr(rangeName));
334 if (cache) {
335 // cout <<
336 // "RooRealSumFunc("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
337 // << " -> " << _normIntMgr.lastIndex()+1 << " (cached)" << endl;
338 return _normIntMgr.lastIndex() + 1;
339 }
340
341 // Create new cache element
342 cache = new CacheElem;
343
344 // Make list of function projection and normalization integrals
345 _funcIter->Reset();
346 RooAbsReal *func;
347 while ((func = (RooAbsReal *)_funcIter->Next())) {
348 RooAbsReal *funcInt = func->createIntegral(analVars, rangeName);
349 if(funcInt->InheritsFrom(RooRealIntegral::Class())) ((RooRealIntegral*)funcInt)->setAllowComponentSelection(true);
350 cache->_funcIntList.addOwned(*funcInt);
351 if (normSet && normSet->getSize() > 0) {
352 RooAbsReal *funcNorm = func->createIntegral(*normSet);
353 cache->_funcNormList.addOwned(*funcNorm);
354 }
355 }
356
357 // Store cache element
358 Int_t code = _normIntMgr.setObj(normSet, &analVars, (RooAbsCacheElement *)cache, RooNameReg::ptr(rangeName));
359
360 if (normSet) {
361 delete normSet;
362 }
363
364 // cout <<
365 // "RooRealSumFunc("<<this<<")::getAnalyticalIntegralWN:"<<GetName()<<"("<<allVars<<","<<analVars<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
366 // << " -> " << code+1 << endl;
367 return code + 1;
368}
369
370//_____________________________________________________________________________
371Double_t RooRealSumFunc::analyticalIntegralWN(Int_t code, const RooArgSet *normSet2, const char *rangeName) const
372{
373 // cout <<
374 // "RooRealSumFunc::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
375 // << endl;
376 // Implement analytical integrations by deferring integration of component
377 // functions to integrators of components
378
379 // Handle trivial passthrough scenario
380 if (code == 0)
381 return getVal(normSet2);
382
383 // WVE needs adaptation for rangeName feature
384 CacheElem *cache = (CacheElem *)_normIntMgr.getObjByIndex(code - 1);
385 if (cache == 0) { // revive the (sterilized) cache
386 // cout <<
387 // "RooRealSumFunc("<<this<<")::analyticalIntegralWN:"<<GetName()<<"("<<code<<","<<(normSet2?*normSet2:RooArgSet())<<","<<(rangeName?rangeName:"<none>")
388 // << ": reviving cache "<< endl;
389 std::unique_ptr<RooArgSet> vars(getParameters(RooArgSet()));
390 RooArgSet iset = _normIntMgr.selectFromSet2(*vars, code - 1);
391 RooArgSet nset = _normIntMgr.selectFromSet1(*vars, code - 1);
392 RooArgSet dummy;
393 Int_t code2 = getAnalyticalIntegralWN(iset, dummy, &nset, rangeName);
394 assert(code == code2); // must have revived the right (sterilized) slot...
395 (void)code2;
396 cache = (CacheElem *)_normIntMgr.getObjByIndex(code - 1);
397 assert(cache != 0);
398 }
399
400 RooFIter funcIntIter = cache->_funcIntList.fwdIterator();
401 RooFIter coefIter = _coefList.fwdIterator();
402 RooFIter funcIter = _funcList.fwdIterator();
403 RooAbsReal *coef(0), *funcInt(0), *func(0);
404 Double_t value(0);
405
406 // N funcs, N-1 coefficients
407 Double_t lastCoef(1);
408 while ((coef = (RooAbsReal *)coefIter.next())) {
409 funcInt = (RooAbsReal *)funcIntIter.next();
410 func = (RooAbsReal *)funcIter.next();
411 Double_t coefVal = coef->getVal(normSet2);
412 if (coefVal) {
413 assert(func);
414 if (normSet2 == 0 || func->isSelectedComp()) {
415 assert(funcInt);
416 value += funcInt->getVal() * coefVal;
417 }
418 lastCoef -= coef->getVal(normSet2);
419 }
420 }
421
422 if (!_haveLastCoef) {
423 // Add last func with correct coefficient
424 funcInt = (RooAbsReal *)funcIntIter.next();
425 if (normSet2 == 0 || func->isSelectedComp()) {
426 assert(funcInt);
427 value += funcInt->getVal() * lastCoef;
428 }
429
430 // Warn about coefficient degeneration
431 if (lastCoef < 0 || lastCoef > 1) {
432 coutW(Eval) << "RooRealSumFunc::evaluate(" << GetName()
433 << " WARNING: sum of FUNC coefficients not in range [0-1], value=" << 1 - lastCoef << endl;
434 }
435 }
436
437 Double_t normVal(1);
438 if (normSet2 && normSet2->getSize() > 0) {
439 normVal = 0;
440
441 // N funcs, N-1 coefficients
442 RooAbsReal *funcNorm;
443 RooFIter funcNormIter = cache->_funcNormList.fwdIterator();
444 RooFIter coefIter2 = _coefList.fwdIterator();
445 while ((coef = (RooAbsReal *)coefIter2.next())) {
446 funcNorm = (RooAbsReal *)funcNormIter.next();
447 Double_t coefVal = coef->getVal(normSet2);
448 if (coefVal) {
449 assert(funcNorm);
450 normVal += funcNorm->getVal() * coefVal;
451 }
452 }
453
454 // Add last func with correct coefficient
455 if (!_haveLastCoef) {
456 funcNorm = (RooAbsReal *)funcNormIter.next();
457 assert(funcNorm);
458 normVal += funcNorm->getVal() * lastCoef;
459 }
460 }
461
462 return value / normVal;
463}
464
465//_____________________________________________________________________________
466std::list<Double_t> *RooRealSumFunc::binBoundaries(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
467{
468 list<Double_t> *sumBinB = 0;
469 Bool_t needClean(kFALSE);
470
472 RooAbsReal *func;
473 // Loop over components pdf
474 while ((func = (RooAbsReal *)iter.next())) {
475
476 list<Double_t> *funcBinB = func->binBoundaries(obs, xlo, xhi);
477
478 // Process hint
479 if (funcBinB) {
480 if (!sumBinB) {
481 // If this is the first hint, then just save it
482 sumBinB = funcBinB;
483 } else {
484
485 list<Double_t> *newSumBinB = new list<Double_t>(sumBinB->size() + funcBinB->size());
486
487 // Merge hints into temporary array
488 merge(funcBinB->begin(), funcBinB->end(), sumBinB->begin(), sumBinB->end(), newSumBinB->begin());
489
490 // Copy merged array without duplicates to new sumBinBArrau
491 delete sumBinB;
492 delete funcBinB;
493 sumBinB = newSumBinB;
494 needClean = kTRUE;
495 }
496 }
497 }
498
499 // Remove consecutive duplicates
500 if (needClean) {
501 list<Double_t>::iterator new_end = unique(sumBinB->begin(), sumBinB->end());
502 sumBinB->erase(new_end, sumBinB->end());
503 }
504
505 return sumBinB;
506}
507
508//_____________________________________________________________________________B
510{
511 // If all components that depend on obs are binned that so is the product
512
514 RooAbsReal *func;
515 while ((func = (RooAbsReal *)iter.next())) {
516 if (func->dependsOn(obs) && !func->isBinnedDistribution(obs)) {
517 return kFALSE;
518 }
519 }
520
521 return kTRUE;
522}
523
524//_____________________________________________________________________________
525std::list<Double_t> *RooRealSumFunc::plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
526{
527 list<Double_t> *sumHint = 0;
528 Bool_t needClean(kFALSE);
529
531 RooAbsReal *func;
532 // Loop over components pdf
533 while ((func = (RooAbsReal *)iter.next())) {
534
535 list<Double_t> *funcHint = func->plotSamplingHint(obs, xlo, xhi);
536
537 // Process hint
538 if (funcHint) {
539 if (!sumHint) {
540
541 // If this is the first hint, then just save it
542 sumHint = funcHint;
543
544 } else {
545
546 list<Double_t> *newSumHint = new list<Double_t>(sumHint->size() + funcHint->size());
547
548 // Merge hints into temporary array
549 merge(funcHint->begin(), funcHint->end(), sumHint->begin(), sumHint->end(), newSumHint->begin());
550
551 // Copy merged array without duplicates to new sumHintArrau
552 delete sumHint;
553 sumHint = newSumHint;
554 needClean = kTRUE;
555 }
556 }
557 }
558
559 // Remove consecutive duplicates
560 if (needClean) {
561 list<Double_t>::iterator new_end = unique(sumHint->begin(), sumHint->end());
562 sumHint->erase(new_end, sumHint->end());
563 }
564
565 return sumHint;
566}
567
568//_____________________________________________________________________________
570{
571 // Label OK'ed components of a RooRealSumFunc with cache-and-track
572 RooFIter siter = funcList().fwdIterator();
573 RooAbsArg *sarg;
574 while ((sarg = siter.next())) {
575 if (sarg->canNodeBeCached() == Always) {
576 trackNodes.add(*sarg);
577 // cout << "tracking node RealSumFunc component " << sarg->IsA()->GetName() << "::" << sarg->GetName() << endl
578 // ;
579 }
580 }
581}
582
583//_____________________________________________________________________________
584void RooRealSumFunc::printMetaArgs(ostream &os) const
585{
586 // Customized printing of arguments of a RooRealSumFuncy to more intuitively reflect the contents of the
587 // product operator construction
588
589 _funcIter->Reset();
590 _coefIter->Reset();
591
593
594 RooAbsArg *coef, *func;
595 if (_coefList.getSize() != 0) {
596 while ((coef = (RooAbsArg *)_coefIter->Next())) {
597 if (!first) {
598 os << " + ";
599 } else {
600 first = kFALSE;
601 }
602 func = (RooAbsArg *)_funcIter->Next();
603 os << coef->GetName() << " * " << func->GetName();
604 }
605 func = (RooAbsArg *)_funcIter->Next();
606 if (func) {
607 os << " + [%] * " << func->GetName();
608 }
609 } else {
610
611 while ((func = (RooAbsArg *)_funcIter->Next())) {
612 if (!first) {
613 os << " + ";
614 } else {
615 first = kFALSE;
616 }
617 os << func->GetName();
618 }
619 }
620
621 os << " ";
622}
void Class()
Definition: Class.C:29
typedef void(GLAPIENTRYP _GLUfuncptr)(void)
#define cxcoutD(a)
Definition: RooMsgService.h:81
#define coutW(a)
Definition: RooMsgService.h:32
#define coutE(a)
Definition: RooMsgService.h:33
#define TRACE_DESTROY
Definition: RooTrace.h:24
#define TRACE_CREATE
Definition: RooTrace.h:23
const Bool_t kFALSE
Definition: RtypesCore.h:101
bool Bool_t
Definition: RtypesCore.h:63
const Bool_t kTRUE
Definition: RtypesCore.h:100
#define ClassImp(name)
Definition: Rtypes.h:364
char name[80]
Definition: TGX11.cxx:110
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
Definition: RooAbsArg.h:75
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:315
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:834
virtual CacheMode canNodeBeCached() const
Definition: RooAbsArg.h:433
friend class RooArgSet
Definition: RooAbsArg.h:644
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:571
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:903
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
Int_t getSize() const
RooFIter fwdIterator() const
One-time forward iterator.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
virtual Bool_t addOwned(RooAbsArg &var, Bool_t silent=kFALSE)
Add an argument and transfer the ownership to the collection.
virtual void Print(Option_t *options=0) const
This method must be overridden when a class wants to print itself.
TIterator * createIterator(Bool_t dir=kIterForward) const
TIterator-style iteration over contained elements.
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition: RooAbsReal.h:63
Bool_t _forceNumInt
Definition: RooAbsReal.h:486
Bool_t isSelectedComp() const
If true, the current pdf is a selected component (for use in plotting)
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:555
virtual void computeBatch(cudaStream_t *, double *output, size_t size, RooBatchCompute::DataMap &) const
Base function for computing multiple values of a RooAbsReal.
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
Double_t getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Definition: RooAbsReal.h:93
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &obs, Double_t xlo, Double_t xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
virtual Bool_t isBinnedDistribution(const RooArgSet &) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
Definition: RooAbsReal.h:344
RooArgList is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgList.h:22
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Definition: RooArgSet.h:35
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=0, const TNamed *isetRangeName=0)
RooArgSet selectFromSet1(RooArgSet const &argSet, int index) const
Create RooArgSet contatining the objects that are both in the cached set 1.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
RooArgSet selectFromSet2(RooArgSet const &argSet, int index) const
Create RooArgSet contatining the objects that are both in the cached set 2.
Int_t lastIndex() const
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=0)
A one-time forward iterator working on RooLinkedList or RooAbsCollection.
RooAbsArg * next()
Return next element or nullptr if at end.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE) override
Reimplementation of standard RooArgList::add()
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
Definition: RooNameReg.cxx:93
RooRealIntegral performs hybrid numerical/analytical integrals of RooAbsReal objects.
TIterator * _funcIter
void computeBatch(cudaStream_t *, double *output, size_t size, RooBatchCompute::DataMap &) const
Base function for computing multiple values of a RooAbsReal.
Bool_t _doFloor
Iterator over coefficient list.
TIterator * _coefIter
Iterator over FUNC list.
Bool_t _haveLastCoef
The integration cache manager.
Double_t evaluate() const
Evaluate this PDF / function / constant. Needs to be overridden by all derived classes.
Bool_t isBinnedDistribution(const RooArgSet &obs) const
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
static Bool_t _doFloorGlobal
virtual std::list< Double_t > * binBoundaries(RooAbsRealLValue &, Double_t, Double_t) const
Retrieve bin boundaries if this distribution is binned in obs.
const RooArgList & funcList() const
RooListProxy _funcList
RooObjCacheManager _normIntMgr
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 ...
virtual std::list< Double_t > * plotSamplingHint(RooAbsRealLValue &, Double_t, Double_t) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
virtual Bool_t checkObservables(const RooArgSet *nset) const
Overloadable function in which derived classes can implement consistency checks of the variables.
Double_t analyticalIntegralWN(Int_t code, const RooArgSet *normSet, const char *rangeName=0) const
Implements the actual analytical integral(s) advertised by getAnalyticalIntegral.
virtual ~RooRealSumFunc()
RooListProxy _coefList
virtual void setCacheAndTrackHints(RooArgSet &)
void printMetaArgs(std::ostream &os) const
A simple container to hold a batch of data values.
Definition: RooSpan.h:34
constexpr std::span< T >::iterator begin() const
Definition: RooSpan.h:98
Iterator abstract base class.
Definition: TIterator.h:30
virtual void Reset()=0
virtual TObject * Next()=0
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:445
std::map< DataKey, RooSpan< const double > > DataMap
@ InputArguments
Definition: RooGlobalFunc.h:61
Definition: first.py:1
static void output(int code)
Definition: gifencode.c:226