Logo ROOT  
Reference Guide
RooAcceptReject Class Reference

Class RooAcceptReject is a generic toy monte carlo 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. More...
 
bool canSampleCategories () const override
 
bool canSampleConditional () const override
 
RooAbsNumGeneratorclone (const RooAbsReal &func, const RooArgSet &genVars, const RooArgSet &, const RooNumGenConfig &config, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr) const override
 
const RooArgSetgenerateEvent (UInt_t remaining, double &resampleRatio) override
 Return a pointer to a generated event. More...
 
std::string const & generatorName () const override
 Return unique name of generator implementation. More...
 
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. More...
 
virtual ~RooAbsNumGenerator ()
 Destructor. More...
 
void attachParameters (const RooArgSet &vars)
 Reattach original parameters to function clone. More...
 
virtual bool canSampleCategories () const
 
virtual bool canSampleConditional () const
 
virtual RooAbsNumGeneratorclone (const RooAbsReal &, const RooArgSet &genVars, const RooArgSet &condVars, const RooNumGenConfig &config, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr) const =0
 
virtual const RooArgSetgenerateEvent (UInt_t remaining, double &resampleRatio)=0
 
virtual std::string const & generatorName () const =0
 Return unique name of generator implementation. More...
 
virtual double getFuncMax ()
 
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. More...
 
const RooArgSetnextAcceptedEvent ()
 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. More...
 

Static Protected Member Functions

static void registerSampler (RooNumGenFactory &fact)
 Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory. More...
 

Protected Attributes

UInt_t _catSampleMult
 Number of real and discrete dimensions to be sampled. More...
 
UInt_t _eventsUsed
 Accepted number of function samples. More...
 
double _funcSum
 Maximum function value found, and sum of all samples made. More...
 
double _maxFuncVal
 
UInt_t _minTrials
 Minimum number of max.finding trials, total number of samples. More...
 
UInt_t _minTrialsArray [4]
 Minimum number of trials samples for 1,2,3 dimensional problems. More...
 
UInt_t _realSampleDim
 
UInt_t _totalEvents
 Total number of function samples. More...
 
- Protected Attributes inherited from RooAbsNumGenerator
RooDataSet_cache
 Dataset holding generared values of observables. More...
 
RooArgSet _catVars
 
RooArgSet _cloneSet
 Set owning clone of input function. More...
 
RooAbsReal_funcClone
 Pointer to top level node of cloned function. More...
 
const RooAbsReal_funcMaxVal
 Container for maximum function value. More...
 
RooRealVar_funcValPtr
 RRVs storing function value in context and in output dataset. More...
 
RooRealVar_funcValStore
 
bool _isValid
 Verbose and valid flag. More...
 
RooArgSet _realVars
 Sets of discrete and real valued observabeles. More...
 
bool _verbose
 

Friends

class RooNumGenFactory
 

#include </home/sftnight/build/workspace/root-makedoc-master/rootspi/rdoc/src/master/roofit/roofitcore/src/RooAcceptReject.h>

Inheritance diagram for RooAcceptReject:
[legend]

Constructor & Destructor Documentation

◆ RooAcceptReject() [1/2]

RooAcceptReject::RooAcceptReject ( )
inline

Definition at line 31 of file RooAcceptReject.h.

◆ RooAcceptReject() [2/2]

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.

Member Function Documentation

◆ addEventToCache()

void RooAcceptReject::addEventToCache ( )
protected

Add a trial event to our cache and update our estimates of the function maximum value and integral.

Definition at line 272 of file RooAcceptReject.cxx.

◆ canSampleCategories()

bool RooAcceptReject::canSampleCategories ( ) const
inlineoverridevirtual

Reimplemented from RooAbsNumGenerator.

Definition at line 46 of file RooAcceptReject.h.

◆ canSampleConditional()

bool RooAcceptReject::canSampleConditional ( ) const
inlineoverridevirtual

Reimplemented from RooAbsNumGenerator.

Definition at line 45 of file RooAcceptReject.h.

◆ clone()

RooAbsNumGenerator * RooAcceptReject::clone ( const RooAbsReal func,
const RooArgSet genVars,
const RooArgSet ,
const RooNumGenConfig config,
bool  verbose = false,
const RooAbsReal maxFuncVal = nullptr 
) const
inlineoverridevirtual

Implements RooAbsNumGenerator.

Definition at line 35 of file RooAcceptReject.h.

◆ generateEvent()

const RooArgSet * RooAcceptReject::generateEvent ( UInt_t  remaining,
double resampleRatio 
)
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 153 of file RooAcceptReject.cxx.

◆ generatorName()

std::string const & RooAcceptReject::generatorName ( ) const
overridevirtual

Return unique name of generator implementation.

Implements RooAbsNumGenerator.

Definition at line 321 of file RooAcceptReject.cxx.

◆ getFuncMax()

double RooAcceptReject::getFuncMax ( )
overridevirtual

Reimplemented from RooAbsNumGenerator.

Definition at line 300 of file RooAcceptReject.cxx.

◆ nextAcceptedEvent()

const RooArgSet * RooAcceptReject::nextAcceptedEvent ( )
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 243 of file RooAcceptReject.cxx.

◆ registerSampler()

void RooAcceptReject::registerSampler ( RooNumGenFactory fact)
staticprotected

Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.

Definition at line 55 of file RooAcceptReject.cxx.

Friends And Related Function Documentation

◆ RooNumGenFactory

friend class RooNumGenFactory
friend

Definition at line 52 of file RooAcceptReject.h.

Member Data Documentation

◆ _catSampleMult

UInt_t RooAcceptReject::_catSampleMult
protected

Number of real and discrete dimensions to be sampled.

Definition at line 59 of file RooAcceptReject.h.

◆ _eventsUsed

UInt_t RooAcceptReject::_eventsUsed
protected

Accepted number of function samples.

Definition at line 62 of file RooAcceptReject.h.

◆ _funcSum

double RooAcceptReject::_funcSum
protected

Maximum function value found, and sum of all samples made.

Definition at line 58 of file RooAcceptReject.h.

◆ _maxFuncVal

double RooAcceptReject::_maxFuncVal
protected

Definition at line 58 of file RooAcceptReject.h.

◆ _minTrials

UInt_t RooAcceptReject::_minTrials
protected

Minimum number of max.finding trials, total number of samples.

Definition at line 60 of file RooAcceptReject.h.

◆ _minTrialsArray

UInt_t RooAcceptReject::_minTrialsArray[4]
protected

Minimum number of trials samples for 1,2,3 dimensional problems.

Definition at line 64 of file RooAcceptReject.h.

◆ _realSampleDim

UInt_t RooAcceptReject::_realSampleDim
protected

Definition at line 59 of file RooAcceptReject.h.

◆ _totalEvents

UInt_t RooAcceptReject::_totalEvents
protected

Total number of function samples.

Definition at line 61 of file RooAcceptReject.h.


The documentation for this class was generated from the following files: