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