40using std::cout, std::endl, std::ostream;
57 coutE(Generation) <<
"RooAbsGenContext::ctor: Error in PDF dependents" << endl ;
68 for (RooAbsArg const* proto : *_prototype->get()) {
70 if(!_theEvent.contains(*proto)) {
71 _protoVars.add(*proto);
72 _theEvent.addClone(*proto);
79 _protoVars.add(*auxProto) ;
80 _theEvent.addClone(*auxProto);
84 _extendMode = model.extendMode() ;
85 if (model.canBeExtended()) {
86 _expectedEvents= (Int_t)(model.expectedEvents(&_theEvent) + 0.5);
92 if (model.normRange()) {
93 _normRange = model.normRange() ;
145 <<
":generate: PDF not extendable: cannot calculate expected number of events" << endl;
152 <<
":generate: cannot calculate expected number of events" << endl;
156 << nEvents <<
" events" << endl;
161 double nExpEvents = nEvents;
163 cxcoutI(Generation) <<
" Extended mode active, number of events generated (" << nEvents <<
") is Poisson fluctuation on "
164 <<
GetName() <<
"::expectedEvents() = " << nExpEvents << endl ;
174 coutE(InputArguments) <<
ClassName() <<
"::" <<
GetName() <<
":generate: prototype dataset is missing \""
175 << arg->GetName() <<
"\"" << endl;
181 if(!ok)
return nullptr;
190 title.
Prepend(
"Generated From ");
202 while(
_genData->numEntries()<nEvents) {
212 if(
nullptr != subEvent) {
217 << actualProtoIdx <<
" from prototype dataset" << endl;
236 output->setDirtyProp(
true) ;
296 os << arg->GetName() ;
326 for (
i=0 ;
i<
n ;
i++) {
345 cxcoutD(Generation) <<
"RooGenContext::resampleData*( existing production trimmed from " << nOrig <<
" to " << trimmedData->numEntries() <<
" events" << endl ;
379 if (opt &&
TString(opt).Contains(
"v")) {
true
Register systematic variations for multiple existing columns using auto-generated tags.
if(isa< VarDecl >(D)||isa< FieldDecl >(D)||isa< EnumConstantDecl >(D))
Common abstract base class for objects that represent a value and a "shape" in RooFit.
bool recursiveCheckObservables(const RooArgSet *nset) const
Recursively call checkObservables on all nodes in the expression tree.
bool contains(const RooAbsArg &var) const
Check if collection contains an argument with the same name as var.
void setDirtyProp(bool flag)
Control propagation of dirty flags from observables in dataset.
Abstract base class for generator contexts of RooAbsPdf objects.
virtual RooDataSet * createDataSet(const char *name, const char *title, const RooArgSet &obs)
Create an empty dataset to hold the events that will be generated.
std::vector< Int_t > _protoOrder
LUT with traversal order of prototype data.
RooAbsPdf::ExtendMode _extendMode
Extended mode capabilities of p.d.f.
StyleOption defaultPrintStyle(Option_t *opt) const override
Define default print style.
Int_t defaultPrintContents(Option_t *opt) const override
Define default contents when printing.
virtual void attach(const RooArgSet ¶ms)
Interface to attach given parameters to object in this context.
RooDataSet * _genData
! Data being generated
virtual RooDataSet * generate(double nEvents=0, bool skipInit=false, bool extendedMode=false)
Generate the specified number of events with nEvents>0 and and return a dataset containing the genera...
void printClassName(std::ostream &os) const override
Print class name of context.
void printName(std::ostream &os) const override
Print name of context.
virtual void initGenerator(const RooArgSet &theEvent)
Interface function to initialize context for generation for given set of observables.
RooArgSet _theEvent
Pointer to observable event being generated.
RooAbsGenContext(const RooAbsPdf &model, const RooArgSet &vars, const RooDataSet *prototype=nullptr, const RooArgSet *auxProto=nullptr, bool _verbose=false)
Constructor.
void printMultiline(std::ostream &os, Int_t contents, bool verbose=false, TString indent="") const override
Interface for multi-line printing.
const RooDataSet * _prototype
Pointer to prototype dataset.
void Print(Option_t *options=nullptr) const override
This method must be overridden when a class wants to print itself.
TString _normRange
Normalization range of pdf.
void printArgs(std::ostream &os) const override
Print arguments of context, i.e. the observables being generated in this context.
UInt_t _expectedEvents
Number of expected events from extended p.d.f.
Int_t _nextProtoIndex
Next prototype event to load according to LUT.
RooArgSet _protoVars
Prototype observables.
void printTitle(std::ostream &os) const override
Print title of context.
virtual void generateEvent(RooArgSet &theEvent, Int_t remaining)=0
bool _verbose
Verbose messaging?
bool _isValid
Is context in valid state?
virtual void setProtoDataOrder(Int_t *lut)
Set the traversal order of prototype data to that in the lookup tables passed as argument.
void resampleData(double &ratio)
Rescale existing output buffer with given ratio.
Abstract interface for all probability density functions.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
RooArgSet * snapshot(bool deepCopy=true) const
Use RooAbsCollection::snapshot(), but return as RooArgSet.
Container class to hold unbinned data.
static TRandom * randomGenerator()
Return a pointer to a singleton random-number generator implementation.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual ULong64_t Poisson(Double_t mean)
Generates a random integer N according to a Poisson law.
const char * Data() const
TString & Prepend(const char *cs)
RooCmdArg EventRange(Int_t nStart, Int_t nStop)