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 RooAbsFunc * | integrand () 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 |
Enumerator | |
---|---|
Trapezoid | |
Midpoint |
Definition at line 39 of file RooRombergIntegrator.h.
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::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::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::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.
|
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.
|
protected |
Initialize the integrator.
Definition at line 397 of file RooRombergIntegrator.cxx.
Implements RooAbsIntegrator.
Definition at line 477 of file RooRombergIntegrator.cxx.
Calculate numeric integral at given set of function binding parameters.
Definition at line 492 of file RooRombergIntegrator.cxx.
|
staticprotected |
Register integrator plugins, their parameters and capabilities with RooNumIntFactory.
Definition at line 239 of file RooRombergIntegrator.cxx.
Reimplemented from RooAbsIntegrator.
Definition at line 54 of file RooAbsIntegrator.h.
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.
Interface to set limits on integration.
Reimplemented from RooAbsIntegrator.
Definition at line 55 of file RooAbsIntegrator.cxx.
Interface function that allows to defer limit definition to integrand definition.
Reimplemented from RooAbsIntegrator.
Definition at line 55 of file RooRombergIntegrator.h.
|
friend |
Definition at line 62 of file RooRombergIntegrator.h.
|
protected |
Apply conversion step?
Definition at line 78 of file RooRombergIntegrator.h.
|
protected |
Absolute convergence tolerance.
Definition at line 76 of file RooRombergIntegrator.h.
|
protected |
Relative convergence tolerance.
Definition at line 77 of file RooRombergIntegrator.h.
|
protected |
Fixed number of steps.
Definition at line 75 of file RooRombergIntegrator.h.
|
protected |
Maximum number of steps.
Definition at line 73 of file RooRombergIntegrator.h.
|
protected |
Minimum number of steps to declare convergence to zero.
Definition at line 74 of file RooRombergIntegrator.h.
|
protected |
Definition at line 71 of file RooRombergIntegrator.h.
|
protected |
Number of segments.
Definition at line 79 of file RooRombergIntegrator.h.
|
protected |
Definition at line 72 of file RooRombergIntegrator.h.
|
protected |
If true limits of function binding are used.
Definition at line 68 of file RooRombergIntegrator.h.
|
protected |
! Integrator workspace
Definition at line 84 of file RooRombergIntegrator.h.
|
protected |
Definition at line 85 of file RooRombergIntegrator.h.
|
protected |
! Upper integration bounds
Definition at line 81 of file RooRombergIntegrator.h.
|
protected |
! Lower integration bounds
Definition at line 80 of file RooRombergIntegrator.h.