54 cxcoutI(
Generation) <<
"RooProdGenContext::ctor() setting up event special generator context for product p.d.f. " << model.
GetName()
55 <<
" for generation of observable(s) " << vars ;
64 deps.
remove(*protoDeps,
true,
true) ;
69 RooLinkedList termList,depsList,impDepList,crossDepList,intList ;
76 cxcoutD(
Generation) <<
"RooProdGenContext::ctor() factorizing product expression in irriducible terms " ;
86 bool anyAction = true ;
99 bool anyPrevAction=anyAction ;
110 if (impDeps==0 || termDeps==0) {
114 cxcoutD(
Generation) <<
"RooProdGenContext::ctor() analyzing product term " << *term <<
" with observable(s) " << *termDeps ;
116 ccxcoutD(
Generation) <<
" which has dependence of external observable(s) " << *impDeps <<
" that to be generated first by other terms" ;
122 neededDeps.
remove(genDeps,
true,
true) ;
125 if (!anyPrevAction) {
126 cxcoutD(
Generation) <<
"RooProdGenContext::ctor() no convergence in single term analysis loop, terminating loop and process remainder of terms as single unit " << endl ;
130 cxcoutD(
Generation) <<
"RooProdGenContext::ctor() skipping this term for now because it needs imported dependents that are not generated yet" << endl ;
136 if (termDeps->getSize()==0) {
137 cxcoutD(
Generation) <<
"RooProdGenContext::ctor() term has no observables requested to be generated, removing it" << endl ;
139 depsList.
Remove(termDeps) ;
140 impDepList.
Remove(impDeps) ;
155 coutI(
Generation) <<
"RooProdGenContext::ctor() creating subcontext for generation of observables " << *pdfDep <<
" from model " << pdf->
GetName() << endl ;
163 genDeps.
add(*pdfDep) ;
170 if (termDeps->getSize()>0) {
183 pdfSetList.
Add(pdfSet) ;
185 if (pdfnset && pdfnset->
getSize()>0) {
190 fullPdfSet.
add(*pdfSet) ;
202 coutI(
Generation) <<
"RooProdGenContext()::ctor creating subcontext for generation of observables " << *termDeps
203 <<
"for irriducuble composite term using sub-product object " << multiPdf->
GetName() ;
207 genDeps.
add(*termDeps) ;
217 depsList.
Remove(termDeps) ;
218 impDepList.
Remove(impDeps) ;
230 cxcoutD(
Generation) <<
"RooProdGenContext::ctor() there are left-over terms that need to be generated separately" << endl ;
242 trailerTerm.
add(*term) ;
243 trailerTermDeps.
add(*termDeps) ;
259 pdfSetList.
Add(pdfSet) ;
261 if (pdfnset && pdfnset->
getSize()>0) {
265 fullPdfSet.
add(*pdfSet) ;
278 cxcoutD(
Generation) <<
"RooProdGenContext(" << model.
GetName() <<
"): creating context for irreducible composite trailer term "
279 << multiPdf->
GetName() <<
" that generates observables " << trailerTermDeps << endl ;
290 coutI(
Generation) <<
"RooProdGenContext(" << model.
GetName() <<
"): generating uniform distribution for non-dependent observable(s) " <<
_uniObs << endl ;
316 for (list<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
328 for (list<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
329 (*iter)->attach(args) ;
340 for (list<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
341 (*iter)->initGenerator(theEvent) ;
357 for (list<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
358 (*iter)->generateEvent(theEvent,remaining) ;
387 for (list<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
388 (*iter)->setProtoDataOrder(lut) ;
401 os <<
indent <<
"--- RooProdGenContext ---" << endl ;
402 os <<
indent <<
"Using PDF ";
404 os <<
indent <<
"List of component generators" << endl ;
409 for (list<RooAbsGenContext*>::const_iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
410 (*iter)->printMultiline(os,content,
verbose,indent2) ;
static void indent(ostringstream &buf, int indent_level)
RooAbsArg is the common abstract base class for objects that represent a value and a "shape" in RooFi...
void setOperMode(OperMode mode, bool recurseADirty=true)
Set the operation mode of this node.
RooArgSet * getObservables(const RooArgSet &set, bool valueOnly=true) const
Given a set of possible observables, return the observables that this PDF depends on.
virtual bool addOwned(RooAbsArg &var, bool silent=false)
Add an argument and transfer the ownership to the collection.
virtual bool remove(const RooAbsArg &var, bool silent=false, bool matchByNameOnly=false)
Remove the specified argument from our list.
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.
void assign(const RooAbsCollection &other) const
Sets the value, cache and constant attribute of any argument in our set that also appears in the othe...
TIterator * createIterator(bool dir=kIterForward) const
TIterator-style iteration over contained elements.
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Interface for multi-line printing.
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
Abstract base class for objects that are lvalues, i.e.
virtual void randomize(const char *rangeName=0)=0
virtual RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, bool verbose=false) const
Interface function to create a generator context from a p.d.f.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDataSet is a container class to hold unbinned data.
const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
RooLinkedList is an collection class for internal use, storing a collection of RooAbsArg pointers in ...
void Delete(Option_t *o=0) override
Remove all elements in collection and delete all elements NB: Collection does not own elements,...
virtual void Add(TObject *arg)
TIterator * MakeIterator(bool forward=true) const
Create a TIterator for this list.
virtual bool Remove(TObject *arg)
Remove object from collection.
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer,...
RooProdGenContext is an efficient implementation of the generator context specific for RooProdPdf PDF...
void setProtoDataOrder(Int_t *lut) override
Set the traversal order of the prototype dataset by the given lookup table.
void attach(const RooArgSet ¶ms) override
Attach generator to given event buffer.
RooArgSet _ownedMultiProds
Owned auxiliary multi-term product PDFs.
TIterator * _uniIter
Iterator over uniform observables.
RooProdGenContext(const RooProdPdf &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, bool _verbose=false)
std::list< RooAbsGenContext * > _gcList
List of component generator contexts.
const RooProdPdf * _pdf
Original PDF.
void initGenerator(const RooArgSet &theEvent) override
One-time initialization of generator context, forward to component generators.
RooArgSet _uniObs
Observable to be generated with flat distribution.
~RooProdGenContext() override
Destructor. Delete all owned subgenerator contexts.
void generateEvent(RooArgSet &theEvent, Int_t remaining) override
Generate a single event of the product by generating the components of the products sequentially.
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Detailed printing interface.
RooProdPdf is an efficient implementation of a product of PDFs of the form.
void factorizeProduct(const RooArgSet &normSet, const RooArgSet &intSet, RooLinkedList &termList, RooLinkedList &normList, RooLinkedList &impDepList, RooLinkedList &crossDepList, RooLinkedList &intList) const
Factorize product in irreducible terms for given choice of integration/normalization.
RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, bool verbose=false) const override
Return generator context optimized for generating events from product p.d.f.s.
void useDefaultGen(bool flag=true)
std::string makeRGPPName(const char *pfx, const RooArgSet &term, const RooArgSet &iset, const RooArgSet &nset, const char *isetRangeName) const
Make an appropriate automatic name for a RooGenProdProj object in getPartIntList()
RooArgSet * findPdfNSet(RooAbsPdf const &pdf) const
Look up user specified normalization set for given input PDF component.
Iterator abstract base class.
virtual TObject * Next()=0
TObject * Clone(const char *newname="") const override
Make a clone of an object using the Streamer facility.
const char * GetName() const override
Returns name of object.
TString & Append(const char *cs)
RooCmdArg Conditional(const RooArgSet &pdfSet, const RooArgSet &depSet, bool depsAreCond=false)