EvtItgSimpsonIntegrator Class Reference

#include <EvtItgSimpsonIntegrator.hh>

Inheritance diagram for EvtItgSimpsonIntegrator:

EvtItgAbsIntegrator List of all members.

Public Member Functions

 EvtItgSimpsonIntegrator (const EvtItgAbsFunction &, double precision=1.0e-5, int maxLoop=20)
virtual ~EvtItgSimpsonIntegrator ()
double evaluate (double lower, double upper) const
double normalisation () const

Protected Member Functions

virtual double evaluateIt (double, double) const
double trapezoid (double lower, double higher, int n, double &result) const
double myFunction (double x) const

Private Member Functions

 EvtItgSimpsonIntegrator ()
 EvtItgSimpsonIntegrator (const EvtItgSimpsonIntegrator &)
EvtItgSimpsonIntegratoroperator= (const EvtItgSimpsonIntegrator &)

Private Attributes

double _precision
double _maxLoop

Detailed Description

Definition at line 35 of file EvtItgSimpsonIntegrator.hh.


Constructor & Destructor Documentation

EvtItgSimpsonIntegrator::EvtItgSimpsonIntegrator ( const EvtItgAbsFunction ,
double  precision = 1.0e-5,
int  maxLoop = 20 
)

Definition at line 49 of file EvtItgSimpsonIntegrator.cc.

00049                                                                                                                    :
00050   EvtItgAbsIntegrator(theFunction),
00051   _precision(precision),
00052   _maxLoop(maxLoop)
00053 {}

EvtItgSimpsonIntegrator::~EvtItgSimpsonIntegrator (  )  [virtual]

Definition at line 60 of file EvtItgSimpsonIntegrator.cc.

00061 {}

EvtItgSimpsonIntegrator::EvtItgSimpsonIntegrator (  )  [private]

EvtItgSimpsonIntegrator::EvtItgSimpsonIntegrator ( const EvtItgSimpsonIntegrator  )  [private]


Member Function Documentation

double EvtItgAbsIntegrator::evaluate ( double  lower,
double  upper 
) const [inherited]

Definition at line 52 of file EvtItgAbsIntegrator.cc.

References EvtItgAbsIntegrator::boundsCheck(), and EvtItgAbsIntegrator::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 }

double EvtItgSimpsonIntegrator::evaluateIt ( double  ,
double   
) const [protected, virtual]

Implements EvtItgAbsIntegrator.

Definition at line 64 of file EvtItgSimpsonIntegrator.cc.

References _maxLoop, _precision, calibUtil::ERROR, ganga-rec::j, report(), s, and EvtItgAbsIntegrator::trapezoid().

00064                                                                     {
00065   
00066   // report(INFO,"EvtGen")<<"in evaluate"<<endl;
00067   int j;
00068   double result(0.0);
00069   double s, st, ost(0.0);
00070   for (j=1;j<4;j++) {
00071     st = trapezoid(lower, higher, j, result);
00072     s = (4.0 * st - ost)/3.0;
00073     ost=st;
00074   }
00075 
00076   double olds(s);
00077   st = trapezoid(lower, higher, j, result);
00078   s = (4.0 * st - ost)/3.0;
00079 
00080   if (fabs(s - olds) < _precision*fabs(olds) || (s==0.0 && olds==0.0))     return s;
00081   
00082   ost=st;
00083 
00084   for (j=5;j<_maxLoop;j++){
00085 
00086     st = trapezoid(lower, higher, j, result);
00087     s = (4.0 * st - ost)/3.0;
00088     
00089     if (fabs(s - olds) < _precision*fabs(olds) || (s==0.0 && olds==0.0))    return s;
00090     olds=s;
00091     ost=st;
00092   }
00093   
00094   report(ERROR,"EvtGen") << "Severe error in EvtItgSimpsonIntegrator.  Failed to converge after loop with 2**"
00095                  << _maxLoop << " calls to the integrand in." << endl;
00096   
00097   return 0.0;
00098     
00099 }

double EvtItgAbsIntegrator::myFunction ( double  x  )  const [inline, protected, inherited]

Definition at line 49 of file EvtItgAbsIntegrator.hh.

References EvtItgAbsIntegrator::_myFunction.

00049 {return _myFunction(x);}

double EvtItgAbsIntegrator::normalisation (  )  const [inherited]

Definition at line 47 of file EvtItgAbsIntegrator.cc.

References EvtItgAbsIntegrator::_myFunction, EvtItgAbsIntegrator::evaluateIt(), EvtItgAbsFunction::lowerRange(), and EvtItgAbsFunction::upperRange().

Referenced by EvtBtoXsgammaKagan::computeHadronicMass().

00047                                          {
00048   return evaluateIt(_myFunction.lowerRange(), _myFunction.upperRange());
00049 }

EvtItgSimpsonIntegrator& EvtItgSimpsonIntegrator::operator= ( const EvtItgSimpsonIntegrator  )  [private]

double EvtItgAbsIntegrator::trapezoid ( double  lower,
double  higher,
int  n,
double &  result 
) const [protected, inherited]

Definition at line 62 of file EvtItgAbsIntegrator.cc.

References EvtItgAbsIntegrator::_myFunction, ganga-rec::j, and x.

Referenced by 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 }


Member Data Documentation

double EvtItgSimpsonIntegrator::_maxLoop [private]

Definition at line 50 of file EvtItgSimpsonIntegrator.hh.

Referenced by evaluateIt().

double EvtItgSimpsonIntegrator::_precision [private]

Definition at line 49 of file EvtItgSimpsonIntegrator.hh.

Referenced by evaluateIt().


Generated on Tue Nov 29 23:19:04 2016 for BOSS_7.0.2 by  doxygen 1.4.7