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