34#include "gsl/gsl_integration.h"
63 fResult(0),fError(0),fStatus(-1),fNEval(-1),
84 fResult(0),fError(0),fStatus(-1),fNEval(-1),
102 fResult(0),fError(0),fStatus(-1),fNEval(-1),
120 fResult(0),fError(0),fStatus(-1),fNEval(-1),
128 std::string typeName(
type);
129 std::transform(typeName.begin(), typeName.end(), typeName.begin(), (
int(*)(
int)) toupper );
130 if (typeName ==
"NONADAPTIVE")
132 else if (typeName ==
"ADAPTIVE")
135 if (typeName !=
"ADAPTIVESINGULAR")
136 MATH_WARN_MSG(
"GSLIntegrator",
"Use default type: AdaptiveSingular");
167 if (
this == &rhs)
return *
this;
204 const int npts[6] = {15,21,31,41,51,61};
221 std::cerr <<
"GSLIntegrator - Error: Unknown integration type" << std::endl;
222 throw std::exception();
259 double * p =
const_cast<double *
>(&pts.front() );
267 std::cerr <<
"GSLIntegrator - Error: Unknown integration type or not enough singular points defined" << std::endl;
412 std::cerr <<
"GSLIntegrator - Error : Function has not been specified " << std::endl;
424 MATH_WARN_MSG(
"GSLIntegrator::SetOptions",
"Invalid rule options - use default ADAPTIVESINGULAR");
436 MATH_WARN_MSG(
"GSLIntegrator::SetOptions",
"Invalid rule options - use default GAUSS31");
#define MATH_WARN_MSG(loc, str)
int gsl_integration_qagil(gsl_function *f, double b, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
int gsl_integration_qag(const gsl_function *f, double a, double b, double epsabs, double epsrel, size_t limit, int key, gsl_integration_workspace *workspace, double *result, double *abserr)
int gsl_integration_qagi(gsl_function *f, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
int gsl_integration_qagiu(gsl_function *f, double a, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
int gsl_integration_qags(const gsl_function *f, double a, double b, double epsabs, double epsrel, size_t limit, gsl_integration_workspace *workspace, double *result, double *abserr)
int gsl_integration_qng(const gsl_function *f, double a, double b, double epsabs, double epsrel, double *result, double *abserr, size_t *neval)
void SetAbsTolerance(double tol)
non-static methods for setting options
double RelTolerance() const
absolute tolerance
void SetRelTolerance(double tol)
set the relative tolerance
unsigned int WKSize() const
size of the workspace
double AbsTolerance() const
non-static methods for retrivieng options
void SetWKSize(unsigned int size)
set workspace size
Wrapper class to the gsl_function C structure.
void SetFunction(const FuncType &f)
fill the GSL C struct from a generic C++ callable object implementing operator()
void SetFuncPointer(GSLFuncPointer f)
set in the GSL C struct the pointer to the function evaluation
void SetParams(void *p)
set in the GSL C struct the extra-object pointer
bool IsValid()
check if function is valid (has been set)
gsl_integration_workspace * GetWS()
Class for performing numerical integration of a function in one dimension.
virtual ROOT::Math::IntegratorOneDimOptions Options() const
get the option used for the integration
void SetAbsTolerance(double absTolerance)
set the desired absolute Error
virtual void SetOptions(const ROOT::Math::IntegratorOneDimOptions &opt)
set the options
Integration::GKRule fRule
void SetIntegrationRule(Integration::GKRule)
set the integration rule (Gauss-Kronrod rule).
GSLIntegrator & operator=(const GSLIntegrator &)
double IntegralCauchy(double a, double b, double c)
evaluate the Cauchy principal value of the integral of a previously defined function f over the defin...
double IntegralUp(const IGenFunction &f, double a)
evaluate the Integral of a function f over the semi-infinite interval (a,+inf)
double IntegralLow(const IGenFunction &f, double b)
evaluate the Integral of a function f over the over the semi-infinite interval (-inf,...
GSLIntegrationWorkspace * fWorkspace
GSLFunctionWrapper * fFunction
int Status() const
return the Error Status of the last Integral calculation
double Error() const
return the estimate of the absolute Error of the last Integral calculation
void SetRelTolerance(double relTolerance)
set the desired relative Error
GSLIntegrator(double absTol=1.E-9, double relTol=1E-6, size_t size=1000)
Default constructor of GSL Integrator for Adaptive Singular integration.
const char * GetTypeName() const
return the name
double Integral()
evaluate the Integral over the infinite interval (-inf,+inf) using the function previously set with G...
double Result() const
return the Result of the last Integral calculation
void SetFunction(const IGenFunction &f)
method to set the a generic integration function
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
Numerical one dimensional integration options.
IntegrationOneDim::Type IntegratorType() const
type of the integrator (return the enumeration type)
void SetIntegrator(const char *name)
set 1D integrator name
void SetNPoints(unsigned int n)
set number of points rule values of 1,2,3,4,5,6 corresponds to 15,21,31,41,51,61 and they are used in...
unsigned int NPoints() const
maximum number of function calls
Interface (abstract) class for 1D numerical integration It must be implemented by the concrate Integr...
GKRule
enumeration specifying the Gauss-KronRod integration rule for ADAPTIVE integration type
Type
enumeration specifying the integration types.
Namespace for new Math classes and functions.
double(* GSLFuncPointer)(double, void *)
Function pointer corresponding to gsl_function signature.