Geant4  10.03
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,
57  const std::vector<size_t>& idxTrans,
58  const std::vector<G4int>& vTrans,
59  const std::vector<G4float>& wLevelGamma,
60  const std::vector<G4float>& wLevelGammaE,
61  const std::vector<G4float>& wGamma,
62  const std::vector<G4float>& vRatio,
63  const std::vector<const std::vector<G4float>*>& wShell);
64 
65  ~G4NucLevel();
66 
67  inline size_t NumberOfTransitions() const;
68 
69  inline G4bool IsXLevel() const;
70 
71  inline size_t FinalExcitationIndex(size_t idx) const;
72 
73  inline G4int TransitionType(size_t idx) const;
74 
75  inline G4float MixingRatio(size_t idx) const;
76 
77  inline G4float GammaProbability(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 size_t SampleGammaETransition(G4double rndm) const;
84 
85  inline size_t SampleShell(size_t idx, G4double rndm) 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  std::vector<size_t> fFinalIndex;
99  std::vector<G4int> fTrans;
100  std::vector<G4float> fGammaCumProbability;
101  std::vector<G4float> fGammaECumProbability;
102  std::vector<G4float> fGammaProbability;
103  std::vector<G4float> fMpRatio;
104  std::vector<const std::vector<G4float>*> fShellProbability;
105  size_t length;
106 };
107 
108 inline size_t G4NucLevel::NumberOfTransitions() const
109 {
110  return length;
111 }
112 
114 {
115  return (1 == fTrans[0]);
116 }
117 
118 inline size_t G4NucLevel::FinalExcitationIndex(size_t idx) const
119 {
120 #ifdef G4VERBOSE
121  if(idx >= length) { PrintError(idx, "FinalExcitationEnergy"); }
122 #endif
123  return fFinalIndex[idx];
124 }
125 
126 inline G4int G4NucLevel::TransitionType(size_t idx) const
127 {
128 #ifdef G4VERBOSE
129  if(idx >= length) { PrintError(idx, "TransitionType"); }
130 #endif
131  return fTrans[idx];
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::MultipolarityRatio(size_t idx) const
151 {
152 #ifdef G4VERBOSE
153  if(idx >= length) { PrintError(idx, "GammaProbability"); }
154 #endif
155  return fMpRatio[idx];
156 }
157 
159 {
160  G4float x = (G4float)rndm;
161  size_t idx = 0;
162  for(; idx<length; ++idx) {
163  if(x <= fGammaCumProbability[idx]) { break; }
164  }
165  return idx;
166 }
167 
169 {
170  G4float x = (G4float)rndm;
171  size_t idx = 0;
172  for(; idx<length; ++idx) {
173  if(x <= fGammaECumProbability[idx]) { break; }
174  }
175  return idx;
176 }
177 
178 inline size_t G4NucLevel::SampleShell(size_t idx, G4double rndm) const
179 {
180 #ifdef G4VERBOSE
181  if(idx >= length) { PrintError(idx, "SampleShell"); }
182 #endif
183  const std::vector<G4float>* prob = fShellProbability[idx];
184  size_t i = 0;
185  if(prob) {
186  size_t nn = prob->size();
187  G4float x = (G4float)rndm;
188  for(; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
189  }
190  return i;
191 }
192 
193 #endif
194 
195 
196 
197 
198 
G4float GammaProbability(size_t idx) const
Definition: G4NucLevel.hh:142
std::vector< size_t > fFinalIndex
Definition: G4NucLevel.hh:98
G4NucLevel(size_t ntrans, const std::vector< size_t > &idxTrans, const std::vector< G4int > &vTrans, const std::vector< G4float > &wLevelGamma, const std::vector< G4float > &wLevelGammaE, const std::vector< G4float > &wGamma, const std::vector< G4float > &vRatio, const std::vector< const std::vector< G4float > * > &wShell)
Definition: G4NucLevel.cc:46
G4float MultipolarityRatio(size_t idx) const
Definition: G4NucLevel.hh:150
size_t length
Definition: G4NucLevel.hh:105
float G4float
Definition: G4Types.hh:77
std::vector< G4int > fTrans
Definition: G4NucLevel.hh:99
G4bool operator!=(const G4NucLevel &right) const =delete
int G4int
Definition: G4Types.hh:78
std::vector< const std::vector< G4float > * > fShellProbability
Definition: G4NucLevel.hh:104
G4float MixingRatio(size_t idx) const
Definition: G4NucLevel.hh:134
std::vector< G4float > fGammaProbability
Definition: G4NucLevel.hh:102
const G4NucLevel & operator=(const G4NucLevel &right)=delete
std::vector< G4float > fGammaCumProbability
Definition: G4NucLevel.hh:100
std::vector< G4float > fMpRatio
Definition: G4NucLevel.hh:103
G4bool IsXLevel() const
Definition: G4NucLevel.hh:113
G4bool operator<(const G4NucLevel &right) const =delete
bool G4bool
Definition: G4Types.hh:79
size_t SampleGammaTransition(G4double rndm) const
Definition: G4NucLevel.hh:158
size_t NumberOfTransitions() const
Definition: G4NucLevel.hh:108
G4int TransitionType(size_t idx) const
Definition: G4NucLevel.hh:126
G4bool operator==(const G4NucLevel &right) const =delete
size_t SampleShell(size_t idx, G4double rndm) const
Definition: G4NucLevel.hh:178
std::vector< G4float > fGammaECumProbability
Definition: G4NucLevel.hh:101
size_t SampleGammaETransition(G4double rndm) const
Definition: G4NucLevel.hh:168
double G4double
Definition: G4Types.hh:76
size_t FinalExcitationIndex(size_t idx) const
Definition: G4NucLevel.hh:118