Geant4 11.2.2
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 () override=default
 
void Init (std::istream &aDataFile) override
 
G4double GetFractionalProbability (G4double anEnergy) override
 
G4double Sample (G4double anEnergy) override
 
- Public Member Functions inherited from G4VParticleHPEDis
 G4VParticleHPEDis ()=default
 
virtual ~G4VParticleHPEDis ()=default
 

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 ( )
overridedefault

Member Function Documentation

◆ GetFractionalProbability()

G4double G4ParticleHPMadlandNixSpectrum::GetFractionalProbability ( G4double anEnergy)
inlineoverridevirtual

Implements G4VParticleHPEDis.

Definition at line 72 of file G4ParticleHPMadlandNixSpectrum.hh.

73 {
74 return theFractionalProb.GetY(anEnergy);
75 }
G4double GetY(G4double x)

◆ Init()

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

Implements G4VParticleHPEDis.

Definition at line 62 of file G4ParticleHPMadlandNixSpectrum.hh.

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

◆ Sample()

G4double G4ParticleHPMadlandNixSpectrum::Sample ( G4double anEnergy)
overridevirtual

Implements G4VParticleHPEDis.

Definition at line 73 of file G4ParticleHPMadlandNixSpectrum.cc.

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

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