46 #include "gsl/gsl_monte_vegas.h"
47 #include "gsl/gsl_monte_miser.h"
48 #include "gsl/gsl_monte_plain.h"
80 fResult(0),fError(0),fStatus(-1),
107 fResult(0),fError(0),fStatus(-1),
211 std::cerr <<
"GSLIntegrator - Error: Unknown integration type" << std::endl;
212 throw std::exception();
286 MATH_WARN_MSG(
"GSLMCIntegration",
"Invalid integration type : use Vegas as default");
296 std::string typeName = (type!=0) ? type :
"VEGAS";
297 if (type == 0)
MATH_INFO_MSG(
"GSLMCIntegration::SetTypeName",
"use default Vegas integrator method");
298 std::transform(typeName.begin(), typeName.end(), typeName.begin(), (int(*)(int)) toupper );
302 if (typeName ==
"PLAIN") {
305 else if (typeName ==
"MISER") {
308 else if (typeName !=
"VEGAS") {
309 MATH_WARN_MSG(
"GSLMCIntegration::SetTypeName",
"Invalid integration type : use Vegas as default");
329 else std::cerr <<
"Mode not matching integration type";
355 MATH_WARN_MSG(
"GSLMCIntegrator::SetOptions",
"Invalid options set for the chosen integration type - ignore them");
371 MATH_ERROR_MSG(
"GSLIntegrator::SetParameters",
" Parameters not matching integration type");
384 MATH_ERROR_MSG(
"GSLIntegrator::SetParameters",
" Parameters not matching integration type");
413 return ws->
GetWS()->sigma;
417 std::cerr <<
"Parameter not mathcing integration type";
433 return ws->
GetWS()->chisq;
437 std::cerr <<
"Parameter not mathcing integration type";
449 MATH_ERROR_MSG(
"GSLMCIntegrator::CheckFunction",
"Function has not been specified");
ROOT::Math::IntegratorMultiDimOptions Options() const
get the option used for the integration
double Result() const
return the type of the integration used
GSLMCIntegrator(MCIntegration::Type type=MCIntegration::kVEGAS, double absTol=-1, double relTol=-1, unsigned int calls=0)
constructor of GSL MCIntegrator using all the default options
Namespace for new ROOT classes and functions.
GSLMonteFunctionWrapper * fFunction
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)
Type
enumeration specifying the integration types.
void SetWKSize(unsigned int size)
set workspace size
void SetFuncPointer(GSLMonteFuncPointer f)
gsl_monte_plain_state * GetWS()
void SetNCalls(unsigned int calls)
set maximum number of function calls
structures collecting parameters for MISER multidimensional integration
void SetParameters(const MiserParameters &p)
void SetFunction(const IMultiGenFunction &f)
method to set the a generic integration function
#define MATH_WARN_MSG(loc, str)
structures collecting parameters for VEGAS multidimensional integration FOr implementation of default...
double Error() const
return the estimate of the absolute Error of the last Integral calculation
void SetRelTolerance(double relTolerance)
set the desired relative Error
double ChiSqr()
returns chi-squared per degree of freedom for the estimate of the integral in the Vegas algorithm ...
IOptions * ExtraOptions() const
return extra options
const char * GetTypeName() const
return the name
virtual ~GSLMCIntegrator()
destructor
GSLMCIntegrationWorkspace * fWorkspace
GSLRngWrapper class to wrap gsl_rng structure.
virtual size_t NDim() const
void SetParameters(const struct VegasParameters &p)
#define MATH_ERROR_MSG(loc, str)
#define MATH_INFO_MSG(loc, str)
Numerical multi dimensional integration options.
void SetFunction(const FuncType &f)
Fill gsl function structure from a C++ Function class.
Interface (abstract) class for multi numerical integration It must be implemented by the concrete Int...
void SetIntegrator(const char *name)
set multi-dim integrator name
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.
MCIntegration::Type fType
void SetParameters(const VegasParameters &p)
set default parameters for VEGAS method
unsigned int NCalls() const
maximum number of function calls
gsl_monte_miser_state * GetWS()
void SetOptions(const ROOT::Math::IntegratorMultiDimOptions &opt)
set the integration options
gsl_monte_function * GetFunc()
void SetType(MCIntegration::Type type)
set integration method
void SetTypeName(const char *typeName)
set integration method using a name instead of an enumeration
GSLMCIntegrator & operator=(const GSLMCIntegrator &)
static ROOT::Math::IOptions * FindDefault(const char *name)
double RelTolerance() const
absolute tolerance
std::string Integrator() const
name of multi-dim integrator
int Status() const
return the Error Status of the last Integral calculation
double Sigma()
set parameters for PLAIN method
ROOT::Math::IOptions * ExtraOptions() const
get the specific options (for Vegas or Miser) in term of string- name
virtual ROOT::Math::IOptions * Options() const =0
retrieve option pointer corresponding to parameters create a new object to be managed by the user ...
Namespace for new Math classes and functions.
double(* GSLMonteFuncPointer)(double *, size_t, void *)
Class for adapting any multi-dimension C++ functor class to C function pointers used by GSL MonteCarl...
void SetGenerator(GSLRngWrapper *r)
set random number generator
void SetMode(MCIntegration::Mode mode)
set integration mode for VEGAS method The possible MODE are : MCIntegration::kIMPORTANCE (default) : ...
Generic interface for defining configuration options of a numerical algorithm.
wrapper to a multi-dim function withtout derivatives for Monte Carlo multi-dimensional integration al...
virtual MCIntegration::Type Type() const =0
void SetAbsTolerance(double absTolerance)
set the desired absolute Error
virtual void Clear()
free the workspace deleting the GSL pointer
double AbsTolerance() const
non-static methods for retrivieng options
virtual bool Init(size_t dim)=0
initialize the workspace creating the GSL pointer if it is not there
Documentation for the abstract class IBaseFunctionMultiDim.
gsl_monte_vegas_state * GetWS()
void SetRelTolerance(double tol)
set the relative tolerance
void SetAbsTolerance(double tol)
non-static methods for setting options