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

Implements an adaptive multi-dimensional Monte Carlo numerical integration, following the VEGAS algorithm originally described in G.

P. Lepage, J. Comp. Phys. 27, 192(1978). This implementation is based on a C version from the 0.9 beta release of the GNU scientific library.

Definition at line 24 of file RooMCIntegrator.h.

Public Types

enum  GeneratorType { QuasiRandom , PseudoRandom }
 
enum  SamplingMode { Importance , ImportanceOnly , Stratified }
 
enum  Stage { AllStages , ReuseGrid , RefineGrid }
 

Public Member Functions

 RooMCIntegrator (const RooAbsFunc &function, const RooNumIntConfig &config)
 Construct an integrator over 'function' where the configuration details are taken from 'config'.
 
 RooMCIntegrator (const RooAbsFunc &function, SamplingMode mode=Importance, GeneratorType genType=QuasiRandom, bool verbose=false)
 Construct an integrator over 'function' with given sampling mode and generator type.
 
bool checkLimits () const override
 Check if we can integrate over the current domain.
 
double getAlpha () const
 
GeneratorType getGenType () const
 
const RooGrid & grid () const
 
double integral (const double *yvec=nullptr) override
 Evaluate the integral using a fixed number of calls to evaluate the integrand equal to about 10k per dimension.
 
void setAlpha (double alpha)
 
void setGenType (GeneratorType type)
 
double vegas (Stage stage, UInt_t calls, UInt_t iterations, double *absError=nullptr)
 Perform one step of Monte Carlo integration using the specified number of iterations with (approximately) the specified number of integrand evaluation calls per iteration.
 
- Public Member Functions inherited from RooAbsIntegrator
 RooAbsIntegrator ()
 
 RooAbsIntegrator (const RooAbsFunc &function, bool printEvalCounter=false)
 Copy constructor.
 
virtual ~RooAbsIntegrator ()=default
 
double calculate (const double *yvec=nullptr)
 Calculate integral value with given array of parameter values.
 
const RooAbsFuncintegrand () const
 Return integrand function binding.
 
double integrand (const double x[]) const
 Return value of integrand at given observable values.
 
bool isValid () const
 Is integrator in valid state.
 
bool printEvalCounter () const
 
virtual bool setLimits (double *, double *)
 
virtual bool setLimits (double xmin, double xmax)
 Interface to set limits on integration.
 
void setPrintEvalCounter (bool value)
 
virtual bool setUseIntegrandLimits (bool flag)
 Interface function that allows to defer limit definition to integrand definition.
 

Static Protected Member Functions

static void registerIntegrator (RooNumIntFactory &fact)
 This function registers class RooMCIntegrator, its configuration options and its capabilities with RooNumIntFactory.
 

Protected Attributes

double _alpha
 Grid stiffness parameter.
 
UInt_t _calls_per_box
 Scratch variables preserved between calls to vegas1/2/2.
 
double _chi_sum
 
double _chisq
 
GeneratorType _genType
 Generator type.
 
RooGrid _grid
 
UInt_t _it_num
 
UInt_t _it_start
 
double _jac
 
Int_t _mode
 Sampling mode.
 
Int_t _nIntegratePerDim
 Number of integration samplings (per dim)
 
Int_t _nRefineIter
 Number of refinement iterations.
 
Int_t _nRefinePerDim
 Number of refinement samplings (per dim)
 
double _result
 
UInt_t _samples
 
double _sigma
 Scratch variables preserved between calls to vegas1/2/2.
 
double _sum_wgts
 
TStopwatch _timer
 Timer.
 
bool _verbose
 Verbosity control.
 
double _wtd_int_sum
 
- Protected Attributes inherited from RooAbsIntegrator
const RooAbsFunc_function = nullptr
 Pointer to function binding of integrand.
 
bool _printEvalCounter = false
 If true print number of function evaluation required for integration.
 
bool _valid = false
 Is integrator in valid state?
 

Friends

class RooNumIntFactory
 

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

Inheritance diagram for RooMCIntegrator:
[legend]

Member Enumeration Documentation

◆ GeneratorType

Enumerator
QuasiRandom 
PseudoRandom 

Definition at line 28 of file RooMCIntegrator.h.

◆ SamplingMode

Enumerator
Importance 
ImportanceOnly 
Stratified 

Definition at line 27 of file RooMCIntegrator.h.

◆ Stage

Enumerator
AllStages 
ReuseGrid 
RefineGrid 

Definition at line 36 of file RooMCIntegrator.h.

Constructor & Destructor Documentation

◆ RooMCIntegrator() [1/2]

RooMCIntegrator::RooMCIntegrator ( const RooAbsFunc function,
SamplingMode  mode = Importance,
GeneratorType  genType = QuasiRandom,
bool  verbose = false 
)

Construct an integrator over 'function' with given sampling mode and generator type.

The sampling mode can be 'Importance' (default), 'ImportanceOnly' and 'Stratified'. The generator type can be 'QuasiRandom' (default) and 'PseudoRandom'. Consult the original VEGAS documentation on details of the mode and type parameters.

Definition at line 100 of file RooMCIntegrator.cxx.

◆ RooMCIntegrator() [2/2]

RooMCIntegrator::RooMCIntegrator ( const RooAbsFunc function,
const RooNumIntConfig config 
)

Construct an integrator over 'function' where the configuration details are taken from 'config'.

Definition at line 117 of file RooMCIntegrator.cxx.

Member Function Documentation

◆ checkLimits()

bool RooMCIntegrator::checkLimits ( ) const
overridevirtual

Check if we can integrate over the current domain.

If return value is true we cannot handle the current limits (e.g. where the domain of one or more observables is open ended.

Reimplemented from RooAbsIntegrator.

Definition at line 139 of file RooMCIntegrator.cxx.

◆ getAlpha()

double RooMCIntegrator::getAlpha ( ) const
inline

Definition at line 39 of file RooMCIntegrator.h.

◆ getGenType()

GeneratorType RooMCIntegrator::getGenType ( ) const
inline

Definition at line 42 of file RooMCIntegrator.h.

◆ grid()

const RooGrid & RooMCIntegrator::grid ( ) const
inline

Definition at line 45 of file RooMCIntegrator.h.

◆ integral()

double RooMCIntegrator::integral ( const double yvec = nullptr)
overridevirtual

Evaluate the integral using a fixed number of calls to evaluate the integrand equal to about 10k per dimension.

Use the first 5k calls to refine the grid over 5 iterations of 1k calls each, and the remaining 5k calls for a single high statistics integration.

Implements RooAbsIntegrator.

Definition at line 152 of file RooMCIntegrator.cxx.

◆ registerIntegrator()

void RooMCIntegrator::registerIntegrator ( RooNumIntFactory fact)
staticprotected

This function registers class RooMCIntegrator, its configuration options and its capabilities with RooNumIntFactory.

Definition at line 52 of file RooMCIntegrator.cxx.

◆ setAlpha()

void RooMCIntegrator::setAlpha ( double  alpha)
inline

Definition at line 40 of file RooMCIntegrator.h.

◆ setGenType()

void RooMCIntegrator::setGenType ( GeneratorType  type)
inline

Definition at line 43 of file RooMCIntegrator.h.

◆ vegas()

double RooMCIntegrator::vegas ( Stage  stage,
UInt_t  calls,
UInt_t  iterations,
double absError = nullptr 
)

Perform one step of Monte Carlo integration using the specified number of iterations with (approximately) the specified number of integrand evaluation calls per iteration.

Use the VEGAS algorithm, starting from the specified stage. Returns the best estimate of the integral. Also sets *absError to the estimated absolute error of the integral estimate if absError is non-zero.

Definition at line 169 of file RooMCIntegrator.cxx.

Friends And Related Symbol Documentation

◆ RooNumIntFactory

friend class RooNumIntFactory
friend

Definition at line 48 of file RooMCIntegrator.h.

Member Data Documentation

◆ _alpha

double RooMCIntegrator::_alpha
protected

Grid stiffness parameter.

Definition at line 55 of file RooMCIntegrator.h.

◆ _calls_per_box

UInt_t RooMCIntegrator::_calls_per_box
protected

Scratch variables preserved between calls to vegas1/2/2.

Definition at line 66 of file RooMCIntegrator.h.

◆ _chi_sum

double RooMCIntegrator::_chi_sum
protected

Definition at line 64 of file RooMCIntegrator.h.

◆ _chisq

double RooMCIntegrator::_chisq
protected

Definition at line 64 of file RooMCIntegrator.h.

◆ _genType

GeneratorType RooMCIntegrator::_genType
protected

Generator type.

Definition at line 57 of file RooMCIntegrator.h.

◆ _grid

RooGrid RooMCIntegrator::_grid
mutableprotected

Definition at line 51 of file RooMCIntegrator.h.

◆ _it_num

UInt_t RooMCIntegrator::_it_num
protected

Definition at line 66 of file RooMCIntegrator.h.

◆ _it_start

UInt_t RooMCIntegrator::_it_start
protected

Definition at line 66 of file RooMCIntegrator.h.

◆ _jac

double RooMCIntegrator::_jac
protected

Definition at line 64 of file RooMCIntegrator.h.

◆ _mode

Int_t RooMCIntegrator::_mode
protected

Sampling mode.

Definition at line 56 of file RooMCIntegrator.h.

◆ _nIntegratePerDim

Int_t RooMCIntegrator::_nIntegratePerDim
protected

Number of integration samplings (per dim)

Definition at line 60 of file RooMCIntegrator.h.

◆ _nRefineIter

Int_t RooMCIntegrator::_nRefineIter
protected

Number of refinement iterations.

Definition at line 58 of file RooMCIntegrator.h.

◆ _nRefinePerDim

Int_t RooMCIntegrator::_nRefinePerDim
protected

Number of refinement samplings (per dim)

Definition at line 59 of file RooMCIntegrator.h.

◆ _result

double RooMCIntegrator::_result
protected

Definition at line 64 of file RooMCIntegrator.h.

◆ _samples

UInt_t RooMCIntegrator::_samples
protected

Definition at line 66 of file RooMCIntegrator.h.

◆ _sigma

double RooMCIntegrator::_sigma
protected

Scratch variables preserved between calls to vegas1/2/2.

Definition at line 65 of file RooMCIntegrator.h.

◆ _sum_wgts

double RooMCIntegrator::_sum_wgts
protected

Definition at line 64 of file RooMCIntegrator.h.

◆ _timer

TStopwatch RooMCIntegrator::_timer
protected

Timer.

Definition at line 62 of file RooMCIntegrator.h.

◆ _verbose

bool RooMCIntegrator::_verbose
protected

Verbosity control.

Definition at line 54 of file RooMCIntegrator.h.

◆ _wtd_int_sum

double RooMCIntegrator::_wtd_int_sum
protected

Definition at line 64 of file RooMCIntegrator.h.

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