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),
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");
379 MATH_ERROR_MSG(
"GSLIntegrator::SetParameters",
" Parameters not matching integration type");
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");
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
double(* GSLMonteFuncPointer)(double *, size_t, void *)
unsigned int NCalls() const
maximum number of function calls
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)
int Status() const
return the Error Status of the last Integral calculation
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)
double RelTolerance() const
absolute tolerance
structures collecting parameters for VEGAS multidimensional integration FOr implementation of default...
virtual size_t NDim() const
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 ...
GSLRandomEngine Base class for all GSL random engines, normally user instantiate the derived classes ...
virtual ~GSLMCIntegrator()
destructor
GSLMCIntegrationWorkspace * fWorkspace
GSLRngWrapper class to wrap gsl_rng structure.
void SetParameters(const struct VegasParameters &p)
#define MATH_ERROR_MSG(loc, str)
ROOT::Math::IntegratorMultiDimOptions Options() const
get the option used for the integration
Documentation for the abstract class IBaseFunctionMultiDim.
std::string Integrator() const
name of multi-dim integrator
#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...
double AbsTolerance() const
non-static methods for retrivieng options
void SetIntegrator(const char *name)
set multi-dim integrator name
MCIntegration::Type fType
void SetParameters(const VegasParameters &p)
set default parameters for VEGAS method
GSLRngWrapper * Engine()
internal method to return the engine Used by class like GSLMCIntegrator to set the engine ...
gsl_monte_miser_state * GetWS()
void SetOptions(const ROOT::Math::IntegratorMultiDimOptions &opt)
set the integration options
ROOT::Math::IOptions * ExtraOptions() const
get the specific options (for Vegas or Miser) in term of string- name
gsl_monte_function * GetFunc()
void SetType(MCIntegration::Type type)
set integration method
double Result() const
return the type of the integration used
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)
void SetGenerator(GSLRandomEngine &r)
set random number generator
const char * GetTypeName() const
return the name
double Sigma()
set parameters for PLAIN method
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.
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
IOptions * ExtraOptions() const
return extra options
virtual void Clear()
free the workspace deleting the GSL pointer
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
virtual bool Init(size_t dim)=0
initialize the workspace creating the GSL pointer if it is not there
gsl_monte_vegas_state * GetWS()
void SetRelTolerance(double tol)
set the relative tolerance
double Error() const
return the estimate of the absolute Error of the last Integral calculation
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.
void SetAbsTolerance(double tol)
non-static methods for setting options