69 for (
int j = 1;
j <
n - 1;
j++) {
77 for (
int j = 1;
j <= it;
j++) {
103 const int nInt = 1 << (
n - 2);
108 for (
int j = 0;
j <
nInt; ++
j) {
119std::pair<double, double>
extrapolate(
int n,
double const *
h,
double const *s,
double *
c,
double *
d)
125 double dif = std::abs(
xa[1]);
126 for (
int i = 1; i <=
nPoints; i++) {
127 double dift = std::abs(
xa[i]);
138 for (
int i = 1; i <=
nPoints -
m; i++) {
140 double hp =
xa[i +
m];
141 double w =
c[i + 1] -
d[i];
144 throw std::runtime_error(
"RooRombergIntegrator::extrapolate: internal error");
163 std::span<double>
hArr, std::span<double>
sArr)
171 std::array<double, nPoints + 1>
cArr = {};
172 std::array<double, nPoints + 1>
dArr = {};
183 for (
int jj = 0;
jj <=
j;
jj++) {
242 sumRule.defineType(
"Trapezoid", RooRombergIntegrator::Trapezoid);
243 sumRule.defineType(
"Midpoint", RooRombergIntegrator::Midpoint);
246 extrap.defineType(
"None", 0);
247 extrap.defineType(
"Wynn-Epsilon", 1);
248 extrap.setLabel(
"Wynn-Epsilon");
254 std::string
name =
"RooIntegrator1D";
257 return std::make_unique<RooRombergIntegrator>(function, config, 1,
false);
269 return std::make_unique<RooRombergIntegrator>(function, config, 2,
false);
271 std::string
name2d =
"RooIntegrator2D";
281 return std::make_unique<RooRombergIntegrator>(function, config, 1,
true);
292 return std::make_unique<RooRombergIntegrator>(function, config, 2,
true);
300 "RooSegmentedIntegrator1D");
323 _useIntegrandLimits(
false),
329 _xmin.push_back(
xmin);
330 _xmax.push_back(
xmax);
343 _epsAbs(config.epsAbs()),
344 _epsRel(config.epsRel())
355 _epsAbs /= std::sqrt(
_nSeg);
356 _epsRel /= std::sqrt(
_nSeg);
360 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::ctor() ERROR: fixSteps>maxSteps, fixSteps set to maxSteps"
365 _useIntegrandLimits =
true;
373RooRombergIntegrator::RooRombergIntegrator(
const RooAbsFunc &function,
double xmin,
double xmax,
376 _useIntegrandLimits(
false),
378 _epsAbs(config.epsAbs()),
379 _epsRel(config.epsRel())
389 _xmin.push_back(
xmin);
390 _xmax.push_back(
xmax);
397bool RooRombergIntegrator::initialize()
411 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::initialize: cannot integrate invalid function"
417 _x.resize(_function->getDimension());
422 return checkLimits();
430bool RooRombergIntegrator::setLimits(
double *
xmin,
double *
xmax)
432 if (_useIntegrandLimits) {
433 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::setLimits: cannot override integrand's limits"
443 return checkLimits();
450bool RooRombergIntegrator::checkLimits()
const
452 if (_useIntegrandLimits) {
453 assert(
nullptr != integrand() && integrand()->isValid());
454 const_cast<std::vector<double> &
>(_xmin).resize(_nDim);
455 const_cast<std::vector<double> &
>(_xmax).resize(_nDim);
457 const_cast<double &
>(_xmin[
iDim]) = integrand()->getMinLimit(
iDim);
458 const_cast<double &
>(_xmax[
iDim]) = integrand()->getMaxLimit(
iDim);
466 oocoutE(
nullptr, Integration) <<
"RooRombergIntegrator::checkLimits: bad range with min > max (_xmin[" <<
iDim
467 <<
"] = " <<
xmin <<
" _xmax[" <<
iDim <<
"] = " <<
xmax <<
")" << std::endl;
477double RooRombergIntegrator::integral(
const double *
yvec)
481 for (
unsigned int i = 0; i < _function->getDimension() - 1; i++) {
482 _x[i + _nDim] =
yvec[i];
486 return integral(_nDim - 1,
_nSeg, _wksp);
492double RooRombergIntegrator::integral(
int iDim,
int nSeg, std::span<double>
wksp)
531 auto func = [&](
double x) {
537 std::tie(output,
steps) =
543 oocoutW(
nullptr, Integration) <<
"RooRombergIntegrator::integral: integral of " << _function->getName()
544 <<
" over range (" <<
xmin <<
"," <<
xmax <<
") did not converge after "
547 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.
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)