CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/PhysicsTools/MVAComputer/interface/Spline.h

Go to the documentation of this file.
00001 #ifndef PhysicsTools_MVAComputer_Spline_h
00002 #define PhysicsTools_MVAComputer_Spline_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     MVAComputer
00006 // Class  :     Spline
00007 //
00008 
00009 //
00010 // Author:      Christophe Saout <christophe.saout@cern.ch>
00011 // Created:     Sat Apr 24 15:18 CEST 2007
00012 // $Id: Spline.h,v 1.5 2009/06/03 09:50:14 saout Exp $
00013 //
00014 
00015 namespace PhysicsTools {
00016 
00026 class Spline {
00027     public:
00028         Spline();
00029         Spline(const Spline &orig);
00030 
00032         Spline(unsigned int n, const double *vals);
00033         ~Spline();
00034 
00035         Spline &operator = (const Spline &orig);
00036 
00038         void set(unsigned int n, const double *vals);
00039 
00041         double eval(double x) const;
00042 
00044         double deriv(double x) const;
00045 
00047         double integral(double x) const;
00048 
00050         double getArea() const { return area; }
00051 
00053         inline unsigned int numberOfEntries() const { return n + 1; }
00054 
00055     private:
00057         struct Segment {
00058                 double coeffs[4];
00059                 double area;
00060 
00061                 double eval(double x) const;
00062                 double deriv(double x) const;
00063                 double integral(double x) const;
00064         };
00065 
00066         unsigned int    n;
00067         Segment         *segments;
00068         double          area;
00069 };
00070 
00071 } // namespace PhysicsTools
00072 
00073 #endif // PhysicsTools_MVAComputer_Spline_h