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

Adaptive numerical integration algorithm.

It uses Romberg's method with trapezoids or midpoints. The integrand is approximated by \( 1, 2, 4, 8, \ldots, 2^n \) trapezoids, and Richardson series acceleration is applied to the series. For refinement step \( n \), that is

\[ R(n,m) = \frac{1}{4^m - 1} \left( 4^m R(n, m-1) - R(n-1, m-1) \right) \]

The integrator will evaluate the first six refinements (i.e. 64 points) in one go, apply a five-point series acceleration, and successively add more steps until the desired precision is reached.

Definition at line 36 of file RooRombergIntegrator.h.

Public Types

enum  SummationRule { Trapezoid , Midpoint }
 

Public Member Functions

 RooRombergIntegrator (const RooAbsFunc &function, const RooNumIntConfig &config, int nDim=1, bool doSegmentation=false)
 Construct integrator on given function binding, using specified configuration object.
 
 RooRombergIntegrator (const RooAbsFunc &function, double xmin, double xmax, const RooNumIntConfig &config, int nDim=1)
 Construct integrator on given function binding, using specified configuration object and integration range.
 
 RooRombergIntegrator (const RooAbsFunc &function, double xmin, double xmax, SummationRule rule=Trapezoid, int maxSteps=0, double eps=0)
 Construct integrator on given function binding for given range, using specified summation rule, maximum number of steps and conversion tolerance.
 
 RooRombergIntegrator (const RooAbsFunc &function, SummationRule rule=Trapezoid, int maxSteps=0, double eps=0)
 Construct integrator on given function binding, using specified summation rule, maximum number of steps and conversion tolerance.
 
bool checkLimits () const override
 Check that our integration range is finite and otherwise return false.
 
double integral (const double *yvec=nullptr) override
 
virtual bool setLimits (double *, double *)
 
bool setLimits (double *xmin, double *xmax) override
 Change our integration limits.
 
virtual bool setLimits (double xmin, double xmax)
 Interface to set limits on integration.
 
bool setUseIntegrandLimits (bool flag) override
 Interface function that allows to defer limit definition to integrand definition.
 
- Public Member Functions inherited from RooAbsIntegrator
 RooAbsIntegrator ()
 
 RooAbsIntegrator (const RooAbsFunc &function, bool printEvalCounter=false)
 Copy constructor.
 
virtual ~RooAbsIntegrator ()=default
 
double calculate (const double *yvec=nullptr)
 Calculate integral value with given array of 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
 
void setPrintEvalCounter (bool value)
 

Protected Member Functions

bool initialize ()
 Initialize the integrator.
 
double integral (int iDim, int nSeg, std::span< double > wksp)
 Calculate numeric integral at given set of function binding parameters.
 

Static Protected Member Functions

static void registerIntegrator (RooNumIntFactory &fact)
 Register integrator plugins, their parameters and capabilities with RooNumIntFactory.
 

Protected Attributes

bool _doExtrap = true
 Apply conversion step?
 
double _epsAbs
 Absolute convergence tolerance.
 
double _epsRel
 Relative convergence tolerance.
 
int _fixSteps = 0
 Fixed number of steps.
 
int _maxSteps
 Maximum number of steps.
 
int _minStepsZero = 999
 Minimum number of steps to declare convergence to zero.
 
int _nDim = 1
 
int _nSeg = 1
 Number of segments.
 
SummationRule _rule
 
bool _useIntegrandLimits
 If true limits of function binding are used.
 
std::vector< double_wksp
 ! Integrator workspace
 
std::vector< double_x
 
std::vector< double_xmax
 ! Upper integration bounds
 
std::vector< double_xmin
 ! Lower integration bounds
 
- Protected Attributes inherited from RooAbsIntegrator
const RooAbsFunc_function = nullptr
 Pointer to function binding of integrand.
 
bool _printEvalCounter = false
 If true print number of function evaluation required for integration.
 
bool _valid = false
 Is integrator in valid state?
 

Friends

class RooNumIntFactory
 

#include </home/sftnight/build/workspace/root-makedoc-master/rootspi/rdoc/src/master/roofit/roofitcore/src/RooRombergIntegrator.h>

Inheritance diagram for RooRombergIntegrator:
[legend]

Member Enumeration Documentation

◆ SummationRule

Enumerator
Trapezoid 
Midpoint 

Definition at line 39 of file RooRombergIntegrator.h.

Constructor & Destructor Documentation

◆ RooRombergIntegrator() [1/4]

RooRombergIntegrator::RooRombergIntegrator ( const RooAbsFunc function,
SummationRule  rule = Trapezoid,
int  maxSteps = 0,
double  eps = 0 
)

Construct integrator on given function binding, using specified summation rule, maximum number of steps and conversion tolerance.

The integration limits are taken from the function binding.

Definition at line 308 of file RooRombergIntegrator.cxx.

◆ RooRombergIntegrator() [2/4]

RooRombergIntegrator::RooRombergIntegrator ( const RooAbsFunc function,
double  xmin,
double  xmax,
SummationRule  rule = Trapezoid,
int  maxSteps = 0,
double  eps = 0 
)

Construct integrator on given function binding for given range, using specified summation rule, maximum number of steps and conversion tolerance.

