47 _x(
"x",
"Dependent", this,
x),
48 _coefList(
"coefList",
"List of coefficients",this),
49 _boundaryList(
"boundaryList",
"List of boundaries",this),
50 _interpolate(interpolate)
56 coutE(InputArguments) <<
"RooStepFunction::ctor(" <<
GetName() <<
") ERROR: Number of boundaries must be number of coefficients plus 1" << std::endl ;
57 throw std::invalid_argument(
"RooStepFunction::ctor() ERROR: Number of boundaries must be number of coefficients plus 1") ;
67 _x(
"x", this, other._x),
68 _coefList(
"coefList",this,other._coefList),
69 _boundaryList(
"boundaryList",this,other._boundaryList),
70 _interpolate(other._interpolate)
83 for (
auto * boundary : static_range_cast<RooAbsReal*>(
_boundaryList)) {
84 b[nb++] = boundary->getVal() ;
88 if ((
_x<
b[0]) || (
_x>
b[nb-1]))
return 0 ;
93 for (
Int_t i=0;i<nb-1;i++){
105 c[0] =
b[0] ;
c[nb] =
b[nb-1] ;
106 for (
Int_t i=0 ; i<nb-1 ; i++) {
107 c[i+1] = (
b[i]+
b[i+1])/2 ;
114 for(
auto * coef : static_range_cast<RooAbsReal*>(
_coefList)) {
115 y[nc++] = coef->getVal() ;
119 for (
Int_t i=0;i<nc-1;i++){
120 if (
_x>
c[i]&&
_x<=
c[i+1]) {
121 double xx[2] ; xx[0]=
c[i] ; xx[1]=
c[i+1] ;
122 double yy[2] ; yy[0]=
y[i] ; yy[1]=
y[i+1] ;
140 for (
auto *boundary : static_range_cast<RooAbsReal *>(
_boundaryList)) {
const TNamed * namePtr() const
De-duplicated pointer to this object's name.
Storage_t::size_type size() const
void reserve(Storage_t::size_type count)
bool addTyped(const RooAbsCollection &list, bool silent=false)
Adds elements of a given RooAbsCollection to the container if they match the specified type.
Abstract base class for objects that represent a real value that may appear on the left hand side of ...
Abstract base class for objects that represent a real value and implements functionality common to al...
RooArgList is a container object that can hold multiple RooAbsArg objects.
RooAbsArg * at(Int_t idx) const
Return object at given index, or nullptr if index is out of range.
static std::list< double > * plotSamplingHintForBinBoundaries(std::span< const double > boundaries, double xlo, double xhi)
Returns sampling hints for a histogram with given boundaries.
static double interpolate(double yArr[], Int_t nOrder, double x)
The Step Function is a binned function whose parameters are the heights of each bin.
const RooArgList & boundaries()
RooListProxy _boundaryList
double evaluate() const override
Transfer contents to std::vector for use below.
std::list< double > * plotSamplingHint(RooAbsRealLValue &obs, double xlo, double xhi) const override
Interface for returning an optional hint for initial sampling points when constructing a curve projec...
const char * GetName() const override
Returns name of object.