Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4LevelManager.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27// -------------------------------------------------------------------
28//
29// GEANT4 header file
30//
31// File name: G4LevelManager
32//
33// Author: V.Ivanchenko
34//
35// Creation date: 4 January 2012
36//
37// Modifications:
38// 13.02.2015 Design change for gamma de-excitation
39//
40// -------------------------------------------------------------------
41//
42// Nuclear level manager for photon de-excitation process
43//
44
45#ifndef G4LEVELMANAGER_HH
46#define G4LEVELMANAGER_HH 1
47
48#include "globals.hh"
49#include "G4NucLevel.hh"
50#include <vector>
51#include <iostream>
52
54{
55
56public:
57 // levels - vector of nuclear level objects, ground state
58 // level has NULL pointer
59 // energies - list of excitation energies of nuclear levels starting
60 // from the ground state with energy zero
61 // spin - 2J, where J is the full angular momentum of the state
62 explicit G4LevelManager(G4int Z, G4int A, size_t nlev,
63 const std::vector<G4double>& energies,
64 const std::vector<G4int>& spin,
65 const std::vector<const G4NucLevel*>& levels);
66
68
69 //===================================================================
70 // run time inlined const functions
71 //===================================================================
72
73 inline size_t NumberOfTransitions() const;
74
75 inline const G4NucLevel* GetLevel(size_t i) const;
76
77 inline G4double LevelEnergy(size_t i) const;
78
79 inline G4double MaxLevelEnergy() const;
80
81 size_t NearestLevelIndex(G4double energy, size_t index=0) const;
82
83 inline size_t NearestLowEdgeLevelIndex(G4double energy) const;
84
85 inline const G4NucLevel* NearestLevel(G4double energy, size_t index=0) const;
86
87 inline G4double NearestLevelEnergy(G4double energy, size_t index=0) const;
88
89 inline G4double NearestLowEdgeLevelEnergy(G4double energy) const;
90
91 // for stable isotopes life time is -1
92 inline G4double LifeTime(size_t i) const;
93
94 inline G4int SpinTwo(size_t i) const;
95
96 inline G4int Parity(size_t i) const;
97
98 inline G4int FloatingLevel(size_t i) const;
99
100 inline G4double ShellCorrection() const;
101
102 inline G4double LevelDensity(G4double U) const;
103
104 const G4String& FloatingType(size_t i) const;
105
106 void StreamInfo(std::ostream& os) const;
107
108private:
109
110#ifdef G4VERBOSE
111 void PrintError(size_t idx, const G4String&) const;
112#endif
113
114 G4LevelManager(const G4LevelManager & right) = delete;
115 const G4LevelManager& operator=(const G4LevelManager &right) = delete;
116 G4bool operator==(const G4LevelManager &right) const = delete;
117 G4bool operator!=(const G4LevelManager &right) const = delete;
118
119 std::vector<G4double> fLevelEnergy;
120 std::vector<G4int> fSpin;
121 std::vector<const G4NucLevel*> fLevels;
122
123 G4double fShellCorrection;
124 G4double fLevelDensity;
125
126 size_t nTransitions;
127
128 static const G4int nfloting = 13;
129 static G4String fFloatingLevels[nfloting];
130
131};
132
134{
135 return nTransitions;
136}
137
138inline const G4NucLevel* G4LevelManager::GetLevel(size_t i) const
139{
140#ifdef G4VERBOSE
141 if(i > nTransitions) { PrintError(i, "GetLevel(idx)"); }
142#endif
143 return fLevels[i];
144}
145
147{
148#ifdef G4VERBOSE
149 if(i > nTransitions) { PrintError(i, "LevelEnergy(idx)"); }
150#endif
151 return fLevelEnergy[i];
152}
153
155{
156 return fLevelEnergy[nTransitions];
157}
158
160{
161 size_t idx = nTransitions;
162 if(energy < fLevelEnergy[nTransitions]) {
163 idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy)
164 - fLevelEnergy.begin() - 1;
165 }
166 return idx;
167}
168
169inline const G4NucLevel*
170G4LevelManager::NearestLevel(G4double energy, size_t index) const
171{
172 return GetLevel(NearestLevelIndex(energy, index));
173}
174
175inline G4double
177{
178 return LevelEnergy(NearestLevelIndex(energy, index));
179}
180
182{
184}
185
186inline G4double G4LevelManager::LifeTime(size_t i) const
187{
188#ifdef G4VERBOSE
189 if(i > nTransitions) { PrintError(i, "LifeTime"); }
190#endif
191 return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0;
192}
193
194inline G4int G4LevelManager::SpinTwo(size_t i) const
195{
196#ifdef G4VERBOSE
197 if(i > nTransitions) { PrintError(i, "SpinTwo"); }
198#endif
199 return std::abs(fSpin[i]%100000 - 100);
200}
201
202inline G4int G4LevelManager::Parity(size_t i) const
203{
204#ifdef G4VERBOSE
205 if(i > nTransitions) { PrintError(i, "SpinTwo"); }
206#endif
207 return (fSpin[i]%100000 - 100 > 0) ? 1 : -1;
208}
209
211{
212#ifdef G4VERBOSE
213 if(i > nTransitions) { PrintError(i, "Floating"); }
214#endif
215 return fSpin[i]/100000;
216}
217
219{
220 return fShellCorrection;
221}
222
224{
225 return fLevelDensity;
226}
227
228#endif
double A(double temperature)
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
G4double LifeTime(size_t i) const
void StreamInfo(std::ostream &os) const
G4double ShellCorrection() const
const G4NucLevel * GetLevel(size_t i) const
G4double LevelDensity(G4double U) const
size_t NearestLevelIndex(G4double energy, size_t index=0) const
G4double NearestLevelEnergy(G4double energy, size_t index=0) const
G4int FloatingLevel(size_t i) const
G4int SpinTwo(size_t i) const
G4int Parity(size_t i) const
size_t NearestLowEdgeLevelIndex(G4double energy) const
const G4String & FloatingType(size_t i) const
G4double MaxLevelEnergy() const
size_t NumberOfTransitions() const
G4double NearestLowEdgeLevelEnergy(G4double energy) const
G4double LevelEnergy(size_t i) const
const G4NucLevel * NearestLevel(G4double energy, size_t index=0) const