38 : _myFunction( theFunction ) {}
43 return evaluateIt( _myFunction.lowerRange(), _myFunction.upperRange() );
48 double newLower( lower ), newUpper( upper );
50 boundsCheck( newLower, newUpper );
56 double& result )
const {
59 return 0.5 * ( higher - lower ) * ( _myFunction( lower ) + _myFunction( higher ) );
63 for ( it = 1, j = 1; j <
n - 1; j++ ) it <<= 1;
65 double itDouble( it );
69 double deltaX( ( higher - lower ) / itDouble );
71 double x( lower + 0.5 * deltaX );
73 for ( j = 1; j <= it; j++ )
75 sum += _myFunction( x );
79 result = 0.5 * ( result + ( higher - lower ) * sum / itDouble );
84void EvtItgAbsIntegrator::boundsCheck(
double& lower,
double& upper )
const {
89 <<
"Warning in EvtItgAbsIntegrator::evaluate. Lower bound " << lower
91 <<
" is less than lower bound " << _myFunction.
lowerRange()
92 <<
" of function. No contribution from this range will be counted." << endl;
96 if ( upper > _myFunction.upperRange() )
99 <<
"Warning in EvtItgAbsIntegrator::evaluate. Upper bound " << upper
101 <<
" is greater than upper bound " << _myFunction.upperRange()
102 <<
" of function. No contribution from this range will be counted." << endl;
103 upper = _myFunction.upperRange();
ostream & report(Severity severity, const char *facility)
double lowerRange() const
double trapezoid(double lower, double higher, int n, double &result) const
virtual ~EvtItgAbsIntegrator()
virtual double evaluateIt(double lower, double higher) const =0
EvtItgAbsIntegrator(const EvtItgAbsFunction &)
double evaluate(double lower, double upper) const
double normalisation() const