Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:54:35

0001 // -*- C++ -*-
0002 // $Id: 
0003 // ------------------------------------------------------------------------------//
0004 // Lagrange's Interpolating Polynomial                                           //
0005 //                                                                               //
0006 //                                                                               //
0007 // Joe Boudreau.                                                                 //
0008 //                                                                               //
0009 // ------------------------------------------------------------------------------//
0010 #ifndef _InterpolatingPolynomial_h_
0011 #define _InterpolatingPolynomial_h_ 
0012 #include "CLHEP/GenericFunctions/AbsFunction.hh"
0013 #include "CLHEP/GenericFunctions/Parameter.hh"
0014 #include <vector>
0015 namespace Genfun {
0016 
0017   /**
0018    * @author
0019    * @ingroup genfun
0020    */
0021   class InterpolatingPolynomial: public AbsFunction {
0022 
0023     FUNCTION_OBJECT_DEF(InterpolatingPolynomial)
0024 
0025       public:
0026 
0027     // Constructor
0028     InterpolatingPolynomial();
0029 
0030     // Copy constructor
0031     InterpolatingPolynomial(const InterpolatingPolynomial &right);
0032   
0033     // Destructor:
0034     virtual ~InterpolatingPolynomial();
0035 
0036     // Retreive function value
0037     virtual double operator ()(double argument) const override;
0038     virtual double operator ()(const Argument & a) const override {return operator() (a[0]);}
0039   
0040     // Puncture this thing:
0041     void addPoint(double x, double y);
0042 
0043     // Get the range:
0044     void getRange(double & min, double & max) const;
0045 
0046   private:
0047   
0048     // It is illegal to assign an adjustable constant
0049     const InterpolatingPolynomial & operator=(const InterpolatingPolynomial &right);
0050 
0051     std::vector<std::pair<double,double> > xPoints;
0052   };
0053 } // namespace Genfun
0054 #endif