Generic Monte Carlo toy generator implement the accept/reject sampling technique on any positively valued function.
The RooAcceptReject generator is used by the various generator context classes to take care of generation of observables for which p.d.fs do not define internal methods
Definition at line 29 of file RooAcceptReject.h.
Public Member Functions | |
RooAcceptReject () | |
RooAcceptReject (const RooAbsReal &func, const RooArgSet &genVars, const RooNumGenConfig &config, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr) | |
Initialize an accept-reject generator for the specified distribution function, which must be non-negative but does not need to be normalized over the variables to be generated, genVars. | |
bool | canSampleCategories () const override |
bool | canSampleConditional () const override |
RooAbsNumGenerator * | clone (const RooAbsReal &func, const RooArgSet &genVars, const RooArgSet &, const RooNumGenConfig &config, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr) const override |
const RooArgSet * | generateEvent (UInt_t remaining, double &resampleRatio) override |
Return a pointer to a generated event. | |
std::string const & | generatorName () const override |
Return unique name of generator implementation. | |
double | getFuncMax () override |
Public Member Functions inherited from RooAbsNumGenerator | |
RooAbsNumGenerator () | |
RooAbsNumGenerator (const RooAbsReal &func, const RooArgSet &genVars, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr) | |
Initialize an accept-reject generator for the specified distribution function, which must be non-negative but does not need to be normalized over the variables to be generated, genVars. | |
virtual | ~RooAbsNumGenerator () |
void | attachParameters (const RooArgSet &vars) |
Reattach original parameters to function clone. | |
bool | isValid () const |
bool | isVerbose () const |
void | setVerbose (bool verbose=true) |
Protected Member Functions | |
void | addEventToCache () |
Add a trial event to our cache and update our estimates of the function maximum value and integral. | |
const RooArgSet * | nextAcceptedEvent () |
Scan through events in the cache which have not been used yet, looking for the first accepted one which is added to the specified container. | |
Static Protected Member Functions | |
static void | registerSampler (RooNumGenFactory &fact) |
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory. | |
Protected Attributes | |
UInt_t | _catSampleMult |
Number of discrete dimensions to be sampled. | |
UInt_t | _eventsUsed |
Accepted number of function samples. | |
double | _funcSum |
Maximum function value found, and sum of all samples made. | |
double | _maxFuncVal |
UInt_t | _minTrials |
Minimum number of max.finding trials, total number of samples. | |
UInt_t | _minTrialsArray [4] |
Minimum number of trials samples for 1,2,3 dimensional problems. | |
UInt_t | _realSampleDim |
Number of real dimensions to be sampled. | |
UInt_t | _totalEvents |
Total number of function samples. | |
Protected Attributes inherited from RooAbsNumGenerator | |
std::unique_ptr< RooDataSet > | _cache |
Dataset holding generared values of observables. | |
RooArgSet | _catVars |
Set of discrete observabeles. | |
RooArgSet | _cloneSet |
Set owning clone of input function. | |
RooAbsReal * | _funcClone = nullptr |
Pointer to top level node of cloned function. | |
const RooAbsReal * | _funcMaxVal = nullptr |
Container for maximum function value. | |
RooRealVar * | _funcValPtr = nullptr |
RRV storing function value in output dataset. | |
std::unique_ptr< RooAbsArg > | _funcValStore |
RRV storing function value in context. | |
bool | _isValid = false |
Valid flag. | |
RooArgSet | _realVars |
Set of real valued observabeles. | |
bool | _verbose = false |
Verbose flag. | |
Friends | |
class | RooNumGenFactory |
|
inline |
Definition at line 31 of file RooAcceptReject.h.
RooAcceptReject::RooAcceptReject | ( | const RooAbsReal & | func, |
const RooArgSet & | genVars, | ||
const RooNumGenConfig & | config, | ||
bool | verbose = false , |
||
const RooAbsReal * | maxFuncVal = nullptr |
||
) |
Initialize an accept-reject generator for the specified distribution function, which must be non-negative but does not need to be normalized over the variables to be generated, genVars.
The function and its dependents are cloned and so will not be disturbed during the generation process.
Definition at line 74 of file RooAcceptReject.cxx.
|
protected |
Add a trial event to our cache and update our estimates of the function maximum value and integral.
Definition at line 271 of file RooAcceptReject.cxx.
|
inlineoverridevirtual |
Reimplemented from RooAbsNumGenerator.
Definition at line 46 of file RooAcceptReject.h.
|
inlineoverridevirtual |
Reimplemented from RooAbsNumGenerator.
Definition at line 45 of file RooAcceptReject.h.
|
inlineoverridevirtual |
Implements RooAbsNumGenerator.
Definition at line 35 of file RooAcceptReject.h.
|
overridevirtual |
Return a pointer to a generated event.
The caller does not own the event and it will be overwritten by a subsequent call. The input parameter 'remaining' should contain your best guess at the total number of subsequent events you will request.
Implements RooAbsNumGenerator.
Definition at line 152 of file RooAcceptReject.cxx.
|
overridevirtual |
Return unique name of generator implementation.
Implements RooAbsNumGenerator.
Definition at line 320 of file RooAcceptReject.cxx.
|
overridevirtual |
Reimplemented from RooAbsNumGenerator.
Definition at line 299 of file RooAcceptReject.cxx.
|
protected |
Scan through events in the cache which have not been used yet, looking for the first accepted one which is added to the specified container.
Return a pointer to the accepted event, or else zero if we use up the cache before we accept an event. The caller does not own the event and it will be overwritten by a subsequent call.
Definition at line 242 of file RooAcceptReject.cxx.
|
staticprotected |
Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.
Definition at line 55 of file RooAcceptReject.cxx.
|
friend |
Definition at line 52 of file RooAcceptReject.h.
|
protected |
Number of discrete dimensions to be sampled.
Definition at line 60 of file RooAcceptReject.h.
|
protected |
Accepted number of function samples.
Definition at line 63 of file RooAcceptReject.h.
|
protected |
Maximum function value found, and sum of all samples made.
Definition at line 58 of file RooAcceptReject.h.
|
protected |
Definition at line 58 of file RooAcceptReject.h.
|
protected |
Minimum number of max.finding trials, total number of samples.
Definition at line 61 of file RooAcceptReject.h.
|
protected |
Minimum number of trials samples for 1,2,3 dimensional problems.
Definition at line 65 of file RooAcceptReject.h.
|
protected |
Number of real dimensions to be sampled.
Definition at line 59 of file RooAcceptReject.h.
|
protected |
Total number of function samples.
Definition at line 62 of file RooAcceptReject.h.