Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
RooAdaptiveGaussKronrodIntegrator1D Class Reference

Implements the Gauss-Kronrod integration algorithm.

An adaptive Gaussian quadrature method for numerical integration in which error is estimated based on evaluation at special points known as the "Kronrod points". By suitably picking these points, abscissas from previous iterations can be reused as part of the new set of points, whereas usual Gaussian quadrature would require recomputation of all abscissas at each iteration.

This class automatically handles (-inf,+inf) integrals by dividing the integration in three regions (-inf,-1), (-1,1), (1,inf) and calculating the 1st and 3rd term using a \( x \rightarrow 1/x \) coordinate transformation.

This class embeds the adaptive Gauss-Kronrod integrator from the GNU Scientific Library version 1.5 and applies a chosen rule ( 10-, 21-, 31-, 41, 51- or 61-point). The integration domain is subdivided and recursively integrated until the required precision is reached.

For integrands with integrable singularities the Wynn epsilon rule can be selected to speed up the convergence of these integrals.

Definition at line 24 of file RooAdaptiveGaussKronrodIntegrator1D.h.

Public Member Functions

 RooAdaptiveGaussKronrodIntegrator1D (const RooAbsFunc &function, const RooNumIntConfig &config)
 Constructor taking a function binding and a configuration object.
 RooAdaptiveGaussKronrodIntegrator1D (const RooAbsFunc &function, double xmin, double xmax, const RooNumIntConfig &config)
 Constructor taking a function binding, an integration range and a configuration object.
 ~RooAdaptiveGaussKronrodIntegrator1D () override
 Destructor.
double calculate (const double *yvec=nullptr)
 Calculate integral value with given array of parameter values.
bool checkLimits () const override
 Check that our integration range is finite and otherwise return false.
double integral (const double *yvec=nullptr) override
 Calculate and return integral at at given parameter values.
const RooAbsFuncintegrand () const
 Return integrand function binding.
double integrand (const double x[]) const
 Return value of integrand at given observable values.
bool isValid () const
 Is integrator in valid state.
bool printEvalCounter () const
bool setLimits (double *xmin, double *xmax) override
 Change our integration limits.
virtual bool setLimits (double xmin, double xmax)
 Interface to set limits on integration.
void setPrintEvalCounter (bool value)
bool setUseIntegrandLimits (bool flag) override
 Interface function that allows to defer limit definition to integrand definition.

Protected Types

enum  DomainType { Closed , OpenLo , OpenHi , Open }

Protected Member Functions

bool initialize ()
 Initialize integrator allocate buffers and setup GSL workspace.
doublexvec (double &xx)

Static Protected Member Functions

static void registerIntegrator (RooNumIntFactory &fact)
 Register this class with RooNumIntConfig as a possible choice of numeric integrator for one-dimensional integrals over finite and infinite domains.

Protected Attributes

DomainType _domainType
double _epsAbs
double _epsRel
const RooAbsFunc_function = nullptr
 Pointer to function binding of integrand.
Int_t _maxSeg
Int_t _methodKey
bool _printEvalCounter = false
 If true print number of function evaluation required for integration.
bool _useIntegrandLimits
bool _valid = false
 Is integrator in valid state?
void * _workspace = nullptr
std::vector< double_x
 ! Current coordinate
double _xmax
 ! Upper integration bound
double _xmin
 ! Lower integration bound

Friends

double RooAdaptiveGaussKronrodIntegrator1D_GSL_GlueFunction (double x, void *data)
 Glue function interacing to GSL code.
class RooNumIntFactory

#include </home/stephan/code/root-2/roofit/roofitmore/src/RooAdaptiveGaussKronrodIntegrator1D.h>

Inheritance diagram for RooAdaptiveGaussKronrodIntegrator1D:
RooAbsIntegrator

Member Enumeration Documentation

◆ DomainType

Enumerator
Closed 
OpenLo 
OpenHi 
Open 

Definition at line 48 of file RooAdaptiveGaussKronrodIntegrator1D.h.

Constructor & Destructor Documentation

◆ RooAdaptiveGaussKronrodIntegrator1D() [1/2]

RooAdaptiveGaussKronrodIntegrator1D::RooAdaptiveGaussKronrodIntegrator1D ( const RooAbsFunc & function,
const RooNumIntConfig & config )

Constructor taking a function binding and a configuration object.

Definition at line 186 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ RooAdaptiveGaussKronrodIntegrator1D() [2/2]

RooAdaptiveGaussKronrodIntegrator1D::RooAdaptiveGaussKronrodIntegrator1D ( const RooAbsFunc & function,
double xmin,
double xmax,
const RooNumIntConfig & config )

Constructor taking a function binding, an integration range and a configuration object.

Definition at line 203 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ ~RooAdaptiveGaussKronrodIntegrator1D()

RooAdaptiveGaussKronrodIntegrator1D::~RooAdaptiveGaussKronrodIntegrator1D ( )
override

Destructor.

Definition at line 238 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

Member Function Documentation

◆ calculate()

double RooAbsIntegrator::calculate ( const double * yvec = nullptr)
inherited

Calculate integral value with given array of parameter values.

Definition at line 49 of file RooAbsIntegrator.cxx.

◆ checkLimits()

bool RooAdaptiveGaussKronrodIntegrator1D::checkLimits ( ) const
overridevirtual

Check that our integration range is finite and otherwise return false.

Update the limits from the integrand if requested.

Reimplemented from RooAbsIntegrator.

