Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NucLevel.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: 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 
52 class G4NucLevel
53 {
54 public:
55 
56  explicit G4NucLevel(size_t ntrans, G4float tgamma,
57  const std::vector<G4int>& vTrans,
58  const std::vector<G4float>& wLevelGamma,
59  const std::vector<G4float>& wGamma,
60  const std::vector<G4float>& vRatio,
61  const std::vector<const std::vector<G4float>*>& wShell);
62 
63  ~G4NucLevel();
64 
65  inline size_t NumberOfTransitions() const;
66 
67  inline size_t FinalExcitationIndex(size_t idx) const;
68 
69  inline G4int TransitionType(size_t idx) const;
70 
71  inline G4float GetTimeGamma() const;
72 
73  inline G4float MixingRatio(size_t idx) const;
74 
75  inline G4float GammaProbability(size_t idx) const;
76 
77  inline G4float GammaCumProbability(size_t idx) const;
78 
79  inline G4float MultipolarityRatio(size_t idx) const;
80 
81  inline size_t SampleGammaTransition(G4double rndm) const;
82 
83  inline G4int SampleShell(size_t idx, G4double rndm) const;
84 
85  inline const std::vector<G4float>* ShellProbabilty(size_t idx) const;
86 
87 private:
88 
89 #ifdef G4VERBOSE
90  void PrintError(size_t idx, const G4String&) const;
91 #endif
92  G4NucLevel(const G4NucLevel &right) = delete;
93  G4bool operator==(const G4NucLevel &right) const = delete;
94  G4bool operator!=(const G4NucLevel &right) const = delete;
95  G4bool operator<(const G4NucLevel &right) const = delete;
96  const G4NucLevel& operator=(const G4NucLevel &right) = delete;
97 
98  size_t length;
99  G4float fTimeGamma;
100 
101  std::vector<G4int> fTrans;
102  std::vector<G4float> fGammaCumProbability;
103  std::vector<G4float> fGammaProbability;
104  std::vector<G4float> fMpRatio;
105  std::vector<const std::vector<G4float>*> fShellProbability;
106 };
107 
108 inline size_t G4NucLevel::NumberOfTransitions() const
109 {
110  return length;
111 }
112 
113 inline size_t G4NucLevel::FinalExcitationIndex(size_t idx) const
114 {
115 #ifdef G4VERBOSE
116  if(idx >= length) { PrintError(idx, "FinalExcitationEnergy"); }
117 #endif
118  return (size_t)(fTrans[idx]/10000);
119 }
120 
121 inline G4int G4NucLevel::TransitionType(size_t idx) const
122 {
123 #ifdef G4VERBOSE
124  if(idx >= length) { PrintError(idx, "TransitionType"); }
125 #endif
126  return fTrans[idx]%10000;
127 }
128 
130 {
131  return fTimeGamma;
132 }
133 
134 inline G4float G4NucLevel::MixingRatio(size_t idx) const
135 {
136 #ifdef G4VERBOSE
137  if(idx >= length) { PrintError(idx, "MixingRatio"); }
138 #endif
139  return fMpRatio[idx];
140 }
141 
142 inline G4float G4NucLevel::GammaProbability(size_t idx) const
143 {
144 #ifdef G4VERBOSE
145  if(idx >= length) { PrintError(idx, "GammaProbability"); }
146 #endif
147  return fGammaProbability[idx];
148 }
149 
150 inline G4float G4NucLevel::GammaCumProbability(size_t idx) const
151 {
152 #ifdef G4VERBOSE
153  if(idx >= length) { PrintError(idx, "GammaCumProbability"); }
154 #endif
155  return fGammaCumProbability[idx];
156 }
157 
158 inline G4float G4NucLevel::MultipolarityRatio(size_t idx) const
159 {
160 #ifdef G4VERBOSE
161  if(idx >= length) { PrintError(idx, "GammaProbability"); }
162 #endif
163  return fMpRatio[idx];
164 }
165 
167 {
168  G4float x = (G4float)rndm;
169  size_t idx = 0;
170  for(; idx<length; ++idx) {
171  if(x <= fGammaCumProbability[idx]) { break; }
172  }
173  return idx;
174 }
175 
176 inline G4int G4NucLevel::SampleShell(size_t idx, G4double rndm) const
177 {
178 #ifdef G4VERBOSE
179  if(idx >= length) { PrintError(idx, "SampleShell"); }
180 #endif
181  const std::vector<G4float>* prob = fShellProbability[idx];
182  G4int i(-1);
183  if(prob) {
184  G4int nn = prob->size();
185  G4float x = (G4float)rndm;
186  for(i=0; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
187  }
188  return i;
189 }
190 
191 inline const std::vector<G4float>*
193 {
194 #ifdef G4VERBOSE
195  if(idx >= length) { PrintError(idx, "ShellProbability"); }
196 #endif
197  return fShellProbability[idx];
198 }
199 
200 #endif
201 
202 
203 
204 
205 
G4float GammaProbability(size_t idx) const
Definition: G4NucLevel.hh:142
G4float MultipolarityRatio(size_t idx) const
Definition: G4NucLevel.hh:158
G4float GammaCumProbability(size_t idx) const
Definition: G4NucLevel.hh:150
float G4float
Definition: G4Types.hh:77
tuple x
Definition: test.py:50
int G4int
Definition: G4Types.hh:78
G4float MixingRatio(size_t idx) const
Definition: G4NucLevel.hh:134
G4float GetTimeGamma() const
Definition: G4NucLevel.hh:129
bool G4bool
Definition: G4Types.hh:79
size_t SampleGammaTransition(G4double rndm) const
Definition: G4NucLevel.hh:166
G4NucLevel(size_t ntrans, G4float 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:46
size_t NumberOfTransitions() const
Definition: G4NucLevel.hh:108
G4int TransitionType(size_t idx) const
Definition: G4NucLevel.hh:121
G4int SampleShell(size_t idx, G4double rndm) const
Definition: G4NucLevel.hh:176
const std::vector< G4float > * ShellProbabilty(size_t idx) const
Definition: G4NucLevel.hh:192
double G4double
Definition: G4Types.hh:76
size_t FinalExcitationIndex(size_t idx) const
Definition: G4NucLevel.hh:113