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

#include <G4ParticleHPNucLevel.hh>

Public Member Functions

 G4ParticleHPNucLevel (G4double e)
 
 ~G4ParticleHPNucLevel ()=default
 
void AddGamma (G4double e, G4double w, G4int idx)
 
void Normalize ()
 
G4ReactionProductGetDecayGamma (G4int &idx) const
 
G4double GetLevelEnergy () const
 
G4double GetNumberOfGammas () const
 
G4double GetGammaEnergy (G4int idx) const
 
 G4ParticleHPNucLevel (const G4ParticleHPNucLevel &)=delete
 
const G4ParticleHPNucLeveloperator= (const G4ParticleHPNucLevel &)=delete
 

Detailed Description

Definition at line 40 of file G4ParticleHPNucLevel.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPNucLevel() [1/2]

G4ParticleHPNucLevel::G4ParticleHPNucLevel ( G4double e)
explicit

Definition at line 35 of file G4ParticleHPNucLevel.cc.

35: levelEnergy(e) {}

◆ ~G4ParticleHPNucLevel()

G4ParticleHPNucLevel::~G4ParticleHPNucLevel ( )
default

◆ G4ParticleHPNucLevel() [2/2]

G4ParticleHPNucLevel::G4ParticleHPNucLevel ( const G4ParticleHPNucLevel & )
delete

Member Function Documentation

◆ AddGamma()

void G4ParticleHPNucLevel::AddGamma ( G4double e,
G4double w,
G4int idx )

Definition at line 37 of file G4ParticleHPNucLevel.cc.

38{
39 gammaData x;
40 x.gammaEnergy = e;
41 x.cumProbability = w;
42 x.next = idx;
43 gammas.push_back(x);
44 ++nGammas;
45}

◆ GetDecayGamma()

G4ReactionProduct * G4ParticleHPNucLevel::GetDecayGamma ( G4int & idx) const

Definition at line 69 of file G4ParticleHPNucLevel.cc.

70{
71 if (gammas.empty()) {
72 return nullptr;
73 }
75 G4double e = 0.0;
76 for (auto& gam : gammas) {
77 if (q <= gam.cumProbability) {
78 e = gam.gammaEnergy;
79 idx = gam.next;
80 break;
81 }
82 }
83 if (e <= 0.0) {
84 return nullptr;
85 }
87 p *= e;
88 auto res = new G4ReactionProduct(G4Gamma::Gamma());
89 res->SetMomentum(p);
90 res->SetKineticEnergy(e);
91 return res;
92}
G4ThreeVector G4RandomDirection()
double G4double
Definition G4Types.hh:83
#define G4UniformRand()
Definition Randomize.hh:52
static G4Gamma * Gamma()
Definition G4Gamma.cc:81

◆ GetGammaEnergy()

G4double G4ParticleHPNucLevel::GetGammaEnergy ( G4int idx) const
inline

Definition at line 56 of file G4ParticleHPNucLevel.hh.

57 {
58 return (idx < nGammas && idx >= 0) ? gammas[idx].gammaEnergy : 0.0;
59 }

◆ GetLevelEnergy()

G4double G4ParticleHPNucLevel::GetLevelEnergy ( ) const
inline

Definition at line 52 of file G4ParticleHPNucLevel.hh.

52{ return levelEnergy; }

◆ GetNumberOfGammas()

G4double G4ParticleHPNucLevel::GetNumberOfGammas ( ) const
inline

Definition at line 54 of file G4ParticleHPNucLevel.hh.

54{ return nGammas; }

◆ Normalize()

void G4ParticleHPNucLevel::Normalize ( )

Definition at line 47 of file G4ParticleHPNucLevel.cc.

48{
49 if (gammas.empty()) {
50 return;
51 }
52 G4double sum = 0.0;
53 for (auto& gam : gammas) {
54 sum += gam.cumProbability;
55 }
56 if (sum <= 0.0) {
57 return;
58 }
59
60 G4double norm = 1.0 / sum;
61 sum = 0;
62 for (auto& gam : gammas) {
63 sum += norm * gam.cumProbability;
64 gam.cumProbability = sum;
65 }
66 gammas[nGammas - 1].cumProbability = 1.0;
67}

◆ operator=()

const G4ParticleHPNucLevel & G4ParticleHPNucLevel::operator= ( const G4ParticleHPNucLevel & )
delete

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