ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4NucLevel.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file 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 //
27 // -------------------------------------------------------------------
28 //
29 // GEANT4 header file
30 //
31 // File name: G4NucLevel
32 //
33 // Author: V.Ivanchenko
34 //
35 // Creation date: 4 January 2012
36 //
37 // Modifications:
38 //
39 // -------------------------------------------------------------------
40 //
41 // Container class keeping information about gamma transition
42 // and for a given nuclear level
43 //
44 
45 #ifndef G4NUCLEVEL_HH
46 #define G4NUCLEVEL_HH 1
47 
48 #include "globals.hh"
49 #include <vector>
50 #include <iostream>
51 
52 class G4NucLevel
53 {
54 public:
55 
56  explicit G4NucLevel(size_t ntrans, G4double 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 G4double GetTimeGamma() const;
72 
73  inline G4float GammaProbability(size_t idx) const;
74 
75  inline G4float GammaCumProbability(size_t idx) const;
76 
77  inline G4float MultipolarityRatio(size_t idx) const;
78 
79  inline size_t SampleGammaTransition(G4double rndm) const;
80 
81  inline G4int SampleShell(size_t idx, G4double rndm) const;
82 
83  inline const std::vector<G4float>* ShellProbabilty(size_t idx) const;
84 
85  void StreamInfo(std::ostream& os) 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;
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, "FinalExcitationIndex(idx)"); }
117 #endif
118  return (size_t)(fTrans[idx]/10000);
119 }
120 
122 {
123 #ifdef G4VERBOSE
124  if(idx >= length) { PrintError(idx, "TransitionType(idx)"); }
125 #endif
126  return fTrans[idx]%10000;
127 }
128 
130 {
131  return fTimeGamma;
132 }
133 
135 {
136 #ifdef G4VERBOSE
137  if(idx >= length) { PrintError(idx, "GammaProbability(idx)"); }
138 #endif
139  return fGammaProbability[idx];
140 }
141 
143 {
144 #ifdef G4VERBOSE
145  if(idx >= length) { PrintError(idx, "GammaCumProbability(idx)"); }
146 #endif
147  return fGammaCumProbability[idx];
148 }
149 
151 {
152 #ifdef G4VERBOSE
153  if(idx >= length) { PrintError(idx, "MultipolarityRatio(idx)"); }
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 
168 inline G4int G4NucLevel::SampleShell(size_t idx, G4double rndm) const
169 {
170 #ifdef G4VERBOSE
171  if(idx >= length) { PrintError(idx, "SampleShell(idx,rndm)"); }
172 #endif
173  const std::vector<G4float>* prob = fShellProbability[idx];
174  G4int i(-1);
175  if(prob) {
176  G4int nn = prob->size();
177  G4float x = (G4float)rndm;
178  for(i=0; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
179  }
180  return i;
181 }
182 
183 inline const std::vector<G4float>*
185 {
186 #ifdef G4VERBOSE
187  if(idx >= length) { PrintError(idx, "ShellProbability(idx)"); }
188 #endif
189  return fShellProbability[idx];
190 }
191 
192 #endif
193 
194 
195 
196 
197