43using std::endl, std::string;
52 RooRealVar maxEval2D(
"maxEval2D",
"Max number of function evaluations for 2-dim integrals",100000) ;
53 RooRealVar maxEval3D(
"maxEval3D",
"Max number of function evaluations for 3-dim integrals",1000000) ;
54 RooRealVar maxEvalND(
"maxEvalND",
"Max number of function evaluations for >3-dim integrals",10000000) ;
55 RooRealVar maxWarn(
"maxWarn",
"Max number of warnings on precision not reached that is printed",5) ;
58 return std::make_unique<RooAdaptiveIntegratorND>(function, config);
80 _rooFunctor = std::make_unique<RooFunctor>(function);
81 _func = std::make_unique<ROOT::Math::Functor>(*
_rooFunctor,
static_cast<unsigned int>(
_rooFunctor->nObs()));
83 switch (_func->NDim()) {
84 case 1:
throw string(
Form(
"RooAdaptiveIntegratorND::ctor ERROR dimension of function must be at least 2")) ;
93 _integrator->SetFunction(*_func) ;
94 _useIntegrandLimits=
true ;
106RooAdaptiveIntegratorND::~RooAdaptiveIntegratorND()
110 oocoutW(
nullptr, NumIntegration) <<
"RooAdaptiveIntegratorND::dtor(" <<
_intName
111 <<
") WARNING: Number of suppressed warningings about integral evaluations where target precision was not reached is " <<
_nError-
_nWarn << std::endl;
122bool RooAdaptiveIntegratorND::checkLimits()
const
125 _xmin.resize(_func->NDim());
126 _xmax.resize(_func->NDim());
129 if (_useIntegrandLimits) {
130 for (
UInt_t i=0 ; i<_func->NDim() ; i++) {
131 _xmin[i]= integrand()->getMinLimit(i);
132 _xmax[i]= integrand()->getMaxLimit(i);
145bool RooAdaptiveIntegratorND::setLimits(
double *
xmin,
double *
xmax)
147 if(_useIntegrandLimits) {
148 oocoutE(
nullptr,Integration) <<
"RooAdaptiveIntegratorND::setLimits: cannot override integrand's limits" << std::endl;
151 for (
UInt_t i=0 ; i<_func->NDim() ; i++) {
156 return checkLimits();
165double RooAdaptiveIntegratorND::integral(
const double* )
167 double ret = _integrator->Integral(_xmin.data(),_xmax.data());
168 if (_integrator->Status()==1) {
171 oocoutW(
nullptr, NumIntegration) <<
"RooAdaptiveIntegratorND::integral(" << integrand()->getName() <<
") WARNING: target rel. precision not reached due to nEval limit of "
172 <<
_nmax <<
", estimated rel. precision is " <<
Form(
"%3.1e",_integrator->RelError()) << std::endl ;
175 oocoutW(
nullptr, NumIntegration) <<
"RooAdaptiveIntegratorND::integral(" << integrand()->getName()
176 <<
") Further warnings on target precision are suppressed conform specification in integrator specification" << std::endl ;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
char * Form(const char *fmt,...)
Formats a string in a circular formatting buffer.
Class for adaptive quadrature integration in multi-dimensions using rectangular regions.
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.
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.
Factory to instantiate numeric integrators from a given function binding and a given configuration.
Variable that can be changed from the outside.
void function(const Char_t *name_, T fun, const Char_t *docstring=0)