CLHEP/GenericFunctions/DefiniteIntegral.hh

00001 // -*- C++ -*-
00002 // $Id: DefiniteIntegral.hh,v 1.4 2002/04/12 15:02:39 evc Exp $
00003 //-------------------------------------------------------------//
00004 //                                                             //
00005 // This functional returns the definite integral of a function //
00006 // between lower bound and upper bound b.                      //
00007 //                                                             //
00008 //-------------------------------------------------------------//
00009 
00010 #ifndef _DefiniteIntegral_h_
00011 #define _DefiniteIntegral_h_
00012 #include "CLHEP/GenericFunctions/AbsFunctional.hh"
00013 
00014 namespace Genfun {
00015 
00020   class DefiniteIntegral:public AbsFunctional {
00021 
00022   public:
00023   
00024     // Constructor:
00025     DefiniteIntegral(double a, double b);
00026 
00027     // Destructor:
00028     ~DefiniteIntegral();
00029 
00030     // Take the definite integral of a function between the bounds:
00031     virtual double operator [] (const AbsFunction & function) const;
00032 
00033 
00034   private:
00035 
00036     // Trapezoid calculation:
00037     double _trapzd( const AbsFunction & function, double a, double b, int j) const;
00038 
00039     // Polynomial interpolation:
00040     void _polint(double *xArray, double *yArray, double x, double & y, double & deltay) const;
00041 
00042     double _a;                          // lower limit of integration
00043     double _b;                          // upper limit of integration
00044 
00045     static const int _K;                // Order
00046     static const int _KP;               // Const dim of certain arrays.
00047   
00048     // buffered value for _trapzd calculation:
00049     mutable double _sTrap;
00050 
00051   };
00052 } // namespace Genfun
00053 #endif

Class Library for High Energy Physics (version 1.8)