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),
107 fResult(0),fError(0),fStatus(-1),
212 std::cerr <<
"GSLIntegrator - Error: Unknown integration type" << std::endl;
213 throw std::exception();
292 MATH_WARN_MSG(
"GSLMCIntegration",
"Invalid integration type : use Vegas as default");
302 std::string typeName = (type!=0) ? type :
"VEGAS";
303 if (type == 0)
MATH_INFO_MSG(
"GSLMCIntegration::SetTypeName",
"use default Vegas integrator method");
304 std::transform(typeName.begin(), typeName.end(), typeName.begin(), (int(*)(int)) toupper );
308 if (typeName ==
"PLAIN") {
311 else if (typeName ==
"MISER") {
314 else if (typeName !=
"VEGAS") {
315 MATH_WARN_MSG(
"GSLMCIntegration::SetTypeName",
"Invalid integration type : use Vegas as default");
335 else std::cerr <<
"Mode not matching integration type";
361 MATH_WARN_MSG(
"GSLMCIntegrator::SetOptions",
"Invalid options set for the chosen integration type - ignore them");
377 MATH_ERROR_MSG(
"GSLIntegrator::SetParameters",
" Parameters not matching integration type");
390 MATH_ERROR_MSG(
"GSLIntegrator::SetParameters",
" Parameters not matching integration type");
419 return ws->
GetWS()->sigma;
423 std::cerr <<
"Parameter not mathcing integration type";
439 return ws->
GetWS()->chisq;
443 std::cerr <<
"Parameter not mathcing integration type";
455 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
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
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.
virtual size_t NDim() const
void SetParameters(const struct VegasParameters &p)
#define MATH_ERROR_MSG(loc, str)
Documentation for the abstract class IBaseFunctionMultiDim.
#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
MCIntegration::Type fType
void SetParameters(const VegasParameters &p)
set default parameters for VEGAS method
unsigned int NCalls() const
maximum number of function calls
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
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)
void SetGenerator(GSLRandomEngine &r)
set random number generator
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 ...
double(* GSLMonteFuncPointer)(double *, size_t, void *)
Class for adapting any multi-dimension C++ functor class to C function pointers used by GSL MonteCarl...
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
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
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
gsl_monte_vegas_state * GetWS()
void SetRelTolerance(double tol)
set the relative tolerance
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.
void SetAbsTolerance(double tol)
non-static methods for setting options