ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4AtomicTransitionManager.cc
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4AtomicTransitionManager.cc
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 //
28 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
29 // Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
30 //
31 // History:
32 // -----------
33 // 16 Sep 2001 E. Guardincerri First Committed to cvs
34 //
35 // -------------------------------------------------------------------
36 
38 #include "G4EmParameters.hh"
39 #include "G4FluoData.hh"
40 #include "G4AugerData.hh"
41 
43 
45 {
46  if (instance == 0) {
48  }
49  return instance;
50 }
51 
53  : augerData(0),
54  zMin(1),
55  zMax(100),
56  infTableLimit(6),
57  supTableLimit(100),
59  verboseLevel(0)
60 {}
61 
63 {
64  delete augerData;
65 
66  std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::iterator pos;
67 
68  for(pos = shellTable.begin(); pos != shellTable.end(); ++pos){
69 
70  std::vector<G4AtomicShell*>vec = (*pos).second;
71  G4int vecSize = vec.size();
72 
73  for (G4int i=0; i< vecSize; ++i){
74  G4AtomicShell* shell = vec[i];
75  delete shell;
76  }
77  }
78 
79  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator ppos;
80  for (ppos = transitionTable.begin(); ppos != transitionTable.end(); ++ppos){
81 
82  std::vector<G4FluoTransition*>vec = (*ppos).second;
83 
84  G4int vecSize=vec.size();
85 
86  for (G4int i=0; i< vecSize; i++){
87  G4FluoTransition* transition = vec[i];
88  delete transition;
89  }
90  }
91 }
92 
94 G4AtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const
95 {
96  std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
97 
98  pos = shellTable.find(Z);
99 
100  if (pos!= shellTable.end())
101  {
102  std::vector<G4AtomicShell*> v = (*pos).second;
103  if (shellIndex < v.size()) { return v[shellIndex]; }
104 
105  else
106  {
107  size_t lastShell = v.size();
109  ed << "No de-excitation for Z= " << Z
110  << " shellIndex= " << shellIndex
111  << ">= numberOfShells= " << lastShell;
112  if (verboseLevel > 0)
113  G4Exception("G4AtomicTransitionManager::Shell()","de0001",
114  JustWarning,ed," AtomicShell not found");
115  if (lastShell > 0) { return v[lastShell - 1]; }
116  }
117  }
118  else
119  {
121  ed << "No de-excitation for Z= " << Z
122  << " shellIndex= " << shellIndex
123  << ". AtomicShell not found - check if data are uploaded";
124  G4Exception("G4AtomicTransitionManager::Shell()","de0001",
125  FatalException,ed,"");
126  }
127  return 0;
128 }
129 
130 // This function gives, upon Z and the Index of the initial shell where
131 // the vacancy is, the radiative transition that can happen (originating
132 // shell, energy, probability)
133 
134 const G4FluoTransition*
136 {
137  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
138  pos = transitionTable.find(Z);
139  if (pos!= transitionTable.end())
140  {
141  std::vector<G4FluoTransition*> v = (*pos).second;
142  if (shellIndex < v.size()) { return(v[shellIndex]); }
143 
144  else {
146  ed << "No fluo transition for Z= " << Z
147  << " shellIndex= " << shellIndex;
148  G4Exception("G4AtomicTransitionManager::ReachebleShell()","de0002",
149  FatalException,ed,"");
150  }
151  }
152  else
153  {
155  ed << "No transition table for Z= " << Z
156  << " shellIndex= " << shellIndex;
157  G4Exception("G4AtomicTransitionManager::ReachableShell()","de0001",
158  FatalException,ed,"");
159  }
160  return 0;
161 }
162 
163 const G4AugerTransition*
165  G4int vacancyShellIndex) const
166 {
167  return augerData->GetAugerTransition(Z,vacancyShellIndex);
168 }
169 
171 {
172  std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
173  pos = shellTable.find(Z);
174 
175  G4int res = 0;
176  if (pos != shellTable.end()){
177 
178  res = ((*pos).second).size();
179 
180  } else {
182  ed << "No deexcitation for Z= " << Z;
183  G4Exception("G4AtomicTransitionManager::NumberOfShells()","de0001",
184  FatalException, ed, "");
185  }
186  return res;
187 }
188 
189 // This function returns the number of possible radiative transitions for
190 // the atom with atomic number Z i.e. the number of shell in wich a vacancy
191 // can be filled with a radiative transition
193 {
194  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
195  pos = transitionTable.find(Z);
196  G4int res = 0;
197  if (pos!= transitionTable.end())
198  {
199  res = ((*pos).second).size();
200  }
201  else
202  {
204  ed << "No deexcitation for Z= " << Z
205  << ", so energy deposited locally";
206  G4Exception("G4AtomicTransitionManager::NumberOfReachebleShells()",
207  "de0001",FatalException,ed,"");
208  }
209  return res;
210 }
211 
212 // This function returns the number of possible NON-radiative transitions
213 // for the atom with atomic number Z i.e. the number of shell in wich a
214 // vacancy can be filled with a NON-radiative transition
215 
217 {
218  return augerData->NumberOfVacancies(Z);
219 }
220 
222  G4int Z, size_t shellIndex) const
223 {
224  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
225 
226  pos = transitionTable.find(Z);
227  G4double totalRadTransProb = 0.0;
228 
229  if (pos!= transitionTable.end())
230  {
231  std::vector<G4FluoTransition*> v = (*pos).second;
232 
233  if (shellIndex < v.size())
234  {
235  G4FluoTransition* transition = v[shellIndex];
236  G4DataVector transProb = transition->TransitionProbabilities();
237 
238  for (size_t j=0; j<transProb.size(); ++j) // AM -- corrected, it was 1
239  {
240  totalRadTransProb += transProb[j];
241  }
242  }
243  else
244  {
246  ed << "Zero transition probability for Z=" << Z
247  << " shellIndex= " << shellIndex;
248  G4Exception(
249  "G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
250  "de0002",FatalException,"Incorrect de-excitation");
251  }
252  }
253  else
254  {
256  ed << "No deexcitation for Z=" << Z
257  << " shellIndex= " << shellIndex;
258  G4Exception(
259  "G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
260  "de0001",FatalException,ed,"Cannot compute transition probability");
261  }
262  return totalRadTransProb;
263 }
264 
266  G4int Z, size_t shellIndex) const
267 {
268  G4double prob = 1.0 - TotalRadiativeTransitionProbability(Z, shellIndex);
269  if(prob > 1.0 || prob < 0.0) {
271  ed << "Total probability mismatch Z= " << Z
272  << " shellIndex= " << shellIndex
273  << " prob= " << prob;
274  G4Exception(
275  "G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()",
276  "de0003",FatalException,ed,"Cannot compute non-radiative probability");
277  return 0.0;
278  }
279  return prob;
280 }
281 
282 #include "G4AutoLock.hh"
283 namespace { G4Mutex AtomicTransitionManagerMutex = G4MUTEX_INITIALIZER; }
284 
286 {
287  G4AutoLock l(&AtomicTransitionManagerMutex);
288 
289  //G4cout << "!!! G4AtomicTransitionManager::Initialise " << isInitialized
290  // << G4endl;
291  if(isInitialized) { return; }
292  isInitialized = true;
293 
294  // Selection of fluorescence files
295  G4String fluoDirectory = (G4EmParameters::Instance()->BeardenFluoDir()?
296  "/fluor_Bearden":"/fluor");
297 
298  // infTableLimit is initialized to 6 because EADL lacks data for Z<=5
299  G4ShellData* shellManager = new G4ShellData;
300  shellManager->LoadData(fluoDirectory+"/binding");
301 
302  // initialization of the data for auger effect
303  augerData = new G4AugerData;
304 
305  // Fills shellTable with the data from EADL, identities and binding
306  // energies of shells
307  for (G4int Z = zMin; Z<= zMax; ++Z)
308  {
309  std::vector<G4AtomicShell*> vectorOfShells;
310  size_t shellIndex = 0;
311 
312  size_t numberOfShells = shellManager->NumberOfShells(Z);
313  // G4cout << "For Z= " << Z << " " << numberOfShells << " shells" << G4endl;
314  for (shellIndex = 0; shellIndex<numberOfShells; ++shellIndex)
315  {
316  G4int shellId = shellManager->ShellId(Z,shellIndex);
317  G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex);
318 
319  G4AtomicShell * shell = new G4AtomicShell(shellId,bindingEnergy);
320 
321  vectorOfShells.push_back(shell);
322  }
323 
324  // shellTable.insert(std::make_pair(Z, vectorOfShells));
325  shellTable[Z] = vectorOfShells;
326  }
327 
328  // Fills transitionTable with the data from EADL, identities, transition
329  // energies and transition probabilities
330  for (G4int Znum= infTableLimit; Znum<=supTableLimit; ++Znum)
331  {
332  G4FluoData* fluoManager = new G4FluoData(fluoDirectory);
333  std::vector<G4FluoTransition*> vectorOfTransitions;
334  fluoManager->LoadData(Znum);
335 
336  size_t numberOfVacancies = fluoManager-> NumberOfVacancies();
337 
338  for(size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies;
339  ++vacancyIndex)
340  {
341  std::vector<G4int> vectorOfIds;
342  G4DataVector vectorOfEnergies;
343  G4DataVector vectorOfProbabilities;
344 
345  G4int finalShell = fluoManager->VacancyId(vacancyIndex);
346  size_t numberOfTransitions =
347  fluoManager->NumberOfTransitions(vacancyIndex);
348  for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions;
349  ++origShellIndex)
350  {
351  G4int originatingShellId =
352  fluoManager->StartShellId(origShellIndex,vacancyIndex);
353  vectorOfIds.push_back(originatingShellId);
354 
355  G4double transitionEnergy =
356  fluoManager->StartShellEnergy(origShellIndex,vacancyIndex);
357  vectorOfEnergies.push_back(transitionEnergy);
358  G4double transitionProbability =
359  fluoManager->StartShellProb(origShellIndex,vacancyIndex);
360  vectorOfProbabilities.push_back(transitionProbability);
361  }
362  G4FluoTransition* transition =
363  new G4FluoTransition (finalShell,vectorOfIds,
364  vectorOfEnergies,vectorOfProbabilities);
365  vectorOfTransitions.push_back(transition);
366  }
367  transitionTable[Znum] = vectorOfTransitions;
368  delete fluoManager;
369  }
370  delete shellManager;
371 }
372 
373 
374 
375 
376