75 std::span<const double> y0,
int order,
bool logx,
bool logy)
76 :
RooAbsReal{
name, title}, _x{
"x",
"x", this,
x}, _logx{logx}, _logy{logy}
78 const std::string title_spline = std::string(title) +
"_spline";
79 if (x0.size() != y0.size()) {
80 std::stringstream errMsg;
81 errMsg <<
"RooSpline::ctor(" <<
GetName() <<
") ERROR: size of x and y are not equal";
82 coutE(InputArguments) << errMsg.str() << std::endl;
83 throw std::invalid_argument(errMsg.str());
87 std::vector<double> x0Copy;
88 x0Copy.assign(x0.begin(), x0.end());
89 std::vector<double> y0Copy;
90 y0Copy.assign(y0.begin(), y0.end());
93 for (
auto &xRef : x0Copy) {
94 xRef = std::log(xRef);
98 for (
auto &yRef : y0Copy) {
99 yRef = std::log(yRef);
104 _spline = std::make_unique<TSpline3>(title_spline.c_str(), &x0Copy[0], &y0Copy[0], x0.size());
105 }
else if (order == 5) {
106 _spline = std::make_unique<TSpline5>(title_spline.c_str(), &x0Copy[0], &y0Copy[0], x0.size());
108 std::stringstream errMsg;
109 errMsg <<
"supported orders are 3 or 5";
110 coutE(InputArguments) << errMsg.str() << std::endl;
111 throw std::invalid_argument(errMsg.str());
120 _spline(static_cast<
TSpline *>(other._spline->Clone())),
121 _x(
"x", this, other._x),
130 const double x_val = (!
_logx) ?
_x : std::exp(
_x);
Abstract base class for objects that represent a real value and implements functionality common to al...
A RooFit class for creating spline functions.
bool _logx
Flag indicating logarithmic scaling of x values.
double evaluate() const override
Evaluate the spline function at the current point.
RooRealProxy _x
The independent variable.
std::unique_ptr< TSpline > _spline
The spline object.
bool _logy
Flag indicating logarithmic scaling of y values.
A TGraph is an object made of two arrays X and Y with npoints each.
const char * GetName() const override
Returns name of object.
Base class for spline implementation containing the Draw/Paint methods.