Geant4  9.6.p02
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4AtomicTransitionManager.cc
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 //
27 // $Id: G4AtomicTransitionManager.cc,v 1.2 ????
28 // GEANT4 tag $Name: not supported by cvs2svn $
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 
40 
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 
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 
164 {
165  if (instance == 0)
166  {
167  instance = new G4AtomicTransitionManager;
168 
169  }
170  return instance;
171 }
172 
173 
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::Shell()","de0001",FatalErrorInArgument,"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 
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::ReachebleShell()","de0002", JustWarning,"Energy Deposited Locally.");
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  // G4String pippo = (G4String(Z));
232 
233  G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
234 
235  G4Exception("G4AtomicTransitionManager::ReachableShell()","de0001",JustWarning,msg);
236  //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
237  return 0;
238  }
239 }
240 
242 {
243 
244  G4AugerTransition* augerTransition = augerData->GetAugerTransition(Z,vacancyShellIndex);
245  return augerTransition;
246 }
247 
248 
249 
251 {
252 
253 std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
254 
255  pos = shellTable.find(Z);
256 
257  if (pos!= shellTable.end()){
258 
259  std::vector<G4AtomicShell*> v = (*pos).second;
260 
261  return v.size();
262  }
263 
264  else{
265  // G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
266  // G4cout << "Absorbed enrgy deposited locally" << G4endl;
267 
268  G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
269 
270  G4Exception("G4AtomicTransitionManager::NumberOfShells()","de0001",JustWarning,msg);
271 
272  //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
273 
274  return 0;
275  }
276 }
277 
278 // This function returns the number of possible radiative transitions for the atom with atomic number Z
279 // i.e. the number of shell in wich a vacancy can be filled with a radiative transition
280 
282 {
283 std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
284 
285  pos = transitionTable.find(Z);
286 
287  if (pos!= transitionTable.end())
288  {
289  std::vector<G4FluoTransition*> v = (*pos).second;
290  return v.size();
291  }
292  else
293  {
294  // G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
295  // G4cout << "Absorbed enrgy deposited locally" << G4endl;
296 
297  G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
298 
299  G4Exception("G4AtomicTransitionManager::NumberOfReachebleShells()","de0001",JustWarning,msg);
300 
301  //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
302 
303  return 0;
304  }
305 }
306 
307 // This function returns the number of possible NON-radiative transitions for the atom with atomic number Z
308 // i.e. the number of shell in wich a vacancy can be filled with a NON-radiative transition
309 
311 {
312  G4int n = augerData->NumberOfVacancies(Z);
313  return n;
314 }
315 
316 
317 
319  size_t shellIndex)
320 
321 {
322 std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos;
323 
324  pos = transitionTable.find(Z);
325 
326  if (pos!= transitionTable.end())
327  {
328  std::vector<G4FluoTransition*> v = (*pos).second;
329 
330  if (shellIndex < v.size())
331  {
332  G4FluoTransition* transition = v[shellIndex];
333  G4DataVector transProb = transition->TransitionProbabilities();
334  G4double totalRadTransProb = 0;
335 
336  for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1
337  {
338  totalRadTransProb = totalRadTransProb + transProb[j];
339  }
340  return totalRadTransProb;
341 
342  }
343  else {
344 
345  G4Exception("G4AtomicTransitionManager::TotalRadiativeTransitionProbability()","de0002", JustWarning,"Energy Deposited Locally.");
346  return 0;
347 
348  }
349  }
350  else{
351  //G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
352  //G4cout << "Absorbed enrgy deposited locally" << G4endl;
353 
354  G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
355 
356  G4Exception("G4AtomicTransitionManager::TotalRadiativeTransitionProbability()","de0001",JustWarning,msg);
357  //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
358 
359 
360  return 0;
361  }
362 }
363 
365 
366 {
367 
368  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos;
369 
370  pos = transitionTable.find(Z);
371 
372  if (pos!= transitionTable.end()){
373 
374  std::vector<G4FluoTransition*> v = (*pos).second;
375 
376 
377  if (shellIndex<v.size()){
378 
379  G4FluoTransition* transition=v[shellIndex];
380  G4DataVector transProb = transition->TransitionProbabilities();
381  G4double totalRadTransProb = 0;
382 
383  for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1
384  {
385  totalRadTransProb = totalRadTransProb + transProb[j];
386  }
387 
388  if (totalRadTransProb > 1) {
389  G4Exception( "G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0003",FatalException,"Total probability mismatch");
390  return 0;
391 }
392  G4double totalNonRadTransProb= (1 - totalRadTransProb);
393 
394  return totalNonRadTransProb; }
395 
396  else {
397 
398 G4Exception("G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0002", JustWarning,"Energy Deposited Locally.");
399 
400  return 0;
401  }
402  }
403  else{
404  // G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
405  // G4cout << "Absorbed enrgy deposited locally" << G4endl;
406 
407  G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
408 
409  G4Exception("G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0001",JustWarning,msg);
410 
411 //"No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.");
412 
413  return 0;
414  }
415 }
416 
417 
418 
419 
420 
421 
422 
423 
424 
425