Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooProduct.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 * GR, Gerhard Raven, VU Amsterdan, graven@nikhef.nl *
8 * *
9 * Copyright (c) 2000-2007, 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\file RooProduct.cxx
19\class RooProduct
20\ingroup Roofitcore
21
22A RooProduct represents the product of a given set of RooAbsReal objects.
23
24**/
25
26#include "RooProduct.h"
27
28#include "RooNameReg.h"
29#include "RooAbsReal.h"
30#include "RooAbsCategory.h"
31#include "RooMsgService.h"
32#include "RooTrace.h"
33
34#include <cmath>
35#include <memory>
36
37using namespace std ;
38
40;
41
42class RooProduct::ProdMap : public std::vector<std::pair<RooArgSet*,RooArgList*> > {} ;
43
44// Namespace with helper functions that have STL stuff that we don't want to expose to CINT
45namespace {
46 typedef RooProduct::ProdMap::iterator RPPMIter ;
47 std::pair<RPPMIter,RPPMIter> findOverlap2nd(RPPMIter i, RPPMIter end) ;
48 void dump_map(ostream& os, RPPMIter i, RPPMIter end) ;
49}
50
51
52
53////////////////////////////////////////////////////////////////////////////////
54/// Default constructor
55
56RooProduct::RooProduct() : _cacheMgr(this,10)
57{
59}
60
61
62
63////////////////////////////////////////////////////////////////////////////////
64/// Destructor
65
67{
69}
70
71
72
73////////////////////////////////////////////////////////////////////////////////
74/// Construct function representing the product of functions in prodSet
75
76RooProduct::RooProduct(const char* name, const char* title, const RooArgList& prodSet) :
77 RooAbsReal(name, title),
78 _compRSet("!compRSet","Set of real product components",this),
79 _compCSet("!compCSet","Set of category product components",this),
80 _cacheMgr(this,10)
81{
82 for (auto comp : prodSet) {
83 addTerm(comp);
84 }
86}
87
88
89RooProduct::RooProduct(const char *name, const char *title, RooAbsReal& real1, RooAbsReal& real2) :
90 RooProduct{name, title, {real1, real2}} {}
91
92
93////////////////////////////////////////////////////////////////////////////////
94/// Copy constructor
95
96RooProduct::RooProduct(const RooProduct& other, const char* name) :
97 RooAbsReal(other, name),
98 _compRSet("!compRSet",this,other._compRSet),
99 _compCSet("!compCSet",this,other._compCSet),
100 _cacheMgr(other._cacheMgr,this)
101{
103}
104
105
106////////////////////////////////////////////////////////////////////////////////
107/// Add a term to this product.
109 if (dynamic_cast<RooAbsReal*>(term)) {
110 _compRSet.add(*term) ;
111 } else if (dynamic_cast<RooAbsCategory*>(term)) {
112 _compCSet.add(*term) ;
113 } else {
114 coutE(InputArguments) << "RooProduct::addTerm(" << GetName() << ") ERROR: component " << term->GetName()
115 << " is not of type RooAbsReal or RooAbsCategory" << endl ;
116 throw std::invalid_argument("RooProduct can only handle terms deriving from RooAbsReal or RooAbsCategory.");
117 }
118}
119
120////////////////////////////////////////////////////////////////////////////////
121/// Force internal handling of integration of given observable if any
122/// of the product terms depend on it.
123
125{
126 // Force internal handling of integration of given observable if any
127 // of the product terms depend on it.
128
129 bool depends(false);
130 for (auto const* rcomp : static_range_cast<RooAbsReal*>(_compRSet)) {
131 if (depends) break;
132 depends = rcomp->dependsOn(dep);
133 }
134 return depends ;
135}
136
137
138
139////////////////////////////////////////////////////////////////////////////////
140/// Group observables into subsets in which the product factorizes
141/// and that can thus be integrated separately
142
144{
145 ProdMap* map = new ProdMap ;
146
147 // Do we have any terms which do not depend on the
148 // on the variables we integrate over?
149 RooArgList *indep = new RooArgList();
150 for (auto const* rcomp : static_range_cast<RooAbsReal*>(_compRSet)) {
151 if( !rcomp->dependsOn(allVars) ) indep->add(*rcomp);
152 }
153 if (indep->getSize()!=0) {
154 map->push_back( std::make_pair(new RooArgSet(),indep) );
155 } else {
156 delete indep;
157 }
158
159 // Map observables -> functions ; start with individual observables
160 for (auto const* var : static_range_cast<RooAbsReal*>(allVars)) {
161 RooArgSet *vars = new RooArgSet(); vars->add(*var);
162 RooArgList *comps = new RooArgList();
163
164 for (auto const* rcomp2 : static_range_cast<RooAbsReal*>(_compRSet)) {
165 if( rcomp2->dependsOn(*var) ) comps->add(*rcomp2);
166 }
167 map->push_back( std::make_pair(vars,comps) );
168 }
169
170 // Merge groups with overlapping dependents
171 bool overlap;
172 do {
173 std::pair<ProdMap::iterator,ProdMap::iterator> i = findOverlap2nd(map->begin(),map->end());
174 overlap = (i.first!=i.second);
175 if (overlap) {
176 i.first->first->add(*i.second->first);
177
178 // In the merging step, make sure not to duplicate
179 for (auto const* targ : *(i.second->second)) {
180 if (!i.first->second->find(*targ)) {
181 i.first->second->add(*targ) ;
182 }
183 }
184 //i.first->second->add(*i.second->second);
185
186 delete i.second->first;
187 delete i.second->second;
188 map->erase(i.second);
189 }
190 } while (overlap);
191
192#ifndef NDEBUG
193 // check that we have all variables to be integrated over on the LHS
194 // of the map, and all terms in the product do appear on the RHS
195 int nVar=0; int nFunc=0;
196 for (ProdMap::iterator i = map->begin();i!=map->end();++i) {
197 nVar+=i->first->getSize();
198 nFunc+=i->second->getSize();
199 }
200 assert(nVar==allVars.getSize());
201 assert(nFunc==_compRSet.getSize());
202#endif
203 return map;
204}
205
206
207
208////////////////////////////////////////////////////////////////////////////////
209/// Return list of (partial) integrals whose product defines the integral of this
210/// RooProduct over the observables in iset in range isetRange. If no such list
211/// exists, create it now and store it in the cache for future use.
212
213Int_t RooProduct::getPartIntList(const RooArgSet* iset, const char *isetRange) const
214{
215
216 // check if we already have integrals for this combination of factors
217 Int_t sterileIndex(-1);
218 CacheElem* cache = (CacheElem*) _cacheMgr.getObj(iset,iset,&sterileIndex,RooNameReg::ptr(isetRange));
219 if (cache!=nullptr) {
220 Int_t code = _cacheMgr.lastIndex();
221 return code;
222 }
223
224 std::unique_ptr<ProdMap> map{groupProductTerms(*iset)};
225
226 cxcoutD(Integration) << "RooProduct::getPartIntList(" << GetName() << ") groupProductTerms returned map" ;
227 if (dologD(Integration)) {
228 dump_map(ccoutD(Integration),map->begin(),map->end());
229 ccoutD(Integration) << endl;
230 }
231
232 // did we find any factorizable terms?
233 if (map->size()<2) {
234
235 for (ProdMap::iterator iter = map->begin() ; iter != map->end() ; ++iter) {
236 delete iter->first ;
237 delete iter->second ;
238 }
239
240 return -1; // RRI caller will zero analVars if return code = 0....
241 }
242 cache = new CacheElem();
243
244 for (ProdMap::const_iterator i = map->begin();i!=map->end();++i) {
245 RooAbsReal *term(nullptr);
246 if (i->second->getSize()>1) { // create a RooProd for this subexpression
247 const char *name = makeFPName("SUBPROD_",*i->second);
248 auto ownedTerm = std::make_unique<RooProduct>(name,name,*i->second);
249 term = ownedTerm.get();
250 cache->_ownedList.addOwned(std::move(ownedTerm));
251 cxcoutD(Integration) << "RooProduct::getPartIntList(" << GetName() << ") created subexpression " << term->GetName() << endl;
252 } else {
253 assert(i->second->getSize()==1);
254 term = static_cast<RooAbsReal*>(i->second->at(0));
255 }
256 assert(term!=nullptr);
257 if (i->first->empty()) { // check whether we need to integrate over this term or not...
258 cache->_prodList.add(*term);
259 cxcoutD(Integration) << "RooProduct::getPartIntList(" << GetName() << ") adding simple factor " << term->GetName() << endl;
260 } else {
261 std::unique_ptr<RooAbsReal> integral{term->createIntegral(*i->first,isetRange)};
262 cache->_prodList.add(*integral);
263 cxcoutD(Integration) << "RooProduct::getPartIntList(" << GetName() << ") adding integral for " << term->GetName() << " : " << integral->GetName() << endl;
264 cache->_ownedList.addOwned(std::move(integral));
265 }
266 }
267 // add current set-up to cache, and return index..
268 Int_t code = _cacheMgr.setObj(iset,iset,(RooAbsCacheElement*)cache,RooNameReg::ptr(isetRange));
269
270 cxcoutD(Integration) << "RooProduct::getPartIntList(" << GetName() << ") created list " << cache->_prodList << " with code " << code+1 << endl
271 << " for iset=" << *iset << " @" << iset << " range: " << (isetRange?isetRange:"<none>") << endl ;
272
273 for (ProdMap::iterator iter = map->begin() ; iter != map->end() ; ++iter) {
274 delete iter->first ;
275 delete iter->second ;
276 }
277 return code;
278}
279
280
281////////////////////////////////////////////////////////////////////////////////
282/// Declare that we handle all integrations internally
283
285 const RooArgSet* /*normSet*/,
286 const char* rangeName) const
287{
288 if (_forceNumInt) return 0 ;
289
290 // Declare that we can analytically integrate all requested observables
291 // (basically, we will take care of the problem, and delegate where required)
292 //assert(normSet==0);
293 assert(analVars.empty());
294 analVars.add(allVars) ;
295 Int_t code = getPartIntList(&analVars,rangeName)+1;
296 return code ;
297}
298
299
300////////////////////////////////////////////////////////////////////////////////
301/// Calculate integral internally from appropriate partial integral cache
302
303double RooProduct::analyticalIntegral(Int_t code, const char* rangeName) const
304{
305 // note: rangeName implicit encoded in code: see _cacheMgr.setObj in getPartIntList...
306 CacheElem *cache = (CacheElem*) _cacheMgr.getObjByIndex(code-1);
307 if (cache==nullptr) {
308 // cache got sterilized, trigger repopulation of this slot, then try again...
309 std::unique_ptr<RooArgSet> vars( getParameters(RooArgSet()) );
310 RooArgSet iset = _cacheMgr.selectFromSet2(*vars, code-1);
311 Int_t code2 = getPartIntList(&iset,rangeName)+1;
312 assert(code==code2); // must have revived the right (sterilized) slot...
313 return analyticalIntegral(code2,rangeName);
314 }
315 assert(cache!=nullptr);
316
317 return calculate(cache->_prodList);
318}
319
320
321////////////////////////////////////////////////////////////////////////////////
322/// Calculate and return product of partial terms in partIntList
323
324double RooProduct::calculate(const RooArgList& partIntList) const
325{
326 double val=1;
327 for (const auto arg : partIntList) {
328 const auto term = static_cast<const RooAbsReal*>(arg);
329 double x = term->getVal();
330 val*= x;
331 }
332 return val;
333}
334
335
336////////////////////////////////////////////////////////////////////////////////
337/// Construct automatic name for internal product terms
338
339const char* RooProduct::makeFPName(const char *pfx,const RooArgSet& terms) const
340{
341 static TString pname;
342 pname = pfx;
343 bool first(true);
344 for (auto const* arg : terms) {
345 if (first) { first=false;}
346 else pname.Append("_X_");
347 pname.Append(arg->GetName());
348 }
349 return pname.Data();
350}
351
352
353
354////////////////////////////////////////////////////////////////////////////////
355/// Evaluate product of input functions
356
358{
359 double prod(1) ;
360
361 const RooArgSet* nset = _compRSet.nset() ;
362 for (const auto item : _compRSet) {
363 auto rcomp = static_cast<const RooAbsReal*>(item);
364
365 prod *= rcomp->getVal(nset) ;
366 }
367
368 for (const auto item : _compCSet) {
369 auto ccomp = static_cast<const RooAbsCategory*>(item);
370
371 prod *= ccomp->getCurrentIndex() ;
372 }
373
374 return prod ;
375}
376
377
378void RooProduct::computeBatch(double* output, size_t nEvents, RooFit::Detail::DataMap const& dataMap) const
379{
380 for (unsigned int i = 0; i < nEvents; ++i) {
381 output[i] = 1.;
382 }
383
384 for (const auto item : _compRSet) {
385 auto rcomp = static_cast<const RooAbsReal*>(item);
386 auto componentValues = dataMap.at(rcomp);
387
388 for (unsigned int i = 0; i < nEvents; ++i) {
389 output[i] *= componentValues.size() == 1 ? componentValues[0] : componentValues[i];
390 }
391 }
392
393 for (const auto item : _compCSet) {
394 auto ccomp = static_cast<const RooAbsCategory*>(item);
395 const int catIndex = ccomp->getCurrentIndex();
396
397 for (unsigned int i = 0; i < nEvents; ++i) {
398 output[i] *= catIndex;
399 }
400 }
401}
402
403
404////////////////////////////////////////////////////////////////////////////////
405/// Forward the plot sampling hint from the p.d.f. that defines the observable obs
406
407std::list<double>* RooProduct::binBoundaries(RooAbsRealLValue& obs, double xlo, double xhi) const
408{
409 for (const auto item : _compRSet) {
410 auto func = static_cast<const RooAbsReal*>(item);
411
412 list<double>* binb = func->binBoundaries(obs,xlo,xhi) ;
413 if (binb) {
414 return binb ;
415 }
416 }
417
418 return nullptr ;
419}
420
421
422//_____________________________________________________________________________B
424{
425 // If all components that depend on obs are binned that so is the product
426
427 for (const auto item : _compRSet) {
428 auto func = static_cast<const RooAbsReal*>(item);
429
430 if (func->dependsOn(obs) && !func->isBinnedDistribution(obs)) {
431 return false ;
432 }
433 }
434
435 return true ;
436}
437
438
439
440////////////////////////////////////////////////////////////////////////////////
441/// Forward the plot sampling hint from the p.d.f. that defines the observable obs
442
443std::list<double>* RooProduct::plotSamplingHint(RooAbsRealLValue& obs, double xlo, double xhi) const
444{
445 for (const auto item : _compRSet) {
446 auto func = static_cast<const RooAbsReal*>(item);
447
448 list<double>* hint = func->plotSamplingHint(obs,xlo,xhi) ;
449 if (hint) {
450 return hint ;
451 }
452 }
453
454 return nullptr ;
455}
456
457
458
459////////////////////////////////////////////////////////////////////////////////
460/// Destructor
461
463{
464}
465
466
467////////////////////////////////////////////////////////////////////////////////
468/// Return list of all RooAbsArgs in cache element
469
471{
472 RooArgList ret(_ownedList) ;
473 return ret ;
474}
475
476
477
478
479////////////////////////////////////////////////////////////////////////////////
480/// Label OK'ed components of a RooProduct with cache-and-track
481
483{
484 RooArgSet comp(components()) ;
485 for (const auto parg : comp) {
486 if (parg->isDerived()) {
487 if (parg->canNodeBeCached()==Always) {
488 trackNodes.add(*parg) ;
489 //cout << "tracking node RooProduct component " << parg->ClassName() << "::" << parg->GetName() << endl ;
490 }
491 }
492 }
493}
494
495////////////////////////////////////////////////////////////////////////////////
496
498{
499 std::string result;
500 // Build a (node1 * node2 * node3 * ...) like expression.
501 result = '(';
502 for (RooAbsArg* item : _compRSet) {
503 result += ctx.getResult(*item) + "*";
504 }
505 result.back() = ')';
506 ctx.addResult(this, result);
507}
508
509////////////////////////////////////////////////////////////////////////////////
510/// Customized printing of arguments of a RooProduct to more intuitively reflect the contents of the
511/// product operator construction
512
513void RooProduct::printMetaArgs(ostream& os) const
514{
515 bool first(true) ;
516
517 for (const auto rcomp : _compRSet) {
518 if (!first) { os << " * " ; } else { first = false ; }
519 os << rcomp->GetName() ;
520 }
521
522 for (const auto item : _compCSet) {
523 auto ccomp = static_cast<const RooAbsCategory*>(item);
524
525 if (!first) { os << " * " ; } else { first = false ; }
526 os << ccomp->GetName() ;
527 }
528
529 os << " " ;
530}
531
532
534 RooAbsReal::ioStreamerPass2(); // call the baseclass method
535
536 if(numProxies() < 2) {
537 throw std::runtime_error("RooProduct::ioStreamerPass2(): the number of proxies in the proxy list should be at least 2!");
538 }
539
540 // If the proxy data members are evolved by schema evolution, the proxy list
541 // that references them will contain null pointers because the evolved
542 // members are only created after the proxy list. That's why we have to set
543 // them manually in that case.
544 RooAbsProxy * p0 = getProxy(0);
545 if(p0 == nullptr) {
547 p0 = &_compRSet;
548 }
549 RooAbsProxy * p1 = getProxy(1);
550 if(p1 == nullptr) {
552 p1 = &_compCSet;
553 }
554
555 // If the proxies in the proxy list still don't correspond to _compRSet and
556 // _compCSet, it's time to print errors. And try to recover.
557 auto expectProxyIs = [this](std::size_t idx, RooAbsProxy * proxyInArg, RooListProxy * ourProxy, const char* memberName) {
558 if(proxyInArg != ourProxy) {
559 // From experience, it's rather the members of the RooProduct that is
560 // still correct in these inconsistent cases. That's why we try to
561 // recover by setting the proxy in the _proxyList to be equal to the
562 // member proxy. But that might be wrong, so it's important to warn the
563 // user anyway.
564 _proxyList.RemoveAt(idx);
565 _proxyList.AddAt(ourProxy, idx);
566 std::stringstream ss;
567 ss << "Problem when reading RooProduct instance \"" << GetName() << "\"!\n"
568 << " _proxyList[" << idx << "] was expected to be equal to " << memberName << ", but it's not.\n"
569 << " - proxyList[" << idx << "] : ";
570 proxyInArg->print(ss, true);
571 ss << "\n - " << memberName << " : " ;
572 ourProxy->print(ss, true);
573 ss << "\n RooFit will resolve this inconsistency by making _proxyList[" << idx << "] point to " << memberName
574 << ".";
575 coutW(LinkStateMgmt) << ss.str() << std::endl;
576 }
577 };
578
579 expectProxyIs(0, p0, &_compRSet, "_compRSet");
580 expectProxyIs(1, p1, &_compCSet, "_compCSet");
581}
582
583
584namespace {
585
586std::pair<RPPMIter,RPPMIter> findOverlap2nd(RPPMIter i, RPPMIter end)
587{
588 // Utility function finding pairs of overlapping input functions
589 for (; i!=end; ++i) for ( RPPMIter j(i+1); j!=end; ++j) {
590 if (i->second->overlaps(*j->second)) {
591 return std::make_pair(i,j);
592 }
593 }
594 return std::make_pair(end,end);
595}
596
597
598void dump_map(ostream& os, RPPMIter i, RPPMIter end)
599{
600 // Utility dump function for debugging
601 bool first(true);
602 os << " [ " ;
603 for(; i!=end;++i) {
604 if (first) { first=false; }
605 else { os << " , " ; }
606 os << *(i->first) << " -> " << *(i->second) ;
607 }
608 os << " ] " ;
609}
610
611}
#define cxcoutD(a)
#define coutW(a)
#define dologD(a)
#define coutE(a)
#define ccoutD(a)
#define TRACE_DESTROY
Definition RooTrace.h:24
#define TRACE_CREATE
Definition RooTrace.h:23
#define ClassImp(name)
Definition Rtypes.h:377
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
char name[80]
Definition TGX11.cxx:110
Common abstract base class for objects that represent a value and a "shape" in RooFit.
Definition RooAbsArg.h:79
RooRefArray _proxyList
Definition RooAbsArg.h:639
RooFit::OwningPtr< 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...
virtual void ioStreamerPass2()
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
Int_t numProxies() const
Return the number of registered proxies.
RooAbsProxy * getProxy(Int_t index) const
Return the nth proxy from the proxy list.
Abstract base class for objects to be stored in RooAbsCache cache manager objects.
A space to attach TBranches.
virtual value_type getCurrentIndex() const
Return index number of current state.
Int_t getSize() const
Return the number of elements in the collection.
virtual bool add(const RooAbsArg &var, bool silent=false)
Add the specified argument to list.
RooAbsArg * first() const
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
RooAbsProxy is the abstract interface for proxy classes.
Definition RooAbsProxy.h:37
const RooArgSet * nset() const
Definition RooAbsProxy.h:52
RooAbsRealLValue is the common abstract base class for objects that represent a real value that may a...
Abstract base class for objects that represent a real value and implements functionality common to al...
Definition RooAbsReal.h:59
virtual std::list< double > * binBoundaries(RooAbsRealLValue &obs, double xlo, double xhi) const
Retrieve bin boundaries if this distribution is binned in obs.
RooFit::OwningPtr< RooAbsReal > createIntegral(const RooArgSet &iset, const RooCmdArg &arg1, const RooCmdArg &arg2={}, const RooCmdArg &arg3={}, const RooCmdArg &arg4={}, const RooCmdArg &arg5={}, const RooCmdArg &arg6={}, const RooCmdArg &arg7={}, const RooCmdArg &arg8={}) const
Create an object that represents the integral of the function over one or more observables listed in ...
bool _forceNumInt
Force numerical integration if flag set.
Definition RooAbsReal.h:546
virtual std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
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:55
Int_t setObj(const RooArgSet *nset, T *obj, const TNamed *isetRangeName=nullptr)
Setter function without integration set.
T * getObjByIndex(Int_t index) const
Retrieve payload object by slot index.
RooArgSet selectFromSet2(RooArgSet const &argSet, int index) const
Create RooArgSet containing the objects that are both in the cached set 2 with a given index and an i...
Int_t lastIndex() const
Return index of slot used in last get or set operation.
T * getObj(const RooArgSet *nset, Int_t *sterileIndex=nullptr, const TNamed *isetRangeName=nullptr)
Getter function without integration set.
bool add(const RooAbsArg &var, bool valueServer, bool shapeServer, bool silent)
Overloaded RooCollection_t::add() method insert object into set and registers object as server to own...
A class to maintain the context for squashing of RooFit models into code.
void addResult(RooAbsArg const *key, std::string const &value)
A function to save an expression that includes/depends on the result of the input node.
std::string const & getResult(RooAbsArg const &arg)
Gets the result for the given node using the node name.
std::span< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
Definition DataMap.cxx:22
static const TNamed * ptr(const char *stringPtr)
Return a unique TNamed pointer for given C++ string.
RooArgList containedArgs(Action) override
Return list of all RooAbsArgs in cache element.
RooArgList _ownedList
Definition RooProduct.h:79
~CacheElem() override
Destructor.
A RooProduct represents the product of a given set of RooAbsReal objects.
Definition RooProduct.h:29
std::list< double > * binBoundaries(RooAbsRealLValue &, double, double) const override
Forward the plot sampling hint from the p.d.f. that defines the observable obs.
RooListProxy _compRSet
Definition RooProduct.h:71
double evaluate() const override
Evaluate product of input functions.
double analyticalIntegral(Int_t code, const char *rangeName=nullptr) const override
Calculate integral internally from appropriate partial integral cache.
void addTerm(RooAbsArg *term)
Add a term to this product.
void computeBatch(double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
std::list< double > * plotSamplingHint(RooAbsRealLValue &, double, double) const override
Forward the plot sampling hint from the p.d.f. that defines the observable obs.
ProdMap * groupProductTerms(const RooArgSet &) const
Group observables into subsets in which the product factorizes and that can thus be integrated separa...
void translate(RooFit::Detail::CodeSquashContext &ctx) const override
This function defines a translation for each RooAbsReal based object that can be used to express the ...
double calculate(const RooArgList &partIntList) const
The cache manager.
bool forceAnalyticalInt(const RooAbsArg &dep) const override
Force internal handling of integration of given observable if any of the product terms depend on it.
void setCacheAndTrackHints(RooArgSet &) override
Label OK'ed components of a RooProduct with cache-and-track.
~RooProduct() override
Destructor.
bool isBinnedDistribution(const RooArgSet &obs) const override
Tests if the distribution is binned. Unless overridden by derived classes, this always returns false.
void ioStreamerPass2() override
Method called by workspace container to finalize schema evolution issues that cannot be handled in a ...
Int_t getPartIntList(const RooArgSet *iset, const char *rangeName=nullptr) const
Return list of (partial) integrals whose product defines the integral of this RooProduct over the obs...
Int_t getAnalyticalIntegralWN(RooArgSet &allVars, RooArgSet &analVars, const RooArgSet *normSet, const char *rangeName=nullptr) const override
Declare that we handle all integrations internally.
void printMetaArgs(std::ostream &os) const override
Customized printing of arguments of a RooProduct to more intuitively reflect the contents of the prod...
const char * makeFPName(const char *pfx, const RooArgSet &terms) const
Construct automatic name for internal product terms.
RooProduct()
Default constructor.
RooObjCacheManager _cacheMgr
Definition RooProduct.h:82
RooListProxy _compCSet
Definition RooProduct.h:72
RooArgList components()
Definition RooProduct.h:48
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
void AddAt(TObject *obj, Int_t idx) override
Add object at position ids.
TObject * RemoveAt(Int_t idx) override
Remove object at index idx.
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:380
TString & Append(const char *cs)
Definition TString.h:576
Double_t x[n]
Definition legend1.C:17
Definition first.py:1
static void output()