40using std::endl, std::string;
49 RooRealVar maxEval2D(
"maxEval2D",
"Max number of function evaluations for 2-dim integrals",100000) ;
50 RooRealVar maxEval3D(
"maxEval3D",
"Max number of function evaluations for 3-dim integrals",1000000) ;
51 RooRealVar maxEvalND(
"maxEvalND",
"Max number of function evaluations for >3-dim integrals",10000000) ;
52 RooRealVar maxWarn(
"maxWarn",
"Max number of warnings on precision not reached that is printed",5) ;
55 return std::make_unique<RooAdaptiveIntegratorND>(function, config);
77 _rooFunctor = std::make_unique<RooFunctor>(function);
78 _func = std::make_unique<ROOT::Math::Functor>(*
_rooFunctor,
static_cast<unsigned int>(
_rooFunctor->nObs()));
80 switch (_func->NDim()) {
81 case 1:
throw string(
Form(
"RooAdaptiveIntegratorND::ctor ERROR dimension of function must be at least 2")) ;
90 _integrator->SetFunction(*_func) ;
91 _useIntegrandLimits=
true ;
103RooAdaptiveIntegratorND::~RooAdaptiveIntegratorND()
107 oocoutW(
nullptr, NumericIntegration) <<
"RooAdaptiveIntegratorND::dtor(" <<
_intName
108 <<
") WARNING: Number of suppressed warningings about integral evaluations where target precision was not reached is " <<
_nError-
_nWarn << std::endl;
119bool RooAdaptiveIntegratorND::checkLimits()
const
122 _xmin.resize(_func->NDim());
123 _xmax.resize(_func->NDim());
126 if (_useIntegrandLimits) {
127 for (
UInt_t i=0 ; i<_func->NDim() ; i++) {
128 _xmin[i]= integrand()->getMinLimit(i);
129 _xmax[i]= integrand()->getMaxLimit(i);
142bool RooAdaptiveIntegratorND::setLimits(
double *
xmin,
double *
xmax)
144 if(_useIntegrandLimits) {
145 oocoutE(
nullptr,Integration) <<
"RooAdaptiveIntegratorND::setLimits: cannot override integrand's limits" << std::endl;
148 for (
UInt_t i=0 ; i<_func->NDim() ; i++) {
153 return checkLimits();
162double RooAdaptiveIntegratorND::integral(
const double* )
164 double ret = _integrator->Integral(_xmin.data(),_xmax.data());
165 if (_integrator->Status()==1) {
168 oocoutW(
nullptr, NumericIntegration) <<
"RooAdaptiveIntegratorND::integral(" << integrand()->getName() <<
") WARNING: target rel. precision not reached due to nEval limit of "
169 <<
_nmax <<
", estimated rel. precision is " <<
Form(
"%3.1e",_integrator->RelError()) << std::endl ;
172 oocoutW(
nullptr, NumericIntegration) <<
"RooAdaptiveIntegratorND::integral(" << integrand()->getName()
173 <<
") Further warnings on target precision are suppressed conform specification in integrator specification" << std::endl ;
int Int_t
Signed integer 4 bytes (int)
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
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...
virtual const char * getName() const
Name of function binding.
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.