Geant4  10.02.p02
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 <assert.h>
51 #include <vector>
52 
53 class G4NucLevel
54 {
55 public:
56 
57  G4NucLevel(const std::vector<G4float>& eTransition,
58  const std::vector<G4float>& wLevelGamma,
59  const std::vector<G4float>& wLevelGammaE,
60  const std::vector<G4float>& wGamma,
61  const std::vector<G4int>& vTrans,
62  const std::vector<const std::vector<G4float>*>& wShell);
63 
64  ~G4NucLevel();
65 
66  inline size_t NumberOfTransitions() const;
67 
68  inline G4bool IsXLevel() const;
69 
70  inline G4float FinalExcitationEnergy(size_t idx) const;
71 
72  inline G4float GammaProbability(size_t idx) const;
73 
74  inline G4int TransitionType(size_t idx) const;
75 
76  inline size_t SampleGammaTransition(G4double rndm) const;
77 
78  inline size_t SampleGammaETransition(G4double rndm) const;
79 
80  inline size_t SampleShell(size_t idx, G4double rndm) const;
81 
82 private:
83 
84  G4NucLevel(const G4NucLevel &right);
85  G4bool operator==(const G4NucLevel &right) const;
86  G4bool operator!=(const G4NucLevel &right) const;
87  G4bool operator<(const G4NucLevel &right) const;
88  const G4NucLevel& operator=(const G4NucLevel &right);
89 
90  std::vector<G4float> fFinalEnergy;
91  std::vector<G4float> fGammaCumProbability;
92  std::vector<G4float> fGammaECumProbability;
93  std::vector<G4float> fGammaProbability;
94  std::vector<G4int> fTrans;
95  const std::vector<const std::vector<G4float>*> fShellProbability;
96  size_t length;
97 };
98 
99 inline size_t G4NucLevel::NumberOfTransitions() const
100 {
101  return length;
102 }
103 
105 {
106  return (1 == fTrans[0]);
107 }
108 
110 {
111  assert(idx < length);
112  return fFinalEnergy[idx];
113 }
114 
115 inline G4float G4NucLevel::GammaProbability(size_t idx) const
116 {
117  assert(idx < length);
118  return fGammaProbability[idx];
119 }
120 
121 inline G4int G4NucLevel::TransitionType(size_t idx) const
122 {
123  assert(idx < length);
124  return fTrans[idx];
125 }
126 
128 {
129  G4float x = (G4float)rndm;
130  size_t idx = 0;
131  for(; idx<length; ++idx) {
132  if(x <= fGammaCumProbability[idx]) { break; }
133  }
134  return idx;
135 }
136 
138 {
139  G4float x = (G4float)rndm;
140  size_t idx = 0;
141  for(; idx<length; ++idx) {
142  if(x <= fGammaECumProbability[idx]) { break; }
143  }
144  return idx;
145 }
146 
147 inline size_t G4NucLevel::SampleShell(size_t idx, G4double rndm) const
148 {
149  assert(idx < length);
150  const std::vector<G4float>* prob = fShellProbability[idx];
151  size_t i = 0;
152  if(prob) {
153  size_t nn = prob->size();
154  G4float x = (G4float)rndm;
155  for(; i<nn; ++i) { if(x <= (*prob)[i]) { break; } }
156  }
157  return i;
158 }
159 
160 #endif
161 
162 
163 
164 
165 
G4float GammaProbability(size_t idx) const
Definition: G4NucLevel.hh:115
G4bool operator<(const G4NucLevel &right) const
size_t length
Definition: G4NucLevel.hh:96
float G4float
Definition: G4Types.hh:77
std::vector< G4int > fTrans
Definition: G4NucLevel.hh:94
G4bool operator==(const G4NucLevel &right) const
int G4int
Definition: G4Types.hh:78
std::vector< G4float > fGammaProbability
Definition: G4NucLevel.hh:93
std::vector< G4float > fGammaCumProbability
Definition: G4NucLevel.hh:91
G4float FinalExcitationEnergy(size_t idx) const
Definition: G4NucLevel.hh:109
G4bool IsXLevel() const
Definition: G4NucLevel.hh:104
bool G4bool
Definition: G4Types.hh:79
const std::vector< const std::vector< G4float > * > fShellProbability
Definition: G4NucLevel.hh:95
size_t SampleGammaTransition(G4double rndm) const
Definition: G4NucLevel.hh:127
std::vector< G4float > fFinalEnergy
Definition: G4NucLevel.hh:90
const G4NucLevel & operator=(const G4NucLevel &right)
size_t NumberOfTransitions() const
Definition: G4NucLevel.hh:99
G4int TransitionType(size_t idx) const
Definition: G4NucLevel.hh:121
const G4double x[NPOINTSGL]
G4bool operator!=(const G4NucLevel &right) const
size_t SampleShell(size_t idx, G4double rndm) const
Definition: G4NucLevel.hh:147
std::vector< G4float > fGammaECumProbability
Definition: G4NucLevel.hh:92
size_t SampleGammaETransition(G4double rndm) const
Definition: G4NucLevel.hh:137
double G4double
Definition: G4Types.hh:76
G4NucLevel(const std::vector< G4float > &eTransition, const std::vector< G4float > &wLevelGamma, const std::vector< G4float > &wLevelGammaE, const std::vector< G4float > &wGamma, const std::vector< G4int > &vTrans, const std::vector< const std::vector< G4float > * > &wShell)
Definition: G4NucLevel.cc:45