Geant4 10.7.0
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 ()
 
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 44 of file G4ParticleHPWattSpectrum.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPWattSpectrum()

G4ParticleHPWattSpectrum::G4ParticleHPWattSpectrum ( )
inline

Definition at line 47 of file G4ParticleHPWattSpectrum.hh.

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

◆ ~G4ParticleHPWattSpectrum()

G4ParticleHPWattSpectrum::~G4ParticleHPWattSpectrum ( )
inline

Definition at line 51 of file G4ParticleHPWattSpectrum.hh.

52 {
53 }

Member Function Documentation

◆ GetFractionalProbability()

G4double G4ParticleHPWattSpectrum::GetFractionalProbability ( G4double  anEnergy)
inlinevirtual

Implements G4VParticleHPEDis.

Definition at line 62 of file G4ParticleHPWattSpectrum.hh.

63 {
64 return theFractionalProb.GetY(anEnergy);
65 }
G4double GetY(G4double x)

◆ Init()

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

Implements G4VParticleHPEDis.

Definition at line 55 of file G4ParticleHPWattSpectrum.hh.

56 {
57 theFractionalProb.Init(aDataFile, CLHEP::eV);
58 theApar.Init(aDataFile, CLHEP::eV);
59 theBpar.Init(aDataFile, CLHEP::eV);
60 }
void Init(std::istream &aDataFile, G4int total, G4double ux=1., G4double uy=1.)

◆ Sample()

G4double G4ParticleHPWattSpectrum::Sample ( G4double  anEnergy)
virtual

Implements G4VParticleHPEDis.

Definition at line 35 of file G4ParticleHPWattSpectrum.cc.

36 {
37 G4double a = theApar.GetY(anEnergy)*eV;
38 G4double b = theBpar.GetY(anEnergy)/eV;
39 G4double result;
40 G4double random, cut, max;
41 max = std::sinh(std::sqrt(b*15.*a));
42
43 G4int icounter=0;
44 G4int icounter_max=1024;
45 do
46 {
47 icounter++;
48 if ( icounter > icounter_max ) {
49 G4cout << "Loop-counter exceeded the threshold value at " << __LINE__ << "th line of " << __FILE__ << "." << G4endl;
50 break;
51 }
52 random = G4UniformRand();
53 result = -a*G4Log(random);
54 cut = G4UniformRand();
55 }
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:226
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
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: