57 RooRealVar nTrial0D(
"nTrial0D",
"Number of trial samples for cat-only generation",100,0,1e9) ;
58 RooRealVar nTrial1D(
"nTrial1D",
"Number of trial samples for 1-dim generation",1000,0,1e9) ;
59 RooRealVar nTrial2D(
"nTrial2D",
"Number of trial samples for 2-dim generation",100000,0,1e9) ;
60 RooRealVar nTrial3D(
"nTrial3D",
"Number of trial samples for N-dim generation",10000000,0,1e9) ;
84 for (
auto * cat : static_range_cast<RooAbsCategory*>(
_catVars)) {
95 <<
" variables with accept-reject may not be accurate" << endl;
102 <<
") WARNING: performing accept/reject sampling on a p.d.f in "
103 <<
_realSampleDim <<
" dimensions without prior knowledge on maximum value "
104 <<
"of p.d.f. Determining maximum value by taking " <<
_minTrials
105 <<
" trial samples. If p.d.f contains sharp peaks smaller than average "
106 <<
"distance between trial sampling points these may be missed and p.d.f. "
107 <<
"may be sampled incorrectly." << endl ;
116 oocoutW(
nullptr, Generation) <<
"RooAcceptReject::ctor(" << func.
GetName() <<
"): WARNING: " <<
_minTrials <<
" trial samples requested by p.d.f for "
117 <<
_realSampleDim <<
"-dimensional accept/reject sampling, this may take some time" << endl ;
122 oocoutI(
nullptr, Generation) << func.
GetName() <<
"::RooAcceptReject" <<
":" << endl
123 <<
" Initializing accept-reject generator for" << endl <<
" ";
126 ooccoutI(
nullptr, Generation) <<
" Function maximum provided, no trial sampling performed" << endl ;
133 ooccoutI(
nullptr, Generation) <<
" Will generate category vars "<<
_catVars << endl ;
136 ooccoutI(
nullptr, Generation) <<
" Will generate real vars " <<
_realVars << endl ;
170 oocoutI(
nullptr, Generation) <<
"RooAcceptReject::generateEvent: resetting event cache" << std::endl;
181 oocxcoutD(
static_cast<TObject*
>(
nullptr), Generation) <<
"RooAcceptReject::generateEvent maxFuncVal has changed, need to resample already accepted events by factor"
194 oocoutE(
nullptr, Generation) <<
"RooAcceptReject::generateEvent: cannot estimate efficiency...giving up" << endl;
200 oocxcoutD(
static_cast<TObject*
>(
nullptr), Generation) <<
"RooAcceptReject::generateEvent: adding " << extra <<
" events to the cache, eff = " << eff << endl;
205 oocxcoutD(
static_cast<TObject*
>(
nullptr), Generation) <<
"RooAcceptReject::generateEvent: estimated function maximum increased from "
257 cerr <<
"RooAcceptReject: accepted event (used " <<
_eventsUsed <<
" of "
275 for(
auto * cat : static_range_cast<RooCategory*>(
_catVars)) cat->randomize();
278 for(
auto * real : static_range_cast<RooRealVar*>(
_realVars)) real->randomize();
295 cerr <<
"RooAcceptReject: generated " <<
_totalEvents <<
" events so far." << endl ;
312 oocoutI(
nullptr, Generation) <<
"RooAcceptReject::getFuncMax: resetting event cache" << endl ;
322 static const std::string
name =
"RooAcceptReject";
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
double getRealValue(const char *name, double defVal=0.0, bool verbose=false) const
Get value of a RooAbsReal stored in set with given name.
Int_t getSize() const
Return the number of elements in the collection.
virtual Int_t numEntries() const
Return number of entries in dataset, i.e., count unweighted entries.
Class RooAbsNumGenerator is the abstract base class for MC event generator implementations like RooAc...
RooArgSet _realVars
Sets of discrete and real valued observabeles.
RooDataSet * _cache
Dataset holding generared values of observables.
const RooAbsReal * _funcMaxVal
Container for maximum function value.
RooRealVar * _funcValPtr
RRVs storing function value in context and in output dataset.
RooAbsReal * _funcClone
Pointer to top level node of cloned function.
RooAbsReal is the common abstract base class for objects that represent a real value and implements f...
double getVal(const RooArgSet *normalisationSet=nullptr) const
Evaluate object.
Class RooAcceptReject is a generic toy monte carlo generator implement the accept/reject sampling tec...
UInt_t _minTrialsArray[4]
Minimum number of trials samples for 1,2,3 dimensional problems.
UInt_t _minTrials
Minimum number of max.finding trials, total number of samples.
static void registerSampler(RooNumGenFactory &fact)
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
double getFuncMax() override
const RooArgSet * nextAcceptedEvent()
Scan through events in the cache which have not been used yet, looking for the first accepted one whi...
void addEventToCache()
Add a trial event to our cache and update our estimates of the function maximum value and integral.
double _funcSum
Maximum function value found, and sum of all samples made.
std::string const & generatorName() const override
Return unique name of generator implementation.
UInt_t _totalEvents
Total number of function samples.
UInt_t _catSampleMult
Number of real and discrete dimensions to be sampled.
const RooArgSet * generateEvent(UInt_t remaining, double &resampleRatio) override
Return a pointer to a generated event.
UInt_t _eventsUsed
Accepted number of function samples.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
const RooArgSet * get(Int_t index) const override
Return RooArgSet with coordinates of event 'index'.
RooNumGenConfig holds the configuration parameters of the various numeric integrators used by RooReal...
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
RooNumGenFactory is a factory to instantiate numeric integrators from a given function binding and a ...
bool storeProtoSampler(RooAbsNumGenerator *proto, const RooArgSet &defConfig)
Method accepting registration of a prototype numeric integrator along with a RooArgSet of its default...
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)
RooRealVar represents a variable that can be changed from the outside.
void setVal(double value) override
Set value of variable to 'value'.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.