Definition at line 270 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ initialize()

bool RooAdaptiveGaussKronrodIntegrator1D::initialize ( )
protected

Initialize integrator allocate buffers and setup GSL workspace.

Definition at line 224 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ integral()

double RooAdaptiveGaussKronrodIntegrator1D::integral ( const double * yvec = nullptr)
overridevirtual

Calculate and return integral at at given parameter values.

Implements RooAbsIntegrator.

Definition at line 312 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ integrand() [1/2]

const RooAbsFunc * RooAbsIntegrator::integrand ( ) const
inlineinherited

Return integrand function binding.

Definition at line 39 of file RooAbsIntegrator.h.

◆ integrand() [2/2]

double RooAbsIntegrator::integrand ( const double x[]) const
inlineinherited

Return value of integrand at given observable values.

Definition at line 34 of file RooAbsIntegrator.h.

◆ isValid()

bool RooAbsIntegrator::isValid ( ) const
inlineinherited

Is integrator in valid state.

Definition at line 29 of file RooAbsIntegrator.h.

◆ printEvalCounter()

bool RooAbsIntegrator::printEvalCounter ( ) const
inlineinherited

Definition at line 51 of file RooAbsIntegrator.h.

◆ registerIntegrator()

void RooAdaptiveGaussKronrodIntegrator1D::registerIntegrator ( RooNumIntFactory & fact)
staticprotected

Register this class with RooNumIntConfig as a possible choice of numeric integrator for one-dimensional integrals over finite and infinite domains.

Definition at line 156 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ setLimits() [1/2]

bool RooAdaptiveGaussKronrodIntegrator1D::setLimits ( double * xmin,
double * xmax )
overridevirtual

Change our integration limits.

Return true if the new limits are ok, or otherwise false. Always returns false and does nothing if this object was constructed to always use our integrand's limits.

Reimplemented from RooAbsIntegrator.

Definition at line 252 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ setLimits() [2/2]

bool RooAbsIntegrator::setLimits ( double xmin,
double xmax )
virtual

Interface to set limits on integration.

Reimplemented from RooAbsIntegrator.

Definition at line 55 of file RooAbsIntegrator.cxx.

◆ setPrintEvalCounter()

void RooAbsIntegrator::setPrintEvalCounter ( bool value)
inlineinherited

Definition at line 52 of file RooAbsIntegrator.h.

◆ setUseIntegrandLimits()

bool RooAdaptiveGaussKronrodIntegrator1D::setUseIntegrandLimits ( bool flag)
inlineoverridevirtual

Interface function that allows to defer limit definition to integrand definition.

Reimplemented from RooAbsIntegrator.

Definition at line 37 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ xvec()

double * RooAdaptiveGaussKronrodIntegrator1D::xvec ( double & xx)
inlineprotected

Definition at line 57 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ RooAdaptiveGaussKronrodIntegrator1D_GSL_GlueFunction

double RooAdaptiveGaussKronrodIntegrator1D_GSL_GlueFunction ( double x,
void * data )
friend

Glue function interacing to GSL code.

Definition at line 301 of file RooAdaptiveGaussKronrodIntegrator1D.cxx.

◆ RooNumIntFactory

friend class RooNumIntFactory
friend

Definition at line 45 of file RooAdaptiveGaussKronrodIntegrator1D.h.

Member Data Documentation

◆ _domainType

DomainType RooAdaptiveGaussKronrodIntegrator1D::_domainType
mutableprotected

Definition at line 49 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _epsAbs

double RooAdaptiveGaussKronrodIntegrator1D::_epsAbs
protected

Definition at line 65 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _epsRel

double RooAdaptiveGaussKronrodIntegrator1D::_epsRel
protected

Definition at line 66 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _function

const RooAbsFunc* RooAbsIntegrator::_function = nullptr
protectedinherited

Pointer to function binding of integrand.

Definition at line 60 of file RooAbsIntegrator.h.

◆ _maxSeg

Int_t RooAdaptiveGaussKronrodIntegrator1D::_maxSeg
protected

Definition at line 68 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _methodKey

Int_t RooAdaptiveGaussKronrodIntegrator1D::_methodKey
protected

Definition at line 67 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _printEvalCounter

bool RooAbsIntegrator::_printEvalCounter = false
protectedinherited

If true print number of function evaluation required for integration.

Definition at line 62 of file RooAbsIntegrator.h.

◆ _useIntegrandLimits

bool RooAdaptiveGaussKronrodIntegrator1D::_useIntegrandLimits
protected

Definition at line 55 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _valid

bool RooAbsIntegrator::_valid = false
protectedinherited

Is integrator in valid state?

Definition at line 61 of file RooAbsIntegrator.h.

◆ _workspace

void* RooAdaptiveGaussKronrodIntegrator1D::_workspace = nullptr
protected

Definition at line 69 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _x

std::vector<double> RooAdaptiveGaussKronrodIntegrator1D::_x
protected

! Current coordinate

Definition at line 63 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _xmax

double RooAdaptiveGaussKronrodIntegrator1D::_xmax
mutableprotected

! Upper integration bound

Definition at line 72 of file RooAdaptiveGaussKronrodIntegrator1D.h.

◆ _xmin

double RooAdaptiveGaussKronrodIntegrator1D::_xmin
mutableprotected

! Lower integration bound

Definition at line 71 of file RooAdaptiveGaussKronrodIntegrator1D.h.


The documentation for this class was generated from the following files: