CMS 3D CMS Logo

funct::GaussIntegrator Class Reference

#include <PhysicsTools/Utilities/interface/NumericalIntegration.h>

List of all members.

Public Member Functions

double error () const
 GaussIntegrator (double epsilon)
 GaussIntegrator ()
template<typename F>
double operator() (const F &f, double a, double b) const

Private Attributes

double aa
double aconst
double bb
double c1
double c2
double epsilon_
double error_
double f1
double f2
double h
unsigned int i
double s16
double s8
double u
double xx

Static Private Attributes

static const double kCST = 5./1000
static const double kHF = 0.5
static const double w [12]
static const double x [12]


Detailed Description

Definition at line 63 of file NumericalIntegration.h.


Constructor & Destructor Documentation

funct::GaussIntegrator::GaussIntegrator (  )  [inline]

Definition at line 65 of file NumericalIntegration.h.

00065 { }

funct::GaussIntegrator::GaussIntegrator ( double  epsilon  )  [inline]

Definition at line 66 of file NumericalIntegration.h.

00066 : epsilon_(epsilon) { }


Member Function Documentation

double funct::GaussIntegrator::error (  )  const [inline]

Definition at line 110 of file NumericalIntegration.h.

References error_.

00110 { return error_; }

template<typename F>
double funct::GaussIntegrator::operator() ( const F &  f,
double  a,
double  b 
) const [inline]

Definition at line 68 of file NumericalIntegration.h.

References aa, funct::abs(), aconst, bb, c1, c2, epsilon_, error_, f, f1, f2, h, i, kCST, kHF, s16, s8, u, w, x, and xx.

00068                                                             {
00069       h = 0;
00070       if (b == a) return h;
00071       aconst = kCST/std::abs(b - a);
00072       bb = a;
00073     CASE1:
00074       aa = bb;
00075       bb = b;
00076     CASE2:
00077       c1 = kHF*(bb + aa);
00078       c2 = kHF*(bb - aa);
00079       s8 = 0;
00080       for(i = 0; i < 4; ++i) {
00081         u = c2*x[i];
00082         xx = c1 + u;
00083         f1 = f(xx);
00084         xx = c1-u;
00085         f2 = f(xx);
00086         s8 += w[i]*(f1 + f2);
00087       }
00088       s16 = 0;
00089       for(i = 4; i < 12; ++i) {
00090         u = c2*x[i];
00091         xx = c1+u;
00092         f1 = f(xx);
00093         xx = c1-u;
00094         f2 = f(xx);
00095         s16 += w[i]*(f1 + f2);
00096       }
00097       s16 = c2*s16;
00098       if (std::abs(s16 - c2*s8) <= epsilon_*(1. + std::abs(s16))) {
00099         h += s16;
00100         if(bb != b) goto CASE1;
00101       } else {
00102         bb = c1;
00103         if(1. + aconst*std::abs(c2) != 1) goto CASE2;
00104         h = s8;
00105       }
00106       
00107       error_ = std::abs(s16 - c2*s8);
00108       return h;   
00109     }    


Member Data Documentation

double funct::GaussIntegrator::aa [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::aconst [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::bb [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::c1 [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::c2 [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::epsilon_ [private]

Definition at line 113 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::error_ [mutable, private]

Definition at line 112 of file NumericalIntegration.h.

Referenced by error(), and operator()().

double funct::GaussIntegrator::f1 [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::f2 [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::h [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

unsigned int funct::GaussIntegrator::i [mutable, private]

Definition at line 118 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::kCST = 5./1000 [static, private]

Definition at line 116 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::kHF = 0.5 [static, private]

Definition at line 115 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::s16 [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::s8 [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::u [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::w [static, private]

Initial value:

 { 
  0.10122853629037626, 0.22238103445337447,
  0.31370664587788729, 0.36268378337836198,
  0.02715245941175409, 0.06225352393864789,
  0.09515851168249278, 0.12462897125553387,
  0.14959598881657673, 0.16915651939500254,
  0.18260341504492359, 0.18945061045506850 }

Definition at line 114 of file NumericalIntegration.h.

Referenced by operator()().

const double funct::GaussIntegrator::x [static, private]

Initial value:

 { 
  0.96028985649753623, 0.79666647741362674,
  0.52553240991632899, 0.18343464249564980,
  0.98940093499164993, 0.94457502307323258,
  0.86563120238783174, 0.75540440835500303,
  0.61787624440264375, 0.45801677765722739,
  0.28160355077925891, 0.09501250983763744 }

Definition at line 114 of file NumericalIntegration.h.

Referenced by operator()().

double funct::GaussIntegrator::xx [mutable, private]

Definition at line 117 of file NumericalIntegration.h.

Referenced by operator()().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:47:02 2009 for CMSSW by  doxygen 1.5.4