Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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 // $Id: G4LevelManager.hh 88516 2015-02-25 11:00:16Z vnivanch $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 header file
31 //
32 // File name: G4LevelManager
33 //
34 // Author: V.Ivanchenko
35 //
36 // Creation date: 4 January 2012
37 //
38 // Modifications:
39 // 13.02.2015 Design change for gamma de-excitation
40 //
41 // -------------------------------------------------------------------
42 //
43 // Nuclear level manager for photon de-excitation process
44 //
45 
46 #ifndef G4LEVELMANAGER_HH
47 #define G4LEVELMANAGER_HH 1
48 
49 #include "globals.hh"
50 #include "G4NucLevel.hh"
51 #include <vector>
52 
54 {
55 
56 public:
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  G4LevelManager(size_t ntrans,
63  const std::vector<G4float>& 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 G4float LevelEnergy(size_t i) const;
78 
79  inline G4float 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 G4float NearestLevelEnergy(G4double energy, size_t index=0) const;
88 
89  inline G4float NearestLowEdgeLevelEnergy(G4double energy) const;
90 
91  inline G4float LifeTime(size_t i) const;
92 
93  inline G4float LifeTimeGamma(size_t i) const;
94 
95  inline G4int SpinTwo(size_t i) const;
96 
97  inline G4int SpinParity(size_t i) const;
98 
99  inline G4int Parity(size_t i) const;
100 
101  inline G4int FloatingLevel(size_t i) const;
102 
103  const G4String& FloatingType(size_t i) const;
104 
105 private:
106 
107 #ifdef G4VERBOSE
108  void PrintError(size_t idx, const G4String&) const;
109 #endif
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 
116  std::vector<G4float> fLevelEnergy;
117  std::vector<G4int> fSpin;
118  std::vector<const G4NucLevel*> fLevels;
119 
120  size_t nTransitions;
121 
122  static const G4int nfloting = 13;
123  static G4String fFloatingLevels[nfloting];
124 
125 };
126 
128 {
129  return nTransitions;
130 }
131 
132 inline const G4NucLevel* G4LevelManager::GetLevel(size_t i) const
133 {
134 #ifdef G4VERBOSE
135  if(i > nTransitions) { PrintError(i, "GetLevel"); }
136 #endif
137  return fLevels[i];
138 }
139 
140 inline G4float G4LevelManager::LevelEnergy(size_t i) const
141 {
142 #ifdef G4VERBOSE
143  if(i > nTransitions) { PrintError(i, "LevelEnergy"); }
144 #endif
145  return fLevelEnergy[i];
146 }
147 
149 {
150  return fLevelEnergy[nTransitions];
151 }
152 
154 {
155  //G4cout<< "index= " << index << " max= " << nTransitions << " exc= " << ener
156  // << " Emax= " << fLevelEnergy[nTransitions] << G4endl;
157  size_t idx = nTransitions;
158  G4float energy = (G4float)ener;
159  if(energy < fLevelEnergy[nTransitions]) {
160  idx = std::lower_bound(fLevelEnergy.begin(), fLevelEnergy.end(), energy)
161  - fLevelEnergy.begin() - 1;
162  }
163  return idx;
164 }
165 
166 inline const G4NucLevel*
168 {
169  return GetLevel(NearestLevelIndex(energy, index));
170 }
171 
172 inline G4float
174 {
175  return LevelEnergy(NearestLevelIndex(energy, index));
176 }
177 
179 {
180  return LevelEnergy(NearestLowEdgeLevelIndex(energy));
181 }
182 
183 inline G4float G4LevelManager::LifeTime(size_t i) const
184 {
185 #ifdef G4VERBOSE
186  if(i > nTransitions) { PrintError(i, "LifeTime"); }
187 #endif
188  return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0f;
189 }
190 
192 {
193 #ifdef G4VERBOSE
194  if(i > nTransitions) { PrintError(i, "LifeTimeGamma"); }
195 #endif
196  return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0f;
197 }
198 
199 inline G4int G4LevelManager::SpinTwo(size_t i) const
200 {
201 #ifdef G4VERBOSE
202  if(i > nTransitions) { PrintError(i, "SpinTwo"); }
203 #endif
204  return std::abs(fSpin[i]%100000 - 100);
205 }
206 
207 inline G4int G4LevelManager::SpinParity(size_t i) const
208 {
209 #ifdef G4VERBOSE
210  if(i > nTransitions) { PrintError(i, "SpinTwo"); }
211 #endif
212  return fSpin[i]%100000 - 100;
213 }
214 
215 inline G4int G4LevelManager::Parity(size_t i) const
216 {
217 #ifdef G4VERBOSE
218  if(i > nTransitions) { PrintError(i, "Parity"); }
219 #endif
220  return (fSpin[i]%100000 - 100)/2;
221 }
222 
223 inline G4int G4LevelManager::FloatingLevel(size_t i) const
224 {
225 #ifdef G4VERBOSE
226  if(i > nTransitions) { PrintError(i, "Floating"); }
227 #endif
228  return fSpin[i]/100000;
229 }
230 
231 #endif
size_t NearestLowEdgeLevelIndex(G4double energy) const
G4int SpinTwo(size_t i) const
G4int SpinParity(size_t i) const
G4float LifeTime(size_t i) const
float G4float
Definition: G4Types.hh:77
const G4NucLevel * NearestLevel(G4double energy, size_t index=0) const
int G4int
Definition: G4Types.hh:78
const G4NucLevel * GetLevel(size_t i) const
G4float LevelEnergy(size_t i) const
bool G4bool
Definition: G4Types.hh:79
size_t NumberOfTransitions() const
G4float NearestLevelEnergy(G4double energy, size_t index=0) const
size_t NearestLevelIndex(G4double energy, size_t index=0) const
G4double energy(const ThreeVector &p, const G4double m)
G4int FloatingLevel(size_t i) const
G4LevelManager(size_t ntrans, const std::vector< G4float > &energies, const std::vector< G4int > &spin, const std::vector< const G4NucLevel * > &levels)
double G4double
Definition: G4Types.hh:76
G4float LifeTimeGamma(size_t i) const
G4float MaxLevelEnergy() const
const G4String & FloatingType(size_t i) const
G4int Parity(size_t i) const
G4float NearestLowEdgeLevelEnergy(G4double energy) const