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!=0) {
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(0);
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!=0);
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==0) {
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!=0);
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(cudaStream_t* /*stream*/, 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 0 ;
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 0 ;
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
497
498
499////////////////////////////////////////////////////////////////////////////////
500/// Customized printing of arguments of a RooProduct to more intuitively reflect the contents of the
501/// product operator construction
502
503void RooProduct::printMetaArgs(ostream& os) const
504{
505 bool first(true) ;
506
507 for (const auto rcomp : _compRSet) {
508 if (!first) { os << " * " ; } else { first = false ; }
509 os << rcomp->GetName() ;
510 }
511
512 for (const auto item : _compCSet) {
513 auto ccomp = static_cast<const RooAbsCategory*>(item);
514
515 if (!first) { os << " * " ; } else { first = false ; }
516 os << ccomp->GetName() ;
517 }
518
519 os << " " ;
520}
521
522
524 RooAbsReal::ioStreamerPass2(); // call the baseclass method
525
526 if(numProxies() < 2) {
527 throw std::runtime_error("RooProduct::ioStreamerPass2(): the number of proxies in the proxy list should be at leat 2!");
528 }
529
530 // If the proxy data members are evolved by schema evolution, the proxy list
531 // that references them will contain null pointers because the evolved
532 // members are only created after the proxy list. That's why we have to set
533 // them manually in that case.
534 RooAbsProxy * p0 = getProxy(0);
535 if(p0 == nullptr) {
537 p0 = &_compRSet;
538 }
539 RooAbsProxy * p1 = getProxy(1);
540 if(p1 == nullptr) {
542 p1 = &_compCSet;
543 }
544
545 // If the proxies in the proxy list still don't correspond to _compRSet and
546 // _compCSet, it's time to print errors. And try to recover.
547 auto expectProxyIs = [this](std::size_t idx, RooAbsProxy * proxyInArg, RooListProxy * ourProxy, const char* memberName) {
548 if(proxyInArg != ourProxy) {
549 // From experience, it's rather the members of the RooProduct that is
550 // still correct in these inconsistent cases. That's why we try to
551 // recover by setting the proxy in the _proxyList to be equal to the
552 // member proxy. But that might be wrong, so it's important to warn the
553 // user anyway.
554 _proxyList.RemoveAt(idx);
555 _proxyList.AddAt(ourProxy, idx);
556 std::stringstream ss;
557 ss << "Problem when reading RooProduct instance \"" << GetName() << "\"!\n"
558 << " _proxyList[" << idx << "] was expected to be equal to " << memberName << ", but it's not.\n"
559 << " - proxyList[" << idx << "] : ";
560 proxyInArg->print(ss, true);
561 ss << "\n - " << memberName << " : " ;
562 ourProxy->print(ss, true);
563 ss << "\n RooFit will resolve this inconsistency by making _proxyList[" << idx << "] point to " << memberName
564 << ".";
565 coutW(LinkStateMgmt) << ss.str() << std::endl;
566 }
567 };
568
569 expectProxyIs(0, p0, &_compRSet, "_compRSet");
570 expectProxyIs(1, p1, &_compCSet, "_compCSet");
571}
572
573
574namespace {
575
576std::pair<RPPMIter,RPPMIter> findOverlap2nd(RPPMIter i, RPPMIter end)
577{
578 // Utility function finding pairs of overlapping input functions
579 for (; i!=end; ++i) for ( RPPMIter j(i+1); j!=end; ++j) {
580 if (i->second->overlaps(*j->second)) {
581 return std::make_pair(i,j);
582 }
583 }
584 return std::make_pair(end,end);
585}
586
587
588void dump_map(ostream& os, RPPMIter i, RPPMIter end)
589{
590 // Utility dump function for debugging
591 bool first(true);
592 os << " [ " ;
593 for(; i!=end;++i) {
594 if (first) { first=false; }
595 else { os << " , " ; }
596 os << *(i->first) << " -> " << *(i->second) ;
597 }
598 os << " ] " ;
599}
600
601}
#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
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:74
RooRefArray _proxyList
Definition RooAbsArg.h:634
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.
RooAbsCacheElement is the abstract base class for objects to be stored in RooAbsCache cache manager o...
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 abstact 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...
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
Definition RooAbsReal.h:62
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=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 std::liste...
bool _forceNumInt
Force numerical integration if flag set.
Definition RooAbsReal.h:512
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 contatining the objects that are both in the cached set 2.
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...
RooSpan< const double > at(RooAbsArg const *arg, RooAbsArg const *caller=nullptr)
Definition DataMap.cxx:21
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:78
~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:70
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.
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...
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:81
RooListProxy _compCSet
Definition RooProduct.h:71
void computeBatch(cudaStream_t *, double *output, size_t nEvents, RooFit::Detail::DataMap const &) const override
Base function for computing multiple values of a RooAbsReal.
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()