#include <EvtItgAbsIntegrator.hh>
Inheritance diagram for EvtItgAbsIntegrator:
Public Member Functions | |
double | evaluate (double lower, double upper) const |
EvtItgAbsIntegrator (const EvtItgAbsFunction &) | |
double | normalisation () const |
virtual | ~EvtItgAbsIntegrator () |
Protected Member Functions | |
virtual double | evaluateIt (double lower, double higher) const =0 |
double | myFunction (double x) const |
double | trapezoid (double lower, double higher, int n, double &result) const |
Private Member Functions | |
void | boundsCheck (double &, double &) const |
EvtItgAbsIntegrator (const EvtItgAbsIntegrator &) | |
EvtItgAbsIntegrator () | |
EvtItgAbsIntegrator & | operator= (const EvtItgAbsIntegrator &) |
Private Attributes | |
const EvtItgAbsFunction & | _myFunction |
|
00039 : 00040 _myFunction(theFunction) 00041 {}
|
|
00044 {}
|
|
|
|
|
|
00089 { 00090 00091 if (lower < _myFunction.lowerRange() ) { 00092 report(WARNING,"EvtGen") << "Warning in EvtItgAbsIntegrator::evaluate. Lower bound " << lower << " of integral " 00093 << " is less than lower bound " << _myFunction.lowerRange() 00094 << " of function. No contribution from this range will be counted." << endl; 00095 lower = _myFunction.lowerRange(); 00096 } 00097 00098 if (upper > _myFunction.upperRange() ) { 00099 report(WARNING,"EvtGen") << "Warning in EvtItgAbsIntegrator::evaluate. Upper bound " << upper << " of integral " 00100 << " is greater than upper bound " << _myFunction.upperRange() 00101 << " of function. No contribution from this range will be counted." << endl; 00102 upper = _myFunction.upperRange(); 00103 } 00104 00105 }
|
|
00052 { 00053 00054 double newLower(lower), newUpper(upper); 00055 00056 boundsCheck(newLower, newUpper); 00057 00058 return evaluateIt(newLower, newUpper); 00059 }
|
|
Implemented in EvtItgSimpsonIntegrator. |
|
00049 {return _myFunction(x);}
|
|
00047 { 00048 return evaluateIt(_myFunction.lowerRange(), _myFunction.upperRange()); 00049 }
|
|
|
|
00062 { 00063 00064 if (n==1) return 0.5*(higher-lower)*(_myFunction(lower) + _myFunction(higher)); 00065 00066 int it, j; 00067 00068 for (it=1, j=1;j<n-1;j++) it <<=1; 00069 00070 double itDouble(it); 00071 00072 double sum(0.0); 00073 00074 double deltaX((higher - lower)/itDouble); 00075 00076 double x(lower + 0.5* deltaX); 00077 00078 for (j=1;j<=it;j++){ 00079 sum+=_myFunction(x); 00080 x+=deltaX; 00081 } 00082 00083 result = 0.5*(result+(higher - lower)*sum/itDouble); 00084 00085 return result; 00086 }
|
|
|