Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ParticleHPMadlandNixSpectrum Class Reference

#include <G4ParticleHPMadlandNixSpectrum.hh>

+ Inheritance diagram for G4ParticleHPMadlandNixSpectrum:

Public Member Functions

 G4ParticleHPMadlandNixSpectrum ()
 
 ~G4ParticleHPMadlandNixSpectrum ()
 
void Init (std::istream &aDataFile)
 
G4double GetFractionalProbability (G4double anEnergy)
 
G4double Sample (G4double anEnergy)
 
- Public Member Functions inherited from G4VParticleHPEDis
 G4VParticleHPEDis ()
 
virtual ~G4VParticleHPEDis ()
 
virtual void Init (std::istream &theData)=0
 
virtual G4double GetFractionalProbability (G4double anEnergy)=0
 
virtual G4double Sample (G4double anEnergy)=0
 

Detailed Description

Definition at line 51 of file G4ParticleHPMadlandNixSpectrum.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPMadlandNixSpectrum()

G4ParticleHPMadlandNixSpectrum::G4ParticleHPMadlandNixSpectrum ( )
inline

Definition at line 54 of file G4ParticleHPMadlandNixSpectrum.hh.

55 {
56 expm1 = G4Exp(-1.);
57 theAvarageKineticPerNucleonForLightFragments = 0.0;
58 theAvarageKineticPerNucleonForHeavyFragments = 0.0;
59 }
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition: G4Exp.hh:180

◆ ~G4ParticleHPMadlandNixSpectrum()

G4ParticleHPMadlandNixSpectrum::~G4ParticleHPMadlandNixSpectrum ( )
inline

Definition at line 60 of file G4ParticleHPMadlandNixSpectrum.hh.

61 {
62 }

Member Function Documentation

◆ GetFractionalProbability()

G4double G4ParticleHPMadlandNixSpectrum::GetFractionalProbability ( G4double  anEnergy)
inlinevirtual

Implements G4VParticleHPEDis.

Definition at line 74 of file G4ParticleHPMadlandNixSpectrum.hh.

75 {
76 return theFractionalProb.GetY(anEnergy);
77 }
G4double GetY(G4double x)

◆ Init()

void G4ParticleHPMadlandNixSpectrum::Init ( std::istream &  aDataFile)
inlinevirtual

Implements G4VParticleHPEDis.

Definition at line 64 of file G4ParticleHPMadlandNixSpectrum.hh.

65 {
66 theFractionalProb.Init(aDataFile);
67 aDataFile>> theAvarageKineticPerNucleonForLightFragments;
68 theAvarageKineticPerNucleonForLightFragments*=CLHEP::eV;
69 aDataFile>> theAvarageKineticPerNucleonForHeavyFragments;
70 theAvarageKineticPerNucleonForHeavyFragments*=CLHEP::eV;
71 theMaxTemp.Init(aDataFile);
72 }
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)

◆ Sample()

G4double G4ParticleHPMadlandNixSpectrum::Sample ( G4double  anEnergy)
virtual

Implements G4VParticleHPEDis.

Definition at line 74 of file G4ParticleHPMadlandNixSpectrum.cc.

75 {
76 G4double tm = theMaxTemp.GetY(anEnergy);
77 G4double last=0, buff, current = 100*MeV;
78 G4double precision = 0.001;
79 G4double newValue = 0., oldValue=0.;
80 G4double random = G4UniformRand();
81
82 G4int icounter=0;
83 G4int icounter_max=1024;
84 do
85 {
86 icounter++;
87 if ( icounter > icounter_max ) {
88 G4cout << "Loop-counter exceeded the threshold value at " << __LINE__ << "th line of " << __FILE__ << "." << G4endl;
89 break;
90 }
91 oldValue = newValue;
92 newValue = FissionIntegral(tm, current);
93 if(newValue < random)
94 {
95 buff = current;
96 current+=std::abs(current-last)/2.;
97 last = buff;
98 if(current>190*MeV) throw G4HadronicException(__FILE__, __LINE__, "Madland-Nix Spectrum has not converged in sampling");
99 }
100 else
101 {
102 buff = current;
103 current-=std::abs(current-last)/2.;
104 last = buff;
105 }
106 }
107 while (std::abs(oldValue-newValue)>precision*newValue); // Loop checking, 11.05.2015, T. Koi
108 return current;
109 }
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
#define G4UniformRand()
Definition: Randomize.hh:52

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