Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
G4GaussLaguerreQ Class Reference

#include <G4GaussLaguerreQ.hh>

Inheritance diagram for G4GaussLaguerreQ:
G4VGaussianQuadrature

Public Member Functions

 G4GaussLaguerreQ (function pFunction, G4double alpha, G4int nLaguerre)
 
G4double Integral () const
 
- Public Member Functions inherited from G4VGaussianQuadrature
 G4VGaussianQuadrature (function pFunction)
 
virtual ~G4VGaussianQuadrature ()
 
G4double GetAbscissa (G4int index) const
 
G4double GetWeight (G4int index) const
 
G4int GetNumber () const
 

Additional Inherited Members

- Protected Member Functions inherited from G4VGaussianQuadrature
G4double GammaLogarithm (G4double xx)
 
- Protected Attributes inherited from G4VGaussianQuadrature
function fFunction
 
G4doublefAbscissa
 
G4doublefWeight
 
G4int fNumber
 

Detailed Description

Definition at line 68 of file G4GaussLaguerreQ.hh.

Constructor & Destructor Documentation

G4GaussLaguerreQ::G4GaussLaguerreQ ( function  pFunction,
G4double  alpha,
G4int  nLaguerre 
)

Definition at line 42 of file G4GaussLaguerreQ.cc.

References G4VGaussianQuadrature::fAbscissa, FatalException, G4VGaussianQuadrature::fNumber, G4VGaussianQuadrature::fWeight, G4Exception(), and G4VGaussianQuadrature::GammaLogarithm().

45  : G4VGaussianQuadrature(pFunction)
46 {
47  const G4double tolerance = 1.0e-10 ;
48  const G4int maxNumber = 12 ;
49  G4int i=1, k=1 ;
50  G4double newton0=0.0, newton1=0.0,
51  temp1=0.0, temp2=0.0, temp3=0.0, temp=0.0, cofi=0.0 ;
52 
53  fNumber = nLaguerre ;
54  fAbscissa = new G4double[fNumber] ;
55  fWeight = new G4double[fNumber] ;
56 
57  for(i=1;i<=fNumber;i++) // Loop over the desired roots
58  {
59  if(i == 1)
60  {
61  newton0 = (1.0 + alpha)*(3.0 + 0.92*alpha)
62  / (1.0 + 2.4*fNumber + 1.8*alpha) ;
63  }
64  else if(i == 2)
65  {
66  newton0 += (15.0 + 6.25*alpha)/(1.0 + 0.9*alpha + 2.5*fNumber) ;
67  }
68  else
69  {
70  cofi = i - 2 ;
71  newton0 += ((1.0+2.55*cofi)/(1.9*cofi)
72  + 1.26*cofi*alpha/(1.0+3.5*cofi))
73  * (newton0 - fAbscissa[i-3])/(1.0 + 0.3*alpha) ;
74  }
75  for(k=1;k<=maxNumber;k++)
76  {
77  temp1 = 1.0 ;
78  temp2 = 0.0 ;
79  for(G4int j=1;j<=fNumber;j++)
80  {
81  temp3 = temp2 ;
82  temp2 = temp1 ;
83  temp1 = ((2*j - 1 + alpha - newton0)*temp2
84  - (j - 1 + alpha)*temp3)/j ;
85  }
86  temp = (fNumber*temp1 - (fNumber +alpha)*temp2)/newton0 ;
87  newton1 = newton0 ;
88  newton0 = newton1 - temp1/temp ;
89  if(std::fabs(newton0 - newton1) <= tolerance)
90  {
91  break ;
92  }
93  }
94  if(k > maxNumber)
95  {
96  G4Exception("G4GaussLaguerreQ::G4GaussLaguerreQ()",
97  "OutOfRange", FatalException,
98  "Too many iterations in Gauss-Laguerre constructor") ;
99  }
100 
101  fAbscissa[i-1] = newton0 ;
102  fWeight[i-1] = -std::exp(GammaLogarithm(alpha + fNumber)
103  - GammaLogarithm((G4double)fNumber))/(temp*fNumber*temp2) ;
104  }
105 }
G4VGaussianQuadrature(function pFunction)
int G4int
Definition: G4Types.hh:78
G4double GammaLogarithm(G4double xx)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
double G4double
Definition: G4Types.hh:76

Member Function Documentation

G4double G4GaussLaguerreQ::Integral ( ) const

Definition at line 116 of file G4GaussLaguerreQ.cc.

References G4VGaussianQuadrature::fAbscissa, G4VGaussianQuadrature::fFunction, G4VGaussianQuadrature::fNumber, and G4VGaussianQuadrature::fWeight.

117 {
118  G4double integral = 0.0 ;
119  for(G4int i=0;i<fNumber;i++)
120  {
121  integral += fWeight[i]*fFunction(fAbscissa[i]) ;
122  }
123  return integral ;
124 }
int G4int
Definition: G4Types.hh:78
double G4double
Definition: G4Types.hh:76

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