Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4NucLevel.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: G4NucLevel.hh 88516 2015-02-25 11:00:16Z vnivanch $
27 //
28 // -------------------------------------------------------------------
29 //
30 // GEANT4 header file
31 //
32 // File name: G4NucLevel
33 //
34 // Author: V.Ivanchenko
35 //
36 // Creation date: 4 January 2012
37 //
38 // Modifications:
39 //
40 // -------------------------------------------------------------------
41 //
42 // Container class keeping information about gamma transition
43 // and for a given nuclear level
44 //
45 
46 #ifndef G4NUCLEVEL_HH
47 #define G4NUCLEVEL_HH 1
48 
49 #include "globals.hh"
50 #include <vector>
51 #include <iostream>
52 
53 class G4NucLevel
54 {
55 public:
56 
57  explicit G4NucLevel(size_t ntrans, G4double tgamma,
58  const std::vector<G4int>& vTrans,
59  const std::vector<G4float>& wLevelGamma,
60  const std::vector<G4float>& wGamma,
61  const std::vector<G4float>& vRatio,
62  const std::vector<const std::vector<G4float>*>& wShell);
63 
64  ~G4NucLevel();
65 
66  inline size_t NumberOfTransitions() const;
67 
68  inline size_t FinalExcitationIndex(size_t idx) const;
69 
70  inline G4int TransitionType(size_t idx) const;
71 
72  inline G4double GetTimeGamma() const;
73 
74  inline G4float GammaProbability(size_t idx) const;
75 
76  inline G4float GammaCumProbability(size_t idx) const;
77 
78  inline G4float MultipolarityRatio(size_t idx) const;
79 
80  inline size_t SampleGammaTransition(G4double rndm) const;
81 
82  inline G4int SampleShell(size_t idx, G4double rndm) const;
83 
84  inline const std::vector<G4float>* ShellProbabilty(size_t idx) const;
85 
86  void StreamInfo(std::ostream& os) const;
87 
88 private:
89 
90 #ifdef G4VERBOSE
91  void PrintError(size_t idx, const G4String&) const;
92 #endif
93  G4NucLevel(const G4NucLevel &right) = delete;
94  G4bool operator==(const G4NucLevel &right) const = delete;
95  G4bool operator!=(const G4NucLevel &right) const = delete;
96  G4bool operator<(const G4NucLevel &right) const = delete;
97  const G4NucLevel& operator=(const G4NucLevel &right) = delete;
98 
99  size_t length;
101 
102  std::vector<G4int> fTrans;
103  std::vector<G4float> fGammaCumProbability;
104  std::vector<G4float> fGammaProbability;
105  std::vector<G4float> fMpRatio;
106  std::vector<const std::vector<G4float>*> fShellProbability;
107 };
108 
109 inline size_t G4NucLevel::NumberOfTransitions() const
110 {
111  return length;
112 }
113 
114 inline size_t G4NucLevel::FinalExcitationIndex(size_t idx) const
115 {
116 #ifdef G4VERBOSE
117  if(idx >= length) { PrintError(idx, "FinalExcitationEnergy"); }
118 #endif
119  return (size_t)(fTrans[idx]/10000);
120 }
121 
122 inline G4int G4NucLevel::TransitionType(size_t idx) const
123 {
124 #ifdef G4VERBOSE
125  if(idx >= length) { PrintError(idx, "TransitionType"); }
126 #endif
127  return fTrans[idx]%10000;
128 }
129 
131 {
132  return fTimeGamma;
133 }
134 
135 inline G4float G4NucLevel::GammaProbability(size_t idx) const
136 {
137 #ifdef G4VERBOSE
138  if(idx >= length) { PrintError(idx, "GammaProbability"); }
139 #endif
140  return fGammaProbability[idx];
141 }
142 
143 inline G4float G4NucLevel::GammaCumProbability(size_t idx) const
144 {
145 #ifdef G4VERBOSE
146  if(idx >= length) { PrintError(idx, "GammaCumProbability"); }
147 #endif
148  return fGammaCumProbability[idx];
149 }
150 
151 inline G4float G4NucLevel::MultipolarityRatio(size_t idx) const
152 {
153 #ifdef G4VERBOSE
154  if(idx >= length) { PrintError(idx, "GammaProbability"); }
155 #endif
156  return fMpRatio[idx];
157 }
158 
160 {
161  G4float x = (G4float)rndm;
162  size_t idx = 0;
163  for(; idx<length; ++idx) {
164  if(x <= fGammaCumProbability[idx]) { break; }
165  }
166  return idx;
167 }
168 
169 inline G4int G4NucLevel::SampleShell(size_t idx, G4double rndm) const
170 {
171 #ifdef G4VERBOSE
172  if(idx >= length) { PrintError(idx, "SampleShell"); }
173 #endif
174  const std::vector<G4float>* prob = fShellProbability[idx];
175  G4int i(-1);
176  if(prob) {
177  G4int nn = prob->size();
178  G4float x = (G4float)rndm;
179  for(i=0; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
180  }
181  return i;
182 }
183 
184 inline const std::vector<G4float>*
186 {
187 #ifdef G4VERBOSE
188  if(idx >= length) { PrintError(idx, "ShellProbability"); }
189 #endif
190  return fShellProbability[idx];
191 }
192 
193 #endif
194 
195 
196 
197 
198 
Float_t x
Definition: compare.C:6
size_t length
Definition: G4NucLevel.hh:99
std::vector< G4int > fTrans
Definition: G4NucLevel.hh:102
G4int SampleShell(size_t idx, G4double rndm) const
Definition: G4NucLevel.hh:169
std::vector< G4float > fGammaCumProbability
Definition: G4NucLevel.hh:103
size_t SampleGammaTransition(G4double rndm) const
Definition: G4NucLevel.hh:159
G4double fTimeGamma
Definition: G4NucLevel.hh:100
float G4float
Definition: G4Types.hh:77
std::vector< const std::vector< G4float > * > fShellProbability
Definition: G4NucLevel.hh:106
G4float MultipolarityRatio(size_t idx) const
Definition: G4NucLevel.hh:151
G4NucLevel(size_t ntrans, G4double tgamma, const std::vector< G4int > &vTrans, const std::vector< G4float > &wLevelGamma, const std::vector< G4float > &wGamma, const std::vector< G4float > &vRatio, const std::vector< const std::vector< G4float > * > &wShell)
Definition: G4NucLevel.cc:47
const std::vector< G4float > * ShellProbabilty(size_t idx) const
Definition: G4NucLevel.hh:185
G4float GammaCumProbability(size_t idx) const
Definition: G4NucLevel.hh:143
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
G4bool operator!=(const G4NucLevel &right) const =delete
size_t FinalExcitationIndex(size_t idx) const
Definition: G4NucLevel.hh:114
G4float GammaProbability(size_t idx) const
Definition: G4NucLevel.hh:135
G4bool operator<(const G4NucLevel &right) const =delete
std::vector< G4float > fGammaProbability
Definition: G4NucLevel.hh:104
void StreamInfo(std::ostream &os) const
Definition: G4NucLevel.cc:97
G4double GetTimeGamma() const
Definition: G4NucLevel.hh:130
G4bool operator==(const G4NucLevel &right) const =delete
int G4int
Definition: G4Types.hh:78
std::vector< G4float > fMpRatio
Definition: G4NucLevel.hh:105
const G4NucLevel & operator=(const G4NucLevel &right)=delete
size_t NumberOfTransitions() const
Definition: G4NucLevel.hh:109
G4int TransitionType(size_t idx) const
Definition: G4NucLevel.hh:122