58 cxcoutI(
Generation) <<
"RooAddGenContext::ctor() setting up event special generator context for sum p.d.f. " << model.
GetName()
59 <<
" for generation of observable(s) " << vars ;
73 coefNSet.
add(*prototype->
get()) ;
81 for (
const auto arg : model.
_pdfList) {
82 auto pdf =
dynamic_cast<const RooAbsPdf *
>(arg);
84 coutF(
Generation) <<
"Cannot generate events from an object that is not a PDF.\n\t"
85 <<
"The offending object is a " << arg->IsA()->GetName() <<
" named '" << arg->GetName() <<
"'." << std::endl;
86 throw std::invalid_argument(
"Trying to generate events from on object that is not a PDF.");
110 cxcoutI(
Generation) <<
"RooAddGenContext::ctor() setting up event special generator context for sum resolution model " << model.
GetName()
111 <<
" for generation of observable(s) " << vars ;
147 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
164 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
165 (*iter)->attach(args) ;
189 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
190 (*iter)->initGenerator(theEvent) ;
205 for (i=0 ; i<
_nComp ; i++) {
207 _gcList[i]->generateEvent(theEvent,remaining) ;
227 for (i=0 ; i<
_nComp ; i++) {
240 for (i=0 ; i<
_nComp ; i++) {
257 for (vector<RooAbsGenContext*>::iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
258 (*iter)->setProtoDataOrder(lut) ;
270 os <<
indent <<
"--- RooAddGenContext ---" << endl ;
271 os <<
indent <<
"Using PDF ";
274 os <<
indent <<
"List of component generators" << endl ;
277 for (vector<RooAbsGenContext*>::const_iterator iter=
_gcList.begin() ; iter!=
_gcList.end() ; ++iter) {
278 (*iter)->printMultiline(os,content,
verbose,indent2) ;
static void indent(ostringstream &buf, int indent_level)
void setOperMode(OperMode mode, Bool_t recurseADirty=kTRUE)
Change cache operation mode to given mode.
Bool_t recursiveRedirectServers(const RooAbsCollection &newServerList, Bool_t mustReplaceAll=kFALSE, Bool_t nameChange=kFALSE, Bool_t recurseInNewSet=kTRUE)
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 RooAbsGenContext * genContext(const RooArgSet &vars, const RooDataSet *prototype=0, const RooArgSet *auxProto=0, Bool_t verbose=kFALSE) const
Interface function to create a generator context from a p.d.f.
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.
TIterator * _pdfIter
List of supplemental normalization factors.
CacheElem * getProjCache(const RooArgSet *nset, const RooArgSet *iset=0, const char *rangeName=0) const
Retrieve cache element with for calculation of p.d.f value with normalization set nset and integrated...
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
Retrieve cache element for the computation of the PDF normalisation.
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.
virtual Bool_t add(const RooAbsCollection &col, Bool_t silent=kFALSE)
Add a collection of arguments to this collection by calling add() for each element in the source coll...
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 TObject * Next()=0
virtual const char * GetName() const
Returns name of object.
TString & Append(const char *cs)