Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4LevelManager.hh
이 파일의 문서화 페이지로 가기
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 #include <iostream>
53 
55 {
56 
57 public:
58  // levels - vector of nuclear level objects, ground state
59  // level has NULL pointer
60  // energies - list of excitation energies of nuclear levels starting
61  // from the ground state with energy zero
62  // spin - 2J, where J is the full angular momentum of the state
63  explicit G4LevelManager(size_t ntrans,
64  const std::vector<G4double>& energies,
65  const std::vector<G4int>& spin,
66  const std::vector<const G4NucLevel*>& levels);
67 
69 
70  //===================================================================
71  // run time inlined const functions
72  //===================================================================
73 
74  inline size_t NumberOfTransitions() const;
75 
76  inline const G4NucLevel* GetLevel(size_t i) const;
77 
78  inline G4double LevelEnergy(size_t i) const;
79 
80  inline G4double MaxLevelEnergy() const;
81 
82  size_t NearestLevelIndex(G4double energy, size_t index=0) const;
83 
84  inline size_t NearestLowEdgeLevelIndex(G4double energy) const;
85 
86  inline const G4NucLevel* NearestLevel(G4double energy, size_t index=0) const;
87 
88  inline G4double NearestLevelEnergy(G4double energy, size_t index=0) const;
89 
90  inline G4double NearestLowEdgeLevelEnergy(G4double energy) const;
91 
92  // for stable isotopes life time is -1
93  inline G4double LifeTime(size_t i) const;
94 
95  inline G4int SpinTwo(size_t i) const;
96 
97  inline G4int Parity(size_t i) const;
98 
99  inline G4int FloatingLevel(size_t i) const;
100 
101  const G4String& FloatingType(size_t i) const;
102 
103  void StreamInfo(std::ostream& os) 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<G4double> fLevelEnergy;
117  std::vector<G4int> fSpin;
118  std::vector<const G4NucLevel*> fLevels;
119 
120  size_t nTransitions;
121 
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 G4double 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  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 
163 inline const G4NucLevel*
165 {
166  return GetLevel(NearestLevelIndex(energy, index));
167 }
168 
169 inline G4double
171 {
172  return LevelEnergy(NearestLevelIndex(energy, index));
173 }
174 
176 {
177  return LevelEnergy(NearestLowEdgeLevelIndex(energy));
178 }
179 
180 inline G4double G4LevelManager::LifeTime(size_t i) const
181 {
182 #ifdef G4VERBOSE
183  if(i > nTransitions) { PrintError(i, "LifeTime"); }
184 #endif
185  return (fLevels[i]) ? fLevels[i]->GetTimeGamma() : 0.0;
186 }
187 
188 inline G4int G4LevelManager::SpinTwo(size_t i) const
189 {
190 #ifdef G4VERBOSE
191  if(i > nTransitions) { PrintError(i, "SpinTwo"); }
192 #endif
193  return std::abs(fSpin[i]%100000 - 100);
194 }
195 
196 inline G4int G4LevelManager::Parity(size_t i) const
197 {
198 #ifdef G4VERBOSE
199  if(i > nTransitions) { PrintError(i, "SpinTwo"); }
200 #endif
201  return (fSpin[i]%100000 - 100 > 0) ? 1 : -1;
202 }
203 
204 inline G4int G4LevelManager::FloatingLevel(size_t i) const
205 {
206 #ifdef G4VERBOSE
207  if(i > nTransitions) { PrintError(i, "Floating"); }
208 #endif
209  return fSpin[i]/100000;
210 }
211 
212 #endif
void StreamInfo(std::ostream &os) const
const G4NucLevel * NearestLevel(G4double energy, size_t index=0) const
G4double MaxLevelEnergy() const
size_t NearestLowEdgeLevelIndex(G4double energy) const
G4int Parity(size_t i) const
const G4NucLevel * GetLevel(size_t i) const
G4bool operator==(const G4LevelManager &right) const =delete
std::vector< G4double > fLevelEnergy
G4int FloatingLevel(size_t i) const
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4double NearestLevelEnergy(G4double energy, size_t index=0) const
static G4String fFloatingLevels[nfloting]
double energy
Definition: plottest35.C:25
const G4LevelManager & operator=(const G4LevelManager &right)=delete
G4double LifeTime(size_t i) const
const G4String & FloatingType(size_t i) const
G4bool operator!=(const G4LevelManager &right) const =delete
static const G4int nfloting
G4double NearestLowEdgeLevelEnergy(G4double energy) const
int G4int
Definition: G4Types.hh:78
G4int SpinTwo(size_t i) const
size_t NumberOfTransitions() const
G4LevelManager(size_t ntrans, const std::vector< G4double > &energies, const std::vector< G4int > &spin, const std::vector< const G4NucLevel * > &levels)
G4double LevelEnergy(size_t i) const
std::vector< G4int > fSpin
size_t NearestLevelIndex(G4double energy, size_t index=0) const
std::vector< const G4NucLevel * > fLevels