47 return std::make_unique<RooImproperIntegrator1D>(function, config);
63RooImproperIntegrator1D::RooImproperIntegrator1D(
const RooAbsFunc& function) :
65 _useIntegrandLimits(true),
79 _useIntegrandLimits(true),
95 _useIntegrandLimits(false),
107void RooImproperIntegrator1D::initialize(
const RooAbsFunc* function)
110 oocoutE(
nullptr,Integration) <<
"RooImproperIntegrator: cannot integrate invalid function" << std::endl;
115 _function= std::make_unique<RooInvTransform>(*function);
117 function = _origFunc ;
118 _integrator1.reset();
119 _integrator2.reset();
120 _integrator3.reset();
125 auto makeIntegrator1D = [&](
RooAbsFunc const& func,
127 RooRombergIntegrator::SummationRule rule) {
130 return std::make_unique<RooRombergIntegrator>(func,
xmin,
xmax, newConfig);
135 switch(_case= limitsCase()) {
138 _integrator1 = std::make_unique<RooRombergIntegrator>(*function,_xmin,_xmax,_config);
143 _integrator1 = makeIntegrator1D(*function,-1,+1,RooRombergIntegrator::Trapezoid);
145 _integrator2 = makeIntegrator1D(*_function,-1,0,RooRombergIntegrator::Midpoint);
146 _integrator3 = makeIntegrator1D(*_function,0,+1,RooRombergIntegrator::Midpoint);
148 case OpenBelowSpansZero:
150 _integrator1 = makeIntegrator1D(*_function,-1,0,RooRombergIntegrator::Midpoint);
151 _integrator2 = makeIntegrator1D(*function,-1,_xmax,RooRombergIntegrator::Trapezoid);
155 _integrator1 = makeIntegrator1D(*_function,1/_xmax,0,RooRombergIntegrator::Midpoint);
157 case OpenAboveSpansZero:
159 _integrator1 = makeIntegrator1D(*_function,0,+1,RooRombergIntegrator::Midpoint);
160 _integrator2 = makeIntegrator1D(*function,_xmin,+1,RooRombergIntegrator::Trapezoid);
164 _integrator1 = makeIntegrator1D(*_function,0,1/_xmin,RooRombergIntegrator::Midpoint);
178bool RooImproperIntegrator1D::setLimits(
double *
xmin,
double *
xmax)
180 if(_useIntegrandLimits) {
181 oocoutE(
nullptr,Integration) <<
"RooImproperIntegrator1D::setLimits: cannot override integrand's limits" << std::endl;
187 return checkLimits();
197bool RooImproperIntegrator1D::checkLimits()
const
200 if (_useIntegrandLimits) {
201 if(_xmin == integrand()->getMinLimit(0) &&
202 _xmax == integrand()->getMaxLimit(0))
return true;
206 if(limitsCase() != _case) {
208 const_cast<RooImproperIntegrator1D*
>(
this)->
initialize() ;
215 _integrator1->setLimits(_xmin,_xmax);
220 case OpenBelowSpansZero:
221 _integrator2->setLimits(-1,_xmax);
224 _integrator1->setLimits(1/_xmax,0);
226 case OpenAboveSpansZero:
227 _integrator2->setLimits(_xmin,+1);
230 _integrator1->setLimits(0,1/_xmin);
243RooImproperIntegrator1D::LimitsCase RooImproperIntegrator1D::limitsCase()
const
246 if(
nullptr == integrand() || !integrand()->isValid())
return Invalid;
248 if (_useIntegrandLimits) {
249 _xmin= integrand()->getMinLimit(0);
250 _xmax= integrand()->getMaxLimit(0);
257 return ClosedBothEnds;
259 else if(inf1 && inf2) {
265 return OpenBelowSpansZero;
273 return OpenAboveSpansZero;
286double RooImproperIntegrator1D::integral(
const double* yvec)
289 if(_integrator1)
result+= _integrator1->integral(yvec);
290 if(_integrator2)
result+= _integrator2->integral(yvec);
291 if(_integrator3)
result+= _integrator3->integral(yvec);
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
bool setCatIndex(const char *name, Int_t newVal=0, bool verbose=false)
Set index value of a RooAbsCategoryLValue stored in set with given name to newVal.
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.
bool registerPlugin(std::string const &name, Creator const &creator, const RooArgSet &defConfig, bool canIntegrate1D, bool canIntegrate2D, bool canIntegrateND, bool canIntegrateOpenEnded, const char *depName="")
Method accepting registration of a prototype numeric integrator along with a RooArgSet of its default...
static constexpr int isInfinite(double x)
Return true if x is infinite by RooNumber internal specification.
void initialize(typename Architecture_t::Matrix_t &A, EInitialization m)