57 cxcoutI(Generation) <<
"RooAddGenContext::ctor() setting up event special generator context for sum p.d.f. " << model.
GetName()
58 <<
" for generation of observable(s) " << vars ;
59 if (prototype)
ccxcoutI(Generation) <<
" with prototype data for " << *prototype->
get() ;
60 if (auxProto && auxProto->
getSize()>0)
ccxcoutI(Generation) <<
" with auxiliary prototypes " << *auxProto ;
72 coefNSet.
add(*prototype->
get()) ;
80 for (
const auto arg : model.
_pdfList) {
81 auto pdf =
dynamic_cast<const RooAbsPdf *
>(arg);
83 coutF(Generation) <<
"Cannot generate events from an object that is not a PDF.\n\t"
84 <<
"The offending object is a " << arg->IsA()->
GetName() <<
" named '" << arg->GetName() <<
"'." << std::endl;
85 throw std::invalid_argument(
"Trying to generate events from on object that is not a PDF.");
109 cxcoutI(Generation) <<
"RooAddGenContext::ctor() setting up event special generator context for sum resolution model " << model.
GetName()
110 <<
" for generation of observable(s) " << vars ;
111 if (prototype)
ccxcoutI(Generation) <<
" with prototype data for " << *prototype->
get() ;
112 if (auxProto && auxProto->
getSize()>0)
ccxcoutI(Generation) <<
" with auxiliary prototypes " << *auxProto ;
123 for (
const auto obj : model.
_pdfList) {
144 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
161 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
162 (*iter)->attach(args) ;
186 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
187 (*iter)->initGenerator(theEvent) ;
202 for (i=0 ; i<
_nComp ; i++) {
204 _gcList[i]->generateEvent(theEvent,remaining) ;
224 for (i=0 ; i<
_nComp ; i++) {
237 for (i=0 ; i<
_nComp ; i++) {
254 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
255 (*iter)->setProtoDataOrder(lut) ;
267 os <<
indent <<
"--- RooAddGenContext ---" << endl ;
268 os <<
indent <<
"Using PDF ";
271 os <<
indent <<
"List of component generators" << endl ;
274 for (vector<RooAbsGenContext*>::const_iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
275 (*iter)->printMultiline(os,content,verbose,indent2) ;
static void indent(ostringstream &buf, int indent_level)
void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE)
Set the operation mode of this node.
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
Recursively replace all servers with the new servers in newSet.
virtual Bool_t add(const RooAbsArg &var, Bool_t silent=kFALSE)
Add the specified argument to list.
RooAbsArg * find(const char *name) const
Find object with given name in list.
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
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.
virtual void fixAddCoefNormalization(const RooArgSet &addNormSet=RooArgSet(), Bool_t force=kTRUE)
Fix the interpretation of the coefficient of any RooAddPdf component in the expression tree headed by...
RooAddGenContext is an efficient implementation of the generator context specific for RooAddPdf PDFs.
RooAddGenContext(const RooAddPdf &model, const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t _verbose=kFALSE)
Constructor.
virtual void initGenerator(const RooArgSet &theEvent)
One-time initialization of generator contex.
virtual ~RooAddGenContext()
Destructor. Delete all owned subgenerator contexts.
virtual void setProtoDataOrder(Int_t *lut)
Forward the setProtoDataOrder call to the component generator contexts.
virtual void generateEvent(RooArgSet &theEvent, Int_t remaining)
Randomly choose one of the component contexts to generate this event, with a probability proportional...
virtual void printMultiline(std::ostream &os, Int_t content, Bool_t verbose=kFALSE, TString indent="") const
Print the details of the context.
void updateThresholds()
Update the cumulative threshold table from the current coefficient values.
std::vector< RooAbsGenContext * > _gcList
virtual void attach(const RooArgSet ¶ms)
Attach given set of variables to internal p.d.f. clone.
RooAddModel::CacheElem * _mcache
RooAddPdf::CacheElem * _pcache
RooAddModel cache element.
RooAddModel is an efficient implementation of a sum of PDFs of the form.
CacheElem * getProjCache(const RooArgSet *nset, const RooArgSet *iset=0, const char *rangeName=0) const
Manager of cache with coefficient projections and transformations.
void updateCoefficients(CacheElem &cache, const RooArgSet *nset) const
Update the coefficient values in the given cache element: calculate new remainder fraction,...
RooListProxy _pdfList
Registry of component analytical integration codes.
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
void updateCoefficients(CacheElem &cache, const RooArgSet *nset) const
Update the coefficient values in the given cache element: calculate new remainder fraction,...
CacheElem * getProjCache(const RooArgSet *nset, const RooArgSet *iset=0, const char *rangeName=0) const
Manager of cache with coefficient projections and transformations.
RooListProxy _pdfList
Registry of component analytical integration codes.
std::vector< double > _coefCache
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
RooDataSet is a container class to hold unbinned data.
virtual const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
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,...
static Double_t uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
virtual const char * GetName() const
Returns name of object.
TString & Append(const char *cs)