library: libGraf #include "TSpline.h"

# TSpline3

class description - source file - inheritance tree (.ps)

## class TSpline3 : public TSpline

| Inheritance Chart:

`TObject`

<-

`TNamed`

`TAttLine`

`TAttFill`

`TAttMarker`

<-

`TSpline`

<-

`TSpline3`

        private:

          virtual void BuildCoeff()
                  void SetCond(const char* opt)

        public:

                           TSpline3()
                           TSpline3(const char* title, Double_t* x, Double_t* y, Int_t n, const char* opt = "0", Double_t valbeg = 0, Double_t valend = 0)
                           TSpline3(const char* title, Double_t xmin, Double_t xmax, Double_t* y, Int_t n, const char* opt = "0", Double_t valbeg = 0, Double_t valend = 0)
                           TSpline3(const char* title, Double_t* x, const TF1* func, Int_t n, const char* opt = "0", Double_t valbeg = 0, Double_t valend = 0)
                           TSpline3(const char* title, Double_t xmin, Double_t xmax, const TF1* func, Int_t n, const char* opt = "0", Double_t valbeg = 0, Double_t valend = 0)
                           TSpline3(const char* title, const TGraph* g, const char* opt = "0", Double_t valbeg = 0, Double_t valend = 0)
                           TSpline3(const TSpline3&)
                   virtual ~TSpline3()
            static TClass* Class()
          virtual Double_t Eval(Double_t x) const
                      void GetCoeff(Int_t i, Double_t& x, Double_t& y, Double_t& b, Double_t& c, Double_t& d)
              virtual void GetKnot(Int_t i, Double_t& x, Double_t& y) const
           virtual TClass* IsA() const
                 TSpline3& operator=(const TSpline3&)
              virtual void SaveAs(const char* filename) const
              virtual void ShowMembers(TMemberInspector& insp, char* parent)
              virtual void Streamer(TBuffer& b)
                      void StreamerNVirtual(TBuffer& b)
               static void Test()

### Data Members

        private:

          TSplinePoly3* fPoly     [fNp] Array of polynomial terms
               Double_t fValBeg   Initial value of first or second derivative
               Double_t fValEnd   End value of first or second derivative
                  Int_t fBegCond  0=no beg cond, 1=first derivative, 2=second derivative
                  Int_t fEndCond  0=no end cond, 1=first derivative, 2=second derivative

## Class Description

     TSpline

     Base class for spline implementation containing the Draw/Paint
     methods

TSpline3(const char *title, Double_t x[], Double_t y[], Int_t n, const char *opt, Double_t valbeg, Double_t valend) : TSpline(title,-1,x[0],x[n-1],n,kFALSE), fValBeg(valbeg), fValEnd(valend), fBegCond(0), fEndCond(0)

     Third spline creator given an array of
     arbitrary knots in increasing abscissa order and
     possibly end point conditions

TSpline3(const char *title, Double_t xmin, Double_t xmax, Double_t y[], Int_t n, const char *opt, Double_t valbeg, Double_t valend) : TSpline(title,(xmax-xmin)/(n-1), xmin, xmax, n, kTRUE), fValBeg(valbeg), fValEnd(valend), fBegCond(0), fEndCond(0)

     Third spline creator given an array of
     arbitrary function values on equidistant n abscissa
     values from xmin to xmax and possibly end point conditions

TSpline3(const char *title, Double_t x[], const TF1 *func, Int_t n, const char *opt, Double_t valbeg, Double_t valend) : TSpline(title,-1, x[0], x[n-1], n, kFALSE), fValBeg(valbeg), fValEnd(valend), fBegCond(0), fEndCond(0)

     Third spline creator given an array of
     arbitrary abscissas in increasing order and a function
     to interpolate and possibly end point conditions

TSpline3(const char *title, Double_t xmin, Double_t xmax, const TF1 *func, Int_t n, const char *opt, Double_t valbeg, Double_t valend) : TSpline(title,(xmax-xmin)/(n-1), xmin, xmax, n, kTRUE), fValBeg(valbeg), fValEnd(valend), fBegCond(0), fEndCond(0)

     Third spline creator given a function to be
     evaluated on n equidistand abscissa points between xmin
     and xmax and possibly end point conditions

