CMS 3D CMS Logo

Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes

RooSpline1D Class Reference

#include <RooSpline1D.h>

List of all members.

Public Member Functions

TObject * clone (const char *newname) const
 RooSpline1D (const char *name, const char *title, RooAbsReal &xvar, unsigned int npoints, const double *xvals, const double *yvals, const char *algo="CSPLINE")
 RooSpline1D ()
 RooSpline1D (const char *name, const char *title, RooAbsReal &xar, unsigned int npoints, const float *xvals, const float *yvals, const char *algo="CSPLINE")
 ~RooSpline1D ()

Protected Member Functions

Double_t evaluate () const

Private Member Functions

void init () const
 not to be serialized

Private Attributes

ROOT::Math::Interpolator * interp_
std::string type_
std::vector< double > x_
RooRealProxy xvar_
std::vector< double > y_

Detailed Description

Definition at line 18 of file RooSpline1D.h.


Constructor & Destructor Documentation

RooSpline1D::RooSpline1D ( ) [inline]

Definition at line 21 of file RooSpline1D.h.

Referenced by clone().

{}
RooSpline1D::RooSpline1D ( const char *  name,
const char *  title,
RooAbsReal &  xvar,
unsigned int  npoints,
const double *  xvals,
const double *  yvals,
const char *  algo = "CSPLINE" 
)

Definition at line 5 of file RooSpline1D.cc.

References i, x_, and y_.

                                                                                                                                                                :
        RooAbsReal(name,title),
        xvar_("xvar","Variable", this, xvar), 
        x_(npoints), y_(npoints), type_(algo),
        interp_(0)
{ 
    for (unsigned int i = 0; i < npoints; ++i) {
        x_[i] = xvals[i];
        y_[i] = yvals[i];
    }
}
RooSpline1D::RooSpline1D ( const char *  name,
const char *  title,
RooAbsReal &  xar,
unsigned int  npoints,
const float *  xvals,
const float *  yvals,
const char *  algo = "CSPLINE" 
)

Definition at line 17 of file RooSpline1D.cc.

References i, x_, and y_.

                                                                                                                                                              :
        RooAbsReal(name,title),
        xvar_("xvar","Variable", this, xvar), 
        x_(npoints), y_(npoints), type_(algo),
        interp_(0)
{ 
    for (unsigned int i = 0; i < npoints; ++i) {
        x_[i] = xvals[i];
        y_[i] = yvals[i];
    }
}
RooSpline1D::~RooSpline1D ( )

Definition at line 30 of file RooSpline1D.cc.

References interp_.

{
    delete interp_;
}

Member Function Documentation

TObject * RooSpline1D::clone ( const char *  newname) const

Definition at line 36 of file RooSpline1D.cc.

References RooSpline1D(), type_, x_, xvar_, and y_.

{
    return new RooSpline1D(newname, this->GetTitle(), const_cast<RooAbsReal &>(xvar_.arg()), x_.size(), &x_[0], &y_[0], type_.c_str());
}
Double_t RooSpline1D::evaluate ( ) const [protected]

Definition at line 52 of file RooSpline1D.cc.

References init(), interp_, and xvar_.

                                     {
    if (interp_ == 0) init();
    return interp_->Eval(xvar_);
}
void RooSpline1D::init ( void  ) const [private]

not to be serialized

Definition at line 41 of file RooSpline1D.cc.

References interp_, type_, x_, and y_.

Referenced by evaluate().

                             {
    delete interp_;
    if      (type_ == "CSPLINE") interp_ = new ROOT::Math::Interpolator(x_, y_, ROOT::Math::Interpolation::kCSPLINE);
    else if (type_ == "LINEAR") interp_ = new ROOT::Math::Interpolator(x_, y_, ROOT::Math::Interpolation::kLINEAR);
    else if (type_ == "POLYNOMIAL") interp_ = new ROOT::Math::Interpolator(x_, y_, ROOT::Math::Interpolation::kPOLYNOMIAL);
    else if (type_ == "CSPLINE_PERIODIC") interp_ = new ROOT::Math::Interpolator(x_, y_, ROOT::Math::Interpolation::kCSPLINE_PERIODIC);
    else if (type_ == "AKIMA") interp_ = new ROOT::Math::Interpolator(x_, y_, ROOT::Math::Interpolation::kAKIMA);
    else if (type_ == "AKIMA_PERIODIC") interp_ = new ROOT::Math::Interpolator(x_, y_, ROOT::Math::Interpolation::kAKIMA_PERIODIC);
    else throw std::invalid_argument("Unknown interpolation type '"+type_+"'");
}

Member Data Documentation

ROOT::Math::Interpolator* RooSpline1D::interp_ [mutable, private]

Definition at line 36 of file RooSpline1D.h.

Referenced by evaluate(), init(), and ~RooSpline1D().

std::string RooSpline1D::type_ [private]

Definition at line 34 of file RooSpline1D.h.

Referenced by clone(), and init().

std::vector<double> RooSpline1D::x_ [private]

Definition at line 33 of file RooSpline1D.h.

Referenced by clone(), init(), and RooSpline1D().

RooRealProxy RooSpline1D::xvar_ [private]

Definition at line 32 of file RooSpline1D.h.

Referenced by clone(), and evaluate().

std::vector<double> RooSpline1D::y_ [private]

Definition at line 33 of file RooSpline1D.h.

Referenced by clone(), init(), and RooSpline1D().