00001 //-------------------------------------------------------------------------- 00002 // 00003 // 00004 // Copyright Information: See EvtGen/COPYRIGHT 00005 // 00006 // Environment: 00007 // This software is part of the EvtGen package developed jointly 00008 // for the BaBar and CLEO collaborations. If you use all or part 00009 // of it, please give an appropriate acknowledgement. 00010 // 00011 // Module: EvtItgAbsIntegrator.hh 00012 // 00013 // Description: 00014 // Abstraction of a generic integrator (Stolen and modified from 00015 // the BaBar IntegrationUtils package - author: Phil Strother). 00016 // 00017 // Modification history: 00018 // 00019 // Jane Tinslay March 21, 2001 Module adapted for use in 00020 // EvtGen 00021 // 00022 //------------------------------------------------------------------------ 00023 00024 #ifndef EVTITGABSINTEGRATOR_HH 00025 #define EVTITGABSINTEGRATOR_HH 00026 00027 00028 #include "EvtGenModels/EvtItgAbsFunction.hh" 00029 00030 class EvtItgAbsIntegrator { 00031 00032 public: 00033 00034 EvtItgAbsIntegrator(const EvtItgAbsFunction &); 00035 00036 virtual ~EvtItgAbsIntegrator( ); 00037 00038 double evaluate(double lower, double upper) const; 00039 00040 double normalisation() const; 00041 00042 protected: 00043 00044 double trapezoid(double lower, double higher, int n, 00045 double &result) const; 00046 00047 virtual double evaluateIt(double lower, double higher) const=0; 00048 00049 double myFunction(double x) const {return _myFunction(x);} 00050 00051 private: 00052 00053 const EvtItgAbsFunction &_myFunction; 00054 00055 void boundsCheck(double &, double &) const; 00056 00057 // Note: if your class needs a copy constructor or an assignment operator, 00058 // make one of the following public and implement it. 00059 EvtItgAbsIntegrator(); 00060 EvtItgAbsIntegrator( const EvtItgAbsIntegrator& ); // Copy Constructor 00061 EvtItgAbsIntegrator& operator= ( const EvtItgAbsIntegrator& ); // Assignment op 00062 00063 }; 00064 00065 #endif // EVTITGABSINTEGRATOR_HH