]>
Commit | Line | Data |
---|---|---|
da0e9ce3 | 1 | //-------------------------------------------------------------------------- |
2 | // | |
3 | // Copyright Information: See EvtGen/COPYRIGHT | |
4 | // | |
5 | // Environment: | |
6 | // This software is part of the EvtGen package developed jointly | |
7 | // for the BaBar and CLEO collaborations. If you use all or part | |
8 | // of it, please give an appropriate acknowledgement. | |
9 | // | |
10 | // Module: EvtItgAbsFunction.hh | |
11 | // | |
12 | // Description: | |
13 | // Abstraction of a generic function for use in integration methods elsewhere | |
14 | // in this package. (Stolen and modified from the BaBar IntegrationUtils package | |
15 | // - author: Phil Strother). | |
16 | // | |
17 | // Modification history: | |
18 | // | |
19 | // Jane Tinslay March 21, 2001 Module adapted for use in | |
20 | // EvtGen | |
21 | // | |
22 | //------------------------------------------------------------------------ | |
23 | #include "EvtGenBase/EvtPatches.hh" | |
24 | ||
25 | #include "EvtGenModels/EvtItgAbsFunction.hh" | |
26 | ||
27 | //------------- | |
28 | // C Headers -- | |
29 | //------------- | |
30 | extern "C" { | |
31 | } | |
32 | #include "assert.h" | |
33 | #include "EvtGenBase/EvtReport.hh" | |
34 | using std::endl; | |
35 | ||
36 | EvtItgAbsFunction::EvtItgAbsFunction(double lowerRange, double upperRange): | |
37 | _upperRange(upperRange), | |
38 | _lowerRange(lowerRange){} | |
39 | ||
40 | EvtItgAbsFunction::~EvtItgAbsFunction( ) | |
41 | {} | |
42 | ||
43 | ||
44 | double | |
45 | EvtItgAbsFunction::value( double x) const{ | |
46 | if (x >= _lowerRange && x <= _upperRange) return myFunction(x); | |
47 | report(ERROR,"EvtGen") << "Error in EvtItgAbsFunction::value. Given co-ordinate " << x | |
48 | << " is outside of allowed range [" << _lowerRange << ", " | |
49 | << _upperRange << "]. Returning 0.0" << endl; | |
50 | return 0.0; // Never get here | |
51 | } | |
52 | ||
53 | double | |
54 | EvtItgAbsFunction::operator()(double x) const{ | |
55 | return myFunction(x); | |
56 | } |