Geant4  10.03
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<G4float>& lifetime,
65  const std::vector<G4float>& lifetimegamma,
66  const std::vector<G4int>& spin,
67  const std::vector<G4int>& meta,
68  const std::vector<const G4NucLevel*>& levels);
69 
71 
72  //===================================================================
73  // run time inlined const functions
74  //===================================================================
75 
76  inline size_t NumberOfTransitions() const;
77 
78  inline const G4NucLevel* GetLevel(size_t i) const;
79 
80  inline G4float LevelEnergy(size_t i) const;
81 
82  inline G4float MaxLevelEnergy() const;
83 
84  size_t NearestLevelIndex(G4double energy, size_t index=0) const;
85 
86  inline size_t NearestLowEdgeLevelIndex(G4double energy) const;
87 
88  inline const G4NucLevel* NearestLevel(G4double energy, size_t index=0) const;
89 
90  inline G4float NearestLevelEnergy(G4double energy, size_t index=0) const;
91 
92  inline G4float NearestLowEdgeLevelEnergy(G4double energy) const;
93 
94  inline G4float LifeTime(size_t i) const;
95 
96  inline G4float LifeTimeGamma(size_t i) const;
97 
98  inline G4int SpinParity(size_t i) const;
99 
100  inline G4int IsFloatingLevel(size_t i) const;
101 
102  const G4String& FloatingType(size_t i) const;
103 
104 private:
105 
106 #ifdef G4VERBOSE
107  void PrintError(size_t idx, const G4String&) const;
108 #endif
109 
110  G4LevelManager(const G4LevelManager & right) = delete;
111  const G4LevelManager& operator=(const G4LevelManager &right) = delete;
112  G4bool operator==(const G4LevelManager &right) const = delete;
113  G4bool operator!=(const G4LevelManager &right) const = delete;
114 
115  std::vector<G4float> fLevelEnergy;
116  std::vector<G4float> fLifeTime;
117  std::vector<G4float> fLifeTimeGamma;
118  std::vector<G4int> fSpin;
119  std::vector<G4int> fFloating;
120  std::vector<const G4NucLevel*> fLevels;
121  size_t nTransitions;
122  static const G4int nfloting = 13;
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 fLifeTime[i];
189 }
190 
192 {
193 #ifdef G4VERBOSE
194  if(i > nTransitions) { PrintError(i, "LifeTimeGamma"); }
195 #endif
196  return fLifeTimeGamma[i];
197 }
198 
199 inline G4int G4LevelManager::SpinParity(size_t i) const
200 {
201 #ifdef G4VERBOSE
202  if(i > nTransitions) { PrintError(i, "SpinParity"); }
203 #endif
204  return fSpin[i];
205 }
206 
208 {
209 #ifdef G4VERBOSE
210  if(i > nTransitions) { PrintError(i, "Floating"); }
211 #endif
212  return (0 != fFloating[i]);
213 }
214 
215 #endif
size_t NearestLowEdgeLevelIndex(G4double energy) const
std::vector< G4int > fFloating
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
std::vector< G4int > fSpin
int G4int
Definition: G4Types.hh:78
const G4NucLevel * GetLevel(size_t i) const
std::vector< G4float > fLevelEnergy
G4float LevelEnergy(size_t i) const
std::vector< G4float > fLifeTime
bool G4bool
Definition: G4Types.hh:79
G4int IsFloatingLevel(size_t i) const
G4bool operator==(const G4LevelManager &right) const =delete
size_t NumberOfTransitions() const
std::vector< const G4NucLevel * > fLevels
G4float NearestLevelEnergy(G4double energy, size_t index=0) const
size_t NearestLevelIndex(G4double energy, size_t index=0) const
std::vector< G4float > fLifeTimeGamma
G4double energy(const ThreeVector &p, const G4double m)
const G4LevelManager & operator=(const G4LevelManager &right)=delete
G4LevelManager(size_t ntrans, const std::vector< G4float > &energies, const std::vector< G4float > &lifetime, const std::vector< G4float > &lifetimegamma, const std::vector< G4int > &spin, const std::vector< G4int > &meta, const std::vector< const G4NucLevel * > &levels)
static const G4int nfloting
double G4double
Definition: G4Types.hh:76
G4float LifeTimeGamma(size_t i) const
static G4String fFloatingLevels[nfloting]
G4float MaxLevelEnergy() const
const G4String & FloatingType(size_t i) const
G4float NearestLowEdgeLevelEnergy(G4double energy) const
G4bool operator!=(const G4LevelManager &right) const =delete