55 if (model.recursiveCheckObservables(&vars)) {
56 coutE(Generation) <<
"RooAbsGenContext::ctor: Error in PDF dependents" << std::endl ;
67 for (RooAbsArg const* proto : *_prototype->get()) {
69 if(!_theEvent.contains(*proto)) {
70 _protoVars.add(*proto);
71 _theEvent.addClone(*proto);
78 _protoVars.add(*auxProto) ;
79 _theEvent.addClone(*auxProto);
83 _extendMode = model.extendMode() ;
84 if (model.canBeExtended()) {
85 _expectedEvents= (Int_t)(model.expectedEvents(&_theEvent) + 0.5);
91 if (model.normRange()) {
92 _normRange = model.normRange() ;
113 ret->setDirtyProp(
false) ;
144 <<
":generate: PDF not extendable: cannot calculate expected number of events" << std::endl;
151 <<
":generate: cannot calculate expected number of events" << std::endl;
155 << nEvents <<
" events" << std::endl;
160 double nExpEvents = nEvents;
162 cxcoutI(Generation) <<
" Extended mode active, number of events generated (" << nEvents <<
") is Poisson fluctuation on "
163 <<
GetName() <<
"::expectedEvents() = " << nExpEvents << std::endl ;
173 coutE(InputArguments) <<
ClassName() <<
"::" <<
GetName() <<
":generate: prototype dataset is missing \""
174 << arg->GetName() <<
"\"" << std::endl;
180 if(!ok)
return nullptr;
189 title.Prepend(
"Generated From ");
201 while(
_genData->numEntries()<nEvents) {
211 if(
nullptr != subEvent) {
216 << actualProtoIdx <<
" from prototype dataset" << std::endl;
295 os << arg->GetName() ;
325 for (i=0 ; i<
n ; i++) {
344 cxcoutD(Generation) <<
"RooGenContext::resampleData*( existing production trimmed from " << nOrig <<
" to " << trimmedData->numEntries() <<
" events" << std::endl ;
378 if (opt &&
TString(opt).Contains(
"v")) {
int Int_t
Signed integer 4 bytes (int).
const char Option_t
Option string (const char).
Common abstract base class for objects that represent a value and a "shape" in RooFit.
bool contains(const char *name) const
Check if collection contains an argument with a specific name.
void setDirtyProp(bool flag)
Control propagation of dirty flags from observables in dataset.
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.
RooCmdArg EventRange(Int_t nStart, Int_t nStop)