TSpline3(const char *title, const TGraph *g, const char *opt, Double_t valbeg, Double_t valend) : TSpline(title,-1,0,0,g->GetN(),kFALSE), fValBeg(valbeg), fValEnd(valend), fBegCond(0), fEndCond(0)

     Third spline creator given a TGraph with
     abscissa in increasing order and possibly end
     point conditions

void SetCond(const char *opt)

     Check the boundary conditions

void Test()

     Test method for TSpline5

       n          number of data points.
       m          2*m-1 is order of spline.
                     m = 2 always for third spline.
       nn,nm1,mm,
       mm1,i,k,
       j,jj       temporary integer variables.
       z,p        temporary double precision variables.
       x[n]       the sequence of knots.
       y[n]       the prescribed function values at the knots.
       a[200][4]  two dimensional array whose columns are
                     the computed spline coefficients
       diff[3]    maximum values of differences of values and
                     derivatives to right and left of knots.
       com[3]     maximum values of coefficients.

       test of TSpline3 with nonequidistant knots and
          equidistant knots follows.

Double_t Eval(Double_t x) const

     Evaluate spline polynomial

void SaveAs(const char *filename) const

     write this spline as a C++ function that can be executed without ROOT
     the name of the function is the name of the file up to the "." if any

void BuildCoeff()

          subroutine cubspl ( tau, c, n, ibcbeg, ibcend )
      from  * a practical guide to splines *  by c. de boor
         ************************  input  ***************************
         n = number of data points. assumed to be .ge. 2.
         (tau(i), c(1,i), i=1,...,n) = abscissae and ordinates of the
            data points. tau is assumed to be strictly increasing.
         ibcbeg, ibcend = boundary condition indicators, and
         c(2,1), c(2,n) = boundary condition information. specifically,
            ibcbeg = 0  means no boundary condition at tau(1) is given.
               in this case, the not-a-knot condition is used, i.e. the
               jump in the third derivative across tau(2) is forced to
               zero, thus the first and the second cubic polynomial pieces
               are made to coincide.)
            ibcbeg = 1  means that the slope at tau(1) is made to equal
               c(2,1), supplied by input.
            ibcbeg = 2  means that the second derivative at tau(1) is
               made to equal c(2,1), supplied by input.
            ibcend = 0, 1, or 2 has analogous meaning concerning the
               boundary condition at tau(n), with the additional infor-
               mation taken from c(2,n).
         ***********************  output  **************************
         c(j,i), j=1,...,4; i=1,...,l (= n-1) = the polynomial coefficients
            of the cubic interpolating spline with interior knots (or
            joints) tau(2), ..., tau(n-1). precisely, in the interval
            (tau(i), tau(i+1)), the spline f is given by
               f(x) = c(1,i)+h*(c(2,i)+h*(c(3,i)+h*c(4,i)/3.)/2.)
            where h = x - tau(i). the function program *ppvalu* may be
            used to evaluate f or its derivatives from tau,c, l = n-1,
            and k=4.

void Streamer(TBuffer &R__b)

     Stream an object of class TSpline3.

### Inline Functions

                   void ~TSpline3()
               TSpline3 TSpline3(const char* title, const TGraph* g, const char* opt = "0", Double_t valbeg = 0, Double_t valend = 0)
                   void GetCoeff(Int_t i, Double_t& x, Double_t& y, Double_t& b, Double_t& c, Double_t& d)
                   void GetKnot(Int_t i, Double_t& x, Double_t& y) const
                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void StreamerNVirtual(TBuffer& b)
               TSpline3 TSpline3(const TSpline3&)
              TSpline3& operator=(const TSpline3&)

Author: Federico Carminati 28/02/2000
Last update: root/graf:$Name: $:$Id: TSpline.cxx,v 1.9 2004/06/01 09:56:25 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *