1 #ifndef __RAT_BoundedInterpolator__
2 #define __RAT_BoundedInterpolator__
4 #include <Math/Interpolator.h>
14 ROOT::Math::Interpolation::Type type = ROOT::Math::Interpolation::kCSPLINE)
15 : fInterpolator(x, y, type) {
17 bound_right = x.at(x.size() - 1);
21 ROOT::Math::Interpolation::Type type = ROOT::Math::Interpolation::kCSPLINE)
22 : fInterpolator(ndata, type) {}
24 bool SetData(
const std::vector<double> &x,
const std::vector<double> &y) {
26 bound_right = x.at(x.size() - 1);
27 return fInterpolator.SetData(x, y);
30 bool SetData(
unsigned int ndata,
const double *x,
const double *y) {
32 bound_right = x[ndata - 1];
33 return fInterpolator.SetData(ndata, x, y);
36 double Eval(
double x)
const {
37 if (x < bound_left)
return fInterpolator.Eval(bound_left + 1e-8);
38 if (x > bound_right)
return fInterpolator.Eval(bound_right - 1e-8);
39 return fInterpolator.Eval(x);
42 double Deriv(
double x)
const {
43 if (x < bound_left || x > bound_right)
return 0;
44 return fInterpolator.Deriv(x);
47 double Deriv2(
double x)
const {
48 if (x < bound_left || x > bound_right)
return 0;
49 return fInterpolator.Deriv2(x);
52 double Integ(
double xlow,
double xhigh)
const {
53 if (xlow <= bound_left) xlow = bound_left + 1e-8;
54 if (xhigh >= bound_right) xhigh = bound_right - 1e-8;
55 if (xlow >= xhigh)
return 0;
56 return fInterpolator.Integ(xlow, xhigh);
60 ROOT::Math::Interpolator fInterpolator;
61 double bound_left, bound_right;
Definition: BoundedInterpolator.hh:11
Definition: CCCrossSecMessenger.hh:29