ROOT logo
ROOT » MATH » MATHMORE » ROOT::Math::GSLMCIntegrator

class ROOT::Math::GSLMCIntegrator: public ROOT::Math::VirtualIntegratorMultiDim



    Class for performing numerical integration of a multidimensional function.
    It uses the numerical integration algorithms of GSL, which reimplements the
    algorithms used in the QUADPACK, a numerical integration package written in Fortran.

    Plain MC, MISER and VEGAS integration algorithms are supported for integration over finite (hypercubic) ranges.

    <A HREF="http://www.gnu.org/software/gsl/manual/gsl-ref_16.html#SEC248">GSL Manual</A>.

    It implements also the interface ROOT::Math::VirtualIntegratorMultiDim so it can be
    instantiate using the plugin manager (plugin name is "GSLMCIntegrator")

    @ingroup MCIntegration


Function Members (Methods)

public:
virtual~GSLMCIntegrator()
doubleChiSqr()
virtual doubleError() const
ROOT::Math::IOptions*ExtraOptions() const
ROOT::Math::IntegrationMultiDim::TypeGetType() const
const char*GetTypeName() const
ROOT::Math::GSLMCIntegratorGSLMCIntegrator(ROOT::Math::IntegrationMultiDim::Type type = MCIntegration::kVEGAS, double absTol = 0, double relTol = 0, unsigned int calls = 0)
ROOT::Math::GSLMCIntegratorGSLMCIntegrator(const char* type, double absTol, double relTol, unsigned int calls)
virtual doubleIntegral(const double* a, const double* b)
doubleIntegral(const ROOT::Math::GSLMCIntegrator::GSLMonteFuncPointer& f, unsigned int dim, double* a, double* b, void* p = 0)
virtual intNEval() const
virtual ROOT::Math::IntegratorMultiDimOptionsOptions() const
virtual doubleResult() const
virtual voidSetAbsTolerance(double absTolerance)
virtual voidSetFunction(const ROOT::Math::IMultiGenFunction& f)
voidSetFunction(ROOT::Math::GSLMCIntegrator::GSLMonteFuncPointer f, unsigned int dim, void* p = 0)
voidSetGenerator(ROOT::Math::GSLRngWrapper* r)
voidSetMode(ROOT::Math::MCIntegration::Mode mode)
virtual voidSetOptions(const ROOT::Math::IntegratorMultiDimOptions& opt)
voidSetParameters(const ROOT::Math::VegasParameters& p)
voidSetParameters(const ROOT::Math::MiserParameters& p)
virtual voidSetRelTolerance(double relTolerance)
voidSetType(ROOT::Math::IntegrationMultiDim::Type type)
voidSetTypeName(const char* typeName)
doubleSigma()
virtual intStatus() const
virtual ROOT::Math::IntegrationMultiDim::TypeROOT::Math::VirtualIntegratorMultiDim::Type() const
protected:
boolCheckFunction()
voidDoInitialize()

Data Members

private:
doublefAbsTol
unsigned intfCalls
unsigned intfDim
doublefError
ROOT::Math::GSLMonteFunctionWrapper*fFunction
doublefRelTol
doublefResult
ROOT::Math::GSLRngWrapper*fRng
intfStatus
ROOT::Math::IntegrationMultiDim::TypefType
ROOT::Math::GSLMCIntegrationWorkspace*fWorkspace

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

