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: G4DiscreteGammaTransition.cc,v 1.12 2010/11/17 19:17:17 vnivanch Exp $ |
---|
27 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
28 | // |
---|
29 | // ------------------------------------------------------------------- |
---|
30 | // GEANT 4 class file |
---|
31 | // |
---|
32 | // CERN, Geneva, Switzerland |
---|
33 | // |
---|
34 | // File name: G4DiscreteGammaTransition |
---|
35 | // |
---|
36 | // Author: Maria Grazia Pia (pia@genova.infn.it) |
---|
37 | // |
---|
38 | // Creation date: 23 October 1998 |
---|
39 | // |
---|
40 | // Modifications: |
---|
41 | // 15 April 1999, Alessandro Brunengo (Alessandro.Brunengo@ge.infn.it) |
---|
42 | // Added creation time evaluation for products of evaporation |
---|
43 | // |
---|
44 | // 21 Nov. 2001, Fan Lei (flei@space.qinetiq.com) |
---|
45 | // i) added G4int _nucleusZ initialise it through the constructor |
---|
46 | // ii) modified SelectGamma() to allow the generation of conversion electrons |
---|
47 | // iii) added #include G4AtomicShells.hh |
---|
48 | // |
---|
49 | // 09 Sep. 2002, Fan Lei (flei@space.qinetiq.com) |
---|
50 | // Added renormalization to determine whether transition leads to |
---|
51 | // electron or gamma in SelectGamma() |
---|
52 | // |
---|
53 | // 19 April 2010, J. M. Quesada. |
---|
54 | // Corrections added for taking into account mismatch between tabulated |
---|
55 | // gamma energies and level energy differences (fake photons eliminated) |
---|
56 | // |
---|
57 | // 9 May 2010, V.Ivanchenko |
---|
58 | // Removed unphysical corretions of gamma energy; fixed default particle |
---|
59 | // as gamma; do not subtract bounding energy in case of electron emmision |
---|
60 | // |
---|
61 | // ------------------------------------------------------------------- |
---|
62 | |
---|
63 | #include "G4DiscreteGammaTransition.hh" |
---|
64 | #include "Randomize.hh" |
---|
65 | #include "G4RandGeneralTmp.hh" |
---|
66 | #include "G4AtomicShells.hh" |
---|
67 | #include "G4NuclearLevel.hh" |
---|
68 | //JMQ: |
---|
69 | #include "G4NuclearLevelStore.hh" |
---|
70 | #include "G4Pow.hh" |
---|
71 | |
---|
72 | G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level): |
---|
73 | _gammaEnergy(0.), _level(level), _excitation(0.), _gammaCreationTime(0.) |
---|
74 | { |
---|
75 | _levelManager = 0; |
---|
76 | } |
---|
77 | |
---|
78 | //JMQ: now A is also needed in the constructor |
---|
79 | //G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level, G4int Z): |
---|
80 | G4DiscreteGammaTransition::G4DiscreteGammaTransition(const G4NuclearLevel& level, G4int Z, G4int A): |
---|
81 | _nucleusZ(Z), _orbitE(-1), _bondE(0.), _aGamma(true), _icm(false), _gammaEnergy(0.), |
---|
82 | _level(level), _excitation(0.), _gammaCreationTime(0.),_A(A),_Z(Z) |
---|
83 | { |
---|
84 | _levelManager = 0; |
---|
85 | _verbose = 0; |
---|
86 | //JMQ: added tolerence in the mismatch |
---|
87 | _tolerance = CLHEP::keV; |
---|
88 | } |
---|
89 | |
---|
90 | |
---|
91 | G4DiscreteGammaTransition::~G4DiscreteGammaTransition() |
---|
92 | { } |
---|
93 | |
---|
94 | |
---|
95 | void G4DiscreteGammaTransition::SelectGamma() |
---|
96 | { |
---|
97 | // default gamma |
---|
98 | _aGamma = true; |
---|
99 | _gammaEnergy = 0.; |
---|
100 | |
---|
101 | G4int nGammas = _level.NumberOfGammas(); |
---|
102 | if (nGammas > 0) |
---|
103 | { |
---|
104 | G4double random = G4UniformRand(); |
---|
105 | |
---|
106 | G4int iGamma; |
---|
107 | for(iGamma=0; iGamma<nGammas; ++iGamma) |
---|
108 | { |
---|
109 | if(random <= (_level.GammaCumulativeProbabilities())[iGamma]) |
---|
110 | { break; } |
---|
111 | } |
---|
112 | |
---|
113 | // Small correction due to the fact that there are mismatches between |
---|
114 | // nominal level energies and emitted gamma energies |
---|
115 | |
---|
116 | // 09.05.2010 VI : it is an error ? |
---|
117 | G4double eCorrection = _level.Energy() - _excitation; |
---|
118 | _gammaEnergy = (_level.GammaEnergies())[iGamma] - eCorrection; |
---|
119 | |
---|
120 | //JMQ: |
---|
121 | //1)If chosen gamma energy is close enough to excitation energy, the later |
---|
122 | // is used instead for gamma dacey to gs (it guarantees energy conservation) |
---|
123 | //2)For energy conservation, level energy differences instead of tabulated |
---|
124 | // gamma energies must be used (origin of final fake photons) |
---|
125 | |
---|
126 | if(_excitation - _gammaEnergy < _tolerance) |
---|
127 | { |
---|
128 | _gammaEnergy =_excitation; |
---|
129 | } |
---|
130 | else |
---|
131 | { |
---|
132 | _levelManager = G4NuclearLevelStore::GetInstance()->GetManager(_Z,_A); |
---|
133 | _gammaEnergy = _excitation - |
---|
134 | _levelManager->NearestLevel(_excitation - _gammaEnergy)->Energy(); |
---|
135 | } |
---|
136 | |
---|
137 | // Warning: the following check is needed to avoid loops: |
---|
138 | // Due essentially to missing nuclear levels in data files, it is |
---|
139 | // possible that _gammaEnergy is so low as the nucleus doesn't change |
---|
140 | // its level after the transition. |
---|
141 | // When such case is found, force the full deexcitation of the nucleus. |
---|
142 | // |
---|
143 | // NOTE: you should force the transition to the next lower level, |
---|
144 | // but this change needs a more complex revision of actual design. |
---|
145 | // I leave this for a later revision. |
---|
146 | |
---|
147 | if (_gammaEnergy < _level.Energy()*10.e-5) _gammaEnergy = _excitation; |
---|
148 | |
---|
149 | //G4cout << "G4DiscreteGammaTransition::SelectGamma: " << _gammaEnergy |
---|
150 | // << " _icm: " << _icm << G4endl; |
---|
151 | |
---|
152 | // now decide whether Internal Coversion electron should be emitted instead |
---|
153 | if (_icm) { |
---|
154 | random = G4UniformRand() ; |
---|
155 | if ( random <= (_level.TotalConvertionProbabilities())[iGamma] |
---|
156 | *(_level.GammaWeights())[iGamma] |
---|
157 | /((_level.TotalConvertionProbabilities())[iGamma]*(_level.GammaWeights())[iGamma] |
---|
158 | +(_level.GammaWeights())[iGamma])) |
---|
159 | { |
---|
160 | G4int iShell = 9; |
---|
161 | random = G4UniformRand() ; |
---|
162 | if ( random <= (_level.KConvertionProbabilities())[iGamma]) |
---|
163 | { iShell = 0;} |
---|
164 | else if ( random <= (_level.L1ConvertionProbabilities())[iGamma]) |
---|
165 | { iShell = 1;} |
---|
166 | else if ( random <= (_level.L2ConvertionProbabilities())[iGamma]) |
---|
167 | { iShell = 2;} |
---|
168 | else if ( random <= (_level.L3ConvertionProbabilities())[iGamma]) |
---|
169 | { iShell = 3;} |
---|
170 | else if ( random <= (_level.M1ConvertionProbabilities())[iGamma]) |
---|
171 | { iShell = 4;} |
---|
172 | else if ( random <= (_level.M2ConvertionProbabilities())[iGamma]) |
---|
173 | { iShell = 5;} |
---|
174 | else if ( random <= (_level.M3ConvertionProbabilities())[iGamma]) |
---|
175 | { iShell = 6;} |
---|
176 | else if ( random <= (_level.M4ConvertionProbabilities())[iGamma]) |
---|
177 | { iShell = 7;} |
---|
178 | else if ( random <= (_level.M5ConvertionProbabilities())[iGamma]) |
---|
179 | { iShell = 8;} |
---|
180 | // the following is needed to match the ishell to that used in G4AtomicShells |
---|
181 | if ( iShell == 9) { |
---|
182 | if ( (_nucleusZ < 28) && (_nucleusZ > 20)) { |
---|
183 | iShell--; |
---|
184 | } else if ( _nucleusZ == 20 || _nucleusZ == 19 ) { |
---|
185 | iShell = iShell -2; |
---|
186 | } |
---|
187 | } |
---|
188 | _bondE = G4AtomicShells::GetBindingEnergy(_nucleusZ, iShell); |
---|
189 | if (_verbose > 0) { |
---|
190 | G4cout << "G4DiscreteGammaTransition: _nucleusZ = " <<_nucleusZ |
---|
191 | << " , iShell = " << iShell |
---|
192 | << " , Shell binding energy = " << _bondE/keV |
---|
193 | << " keV " << G4endl; |
---|
194 | } |
---|
195 | |
---|
196 | // 09.05.2010 VI : it is an error - cannot subtract bond energy from |
---|
197 | // transition energy here |
---|
198 | //_gammaEnergy = _gammaEnergy - _bondE; |
---|
199 | //G4cout << "_gammaEnergy = " << _gammaEnergy << G4endl; |
---|
200 | |
---|
201 | _orbitE = iShell; |
---|
202 | _aGamma = false ; // emitted is not a gamma now |
---|
203 | } |
---|
204 | } |
---|
205 | |
---|
206 | G4double tau = _level.HalfLife() / G4Pow::GetInstance()->logZ(2); |
---|
207 | |
---|
208 | //09.05.2010 VI rewrite samling of decay time |
---|
209 | // assuming ordinary exponential low |
---|
210 | _gammaCreationTime = 0.; |
---|
211 | if(tau > 0.0) { _gammaCreationTime = -tau*std::log(G4UniformRand()); } |
---|
212 | |
---|
213 | //G4double tMin = 0; |
---|
214 | //G4double tMax = 10.0 * tau; |
---|
215 | // Original code, not very efficent |
---|
216 | // G4int nBins = 200; |
---|
217 | //G4double sampleArray[200]; |
---|
218 | |
---|
219 | // for(G4int i = 0;i<nBins;i++) |
---|
220 | //{ |
---|
221 | // G4double t = tMin + ((tMax-tMin)/nBins)*i; |
---|
222 | // sampleArray[i] = (std::exp(-t/tau))/tau; |
---|
223 | // } |
---|
224 | |
---|
225 | // G4RandGeneralTmp randGeneral(sampleArray, nBins); |
---|
226 | //G4double random = randGeneral.shoot(); |
---|
227 | |
---|
228 | //_gammaCreationTime = tMin + (tMax - tMin) * random; |
---|
229 | |
---|
230 | // new code by Fan Lei |
---|
231 | // |
---|
232 | /* |
---|
233 | if (tau != 0 ) |
---|
234 | { |
---|
235 | random = G4UniformRand() ; |
---|
236 | _gammaCreationTime = -(std::log(random*(std::exp(-tMax/tau) - std::exp(-tMin/tau)) + |
---|
237 | std::exp(-tMin/tau))); |
---|
238 | // if(_verbose > 10) |
---|
239 | // G4cout << "*---*---* G4DiscreteTransition: _gammaCreationTime = " |
---|
240 | // << _gammaCreationTime/second << G4endl; |
---|
241 | } else { _gammaCreationTime=0.; } |
---|
242 | */ |
---|
243 | } |
---|
244 | return; |
---|
245 | } |
---|
246 | |
---|
247 | G4double G4DiscreteGammaTransition::GetGammaEnergy() |
---|
248 | { |
---|
249 | return _gammaEnergy; |
---|
250 | } |
---|
251 | |
---|
252 | G4double G4DiscreteGammaTransition::GetGammaCreationTime() |
---|
253 | { |
---|
254 | return _gammaCreationTime; |
---|
255 | } |
---|
256 | |
---|
257 | void G4DiscreteGammaTransition::SetEnergyFrom(G4double energy) |
---|
258 | { |
---|
259 | _excitation = energy; |
---|
260 | } |
---|
261 | |
---|
262 | |
---|
263 | |
---|
264 | |
---|
265 | |
---|
266 | |
---|