Geant4  10.02.p01
G4ParticleHPMadlandNixSpectrum.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // P. Arce, June-2014 Conversion neutron_hp to particle_hp
28 //
29 #ifndef G4ParticleHPMadlandNixSpectrum_h
30 #define G4ParticleHPMadlandNixSpectrum_h 1
31 
32 #include <fstream>
33 #include <cmath>
34 #include <CLHEP/Units/PhysicalConstants.h>
35 
36 #include "globals.hh"
37 #include "G4ios.hh"
38 #include "Randomize.hh"
39 #include "G4Exp.hh"
40 #include "G4Log.hh"
41 #include "G4Pow.hh"
42 #include "G4ParticleHPVector.hh"
43 #include "G4VParticleHPEDis.hh"
44 
45 // #include <nag.h> @
46 // #include <nags.h> @
47 
48 
49 // we will need a List of these .... one per term.
50 
52 {
53  public:
55  {
56  expm1 = G4Exp(-1.);
57  }
59  {
60  }
61 
62  inline void Init(std::istream & aDataFile)
63  {
64  theFractionalProb.Init(aDataFile);
66  theAvarageKineticPerNucleonForLightFragments*=CLHEP::eV;
68  theAvarageKineticPerNucleonForHeavyFragments*=CLHEP::eV;
69  theMaxTemp.Init(aDataFile);
70  }
71 
73  {
74  return theFractionalProb.GetY(anEnergy);
75  }
76 
77  G4double Sample(G4double anEnergy);
78 
79  private:
80 
81  G4double Madland(G4double aSecEnergy, G4double tm);
82 
84  {
85  return 0.5*( GIntegral(tm, anEnergy, theAvarageKineticPerNucleonForLightFragments)
87  }
88 
89  G4double GIntegral(G4double tm, G4double anEnergy, G4double aMean);
90 
91  inline G4double Gamma05(G4double aValue)
92  {
93  G4double result;
94  // gamma(1.2,x*X) = std::sqrt(CLHEP::pi)*Erf(x)
95  G4double x = std::sqrt(aValue);
96  G4double t = 1./(1+0.47047*x);
97  result = 1- (0.3480242*t - 0.0958798*t*t + 0.7478556*t*t*t)*G4Exp(-aValue); // @ check
98  result *= std::sqrt(CLHEP::pi);
99  return result;
100  }
101 
102  inline G4double Gamma15(G4double aValue)
103  {
104  G4double result;
105  // gamma(a+1, x) = a*gamma(a,x)-x**a*std::exp(-x)
106  result = 0.5*Gamma05(aValue) - std::sqrt(aValue)*G4Exp(-aValue); // @ check
107  return result;
108  }
109 
110  inline G4double Gamma25(G4double aValue)
111  {
112  G4double result;
113  result = 1.5*Gamma15(aValue) - G4Pow::GetInstance()->powA(aValue,1.5)*G4Exp(aValue); // @ check
114  return result;
115  }
116 
117  inline G4double E1(G4double aValue)
118  {
119  // good only for rather low aValue @@@ replace by the corresponding NAG function for the
120  // exponential integral. (<5 seems ok.
121  G4double gamma = 0.577216;
122  G4double precision = 0.000001;
123  G4double result =-gamma - G4Log(aValue);
124  G4double term = -aValue;
125  //110527TKDB Unnessary codes, Detected by gcc4.6 compiler
126  //G4double last;
127  G4int count = 1;
128  result -= term;
129  for(;;)
130  {
131  count++;
132  //110527TKDB Unnessary codes, Detected by gcc4.6 compiler
133  //last = result;
134  term = -term*aValue*(count-1)/(count*count);
135  result -=term;
136  if(std::fabs(term)/std::fabs(result)<precision) break;
137  }
138 // NagError *fail; @
139 // result = nag_exp_integral(aValue, fail); @
140  return result;
141  }
142 
143  private:
144 
146 
147  private:
148 
150 
153 
155 
156 };
157 
158 #endif
static G4Pow * GetInstance()
Definition: G4Pow.cc:55
G4double powA(G4double A, G4double y) const
Definition: G4Pow.hh:259
int G4int
Definition: G4Types.hh:78
G4double GetFractionalProbability(G4double anEnergy)
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)
G4double GetY(G4double x)
G4double G4Log(G4double x)
Definition: G4Log.hh:230
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:183
G4double Madland(G4double aSecEnergy, G4double tm)
static const double eV
Definition: G4SIunits.hh:212
static const double pi
Definition: G4SIunits.hh:74
const G4double x[NPOINTSGL]
G4double GIntegral(G4double tm, G4double anEnergy, G4double aMean)
G4double FissionIntegral(G4double tm, G4double anEnergy)
double G4double
Definition: G4Types.hh:76