BOSS 7.0.5
BESIII Offline Software System
Loading...
Searching...
No Matches
EvtItgSimpsonIntegrator Class Reference

#include <EvtItgSimpsonIntegrator.hh>

+ Inheritance diagram for EvtItgSimpsonIntegrator:

Public Member Functions

 EvtItgSimpsonIntegrator (const EvtItgAbsFunction &, double precision=1.0e-5, int maxLoop=20)
 
virtual ~EvtItgSimpsonIntegrator ()
 
- Public Member Functions inherited from EvtItgAbsIntegrator
 EvtItgAbsIntegrator (const EvtItgAbsFunction &)
 
virtual ~EvtItgAbsIntegrator ()
 
double evaluate (double lower, double upper) const
 
double normalisation () const
 

Protected Member Functions

virtual double evaluateIt (double, double) const
 
- Protected Member Functions inherited from EvtItgAbsIntegrator
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
 

Detailed Description

Definition at line 35 of file EvtItgSimpsonIntegrator.hh.

Constructor & Destructor Documentation

◆ EvtItgSimpsonIntegrator()

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

Definition at line 49 of file EvtItgSimpsonIntegrator.cc.

49 :
50 EvtItgAbsIntegrator(theFunction),
51 _precision(precision),
52 _maxLoop(maxLoop)
53{}

Referenced by EvtItgSimpsonIntegrator().

◆ ~EvtItgSimpsonIntegrator()

EvtItgSimpsonIntegrator::~EvtItgSimpsonIntegrator ( )
virtual

Definition at line 60 of file EvtItgSimpsonIntegrator.cc.

61{}

Member Function Documentation

◆ evaluateIt()

double EvtItgSimpsonIntegrator::evaluateIt ( double  lower,
double  higher 
) const
protectedvirtual

Implements EvtItgAbsIntegrator.

Definition at line 64 of file EvtItgSimpsonIntegrator.cc.

64 {
65
66 // report(INFO,"EvtGen")<<"in evaluate"<<endl;
67 int j;
68 double result(0.0);
69 double s, st, ost(0.0);
70 for (j=1;j<4;j++) {
71 st = trapezoid(lower, higher, j, result);
72 s = (4.0 * st - ost)/3.0;
73 ost=st;
74 }
75
76 double olds(s);
77 st = trapezoid(lower, higher, j, result);
78 s = (4.0 * st - ost)/3.0;
79
80 if (fabs(s - olds) < _precision*fabs(olds) || (s==0.0 && olds==0.0)) return s;
81
82 ost=st;
83
84 for (j=5;j<_maxLoop;j++){
85
86 st = trapezoid(lower, higher, j, result);
87 s = (4.0 * st - ost)/3.0;
88
89 if (fabs(s - olds) < _precision*fabs(olds) || (s==0.0 && olds==0.0)) return s;
90 olds=s;
91 ost=st;
92 }
93
94 report(ERROR,"EvtGen") << "Severe error in EvtItgSimpsonIntegrator. Failed to converge after loop with 2**"
95 << _maxLoop << " calls to the integrand in." << endl;
96
97 return 0.0;
98
99}
ostream & report(Severity severity, const char *facility)
Definition: EvtReport.cc:36
@ ERROR
Definition: EvtReport.hh:49
XmlRpcServer s
Definition: HelloServer.cpp:11
double trapezoid(double lower, double higher, int n, double &result) const

The documentation for this class was generated from the following files: