CLHEP/GenericFunctions/DefiniteIntegral.hh

// -*- C++ -*-
// $Id: DefiniteIntegral.hh,v 1.2 2001/05/16 05:10:31 joeb Exp $
//-------------------------------------------------------------//
//                                                             //
// This functional returns the definite integral of a function //
// between lower bound and upper bound b.                      //
//                                                             //
//-------------------------------------------------------------//

#ifndef _DefiniteIntegral_h_
#define _DefiniteIntegral_h_
#include "CLHEP/GenericFunctions/AbsFunctional.hh"

HEP_BEGIN_NAMESPACE(Genfun)

  class DefiniteIntegral:public AbsFunctional {

  public:
  
    // Constructor:
    DefiniteIntegral(double a, double b);

    // Destructor:
    ~DefiniteIntegral();

    // Take the definite integral of a function between the bounds:
    virtual double operator [] (const AbsFunction & function) const;


  private:

    // Trapezoid calculation:
    double _trapzd( const AbsFunction & function, double a, double b, int j) const;

    // Polynomial interpolation:
    void _polint(double *xArray, double *yArray, double x, double & y, double & deltay) const;

    double _a;                          // lower limit of integration
    double _b;                          // upper limit of integration

    static const int _K;                // Order
    static const int _KP;               // Const dim of certain arrays.
  
    // buffered value for _trapzd calculation:
    mutable double _sTrap;

  };
HEP_END_NAMESPACE(Genfun)
#endif

Generated by GNU enscript 1.6.1.