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

#include <G4ParticleHPDeExGammas.hh>

Public Member Functions

 G4ParticleHPDeExGammas ()
 
 ~G4ParticleHPDeExGammas ()
 
void Init (std::istream &aDataFile)
 
G4ReactionProductVectorGetDecayGammas (G4int idx) const
 
G4int GetNumberOfLevels () const
 
G4double GetLevelEnergy (G4int idx) const
 
 G4ParticleHPDeExGammas (const G4ParticleHPDeExGammas &)=delete
 
const G4ParticleHPDeExGammasoperator= (const G4ParticleHPDeExGammas &)=delete
 

Detailed Description

Definition at line 40 of file G4ParticleHPDeExGammas.hh.

Constructor & Destructor Documentation

◆ G4ParticleHPDeExGammas() [1/2]

G4ParticleHPDeExGammas::G4ParticleHPDeExGammas ( )
explicitdefault

◆ ~G4ParticleHPDeExGammas()

G4ParticleHPDeExGammas::~G4ParticleHPDeExGammas ( )

Definition at line 42 of file G4ParticleHPDeExGammas.cc.

43{
44 for (auto& ptr : theLevels) {
45 delete ptr;
46 }
47}

◆ G4ParticleHPDeExGammas() [2/2]

G4ParticleHPDeExGammas::G4ParticleHPDeExGammas ( const G4ParticleHPDeExGammas & )
delete

Member Function Documentation

◆ GetDecayGammas()

G4ReactionProductVector * G4ParticleHPDeExGammas::GetDecayGammas ( G4int idx) const

Definition at line 109 of file G4ParticleHPDeExGammas.cc.

110{
111 G4int idx = i;
112 if (idx >= nLevels || idx <= 0) return nullptr;
113 auto result = new G4ReactionProductVector();
114
115 for (;;) {
116 if (idx <= 0) {
117 break;
118 }
119 auto ptr = theLevels[idx]->GetDecayGamma(idx);
120 if (nullptr != ptr) {
121 result->push_back(ptr);
122 }
123 }
124 return result;
125}
std::vector< G4ReactionProduct * > G4ReactionProductVector
int G4int
Definition G4Types.hh:85

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), and G4ParticleHPInelasticCompFS::CompositeApply().

◆ GetLevelEnergy()

G4double G4ParticleHPDeExGammas::GetLevelEnergy ( G4int idx) const
inline

Definition at line 52 of file G4ParticleHPDeExGammas.hh.

53 {
54 return (idx < nLevels && idx >= 0) ? theLevels[idx]->GetLevelEnergy() : 0.0;
55 }

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), G4ParticleHPInelasticCompFS::CompositeApply(), and Init().

◆ GetNumberOfLevels()

G4int G4ParticleHPDeExGammas::GetNumberOfLevels ( ) const
inline

Definition at line 50 of file G4ParticleHPDeExGammas.hh.

50{ return nLevels; }

Referenced by G4ParticleHPInelasticBaseFS::BaseApply(), and G4ParticleHPInelasticCompFS::CompositeApply().

◆ Init()

void G4ParticleHPDeExGammas::Init ( std::istream & aDataFile)

Definition at line 49 of file G4ParticleHPDeExGammas.cc.

50{
51 // G4cout << "### G4ParticleHPDeExGammas::Init new file " << G4endl;
52 // ground state
53 auto level = new G4ParticleHPNucLevel(0.0);
54
55 G4double elevel0 = 0.0;
56 G4double elevel = 0.0;
57 G4double egamma = 0.0;
58 G4double prob = 0.0;
59 constexpr G4double eps = 1 * CLHEP::eV;
60 for (;;) {
61 if (aDataFile >> elevel) {
62 // next line
63 aDataFile >> egamma >> prob;
64 egamma *= CLHEP::keV;
65 elevel *= CLHEP::keV;
66 prob = std::max(prob, 1.e-6);
67 // G4cout << " El0=" << elevel0 << " El=" << elevel
68 // << " Eg=" << egamma << " w=" << prob << G4endl;
69
70 // save previous level and start a new level
71 if (std::abs(elevel - elevel0) > eps) {
72 level->Normalize();
73 theLevels.push_back(level);
74 ++nLevels;
75 level = new G4ParticleHPNucLevel(elevel);
76 elevel0 = elevel;
77 // G4cout << " New level " << nLevels << " E=" << elevel << G4endl;
78 }
79
80 // find the next level
81 G4double e = elevel - egamma;
82 G4int next = -1;
83 G4double del = DBL_MAX;
84 for (G4int i = 0; i < nLevels; ++i) {
85 G4double de = std::abs(theLevels[i]->GetLevelEnergy() - e);
86 if (de < del) {
87 next = i;
88 del = de;
89 }
90 }
91 // save level data
92 if (next >= 0) {
93 level->AddGamma(egamma, prob, next);
94 // G4cout << " NLevel=" << nLevels << " Elevel=" << elevel
95 // << " Egamma=" << egamma << " W=" << prob << " next=" << next << G4endl;
96 }
97 }
98 else {
99 // end of file - save recent level
100 level->Normalize();
101 theLevels.push_back(level);
102 ++nLevels;
103 // G4cout << "### End of file Nlevels=" << nLevels << G4endl;
104 break;
105 }
106 }
107}
double G4double
Definition G4Types.hh:83
G4double GetLevelEnergy(G4int idx) const
#define DBL_MAX
Definition templates.hh:62

Referenced by G4ParticleHPInelasticBaseFS::InitGammas(), and G4ParticleHPInelasticCompFS::InitGammas().

◆ operator=()

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

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