45#include "gsl/gsl_monte_vegas.h"
46#include "gsl/gsl_monte_miser.h"
47#include "gsl/gsl_monte_plain.h"
79 fResult(0),fError(0),fStatus(-1),
108 fResult(0),fError(0),fStatus(-1),
213 std::cerr <<
"GSLIntegrator - Error: Unknown integration type" << std::endl;
214 throw std::exception();
293 MATH_WARN_MSG(
"GSLMCIntegration",
"Invalid integration type : use Vegas as default");
303 std::string typeName = (
type!=0) ?
type :
"VEGAS";
304 if (
type == 0)
MATH_INFO_MSG(
"GSLMCIntegration::SetTypeName",
"use default Vegas integrator method");
305 std::transform(typeName.begin(), typeName.end(), typeName.begin(), (
int(*)(
int)) toupper );
309 if (typeName ==
"PLAIN") {
312 else if (typeName ==
"MISER") {
315 else if (typeName !=
"VEGAS") {
316 MATH_WARN_MSG(
"GSLMCIntegration::SetTypeName",
"Invalid integration type : use Vegas as default");
337 else std::cerr <<
"Mode not matching integration type";
363 MATH_WARN_MSG(
"GSLMCIntegrator::SetOptions",
"Invalid options set for the chosen integration type - ignore them");
376 ws->SetParameters(p);
379 MATH_ERROR_MSG(
"GSLIntegrator::SetParameters",
" Parameters not matching integration type");
389 ws->SetParameters(p);
392 MATH_ERROR_MSG(
"GSLIntegrator::SetParameters",
" Parameters not matching integration type");
421 return ws->GetWS()->sigma;
425 std::cerr <<
"Parameter not mathcing integration type";
441 return ws->GetWS()->chisq;
445 std::cerr <<
"Parameter not mathcing integration type";
457 MATH_ERROR_MSG(
"GSLMCIntegrator::CheckFunction",
"Function has not been specified");
#define MATH_INFO_MSG(loc, str)
Pre-processor macro to report messages which can be configured to use ROOT error or simply an std::io...
#define MATH_ERROR_MSG(loc, str)
#define MATH_WARN_MSG(loc, str)
void SetAbsTolerance(double tol)
non-static methods for setting options
double RelTolerance() const
absolute tolerance
void SetRelTolerance(double tol)
set the relative tolerance
double AbsTolerance() const
non-static methods for retrivieng options
void SetWKSize(unsigned int size)
set workspace size
IOptions * ExtraOptions() const
return extra options
virtual void Clear()
free the workspace deleting the GSL pointer
virtual size_t NDim() const
virtual ROOT::Math::IOptions * Options() const =0
retrieve option pointer corresponding to parameters create a new object to be managed by the user
virtual MCIntegration::Type Type() const =0
virtual bool Init(size_t dim)=0
initialize the workspace creating the GSL pointer if it is not there
double Integral(const GSLMonteFuncPointer &f, unsigned int dim, double *a, double *b, void *p=0)
evaluate the Integral of a function f over the defined hypercube (a,b)
double Error() const
return the estimate of the absolute Error of the last Integral calculation
GSLMonteFunctionWrapper * fFunction
GSLMCIntegrator(MCIntegration::Type type=MCIntegration::kVEGAS, double absTol=-1, double relTol=-1, unsigned int calls=0)
constructor of GSL MCIntegrator.
const char * GetTypeName() const
return the name
GSLMCIntegrator & operator=(const GSLMCIntegrator &)
double Result() const
return the type of the integration used
void SetOptions(const ROOT::Math::IntegratorMultiDimOptions &opt)
set the integration options
void SetParameters(const VegasParameters &p)
set default parameters for VEGAS method
void SetGenerator(GSLRandomEngine &r)
set random number generator
ROOT::Math::IntegratorMultiDimOptions Options() const
get the option used for the integration
ROOT::Math::IOptions * ExtraOptions() const
get the specific options (for Vegas or Miser) in term of string- name
GSLMCIntegrationWorkspace * fWorkspace
void SetMode(MCIntegration::Mode mode)
set integration mode for VEGAS method The possible MODE are : MCIntegration::kIMPORTANCE (default) : ...
void SetTypeName(const char *typeName)
set integration method using a name instead of an enumeration
void SetRelTolerance(double relTolerance)
set the desired relative Error
virtual ~GSLMCIntegrator()
destructor
double Sigma()
set parameters for PLAIN method
double ChiSqr()
returns chi-squared per degree of freedom for the estimate of the integral in the Vegas algorithm
int Status() const
return the Error Status of the last Integral calculation
void SetAbsTolerance(double absTolerance)
set the desired absolute Error
void SetFunction(const IMultiGenFunction &f)
method to set the a generic integration function
void SetType(MCIntegration::Type type)
set integration method
MCIntegration::Type fType
wrapper to a multi-dim function withtout derivatives for Monte Carlo multi-dimensional integration al...
gsl_monte_function * GetFunc()
void SetFunction(const FuncType &f)
Fill gsl function structure from a C++ Function class.
void SetFuncPointer(GSLMonteFuncPointer f)
GSLRandomEngine Base class for all GSL random engines, normally user instantiate the derived classes ...
GSLRngWrapper class to wrap gsl_rng structure.
Documentation for the abstract class IBaseFunctionMultiDim.
Generic interface for defining configuration options of a numerical algorithm.
Numerical multi dimensional integration options.
static ROOT::Math::IOptions * FindDefault(const char *name)
void SetIntegrator(const char *name)
set multi-dim integrator name
void SetNCalls(unsigned int calls)
set maximum number of function calls
unsigned int NCalls() const
maximum number of function calls
std::string Integrator() const
name of multi-dim integrator
Interface (abstract) class for multi numerical integration It must be implemented by the concrete Int...
Type
enumeration specifying the integration types.
double(* GSLMonteFuncPointer)(double *, size_t, void *)
Class for adapting any multi-dimension C++ functor class to C function pointers used by GSL MonteCarl...
Namespace for new Math classes and functions.
Namespace for new ROOT classes and functions.
structures collecting parameters for MISER multidimensional integration
structures collecting parameters for VEGAS multidimensional integration FOr implementation of default...