16#ifndef ROO_ADD_GEN_CONTEXT
17#define ROO_ADD_GEN_CONTEXT
46 static std::unique_ptr<RooAbsGenContext>
create(
const Pdf_t &pdf,
const RooArgSet &vars,
58 std::unique_ptr<RooArgSet>
_vars ;
61 std::vector<std::unique_ptr<RooAbsGenContext>>
_gcList ;
85 auto hasNegativeCoefs = [&]() {
86 for(
auto * coef : static_range_cast<RooAbsReal*>(pdf._coefList)) {
87 if(coef->getVal() < 0)
return true;
94 if(hasNegativeCoefs()) {
95 oocxcoutI(&pdf, Generation) << pdf.ClassName() <<
"::genContext():"
96 <<
" using a generic generator context instead of the RooAddGenContext for the "
97 << pdf.ClassName() <<
" \"" << pdf.GetName() <<
"\", because the pdf has negative coefficients." << std::endl;
98 return std::make_unique<RooGenContext>(pdf, vars, prototype, auxProto, verbose);
101 return std::make_unique<RooAddGenContext>(pdf, vars, prototype, auxProto,verbose) ;
#define ClassDefOverride(name, id)
static void indent(ostringstream &buf, int indent_level)
Abstract base class for generator contexts of RooAbsPdf objects.
bool _verbose
Verbose messaging?
Abstract interface for all probability density functions.
RooAddGenContext is an efficient implementation of the generator context specific for RooAddPdf PDFs.
void setProtoDataOrder(Int_t *lut) override
Forward the setProtoDataOrder call to the component generator contexts.
std::vector< double > _coefThresh
[_nComp] Array of coefficient thresholds
std::unique_ptr< RooArgSet > _pdfSet
Set owned all nodes of internal clone of p.d.f.
std::unique_ptr< RooArgSet > _vars
bool _isModel
Are we generating from a RooAddPdf or a RooAddModel.
void initGenerator(const RooArgSet &theEvent) override
One-time initialization of generator context.
std::vector< std::unique_ptr< RooAbsGenContext > > _gcList
List of component generator contexts.
static std::unique_ptr< RooAbsGenContext > create(const Pdf_t &pdf, const RooArgSet &vars, const RooDataSet *prototype, const RooArgSet *auxProto, bool verbose)
Returns a RooAddGenContext if possible, or, if the RooAddGenContext doesn't support this particular R...
void updateThresholds()
Update the cumulative threshold table from the current coefficient values.
void printMultiline(std::ostream &os, Int_t content, bool verbose=false, TString indent="") const override
Print the details of the context.
AddCacheElem * _pcache
! RooAddPdf cache element
RooAddGenContext(const RooAddGenContext &other)
void attach(const RooArgSet ¶ms) override
Attach given set of variables to internal p.d.f. clone.
Int_t _nComp
Number of PDF components.
RooAbsPdf * _pdf
Pointer to cloned p.d.f.
void generateEvent(RooArgSet &theEvent, Int_t remaining) override
Randomly choose one of the component contexts to generate this event, with a probability proportional...
RooAddModel is an efficient implementation of a sum of PDFs of the form.
Efficient implementation of a sum of PDFs of the form.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooDataSet is a container class to hold unbinned data.