Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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, std::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 // only in this method there is a check on the vector boundary
74 std::size_t NearestLevelIndex(const G4double energy, const std::size_t index=0) const;
75
76 inline std::size_t NumberOfTransitions() const;
77
78 inline const G4NucLevel* GetLevel(const std::size_t i) const;
79
80 inline G4double LevelEnergy(const std::size_t i) const;
81
82 inline G4double MaxLevelEnergy() const;
83
84 inline std::size_t NearestLowEdgeLevelIndex(const G4double energy) const;
85
86 inline const G4NucLevel* NearestLevel(const G4double energy,
87 const std::size_t index=0) const;
88
89 inline G4double NearestLevelEnergy(const G4double energy,
90 const std::size_t index=0) const;
91
92 inline G4double NearestLowEdgeLevelEnergy(const G4double energy) const;
93
94 // for stable isotopes life time is -1
95 inline G4double LifeTime(const std::size_t i) const;
96
97 inline G4int SpinTwo(const std::size_t i) const;
98
99 inline G4int Parity(const std::size_t i) const;
100
101 inline G4int FloatingLevel(const std::size_t i) const;
102
103 inline G4double ShellCorrection() const;
104
105 inline G4double LevelDensity(const G4double U) const;
106
107 const G4String& FloatingType(const std::size_t i) const;
108
109 void StreamInfo(std::ostream& os) const;
110
111 G4LevelManager(const G4LevelManager & right) = delete;
112 const G4LevelManager& operator=(const G4LevelManager &right) = delete;
113 G4bool operator==(const G4LevelManager &right) const = delete;
114 G4bool operator!=(const G4LevelManager &right) const = delete;
115
116private:
117
118 std::vector<G4double> fLevelEnergy;
119 std::vector<G4int> fSpin;
120 std::vector<const G4NucLevel*> fLevels;
121
122 G4double fShellCorrection;
123 G4double fLevelDensity;
124
125 std::size_t nTransitions;
126
127 static const G4int nfloting = 13;
128 static G4String fFloatingLevels[nfloting];
129
130};
131
132inline std::size_t G4LevelManager::NumberOfTransitions() const
133{
134 return nTransitions;
135}
136
137inline const G4NucLevel* G4LevelManager::GetLevel(const std::size_t i) const
138{
139 return fLevels[i];
140}
141
142inline G4double G4LevelManager::LevelEnergy(const std::size_t i) const
143{
144 return fLevelEnergy[i];
145}
146
148{
149 return fLevelEnergy[nTransitions];
150}
151
152inline std::size_t
154{
155 std::size_t idx = nTransitions;
156 if(energy < fLevelEnergy[nTransitions]) {
157 idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy)
158 - fLevelEnergy.begin() - 1;
159 }
160 return idx;
161}
162
163inline const G4NucLevel*
164G4LevelManager::NearestLevel(const G4double energy, const std::size_t index) const
165{
166 return GetLevel(NearestLevelIndex(energy, index));
167}
168
169inline G4double
171 const std::size_t index) const
172{
173 return LevelEnergy(NearestLevelIndex(energy, index));
174}
175
176inline G4double
178{
180}
181
182inline G4double G4LevelManager::LifeTime(const std::size_t i) const
183{
184 return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0;
185}
186
187inline G4int G4LevelManager::SpinTwo(const std::size_t i) const
188{
189 return std::abs(fSpin[i]%100000 - 100);
190}
191
192inline G4int G4LevelManager::Parity(const std::size_t i) const
193{
194 return (fSpin[i]%100000 - 100 > 0) ? 1 : -1;
195}
196
197inline G4int G4LevelManager::FloatingLevel(const std::size_t i) const
198{
199 return fSpin[i]/100000;
200}
201
203{
204 return fShellCorrection;
205}
206
208{
209 return fLevelDensity;
210}
211
212#endif
double G4double
Definition: G4Types.hh:83
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
const G4double A[17]
const G4NucLevel * GetLevel(const std::size_t i) const
void StreamInfo(std::ostream &os) const
G4double NearestLowEdgeLevelEnergy(const G4double energy) const
G4double ShellCorrection() const
std::size_t NearestLevelIndex(const G4double energy, const std::size_t index=0) const
G4int FloatingLevel(const std::size_t i) const
G4double LevelEnergy(const std::size_t i) const
G4double LevelDensity(const G4double U) const
G4LevelManager(const G4LevelManager &right)=delete
std::size_t NumberOfTransitions() const
G4bool operator==(const G4LevelManager &right) const =delete
G4int SpinTwo(const std::size_t i) const
const G4String & FloatingType(const std::size_t i) const
const G4NucLevel * NearestLevel(const G4double energy, const std::size_t index=0) const
std::size_t NearestLowEdgeLevelIndex(const G4double energy) const
G4double MaxLevelEnergy() const
G4int Parity(const std::size_t i) const
G4double LifeTime(const std::size_t i) const
const G4LevelManager & operator=(const G4LevelManager &right)=delete
G4double NearestLevelEnergy(const G4double energy, const std::size_t index=0) const
G4bool operator!=(const G4LevelManager &right) const =delete