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 //
13 
14 namespace PhysicsTools {
15 
25 class Spline {
26  public:
27  Spline();
28  Spline(const Spline &orig);
29 
31  Spline(unsigned int n, const double *vals);
32  ~Spline();
33 
34  Spline &operator = (const Spline &orig);
35 
37  void set(unsigned int n, const double *vals);
38 
40  double eval(double x) const;
41 
43  double deriv(double x) const;
44 
46  double integral(double x) const;
47 
49  double getArea() const { return area; }
50 
52  inline unsigned int numberOfEntries() const { return n + 1; }
53 
54  private:
56  struct Segment {
57  double coeffs[4];
58  double area;
59 
60  double eval(double x) const;
61  double deriv(double x) const;
62  double integral(double x) const;
63  };
64 
65  unsigned int n;
67  double area;
68 };
69 
70 } // namespace PhysicsTools
71 
72 #endif // PhysicsTools_MVAComputer_Spline_h
unsigned int n
Definition: Spline.h:65
double eval(double x) const
Definition: Spline.cc:21
Spline & operator=(const Spline &orig)
Definition: Spline.cc:121
double integral(double x) const
compute integral under curve between 0 and x
Definition: Spline.cc:159
void set(unsigned int n, const double *vals)
initialize spline from n y coordinates in array vals
Definition: Spline.cc:66
double integral(double x) const
Definition: Spline.cc:42
internal class describing a &quot;segment&quot; (between two x points)
Definition: Spline.h:56
double deriv(double x) const
compute the derivate at x coordinate x
Definition: Spline.cc:144
double eval(double x) const
compute y coordinate at x coordinate x
Definition: Spline.cc:131
unsigned int numberOfEntries() const
return the number of entries
Definition: Spline.h:52
double deriv(double x) const
Definition: Spline.cc:32
Definition: DDAxes.h:10
A simple class for cubic splines.
Definition: Spline.h:25
Segment * segments
Definition: Spline.h:66
double getArea() const
total area (integral between 0 and 1) under curve
Definition: Spline.h:49