CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Spline.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_MVAComputer_Spline_h
2 #define PhysicsTools_MVAComputer_Spline_h
3 // -*- C++ -*-
4 //
5 // Package: MVAComputer
6 // Class : Spline
7 //
8 
9 //
10 // Author: Christophe Saout <christophe.saout@cern.ch>
11 // Created: Sat Apr 24 15:18 CEST 2007
12 // $Id: Spline.h,v 1.5 2009/06/03 09:50:14 saout Exp $
13 //
14 
15 namespace PhysicsTools {
16 
26 class Spline {
27  public:
28  Spline();
29  Spline(const Spline &orig);
30 
32  Spline(unsigned int n, const double *vals);
33  ~Spline();
34 
35  Spline &operator = (const Spline &orig);
36 
38  void set(unsigned int n, const double *vals);
39 
41  double eval(double x) const;
42 
44  double deriv(double x) const;
45 
47  double integral(double x) const;
48 
50  double getArea() const { return area; }
51 
53  inline unsigned int numberOfEntries() const { return n + 1; }
54 
55  private:
57  struct Segment {
58  double coeffs[4];
59  double area;
60 
61  double eval(double x) const;
62  double deriv(double x) const;
63  double integral(double x) const;
64  };
65 
66  unsigned int n;
68  double area;
69 };
70 
71 } // namespace PhysicsTools
72 
73 #endif // PhysicsTools_MVAComputer_Spline_h
unsigned int n
Definition: Spline.h:66
double eval(double x) const
Definition: Spline.cc:22
Spline & operator=(const Spline &orig)
Definition: Spline.cc:122
double integral(double x) const
compute integral under curve between 0 and x
Definition: Spline.cc:160
void set(unsigned int n, const double *vals)
initialize spline from n y coordinates in array vals
Definition: Spline.cc:67
double integral(double x) const
Definition: Spline.cc:43
internal class describing a &quot;segment&quot; (between two x points)
Definition: Spline.h:57
double deriv(double x) const
compute the derivate at x coordinate x
Definition: Spline.cc:145
double eval(double x) const
compute y coordinate at x coordinate x
Definition: Spline.cc:132
unsigned int numberOfEntries() const
return the number of entries
Definition: Spline.h:53
double deriv(double x) const
Definition: Spline.cc:33
Definition: DDAxes.h:10
A simple class for cubic splines.
Definition: Spline.h:26
Segment * segments
Definition: Spline.h:67
double getArea() const
total area (integral between 0 and 1) under curve
Definition: Spline.h:50