52  cxcoutI(Generation) << 
"RooAddGenContext::ctor() setting up event special generator context for sum p.d.f. " << model.
GetName()
 
   53         << 
" for generation of observable(s) " << vars ;
 
   54  if (prototype) 
ccxcoutI(Generation) << 
" with prototype data for " << *prototype->
get() ;
 
   55  if (auxProto && !auxProto->
empty())  
ccxcoutI(Generation) << 
" with auxiliary prototypes " << *auxProto ;
 
   67      coefNSet.
add(*prototype->
get()) ;
 
   75  for (
const auto arg : model.
_pdfList) {
 
   76    auto pdf = 
dynamic_cast<const RooAbsPdf *
>(arg);
 
   78      coutF(Generation) << 
"Cannot generate events from an object that is not a PDF.\n\t" 
   79          << 
"The offending object is a " << arg->
ClassName() << 
" named '" << arg->GetName() << 
"'." << std::endl;
 
   80      throw std::invalid_argument(
"Trying to generate events from on object that is not a PDF.");
 
   83    _gcList.emplace_back(pdf->genContext(vars,prototype,auxProto,verbose));
 
  100  cxcoutI(Generation) << 
"RooAddGenContext::ctor() setting up event special generator context for sum resolution model " << model.
GetName()
 
  101         << 
" for generation of observable(s) " << vars ;
 
  102  if (prototype) 
ccxcoutI(Generation) << 
" with prototype data for " << *prototype->
get() ;
 
  103  if (auxProto && !auxProto->
empty())  
ccxcoutI(Generation) << 
" with auxiliary prototypes " << *auxProto ;
 
  114  for (
const auto obj : model.
_pdfList) {
 
  116    _gcList.emplace_back(pdf->genContext(vars,prototype,auxProto,verbose));
 
  158    gc->initGenerator(theEvent) ;
 
  174      _gcList[i]->generateEvent(theEvent,remaining) ;
 
  188  auto updateThresholdsImpl = [&](
auto* pdf, 
auto * cache) {
 
  189    pdf->updateCoefficients(*cache,
_vars.get()) ;
 
  193      double coef = pdf->_coefCache[i];
 
  195        std::stringstream errMsgStream;
 
  196        errMsgStream << 
"RooAddGenContext::updateThresholds(): coefficient number " << i << 
" of the " 
  197                     << pdf->ClassName() << 
" \"" << pdf->GetName() <<  
"\"" << 
" is negative!" 
  198                     << 
" The current RooAddGenConext doesn't support negative coefficients." 
  199                     << 
" Please recreate a new generator context with " << pdf->ClassName() << 
"::genContext()";
 
  200        auto const errMsg = errMsgStream.str();
 
  201        cxcoutE(Generation) << errMsg << std::endl;
 
  202        throw std::runtime_error(errMsg);
 
  220    gc->setProtoDataOrder(lut) ;
 
  232  os << 
indent << 
"--- RooAddGenContext ---" << std::endl;
 
  233  os << 
indent << 
"Using PDF ";
 
  236  os << 
indent << 
"List of component generators" << std::endl;
 
  240    gc->printMultiline(os,content,verbose,indent2) ;
 
static void indent(ostringstream &buf, int indent_level)
 
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void gc
 
bool recursiveRedirectServers(const RooAbsCollection &newServerList, bool mustReplaceAll=false, bool nameChange=false, bool recurseInNewSet=true)
Recursively replace all servers with the new servers in newSet.
 
void setOperMode(OperMode mode, bool recurseADirty=true)
Set the operation mode of this node.
 
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.
 
RooAbsGenContext is the abstract base class for generator contexts of RooAbsPdf objects.
 
RooArgSet _theEvent
Pointer to observable event being generated.
 
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.
 
virtual void fixAddCoefNormalization(const RooArgSet &addNormSet=RooArgSet(), bool force=true)
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.
 
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 contex.
 
std::vector< std::unique_ptr< RooAbsGenContext > > _gcList
List of component generator contexts.
 
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
 
void attach(const RooArgSet ¶ms) override
Attach given set of variables to internal p.d.f. clone.
 
Int_t _nComp
Number of PDF components.
 
RooAddGenContext(const RooAddPdf &model, const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool _verbose=false)
Constructor.
 
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.
 
RooListProxy _pdfList
List of component PDFs.
 
AddCacheElem * getProjCache(const RooArgSet *nset, const RooArgSet *iset=nullptr) const
Retrieve cache element with for calculation of p.d.f value with normalization set nset and integrated...
 
RooAddPdf is an efficient implementation of a sum of PDFs of the form.
 
AddCacheElem * getProjCache(const RooArgSet *nset, const RooArgSet *iset=nullptr) const
Manager of cache with coefficient projections and transformations.
 
RooListProxy _pdfList
List of component PDFs.
 
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.
 
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 uniform(TRandom *generator=randomGenerator())
Return a number uniformly distributed from (0,1)
 
const char * GetName() const override
Returns name of object.
 
virtual const char * ClassName() const
Returns name of class to which the object belongs.
 
TString & Append(const char *cs)