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 | // $Id: G4AtomicTransitionManager.cc,v 1.2 ???? |
---|
28 | // GEANT4 tag $Name: geant4-09-04-ref-00 $ |
---|
29 | // |
---|
30 | // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) |
---|
31 | // Alfonso Mantero (Alfonso.Mantero@ge.infn.it) |
---|
32 | // |
---|
33 | // History: |
---|
34 | // ----------- |
---|
35 | // 16 Sep 2001 E. Guardincerri First Committed to cvs |
---|
36 | // |
---|
37 | // ------------------------------------------------------------------- |
---|
38 | |
---|
39 | #include "G4AtomicTransitionManager.hh" |
---|
40 | |
---|
41 | G4AtomicTransitionManager::G4AtomicTransitionManager(G4int minZ, G4int maxZ, |
---|
42 | G4int limitInfTable,G4int limitSupTable) |
---|
43 | :zMin(minZ), |
---|
44 | zMax(maxZ), |
---|
45 | infTableLimit(limitInfTable), |
---|
46 | supTableLimit(limitSupTable) |
---|
47 | { |
---|
48 | // infTableLimit is initialized to 6 because EADL lacks data for Z<=5 |
---|
49 | G4ShellData* shellManager = new G4ShellData; |
---|
50 | |
---|
51 | // initialization of the data for auger effect |
---|
52 | |
---|
53 | augerData = new G4AugerData; |
---|
54 | |
---|
55 | shellManager->LoadData("/fluor/binding"); |
---|
56 | |
---|
57 | // Fills shellTable with the data from EADL, identities and binding |
---|
58 | // energies of shells |
---|
59 | for (G4int Z = zMin; Z<= zMax; Z++) |
---|
60 | { |
---|
61 | std::vector<G4AtomicShell*> vectorOfShells; |
---|
62 | size_t shellIndex = 0; |
---|
63 | |
---|
64 | size_t numberOfShells=shellManager->NumberOfShells(Z); |
---|
65 | for (shellIndex = 0; shellIndex<numberOfShells; shellIndex++) |
---|
66 | { |
---|
67 | G4int shellId = shellManager->ShellId(Z,shellIndex); |
---|
68 | G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex); |
---|
69 | |
---|
70 | G4AtomicShell * shell = new G4AtomicShell(shellId,bindingEnergy); |
---|
71 | |
---|
72 | vectorOfShells.push_back(shell); |
---|
73 | } |
---|
74 | |
---|
75 | // shellTable.insert(std::make_pair(Z, vectorOfShells)); |
---|
76 | shellTable[Z] = vectorOfShells; |
---|
77 | } |
---|
78 | |
---|
79 | // Fills transitionTable with the data from EADL, identities, transition |
---|
80 | // energies and transition probabilities |
---|
81 | for (G4int Znum= infTableLimit; Znum<=supTableLimit; Znum++) |
---|
82 | { G4FluoData* fluoManager = new G4FluoData; |
---|
83 | std::vector<G4FluoTransition*> vectorOfTransitions; |
---|
84 | fluoManager->LoadData(Znum); |
---|
85 | |
---|
86 | size_t numberOfVacancies = fluoManager-> NumberOfVacancies(); |
---|
87 | |
---|
88 | for (size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies; vacancyIndex++) |
---|
89 | |
---|
90 | { |
---|
91 | std::vector<G4int> vectorOfIds; |
---|
92 | G4DataVector vectorOfEnergies; |
---|
93 | G4DataVector vectorOfProbabilities; |
---|
94 | |
---|
95 | G4int finalShell = fluoManager->VacancyId(vacancyIndex); |
---|
96 | size_t numberOfTransitions = fluoManager->NumberOfTransitions(vacancyIndex); |
---|
97 | for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions; |
---|
98 | origShellIndex++) |
---|
99 | |
---|
100 | { |
---|
101 | |
---|
102 | G4int originatingShellId = fluoManager->StartShellId(origShellIndex,vacancyIndex); |
---|
103 | |
---|
104 | vectorOfIds.push_back(originatingShellId); |
---|
105 | |
---|
106 | G4double transitionEnergy = fluoManager->StartShellEnergy(origShellIndex,vacancyIndex); |
---|
107 | vectorOfEnergies.push_back(transitionEnergy); |
---|
108 | G4double transitionProbability = fluoManager->StartShellProb(origShellIndex,vacancyIndex); |
---|
109 | vectorOfProbabilities.push_back(transitionProbability); |
---|
110 | } |
---|
111 | G4FluoTransition * transition = new G4FluoTransition (finalShell,vectorOfIds, |
---|
112 | vectorOfEnergies,vectorOfProbabilities); |
---|
113 | vectorOfTransitions.push_back(transition); |
---|
114 | } |
---|
115 | // transitionTable.insert(std::make_pair(Znum, vectorOfTransitions)); |
---|
116 | transitionTable[Znum] = vectorOfTransitions; |
---|
117 | |
---|
118 | delete fluoManager; |
---|
119 | } |
---|
120 | delete shellManager; |
---|
121 | } |
---|
122 | |
---|
123 | G4AtomicTransitionManager::~G4AtomicTransitionManager() |
---|
124 | |
---|
125 | { |
---|
126 | |
---|
127 | delete augerData; |
---|
128 | |
---|
129 | std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::iterator pos; |
---|
130 | |
---|
131 | for (pos = shellTable.begin(); pos != shellTable.end(); pos++){ |
---|
132 | |
---|
133 | std::vector< G4AtomicShell*>vec = (*pos).second; |
---|
134 | |
---|
135 | G4int vecSize=vec.size(); |
---|
136 | |
---|
137 | for (G4int i=0; i< vecSize; i++){ |
---|
138 | G4AtomicShell* shell = vec[i]; |
---|
139 | delete shell; |
---|
140 | } |
---|
141 | |
---|
142 | } |
---|
143 | |
---|
144 | std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator ppos; |
---|
145 | |
---|
146 | for (ppos = transitionTable.begin(); ppos != transitionTable.end(); ppos++){ |
---|
147 | |
---|
148 | std::vector<G4FluoTransition*>vec = (*ppos).second; |
---|
149 | |
---|
150 | G4int vecSize=vec.size(); |
---|
151 | |
---|
152 | for (G4int i=0; i< vecSize; i++){ |
---|
153 | G4FluoTransition* transition = vec[i]; |
---|
154 | delete transition; |
---|
155 | } |
---|
156 | |
---|
157 | } |
---|
158 | |
---|
159 | } |
---|
160 | |
---|
161 | G4AtomicTransitionManager* G4AtomicTransitionManager::instance = 0; |
---|
162 | |
---|
163 | G4AtomicTransitionManager* G4AtomicTransitionManager::Instance() |
---|
164 | { |
---|
165 | if (instance == 0) |
---|
166 | { |
---|
167 | instance = new G4AtomicTransitionManager; |
---|
168 | |
---|
169 | } |
---|
170 | return instance; |
---|
171 | } |
---|
172 | |
---|
173 | |
---|
174 | G4AtomicShell* G4AtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const |
---|
175 | { |
---|
176 | std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos; |
---|
177 | |
---|
178 | pos = shellTable.find(Z); |
---|
179 | |
---|
180 | if (pos!= shellTable.end()) |
---|
181 | { |
---|
182 | std::vector<G4AtomicShell*> v = (*pos).second; |
---|
183 | if (shellIndex<v.size()) |
---|
184 | { |
---|
185 | return(v[shellIndex]); |
---|
186 | } |
---|
187 | else |
---|
188 | { |
---|
189 | size_t lastShell = v.size(); |
---|
190 | G4cout << "G4AtomicTransitionManager::Shell - Z = " |
---|
191 | << Z << ", shellIndex = " << shellIndex |
---|
192 | << " not found; number of shells = " << lastShell << G4endl; |
---|
193 | // G4Exception("G4AtomicTransitionManager:shell not found"); |
---|
194 | if (lastShell > 0) |
---|
195 | { |
---|
196 | return v[lastShell - 1]; |
---|
197 | } |
---|
198 | else |
---|
199 | { |
---|
200 | return 0; |
---|
201 | } |
---|
202 | } |
---|
203 | } |
---|
204 | else |
---|
205 | { |
---|
206 | G4Exception("G4AtomicTransitionManager:Z not found"); |
---|
207 | return 0; |
---|
208 | } |
---|
209 | } |
---|
210 | |
---|
211 | // This function gives, upon Z and the Index of the initial shell where te vacancy is, |
---|
212 | // the radiative transition that can happen (originating shell, energy, probability) |
---|
213 | |
---|
214 | const G4FluoTransition* G4AtomicTransitionManager::ReachableShell(G4int Z,size_t shellIndex) const |
---|
215 | { |
---|
216 | std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos; |
---|
217 | pos = transitionTable.find(Z); |
---|
218 | if (pos!= transitionTable.end()) |
---|
219 | { |
---|
220 | std::vector<G4FluoTransition*> v = (*pos).second; |
---|
221 | if (shellIndex < v.size()) return(v[shellIndex]); |
---|
222 | else { |
---|
223 | G4Exception("G4AtomicTransitionManager:reachable shell not found"); |
---|
224 | return 0; |
---|
225 | } |
---|
226 | } |
---|
227 | else{ |
---|
228 | G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; |
---|
229 | G4cout << "Absorbed enrgy deposited locally" << G4endl; |
---|
230 | |
---|
231 | // G4Exception("G4AtomicTransitionManager:Z not found"); |
---|
232 | return 0; |
---|
233 | } |
---|
234 | } |
---|
235 | |
---|
236 | const G4AugerTransition* G4AtomicTransitionManager::ReachableAugerShell(G4int Z, G4int vacancyShellIndex) const |
---|
237 | { |
---|
238 | |
---|
239 | G4AugerTransition* augerTransition = augerData->GetAugerTransition(Z,vacancyShellIndex); |
---|
240 | return augerTransition; |
---|
241 | } |
---|
242 | |
---|
243 | |
---|
244 | |
---|
245 | G4int G4AtomicTransitionManager::NumberOfShells (G4int Z) const |
---|
246 | { |
---|
247 | |
---|
248 | std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos; |
---|
249 | |
---|
250 | pos = shellTable.find(Z); |
---|
251 | |
---|
252 | if (pos!= shellTable.end()){ |
---|
253 | |
---|
254 | std::vector<G4AtomicShell*> v = (*pos).second; |
---|
255 | |
---|
256 | return v.size(); |
---|
257 | } |
---|
258 | |
---|
259 | else{ |
---|
260 | G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; |
---|
261 | G4cout << "Absorbed enrgy deposited locally" << G4endl; |
---|
262 | |
---|
263 | // G4Exception("G4AtomicTransitionManager:Z not found"); |
---|
264 | return 0; |
---|
265 | } |
---|
266 | } |
---|
267 | |
---|
268 | // This function returns the number of possible radiative transitions for the atom with atomic number Z |
---|
269 | // i.e. the number of shell in wich a vacancy can be filled with a radiative transition |
---|
270 | |
---|
271 | G4int G4AtomicTransitionManager::NumberOfReachableShells(G4int Z) const |
---|
272 | { |
---|
273 | std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos; |
---|
274 | |
---|
275 | pos = transitionTable.find(Z); |
---|
276 | |
---|
277 | if (pos!= transitionTable.end()) |
---|
278 | { |
---|
279 | std::vector<G4FluoTransition*> v = (*pos).second; |
---|
280 | return v.size(); |
---|
281 | } |
---|
282 | else |
---|
283 | { |
---|
284 | G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; |
---|
285 | G4cout << "Absorbed enrgy deposited locally" << G4endl; |
---|
286 | |
---|
287 | // G4Exception("G4AtomicTransitionManager:Z not found"); |
---|
288 | return 0; |
---|
289 | } |
---|
290 | } |
---|
291 | |
---|
292 | // This function returns the number of possible NON-radiative transitions for the atom with atomic number Z |
---|
293 | // i.e. the number of shell in wich a vacancy can be filled with a NON-radiative transition |
---|
294 | |
---|
295 | G4int G4AtomicTransitionManager::NumberOfReachableAugerShells(G4int Z)const |
---|
296 | { |
---|
297 | G4int n = augerData->NumberOfVacancies(Z); |
---|
298 | return n; |
---|
299 | } |
---|
300 | |
---|
301 | |
---|
302 | |
---|
303 | G4double G4AtomicTransitionManager::TotalRadiativeTransitionProbability(G4int Z, |
---|
304 | size_t shellIndex) |
---|
305 | |
---|
306 | { |
---|
307 | std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos; |
---|
308 | |
---|
309 | pos = transitionTable.find(Z); |
---|
310 | |
---|
311 | if (pos!= transitionTable.end()) |
---|
312 | { |
---|
313 | std::vector<G4FluoTransition*> v = (*pos).second; |
---|
314 | |
---|
315 | if (shellIndex < v.size()) |
---|
316 | { |
---|
317 | G4FluoTransition* transition = v[shellIndex]; |
---|
318 | G4DataVector transProb = transition->TransitionProbabilities(); |
---|
319 | G4double totalRadTransProb = 0; |
---|
320 | |
---|
321 | for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1 |
---|
322 | { |
---|
323 | totalRadTransProb = totalRadTransProb + transProb[j]; |
---|
324 | } |
---|
325 | return totalRadTransProb; |
---|
326 | |
---|
327 | } |
---|
328 | else { |
---|
329 | G4Exception( "G4AtomicTransitionManager: shell not found" ); |
---|
330 | return 0; |
---|
331 | |
---|
332 | } |
---|
333 | } |
---|
334 | else{ |
---|
335 | G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; |
---|
336 | G4cout << "Absorbed enrgy deposited locally" << G4endl; |
---|
337 | |
---|
338 | // G4Exception("G4AtomicTransitionManager:Z not found"); |
---|
339 | |
---|
340 | return 0; |
---|
341 | } |
---|
342 | } |
---|
343 | |
---|
344 | G4double G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex) |
---|
345 | |
---|
346 | { |
---|
347 | |
---|
348 | std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos; |
---|
349 | |
---|
350 | pos = transitionTable.find(Z); |
---|
351 | |
---|
352 | if (pos!= transitionTable.end()){ |
---|
353 | |
---|
354 | std::vector<G4FluoTransition*> v = (*pos).second; |
---|
355 | |
---|
356 | |
---|
357 | if (shellIndex<v.size()){ |
---|
358 | |
---|
359 | G4FluoTransition* transition=v[shellIndex]; |
---|
360 | G4DataVector transProb = transition->TransitionProbabilities(); |
---|
361 | G4double totalRadTransProb = 0; |
---|
362 | |
---|
363 | for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1 |
---|
364 | { |
---|
365 | totalRadTransProb = totalRadTransProb + transProb[j]; |
---|
366 | } |
---|
367 | |
---|
368 | if (totalRadTransProb > 1) { |
---|
369 | G4Exception( "Wrong Total Probability"); |
---|
370 | return 0; |
---|
371 | } |
---|
372 | G4double totalNonRadTransProb= (1 - totalRadTransProb); |
---|
373 | |
---|
374 | return totalNonRadTransProb; } |
---|
375 | |
---|
376 | else { |
---|
377 | G4Exception( "shell not found"); |
---|
378 | return 0; |
---|
379 | } |
---|
380 | } |
---|
381 | else{ |
---|
382 | G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; |
---|
383 | G4cout << "Absorbed enrgy deposited locally" << G4endl; |
---|
384 | |
---|
385 | // G4Exception("G4AtomicTransitionManager:Z not found"); |
---|
386 | return 0; |
---|
387 | } |
---|
388 | } |
---|
389 | |
---|
390 | |
---|
391 | |
---|
392 | |
---|
393 | |
---|
394 | |
---|
395 | |
---|
396 | |
---|
397 | |
---|
398 | |
---|