#include <EvtItgAbsIntegrator.hh>
Inheritance diagram for EvtItgAbsIntegrator:
Public Member Functions | |
EvtItgAbsIntegrator (const EvtItgAbsFunction &) | |
virtual | ~EvtItgAbsIntegrator () |
double | evaluate (double lower, double upper) const |
double | normalisation () const |
Protected Member Functions | |
double | trapezoid (double lower, double higher, int n, double &result) const |
virtual double | evaluateIt (double lower, double higher) const =0 |
double | myFunction (double x) const |
Private Member Functions | |
void | boundsCheck (double &, double &) const |
EvtItgAbsIntegrator () | |
EvtItgAbsIntegrator (const EvtItgAbsIntegrator &) | |
EvtItgAbsIntegrator & | operator= (const EvtItgAbsIntegrator &) |
Private Attributes | |
const EvtItgAbsFunction & | _myFunction |
Definition at line 30 of file EvtItgAbsIntegrator.hh.
EvtItgAbsIntegrator::EvtItgAbsIntegrator | ( | const EvtItgAbsFunction & | ) |
Definition at line 39 of file EvtItgAbsIntegrator.cc.
00039 : 00040 _myFunction(theFunction) 00041 {}
EvtItgAbsIntegrator::~EvtItgAbsIntegrator | ( | ) | [virtual] |
EvtItgAbsIntegrator::EvtItgAbsIntegrator | ( | ) | [private] |
EvtItgAbsIntegrator::EvtItgAbsIntegrator | ( | const EvtItgAbsIntegrator & | ) | [private] |
void EvtItgAbsIntegrator::boundsCheck | ( | double & | , | |
double & | ||||
) | const [private] |
Definition at line 89 of file EvtItgAbsIntegrator.cc.
References _myFunction, EvtItgAbsFunction::lowerRange(), report(), EvtItgAbsFunction::upperRange(), and Bes_Common::WARNING.
Referenced by evaluate().
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 }
double EvtItgAbsIntegrator::evaluate | ( | double | lower, | |
double | upper | |||
) | const |
Definition at line 52 of file EvtItgAbsIntegrator.cc.
References boundsCheck(), and evaluateIt().
Referenced by EvtBtoXsgammaKagan::computeHadronicMass(), EvtVubNLO::Gamma(), EvtBtoXsgammaRootFinder::GetGaussIntegFcnRoot(), and EvtVubNLO::tripleDiff().
00052 { 00053 00054 double newLower(lower), newUpper(upper); 00055 00056 boundsCheck(newLower, newUpper); 00057 00058 return evaluateIt(newLower, newUpper); 00059 }
virtual double EvtItgAbsIntegrator::evaluateIt | ( | double | lower, | |
double | higher | |||
) | const [protected, pure virtual] |
double EvtItgAbsIntegrator::myFunction | ( | double | x | ) | const [inline, protected] |
Definition at line 49 of file EvtItgAbsIntegrator.hh.
References _myFunction.
00049 {return _myFunction(x);}
double EvtItgAbsIntegrator::normalisation | ( | ) | const |
Definition at line 47 of file EvtItgAbsIntegrator.cc.
References _myFunction, evaluateIt(), EvtItgAbsFunction::lowerRange(), and EvtItgAbsFunction::upperRange().
Referenced by EvtBtoXsgammaKagan::computeHadronicMass().
00047 { 00048 return evaluateIt(_myFunction.lowerRange(), _myFunction.upperRange()); 00049 }
EvtItgAbsIntegrator& EvtItgAbsIntegrator::operator= | ( | const EvtItgAbsIntegrator & | ) | [private] |
double EvtItgAbsIntegrator::trapezoid | ( | double | lower, | |
double | higher, | |||
int | n, | |||
double & | result | |||
) | const [protected] |
Definition at line 62 of file EvtItgAbsIntegrator.cc.
References _myFunction, ganga-rec::j, and x.
Referenced by EvtItgSimpsonIntegrator::evaluateIt().
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 }
const EvtItgAbsFunction& EvtItgAbsIntegrator::_myFunction [private] |
Definition at line 53 of file EvtItgAbsIntegrator.hh.
Referenced by boundsCheck(), myFunction(), normalisation(), and trapezoid().