71 for (
int j = 1;
j <
n - 1;
j++) {
79 for (
int j = 1;
j <= it;
j++) {
105 const int nInt = 1 << (
n - 2);
110 for (
int j = 0;
j <
nInt; ++
j) {
121std::pair<double, double>
extrapolate(
int n,
double const *
h,
double const *s,
double *
c,
double *
d)
127 double dif = std::abs(
xa[1]);
128 for (
int i = 1; i <=
nPoints; i++) {
129 double dift = std::abs(
xa[i]);
140 for (
int i = 1; i <=
nPoints -
m; i++) {
142 double hp =
xa[i +
m];
143 double w =
c[i + 1] -
d[i];
146 throw std::runtime_error(
"RooRombergIntegrator::extrapolate: internal error");
165 std::span<double>
hArr, std::span<double>
sArr)
173 std::array<double, nPoints + 1>
cArr = {};
174 std::array<double, nPoints + 1>
dArr = {};
185 for (
int jj = 0;
jj <=
j;
jj++) {
244 sumRule.defineType(
"Trapezoid", RooRombergIntegrator::Trapezoid);
245 sumRule.defineType(
"Midpoint", RooRombergIntegrator::Midpoint);
248 extrap.defineType(
"None", 0);
249 extrap.defineType(
"Wynn-Epsilon", 1);
250 extrap.setLabel(
"Wynn-Epsilon");
256 std::string
name =
"RooIntegrator1D";
259 return std::make_unique<RooRombergIntegrator>(function, config, 1,
false);
271 return std::make_unique<RooRombergIntegrator>(function, config, 2,
false);
273 std::string
name2d =
"RooIntegrator2D";
283 return std::make_unique<RooRombergIntegrator>(function, config, 1,
true);
294 return std::make_unique<RooRombergIntegrator>(function, config, 2,
true);
302 "RooSegmentedIntegrator1D");
325 _useIntegrandLimits(
false),
331 _xmin.push_back(
xmin);
332 _xmax.push_back(
xmax);
345 _epsAbs(config.epsAbs()),
346 _epsRel(config.epsRel())
357 _epsAbs /= std::sqrt(
_nSeg);
358 _epsRel /= std::sqrt(
_nSeg);
362 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::ctor() ERROR: fixSteps>maxSteps, fixSteps set to maxSteps"
367 _useIntegrandLimits =
true;
375RooRombergIntegrator::RooRombergIntegrator(
const RooAbsFunc &function,
double xmin,
double xmax,
378 _useIntegrandLimits(
false),
380 _epsAbs(config.epsAbs()),
381 _epsRel(config.epsRel())
391 _xmin.push_back(
xmin);
392 _xmax.push_back(
xmax);
399bool RooRombergIntegrator::initialize()
413 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::initialize: cannot integrate invalid function"
419 _x.resize(_function->getDimension());
424 return checkLimits();
432bool RooRombergIntegrator::setLimits(
double *
xmin,
double *
xmax)
434 if (_useIntegrandLimits) {
435 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::setLimits: cannot override integrand's limits"
445 return checkLimits();
452bool RooRombergIntegrator::checkLimits()
const
454 if (_useIntegrandLimits) {
455 assert(
nullptr != integrand() && integrand()->isValid());
456 const_cast<std::vector<double> &
>(_xmin).resize(_nDim);
457 const_cast<std::vector<double> &
>(_xmax).resize(_nDim);
459 const_cast<double &
>(_xmin[
iDim]) = integrand()->getMinLimit(
iDim);
460 const_cast<double &
>(_xmax[
iDim]) = integrand()->getMaxLimit(
iDim);
468 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::checkLimits: bad range with min > max (_xmin[" <<
iDim
469 <<
"] = " <<
xmin <<
" _xmax[" <<
iDim <<
"] = " <<
xmax <<
")" << std::endl;
479double RooRombergIntegrator::integral(
const double *
yvec)
483 for (
unsigned int i = 0; i < _function->getDimension() - 1; i++) {
484 _x[i + _nDim] =
yvec[i];
488 return integral(_nDim - 1,
_nSeg, _wksp);
494double RooRombergIntegrator::integral(
int iDim,
int nSeg, std::span<double>
wksp)
533 auto func = [&](
double x) {
545 oocoutW(
nullptr, Integration) <<
"RooRombergIntegrator::integral: integral of " << _function->getName()
546 <<
" over range (" <<
xmin <<
"," <<
xmax <<
") did not converge after "
549 ooccoutW(
nullptr, Integration) <<
" [" <<
j <<
"] h = " <<
hArr[
j] <<
" , s = " <<
sArr[
j] << std::endl;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t del
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Abstract interface for evaluating a real-valued function of one real variable and performing numerica...
Abstract interface for integrators of real-valued functions that implement the RooAbsFunc interface.
RooArgSet is a container object that can hold multiple RooAbsArg objects.
Object to represent discrete states.
Holds the configuration parameters of the various numeric integrators used by RooRealIntegral.
const RooArgSet & getConfigSection(const char *name) const
Retrieve configuration information specific to integrator with given name.
static RooNumIntConfig & defaultConfig()
Return reference to instance of default numeric integrator configuration object.
Factory to instantiate numeric integrators from a given function binding and a given configuration.
static constexpr int isInfinite(double x)
Return true if x is infinite by RooNumber internal specification.
Variable that can be changed from the outside.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)
The namespace RooFit contains mostly switches that change the behaviour of functions of PDFs (or othe...
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)
static uint64_t sum(uint64_t i)