GSLMCIntegrator(MCIntegration::Type type = MCIntegration::kVEGAS, double absTol = 0, double relTol = 0, unsigned int calls = 0 )
 constructors
       /**
           constructor of GSL MCIntegrator using all the default options
       *
       GSLMCIntegrator( );
 constructor of GSL MCIntegrator. VEGAS MC is set as default integration type

      @param type type of integration. The possible types are defined in the MCIntegration::Type enumeration
                                        Default is VEGAS
      @param absTol desired absolute Error
      @param relTol desired relative Error
      @param calls maximum number of function calls

      NOTE: When the default values are used , the options are taken from teh static method of ROOT::Math::IntegratorMultiDimOptions

GSLMCIntegrator(const char* type, double absTol, double relTol, unsigned int calls)
 constructor of GSL MCIntegrator. VEGAS MC is set as default integration type

      @param type type of integration using a char * (required by plug-in manager)
      @param absTol desired absolute Error
      @param relTol desired relative Error
      @param calls maximum number of function calls

virtual ~GSLMCIntegrator()
          destructor

GSLMCIntegrator(const ROOT::Math::GSLMCIntegrator& )
 disable copy ctrs
GSLMCIntegrator & operator=(const ROOT::Math::GSLMCIntegrator& )
void SetFunction(const ROOT::Math::IMultiGenFunction& f)
 template methods for generic functors

         method to set the a generic integration function

          @param f integration function. The function type must implement the assigment operator, <em>  double  operator() (  double  x ) </em>


void SetFunction(ROOT::Math::GSLMCIntegrator::GSLMonteFuncPointer f, unsigned int dim, void* p = 0)
double Integral(const ROOT::Math::GSLMCIntegrator::GSLMonteFuncPointer& f, unsigned int dim, double* a, double* b, void* p = 0)
 methods using GSLMonteFuncPointer

         evaluate the Integral of a function f over the defined hypercube (a,b)
       @param f integration function. The function type must implement the mathlib::IGenFunction interface
       @param a lower value of the integration interval
       @param b upper value of the integration interval

double Integral(const double* a, const double* b)
         evaluate the integral using the previously defined function

double Result() const
 to be added later
double Integral(const GSLMonteFuncPointer & f);
double Integral(GSLMonteFuncPointer f, void * p, double* a, double* b);

         return the type of the integration used

MCIntegration::Type MCType() const;

         return  the Result of the last Integral calculation

double Error() const
         return the estimate of the absolute Error of the last Integral calculation

int Status() const
         return the Error Status of the last Integral calculation

int NEval() const
          return number of function evaluations in calculating the integral
          (This is an fixed by the user)

{ return fCalls; }
void SetRelTolerance(double relTolerance)
 setter for control Parameters  (getters are not needed so far )

         set the desired relative Error

void SetAbsTolerance(double absTolerance)
         set the desired absolute Error

void SetOptions(const ROOT::Math::IntegratorMultiDimOptions& opt)
         set the integration options

void SetGenerator(ROOT::Math::GSLRngWrapper* r)
       set random number generator

void SetType(ROOT::Math::IntegrationMultiDim::Type type)
       set integration method

void SetTypeName(const char* typeName)
       set integration method using a name instead of an enumeration

void SetMode(ROOT::Math::MCIntegration::Mode mode)
       set integration mode for VEGAS method
         The possible MODE are :
         MCIntegration::kIMPORTANCE (default) : VEGAS will use importance sampling
         MCIntegration::kSTRATIFIED           : VEGAS will use stratified sampling  if certain condition are satisfied
         MCIntegration::kIMPORTANCE_ONLY      : VEGAS will always use importance smapling

void SetParameters(const VegasParameters &p)
       set default parameters for VEGAS method

void SetParameters(const MiserParameters &p)
       set default parameters for MISER method

double Sigma()
       set parameters for PLAIN method

void SetPParameters(const PlainParameters &p);

       returns the error sigma from the last iteration of the Vegas algorithm

double ChiSqr()
       returns chi-squared per degree of freedom for the estimate of the integral in the Vegas algorithm

MCIntegration::Type GetType() const
          return the type
          (need to be called GetType to avois a conflict with typedef)

{ return fType; }
const char * GetTypeName() const
          return the name

ROOT::Math::IOptions * ExtraOptions() const
         get the specific options (for Vegas or Miser)
         in term of string-  name

bool CheckFunction()
 internal method to check validity of GSL function pointer
void DoInitialize()
 set internally the type of integration method