Geant4  10.02.p02
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 #include "G4EmParameters.hh"
40 #include "G4FluoData.hh"
41 #include "G4AugerData.hh"
42 
44 
46 {
47  if (instance == 0) {
49  }
50  return instance;
51 }
52 
54  : augerData(0),
55  zMin(1),
56  zMax(100),
57  infTableLimit(6),
58  supTableLimit(100),
59  isInitialized(false)
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  G4Exception("G4AtomicTransitionManager::Shell()","de0001",
113  JustWarning,ed," AtomicShell not found");
114  if (lastShell > 0) { return v[lastShell - 1]; }
115  }
116  }
117  else
118  {
120  ed << "No de-excitation for Z= " << Z
121  << " shellIndex= " << shellIndex
122  << ". AtomicShell not found - check if data are uploaded";
123  G4Exception("G4AtomicTransitionManager::Shell()","de0001",
124  FatalException,ed,"");
125  }
126  return 0;
127 }
128 
129 // This function gives, upon Z and the Index of the initial shell where
130 // the vacancy is, the radiative transition that can happen (originating
131 // shell, energy, probability)
132 
133 const G4FluoTransition*
135 {
136  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
137  pos = transitionTable.find(Z);
138  if (pos!= transitionTable.end())
139  {
140  std::vector<G4FluoTransition*> v = (*pos).second;
141  if (shellIndex < v.size()) { return(v[shellIndex]); }
142 
143  else {
145  ed << "No fluo transition for Z= " << Z
146  << " shellIndex= " << shellIndex;
147  G4Exception("G4AtomicTransitionManager::ReachebleShell()","de0002",
148  FatalException,ed,"");
149  }
150  }
151  else
152  {
154  ed << "No transition table for Z= " << Z
155  << " shellIndex= " << shellIndex;
156  G4Exception("G4AtomicTransitionManager::ReachableShell()","de0001",
157  FatalException,ed,"");
158  }
159  return 0;
160 }
161 
162 const G4AugerTransition*
164  G4int vacancyShellIndex) const
165 {
166  return augerData->GetAugerTransition(Z,vacancyShellIndex);
167 }
168 
170 {
171  std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
172  pos = shellTable.find(Z);
173 
174  G4int res = 0;
175  if (pos != shellTable.end()){
176 
177  res = ((*pos).second).size();
178 
179  } else {
181  ed << "No deexcitation for Z= " << Z;
182  G4Exception("G4AtomicTransitionManager::NumberOfShells()","de0001",
183  FatalException, ed, "");
184  }
185  return res;
186 }
187 
188 // This function returns the number of possible radiative transitions for
189 // the atom with atomic number Z i.e. the number of shell in wich a vacancy
190 // can be filled with a radiative transition
192 {
193  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
194  pos = transitionTable.find(Z);
195  G4int res = 0;
196  if (pos!= transitionTable.end())
197  {
198  res = ((*pos).second).size();
199  }
200  else
201  {
203  ed << "No deexcitation for Z= " << Z
204  << ", so energy deposited locally";
205  G4Exception("G4AtomicTransitionManager::NumberOfReachebleShells()",
206  "de0001",FatalException,ed,"");
207  }
208  return res;
209 }
210 
211 // This function returns the number of possible NON-radiative transitions
212 // for the atom with atomic number Z i.e. the number of shell in wich a
213 // vacancy can be filled with a NON-radiative transition
214 
216 {
217  return augerData->NumberOfVacancies(Z);
218 }
219 
221  G4int Z, size_t shellIndex) const
222 {
223  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
224 
225  pos = transitionTable.find(Z);
226  G4double totalRadTransProb = 0.0;
227 
228  if (pos!= transitionTable.end())
229  {
230  std::vector<G4FluoTransition*> v = (*pos).second;
231 
232  if (shellIndex < v.size())
233  {
234  G4FluoTransition* transition = v[shellIndex];
235  G4DataVector transProb = transition->TransitionProbabilities();
236 
237  for (size_t j=0; j<transProb.size(); ++j) // AM -- corrected, it was 1
238  {
239  totalRadTransProb += transProb[j];
240  }
241  }
242  else
243  {
245  ed << "Zero transition probability for Z=" << Z
246  << " shellIndex= " << shellIndex;
247  G4Exception(
248  "G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
249  "de0002",FatalException,"Incorrect de-excitation");
250  }
251  }
252  else
253  {
255  ed << "No deexcitation for Z=" << Z
256  << " shellIndex= " << shellIndex;
257  G4Exception(
258  "G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
259  "de0001",FatalException,ed,"Cannot compute transition probability");
260  }
261  return totalRadTransProb;
262 }
263 
265  G4int Z, size_t shellIndex) const
266 {
267  G4double prob = 1.0 - TotalRadiativeTransitionProbability(Z, shellIndex);
268  if(prob > 1.0 || prob < 0.0) {
270  ed << "Total probability mismatch Z= " << Z
271  << " shellIndex= " << shellIndex
272  << " prob= " << prob;
273  G4Exception(
274  "G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()",
275  "de0003",FatalException,ed,"Cannot compute non-radiative probability");
276  return 0.0;
277  }
278  return prob;
279 }
280 
281 #include "G4AutoLock.hh"
282 namespace { G4Mutex AtomicTransitionManagerMutex = G4MUTEX_INITIALIZER; }
283 
285 {
286  G4AutoLock l(&AtomicTransitionManagerMutex);
287 
288  //G4cout << "!!! G4AtomicTransitionManager::Initialise " << isInitialized
289  // << G4endl;
290  if(isInitialized) { return; }
291  isInitialized = true;
292 
293  // Selection of fluorescence files
294  G4String fluoDirectory = (G4EmParameters::Instance()->BeardenFluoDir()?
295  "/fluor_Bearden":"/fluor");
296 
297  // infTableLimit is initialized to 6 because EADL lacks data for Z<=5
298  G4ShellData* shellManager = new G4ShellData;
299  shellManager->LoadData(fluoDirectory+"/binding");
300 
301  // initialization of the data for auger effect
302  augerData = new G4AugerData;
303 
304  // Fills shellTable with the data from EADL, identities and binding
305  // energies of shells
306  for (G4int Z = zMin; Z<= zMax; ++Z)
307  {
308  std::vector<G4AtomicShell*> vectorOfShells;
309  size_t shellIndex = 0;
310 
311  size_t numberOfShells = shellManager->NumberOfShells(Z);
312  // G4cout << "For Z= " << Z << " " << numberOfShells << " shells" << G4endl;
313  for (shellIndex = 0; shellIndex<numberOfShells; ++shellIndex)
314  {
315  G4int shellId = shellManager->ShellId(Z,shellIndex);
316  G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex);
317 
318  G4AtomicShell * shell = new G4AtomicShell(shellId,bindingEnergy);
319 
320  vectorOfShells.push_back(shell);
321  }
322 
323  // shellTable.insert(std::make_pair(Z, vectorOfShells));
324  shellTable[Z] = vectorOfShells;
325  }
326 
327  // Fills transitionTable with the data from EADL, identities, transition
328  // energies and transition probabilities
329  for (G4int Znum= infTableLimit; Znum<=supTableLimit; ++Znum)
330  {
331  G4FluoData* fluoManager = new G4FluoData(fluoDirectory);
332  std::vector<G4FluoTransition*> vectorOfTransitions;
333  fluoManager->LoadData(Znum);
334 
335  size_t numberOfVacancies = fluoManager-> NumberOfVacancies();
336 
337  for(size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies;
338  ++vacancyIndex)
339  {
340  std::vector<G4int> vectorOfIds;
341  G4DataVector vectorOfEnergies;
342  G4DataVector vectorOfProbabilities;
343 
344  G4int finalShell = fluoManager->VacancyId(vacancyIndex);
345  size_t numberOfTransitions =
346  fluoManager->NumberOfTransitions(vacancyIndex);
347  for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions;
348  ++origShellIndex)
349  {
350  G4int originatingShellId =
351  fluoManager->StartShellId(origShellIndex,vacancyIndex);
352  vectorOfIds.push_back(originatingShellId);
353 
354  G4double transitionEnergy =
355  fluoManager->StartShellEnergy(origShellIndex,vacancyIndex);
356  vectorOfEnergies.push_back(transitionEnergy);
357  G4double transitionProbability =
358  fluoManager->StartShellProb(origShellIndex,vacancyIndex);
359  vectorOfProbabilities.push_back(transitionProbability);
360  }
361  G4FluoTransition* transition =
362  new G4FluoTransition (finalShell,vectorOfIds,
363  vectorOfEnergies,vectorOfProbabilities);
364  vectorOfTransitions.push_back(transition);
365  }
366  transitionTable[Znum] = vectorOfTransitions;
367  delete fluoManager;
368  }
369  delete shellManager;
370 }
371 
372 
373 
374 
375 
G4double StartShellProb(G4int initIndex, G4int vacancyIndex) const
Definition: G4FluoData.cc:168
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
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
int G4int
Definition: G4Types.hh:78
#define G4MUTEX_INITIALIZER
Definition: G4Threading.hh:175
G4int ShellId(G4int Z, G4int shellIndex) const
Definition: G4ShellData.cc:121
void LoadData(const G4String &fileName)
Definition: G4ShellData.cc:234
G4double TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex) const
G4double BindingEnergy(G4int Z, G4int shellIndex) const
Definition: G4ShellData.cc:166
G4int VacancyId(G4int vacancyIndex) const
Definition: G4FluoData.cc:76
G4int NumberOfReachableAugerShells(G4int Z) const
G4int StartShellId(G4int initIndex, G4int vacancyIndex) const
Definition: G4FluoData.cc:115
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void LoadData(G4int Z)
Definition: G4FluoData.cc:195
G4double TotalRadiativeTransitionProbability(G4int Z, size_t shellIndex) const
G4int G4Mutex
Definition: G4Threading.hh:173
G4double StartShellEnergy(G4int initIndex, G4int vacancyIndex) const
Definition: G4FluoData.cc:143
const G4FluoTransition * ReachableShell(G4int Z, size_t shellIndex) const
size_t NumberOfShells(G4int Z) const
Definition: G4ShellData.cc:84
static G4EmParameters * Instance()
size_t NumberOfTransitions(G4int vacancyIndex) const
Definition: G4FluoData.cc:97
static G4AtomicTransitionManager * instance
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
G4bool isInitialized()
Check if the generator is initialized.
static const G4double pos
G4bool BeardenFluoDir() const