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