Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RooFoamGenerator Class Reference

Generic Monte Carlo toy generator that implement the TFOAM sampling technique on any positively valued function.

The RooFoamGenerator 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.

The foam generator reacts to the following config options:

  • nCell[123N]D
  • nSample
  • chatLevel Access those using: myPdf->specialGeneratorConfig()->getConfigSection("RooFoamGenerator").setRealValue("nSample",1e4);
See also
rf902_numgenconfig.C

Definition at line 32 of file RooFoamGenerator.h.

Public Member Functions

 RooFoamGenerator ()=default
 
 RooFoamGenerator (const RooAbsReal &func, const RooArgSet &genVars, const RooNumGenConfig &config, bool verbose=false, const RooAbsReal *maxFuncVal=nullptr)
 
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
 
TFoamengine ()
 
const RooArgSetgenerateEvent (UInt_t remaining, double &resampleRatio) override
 are we actually generating anything? (the cache always contains at least our function value)
 
std::string const & generatorName () const override
 Return unique name of generator implementation.
 
- 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.
 
virtual double getFuncMax ()
 
bool isValid () const
 
bool isVerbose () const
 
void setVerbose (bool verbose=true)
 

Static Protected Member Functions

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

Protected Attributes

std::unique_ptr< TFoamIntegrand_binding
 Binding of RooAbsReal to TFoam function interface.
 
std::vector< double_range
 Range of observables to be generated ;.
 
std::unique_ptr< TFoam_tfoam
 Instance of TFOAM generator.
 
std::vector< double_vec
 Transfer array for FOAM output.
 
std::vector< double_xmin
 Lower bound of observables to be generated ;.
 
- 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
 

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

Inheritance diagram for RooFoamGenerator:
[legend]

Constructor & Destructor Documentation

◆ RooFoamGenerator() [1/2]

RooFoamGenerator::RooFoamGenerator ( )
default

◆ RooFoamGenerator() [2/2]

RooFoamGenerator::RooFoamGenerator ( const RooAbsReal func,
const RooArgSet genVars,
const RooNumGenConfig config,
bool  verbose = false,
const RooAbsReal maxFuncVal = nullptr 
)

Definition at line 105 of file RooFoamGenerator.cxx.

Member Function Documentation

◆ canSampleCategories()

bool RooFoamGenerator::canSampleCategories ( ) const
inlineoverridevirtual

Reimplemented from RooAbsNumGenerator.

Definition at line 46 of file RooFoamGenerator.h.

◆ canSampleConditional()

bool RooFoamGenerator::canSampleConditional ( ) const
inlineoverridevirtual

Reimplemented from RooAbsNumGenerator.

Definition at line 45 of file RooFoamGenerator.h.

◆ clone()

RooAbsNumGenerator * RooFoamGenerator::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 36 of file RooFoamGenerator.h.

◆ engine()

TFoam & RooFoamGenerator::engine ( )
inline

Definition at line 43 of file RooFoamGenerator.h.

◆ generateEvent()

const RooArgSet * RooFoamGenerator::generateEvent ( UInt_t  remaining,
double resampleRatio 
)
overridevirtual

are we actually generating anything? (the cache always contains at least our function value)

Implements RooAbsNumGenerator.

Definition at line 140 of file RooFoamGenerator.cxx.

◆ generatorName()

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

Return unique name of generator implementation.

Implements RooAbsNumGenerator.

Definition at line 158 of file RooFoamGenerator.cxx.

◆ registerSampler()

void RooFoamGenerator::registerSampler ( RooNumGenFactory fact)
staticprotected

Register RooIntegrator1D, is parameters and capabilities with RooNumIntFactory.

Definition at line 86 of file RooFoamGenerator.cxx.

Friends And Related Symbol Documentation

◆ RooNumGenFactory

friend class RooNumGenFactory
friend

Definition at line 52 of file RooFoamGenerator.h.

Member Data Documentation

◆ _binding

std::unique_ptr<TFoamIntegrand> RooFoamGenerator::_binding
protected

Binding of RooAbsReal to TFoam function interface.

Definition at line 55 of file RooFoamGenerator.h.

◆ _range

std::vector<double> RooFoamGenerator::_range
protected

Range of observables to be generated ;.

Definition at line 58 of file RooFoamGenerator.h.

◆ _tfoam

std::unique_ptr<TFoam> RooFoamGenerator::_tfoam
protected

Instance of TFOAM generator.

Definition at line 56 of file RooFoamGenerator.h.

◆ _vec

std::vector<double> RooFoamGenerator::_vec
protected

Transfer array for FOAM output.

Definition at line 59 of file RooFoamGenerator.h.

◆ _xmin

std::vector<double> RooFoamGenerator::_xmin
protected

Lower bound of observables to be generated ;.

Definition at line 57 of file RooFoamGenerator.h.

  • roofit/roofitcore/src/RooFoamGenerator.h
  • roofit/roofitcore/src/RooFoamGenerator.cxx