47 #include "gsl/gsl_monte_vegas.h" 48 #include "gsl/gsl_monte_miser.h" 49 #include "gsl/gsl_monte_plain.h" 81 fResult(0),fError(0),fStatus(-1),
214 std::cerr <<
"GSLIntegrator - Error: Unknown integration type" << std::endl;
215 throw std::exception();
294 MATH_WARN_MSG(
"GSLMCIntegration",
"Invalid integration type : use Vegas as default");
304 std::string typeName = (type!=0) ? type :
"VEGAS";
305 if (type == 0)
MATH_INFO_MSG(
"GSLMCIntegration::SetTypeName",
"use default Vegas integrator method");
306 std::transform(typeName.begin(), typeName.end(), typeName.begin(), (int(*)(int)) toupper );
310 if (typeName ==
"PLAIN") {
313 else if (typeName ==
"MISER") {
316 else if (typeName !=
"VEGAS") {
317 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");
ROOT::Math::IntegratorMultiDimOptions Options() const
get the option used for the integration
virtual unsigned int NDim() const =0
Retrieve the dimension of the function.
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
double(* GSLMonteFuncPointer)(double *, size_t, void *)
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
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
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_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()
#define MATH_WARN_MSG(loc, str)
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)
virtual MCIntegration::Type Type() const =0
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
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...
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
virtual ROOT::Math::IOptions * Options() const =0
retrieve option pointer corresponding to parameters create a new object to be managed by the user ...
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
#define MATH_ERROR_MSG(loc, str)