Monte Carlo numerical integrators#

The modularity of CepGen also allows for multiple integration algorithms to be steered and profit for some increased numerical stability of a wise choice of parameters. Several interfaces to external algorithms are provided in the core and CepGenAddOns libraries.

In the Python cards parsing these can be steered through the integrator keyword. All modules are derived from a common cepgen::Integrator object, described below:

A full list of the algorithms and their parameters can be found here.

class Integrator : public NamedModule<Integrator>#

Subclassed by BasesIntegrator, FoamIntegrator, GSLIntegrator, NaiveBoostIntegrator, Integrator, Integrator, Integrator

Detailed description

class Integrator : public NamedModule<Integrator>

Monte-Carlo integration algorithm.

Subclassed by BasesIntegrator, FoamIntegrator, GSLIntegrator, NaiveBoostIntegrator, Integrator, Integrator, Integrator

Public Functions

explicit Integrator(const ParametersList &params)

Integrator algorithm constructor.

void checkLimits(const Integrand&)

Ensure the integration bounds are properly set.

inline virtual void setLimits(const std::vector<Limits> &limits)

Specify the variables limits on integration.

virtual double eval(Integrand&, const std::vector<double>&) const

Compute the function value at the given phase space point.

virtual double uniform(const Limits& = {0., 1.}) const

Generate a uniformly distributed (between 0 and 1) random number.

virtual Value integrate(Integrand &result) = 0

Perform the multidimensional Monte Carlo integration.

Parameters:

result[out] integral computed over the full phase space

inline const std::string &name() const

Module unique indexing name.

inline bool operator==(const SteeredObject &oth) const

Equality operator.

inline bool operator!=(const SteeredObject &oth) const

Inequality operator.

inline virtual const ParametersList &parameters() const override

Module user-defined parameters.

inline virtual void setParameters(const ParametersList &params) override

Set module parameters.

inline void setDescribedParameters(const ParametersList &params_orig)

Set (documented) module parameters.

Public Static Functions

static Value integrate(const std::function<double(const std::vector<double>&)>&, const ParametersList&, size_t)

Perform an integration with a given functional and a given set of parameters.

static Value integrate(const std::function<double(const std::vector<double>&)>&, const ParametersList&, const std::vector<Limits>&)

Perform an integration with a given functional and a given set of parameters.


GSL Monte Carlo integrator algorithms#

This category encompasses all “historical” integrator algorithms. Relying on the GSL implementation of gsl_monte_xxx integration routines, they are all characterised by a set of algorithm-specific relevent parameters (see the GSL manual for a description).

Currently, three modules are provided natively in CepGen:

In CepGen, all interfacing modules are derivatives of the base cepgen::GSLIntegrator object:

class GSLIntegrator : public Integrator#

Subclassed by MISERIntegrator, PlainIntegrator, VegasIntegrator

ROOT integration algorithms#

Added in version 0.9.10.

This two-in-one cepgen::root::Integrator interfacing object allows the numerical integration of an integrand through the two ROOT numerical integration algorithms:

According to the user’s request, either of the two objects is populated and configured. The following parameters are to be steered by the end user:

  • type: integrator algorithm type: : - gauss, legendre, adaptive, adaptiveSingular, nonAdaptive, for one-dimensional integration,

    • adaptive, plain, miser, vegas for multidimensional integration. The last three are one-to-one equivalent to the GSL Monte Carlo algorithms described above (except for the interface and parameters definition).

  • absToL: desired absolute error ;

  • relToL: desired relative error ;

  • size: maximum number of sub-intervals.

Foam integration algorithm#

Added in version 0.9.10.

Whenever found in the ROOT installation path, an interface to the Foam algorithm [Jad03] is also provided (either for numerical integration, or for unweighted event generation). The interfacing object, cepgen::FoamIntegrator, can be steered using the parameters listed here.

Python integration algorithms#

Added in version 1.2.0.

The cepgen::python::Integrator Python extension module allows the interfacing between CepGen and any Python numerical integrator algorithm. It relies on the definition of a Python wrapper/interfacing function of the form:

def integrate(f,                # [](vector<double>) -> double, C++ integrand wrapper
              num_dim: int,     # number of dimensions to integrate
              num_iter: int,    # (optional) number of iterations for integration
              num_warmup: int,  # number of function calls for (optional) warmup
              num_calls: int,   # number of function calls at each iteration
              limits: list[tuple[float]]=[]  # list of (min, max) variables limits
              ):
    # definition of integration procedure
    # [...]
    return (average, standard_deviation)

Among centrally provided implementations of Python integrators wrapper (found in the python/IntegrationAlgos directory), one may quote: