BOSS 8.0.0
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
double myFunction (double x) const

Detailed Description

Definition at line 34 of file EvtItgSimpsonIntegrator.hh.

Constructor & Destructor Documentation

◆ EvtItgSimpsonIntegrator()

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

Definition at line 47 of file EvtItgSimpsonIntegrator.cc.

49 : EvtItgAbsIntegrator( theFunction ), _precision( precision ), _maxLoop( maxLoop ) {}
EvtItgAbsIntegrator(const EvtItgAbsFunction &)

◆ ~EvtItgSimpsonIntegrator()

EvtItgSimpsonIntegrator::~EvtItgSimpsonIntegrator ( )
virtual

Definition at line 55 of file EvtItgSimpsonIntegrator.cc.

55{}

Member Function Documentation

◆ evaluateIt()

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

Implements EvtItgAbsIntegrator.

Definition at line 57 of file EvtItgSimpsonIntegrator.cc.

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

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