00001 //-------------------------------------------------------------------------- 00002 // 00003 // Copyright Information: See EvtGen/COPYRIGHT 00004 // 00005 // Environment: 00006 // This software is part of the EvtGen package developed jointly 00007 // for the BaBar and CLEO collaborations. If you use all or part 00008 // of it, please give an appropriate acknowledgement. 00009 // 00010 // Module: EvtItgAbsFunction.hh 00011 // 00012 // Description: 00013 // Abstraction of a generic function for use in integration methods elsewhere 00014 // in this package. (Stolen and modified from the BaBar IntegrationUtils package 00015 // - author: Phil Strother). 00016 // 00017 // Modification history: 00018 // 00019 // Jane Tinslay March 21, 2001 Module adapted for use in 00020 // EvtGen 00021 // 00022 //------------------------------------------------------------------------ 00023 #include "EvtGenBase/EvtPatches.hh" 00024 00025 #include "EvtGenModels/EvtItgAbsFunction.hh" 00026 00027 //------------- 00028 // C Headers -- 00029 //------------- 00030 extern "C" { 00031 } 00032 #include "assert.h" 00033 #include "EvtGenBase/EvtReport.hh" 00034 using std::endl; 00035 00036 EvtItgAbsFunction::EvtItgAbsFunction(double lowerRange, double upperRange): 00037 _upperRange(upperRange), 00038 _lowerRange(lowerRange){} 00039 00040 EvtItgAbsFunction::~EvtItgAbsFunction( ) 00041 {} 00042 00043 00044 double 00045 EvtItgAbsFunction::value( double x) const{ 00046 if (x >= _lowerRange && x <= _upperRange) return myFunction(x); 00047 report(ERROR,"EvtGen") << "Error in EvtItgAbsFunction::value. Given co-ordinate " << x 00048 << " is outside of allowed range [" << _lowerRange << ", " 00049 << _upperRange << "]. Returning 0.0" << endl; 00050 return 0.0; // Never get here 00051 } 00052 00053 double 00054 EvtItgAbsFunction::operator()(double x) const{ 00055 return myFunction(x); 00056 }