The integration limits are taken from the function binding.

Definition at line 320 of file RooRombergIntegrator.cxx.

◆ RooRombergIntegrator() [3/4]

RooRombergIntegrator::RooRombergIntegrator ( const RooAbsFunc function,
const RooNumIntConfig config,
int  nDim = 1,
bool  doSegmentation = false 
)

Construct integrator on given function binding, using specified configuration object.

The integration limits are taken from the function binding

Definition at line 339 of file RooRombergIntegrator.cxx.

◆ RooRombergIntegrator() [4/4]

RooRombergIntegrator::RooRombergIntegrator ( const RooAbsFunc function,
double  xmin,
double  xmax,
const RooNumIntConfig config,
int  nDim = 1 
)

Construct integrator on given function binding, using specified configuration object and integration range.

Definition at line 373 of file RooRombergIntegrator.cxx.

Member Function Documentation

◆ checkLimits()

bool RooRombergIntegrator::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 450 of file RooRombergIntegrator.cxx.

◆ initialize()

bool RooRombergIntegrator::initialize ( )
protected

Initialize the integrator.

Definition at line 397 of file RooRombergIntegrator.cxx.

◆ integral() [1/2]

double RooRombergIntegrator::integral ( const double yvec = nullptr)
overridevirtual

Implements RooAbsIntegrator.

Definition at line 477 of file RooRombergIntegrator.cxx.

◆ integral() [2/2]

double RooRombergIntegrator::integral ( int  iDim,
int  nSeg,
std::span< double wksp 
)
protected

Calculate numeric integral at given set of function binding parameters.

Definition at line 492 of file RooRombergIntegrator.cxx.

◆ registerIntegrator()

void RooRombergIntegrator::registerIntegrator ( RooNumIntFactory fact)
staticprotected

Register integrator plugins, their parameters and capabilities with RooNumIntFactory.

Definition at line 239 of file RooRombergIntegrator.cxx.

◆ setLimits() [1/3]

virtual bool RooAbsIntegrator::setLimits ( double ,
double  
)
inlinevirtual

Reimplemented from RooAbsIntegrator.

Definition at line 54 of file RooAbsIntegrator.h.

◆ setLimits() [2/3]

bool RooRombergIntegrator::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 430 of file RooRombergIntegrator.cxx.

◆ setLimits() [3/3]

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.

◆ setUseIntegrandLimits()

bool RooRombergIntegrator::setUseIntegrandLimits ( bool  flag)
inlineoverridevirtual

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

Reimplemented from RooAbsIntegrator.

Definition at line 55 of file RooRombergIntegrator.h.

Friends And Related Symbol Documentation

◆ RooNumIntFactory

friend class RooNumIntFactory
friend

Definition at line 62 of file RooRombergIntegrator.h.

Member Data Documentation

◆ _doExtrap

bool RooRombergIntegrator::_doExtrap = true
protected

Apply conversion step?

Definition at line 78 of file RooRombergIntegrator.h.

◆ _epsAbs

double RooRombergIntegrator::_epsAbs
protected

Absolute convergence tolerance.

Definition at line 76 of file RooRombergIntegrator.h.

◆ _epsRel

double RooRombergIntegrator::_epsRel
protected

Relative convergence tolerance.

Definition at line 77 of file RooRombergIntegrator.h.

◆ _fixSteps

int RooRombergIntegrator::_fixSteps = 0
protected

Fixed number of steps.

Definition at line 75 of file RooRombergIntegrator.h.

◆ _maxSteps

int RooRombergIntegrator::_maxSteps
protected

Maximum number of steps.

Definition at line 73 of file RooRombergIntegrator.h.

◆ _minStepsZero

int RooRombergIntegrator::_minStepsZero = 999
protected

Minimum number of steps to declare convergence to zero.

Definition at line 74 of file RooRombergIntegrator.h.

◆ _nDim

int RooRombergIntegrator::_nDim = 1
protected

Definition at line 71 of file RooRombergIntegrator.h.

◆ _nSeg

int RooRombergIntegrator::_nSeg = 1
protected

Number of segments.

Definition at line 79 of file RooRombergIntegrator.h.

◆ _rule

SummationRule RooRombergIntegrator::_rule
protected

Definition at line 72 of file RooRombergIntegrator.h.

◆ _useIntegrandLimits

bool RooRombergIntegrator::_useIntegrandLimits
protected

If true limits of function binding are used.

Definition at line 68 of file RooRombergIntegrator.h.

◆ _wksp

std::vector<double> RooRombergIntegrator::_wksp
protected

! Integrator workspace

Definition at line 84 of file RooRombergIntegrator.h.

◆ _x

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

Definition at line 85 of file RooRombergIntegrator.h.

◆ _xmax

std::vector<double> RooRombergIntegrator::_xmax
protected

! Upper integration bounds

Definition at line 81 of file RooRombergIntegrator.h.

◆ _xmin

std::vector<double> RooRombergIntegrator::_xmin
protected

! Lower integration bounds

Definition at line 80 of file RooRombergIntegrator.h.

  • roofit/roofitcore/src/RooRombergIntegrator.h
  • roofit/roofitcore/src/RooRombergIntegrator.cxx