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

#include <G4ParticleHPWattSpectrum.hh>

+ Inheritance diagram for G4ParticleHPWattSpectrum:

Public Member Functions

 G4ParticleHPWattSpectrum ()
 
 ~G4ParticleHPWattSpectrum () 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 45 of file G4ParticleHPWattSpectrum.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPWattSpectrum()

G4ParticleHPWattSpectrum::G4ParticleHPWattSpectrum ( )
inline

Definition at line 48 of file G4ParticleHPWattSpectrum.hh.

48{ expm1 = G4Exp(-1.); }
G4double G4Exp(G4double initial_x)
Exponential Function double precision.
Definition G4Exp.hh:180

◆ ~G4ParticleHPWattSpectrum()

G4ParticleHPWattSpectrum::~G4ParticleHPWattSpectrum ( )
overridedefault

Member Function Documentation

◆ GetFractionalProbability()

G4double G4ParticleHPWattSpectrum::GetFractionalProbability ( G4double anEnergy)
inlineoverridevirtual

Implements G4VParticleHPEDis.

Definition at line 58 of file G4ParticleHPWattSpectrum.hh.

59 {
60 return theFractionalProb.GetY(anEnergy);
61 }
G4double GetY(G4double x)

◆ Init()

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

Implements G4VParticleHPEDis.

Definition at line 51 of file G4ParticleHPWattSpectrum.hh.

52 {
53 theFractionalProb.Init(aDataFile, CLHEP::eV);
54 theApar.Init(aDataFile, CLHEP::eV);
55 theBpar.Init(aDataFile, CLHEP::eV);
56 }
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)

◆ Sample()

G4double G4ParticleHPWattSpectrum::Sample ( G4double anEnergy)
overridevirtual

Implements G4VParticleHPEDis.

Definition at line 36 of file G4ParticleHPWattSpectrum.cc.

37{
38 G4double a = theApar.GetY(anEnergy) * eV;
39 G4double b = theBpar.GetY(anEnergy) / eV;
40 G4double result = 0.;
41 G4double random, cut, max;
42 max = std::sinh(std::sqrt(b * 15. * a));
43
44 G4int icounter = 0;
45 G4int icounter_max = 1024;
46 do {
47 icounter++;
48 if (icounter > icounter_max) {
49 G4cout << "Loop-counter exceeded the threshold value at " << __LINE__ << "th line of "
50 << __FILE__ << "." << G4endl;
51 break;
52 }
53 random = G4UniformRand();
54 result = -a * G4Log(random);
55 cut = G4UniformRand();
56 } while (cut > std::sinh(std::sqrt(b * result)) / max); // Loop checking, 11.05.2015, T. Koi
57 return result;
58}
G4double G4Log(G4double x)
Definition G4Log.hh:227
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
T max(const T t1, const T t2)
brief Return the largest of the two arguments

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