Geant4-11
Public Member Functions | Private Member Functions | Private Attributes
G4ParticleHPWattSpectrum Class Reference

#include <G4ParticleHPWattSpectrum.hh>

Inheritance diagram for G4ParticleHPWattSpectrum:
G4VParticleHPEDis

Public Member Functions

 G4ParticleHPWattSpectrum ()
 
G4double GetFractionalProbability (G4double anEnergy)
 
void Init (std::istream &aDataFile)
 
G4double Sample (G4double anEnergy)
 
 ~G4ParticleHPWattSpectrum ()
 

Private Member Functions

G4double Watt (G4double anEnergy, G4double a, G4double b)
 

Private Attributes

G4double expm1
 
G4ParticleHPVector theApar
 
G4ParticleHPVector theBpar
 
G4ParticleHPVector theFractionalProb
 

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

References expm1, and G4Exp().

◆ ~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)

References G4ParticleHPVector::GetY(), and theFractionalProb.

◆ Init()

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

Implements G4VParticleHPEDis.

Definition at line 55 of file G4ParticleHPWattSpectrum.hh.

56 {
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.)
static constexpr double eV

References CLHEP::eV, G4ParticleHPVector::Init(), theApar, theBpar, and theFractionalProb.

◆ 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=0.;
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
static constexpr double eV
Definition: G4SIunits.hh:201
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

References eV, G4cout, G4endl, G4Log(), G4UniformRand, G4ParticleHPVector::GetY(), G4INCL::Math::max(), theApar, and theBpar.

◆ Watt()

G4double G4ParticleHPWattSpectrum::Watt ( G4double  anEnergy,
G4double  a,
G4double  b 
)
inlineprivate

Definition at line 71 of file G4ParticleHPWattSpectrum.hh.

72 {
73 G4double energy = anEnergy/CLHEP::eV;
74 G4double result = G4Exp(-energy/a)*std::sinh(std::sqrt(b*energy));
75 return result;
76 }
G4double energy(const ThreeVector &p, const G4double m)

References G4INCL::KinematicsUtils::energy(), CLHEP::eV, and G4Exp().

Field Documentation

◆ expm1

G4double G4ParticleHPWattSpectrum::expm1
private

Definition at line 80 of file G4ParticleHPWattSpectrum.hh.

Referenced by G4ParticleHPWattSpectrum().

◆ theApar

G4ParticleHPVector G4ParticleHPWattSpectrum::theApar
private

Definition at line 84 of file G4ParticleHPWattSpectrum.hh.

Referenced by Init(), and Sample().

◆ theBpar

G4ParticleHPVector G4ParticleHPWattSpectrum::theBpar
private

Definition at line 85 of file G4ParticleHPWattSpectrum.hh.

Referenced by Init(), and Sample().

◆ theFractionalProb

G4ParticleHPVector G4ParticleHPWattSpectrum::theFractionalProb
private

Definition at line 82 of file G4ParticleHPWattSpectrum.hh.

Referenced by GetFractionalProbability(), and Init().


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