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 RooAbsFunc * | integrand () 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 |
Enumerator | |
---|---|
QuasiRandom | |
PseudoRandom |
Definition at line 28 of file RooMCIntegrator.h.
Enumerator | |
---|---|
Importance | |
ImportanceOnly | |
Stratified |
Definition at line 27 of file RooMCIntegrator.h.
Enumerator | |
---|---|
AllStages | |
ReuseGrid | |
RefineGrid |
Definition at line 36 of file RooMCIntegrator.h.
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::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.
|
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.
|
inline |
Definition at line 39 of file RooMCIntegrator.h.
|
inline |
Definition at line 42 of file RooMCIntegrator.h.
|
inline |
Definition at line 45 of file RooMCIntegrator.h.
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.
|
staticprotected |
This function registers class RooMCIntegrator, its configuration options and its capabilities with RooNumIntFactory.
Definition at line 52 of file RooMCIntegrator.cxx.
|
inline |
Definition at line 40 of file RooMCIntegrator.h.
|
inline |
Definition at line 43 of file RooMCIntegrator.h.
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.
|
friend |
Definition at line 48 of file RooMCIntegrator.h.
|
protected |
Grid stiffness parameter.
Definition at line 55 of file RooMCIntegrator.h.
|
protected |
Scratch variables preserved between calls to vegas1/2/2.
Definition at line 66 of file RooMCIntegrator.h.
|
protected |
Definition at line 64 of file RooMCIntegrator.h.
|
protected |
Definition at line 64 of file RooMCIntegrator.h.
|
protected |
Generator type.
Definition at line 57 of file RooMCIntegrator.h.
|
mutableprotected |
Definition at line 51 of file RooMCIntegrator.h.
|
protected |
Definition at line 66 of file RooMCIntegrator.h.
|
protected |
Definition at line 66 of file RooMCIntegrator.h.
|
protected |
Definition at line 64 of file RooMCIntegrator.h.
|
protected |
Sampling mode.
Definition at line 56 of file RooMCIntegrator.h.
|
protected |
Number of integration samplings (per dim)
Definition at line 60 of file RooMCIntegrator.h.
|
protected |
Number of refinement iterations.
Definition at line 58 of file RooMCIntegrator.h.
|
protected |
Number of refinement samplings (per dim)
Definition at line 59 of file RooMCIntegrator.h.
|
protected |
Definition at line 64 of file RooMCIntegrator.h.
|
protected |
Definition at line 66 of file RooMCIntegrator.h.
|
protected |
Scratch variables preserved between calls to vegas1/2/2.
Definition at line 65 of file RooMCIntegrator.h.
|
protected |
Definition at line 64 of file RooMCIntegrator.h.
|
protected |
Definition at line 62 of file RooMCIntegrator.h.
|
protected |
Verbosity control.
Definition at line 54 of file RooMCIntegrator.h.
|
protected |
Definition at line 64 of file RooMCIntegrator.h.