Geant4  10.01
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 "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),
58  isInitialized(false),
59  fluoDirectory("/fluor")
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  G4Exception("G4AtomicTransitionManager::Shell()","de0001",
123  FatalException,ed,"AtomicShell not found");
124  }
125  return 0;
126 }
127 
128 // This function gives, upon Z and the Index of the initial shell where
129 // the vacancy is, the radiative transition that can happen (originating
130 // shell, energy, probability)
131 
132 const G4FluoTransition*
134 {
135  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
136  pos = transitionTable.find(Z);
137  if (pos!= transitionTable.end())
138  {
139  std::vector<G4FluoTransition*> v = (*pos).second;
140  if (shellIndex < v.size()) { return(v[shellIndex]); }
141 
142  else {
144  ed << "No fluo transition for Z= " << Z
145  << " shellIndex= " << shellIndex;
146  G4Exception("G4AtomicTransitionManager::ReachebleShell()","de0002",
147  FatalException,ed,"");
148  }
149  }
150  else
151  {
153  ed << "No transition table for Z= " << Z
154  << " shellIndex= " << shellIndex;
155  G4Exception("G4AtomicTransitionManager::ReachableShell()","de0001",
156  FatalException,ed,"");
157  }
158  return 0;
159 }
160 
161 const G4AugerTransition*
163  G4int vacancyShellIndex) const
164 {
165  return augerData->GetAugerTransition(Z,vacancyShellIndex);
166 }
167 
169 {
170  std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
171  pos = shellTable.find(Z);
172 
173  G4int res = 0;
174  if (pos != shellTable.end()){
175 
176  res = ((*pos).second).size();
177 
178  } else {
180  ed << "No deexcitation for Z= " << Z;
181  G4Exception("G4AtomicTransitionManager::NumberOfShells()","de0001",
182  FatalException, ed, "");
183  }
184  return res;
185 }
186 
187 // This function returns the number of possible radiative transitions for
188 // the atom with atomic number Z i.e. the number of shell in wich a vacancy
189 // can be filled with a radiative transition
191 {
192  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
193  pos = transitionTable.find(Z);
194  G4int res = 0;
195  if (pos!= transitionTable.end())
196  {
197  res = ((*pos).second).size();
198  }
199  else
200  {
202  ed << "No deexcitation for Z= " << Z
203  << ", so energy deposited locally";
204  G4Exception("G4AtomicTransitionManager::NumberOfReachebleShells()",
205  "de0001",FatalException,ed,"");
206  }
207  return res;
208 }
209 
210 // This function returns the number of possible NON-radiative transitions
211 // for the atom with atomic number Z i.e. the number of shell in wich a
212 // vacancy can be filled with a NON-radiative transition
213 
215 {
216  return augerData->NumberOfVacancies(Z);
217 }
218 
220  G4int Z, size_t shellIndex) const
221 {
222  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
223 
224  pos = transitionTable.find(Z);
225  G4double totalRadTransProb = 0.0;
226 
227  if (pos!= transitionTable.end())
228  {
229  std::vector<G4FluoTransition*> v = (*pos).second;
230 
231  if (shellIndex < v.size())
232  {
233  G4FluoTransition* transition = v[shellIndex];
234  G4DataVector transProb = transition->TransitionProbabilities();
235 
236  for (size_t j=0; j<transProb.size(); ++j) // AM -- corrected, it was 1
237  {
238  totalRadTransProb += transProb[j];
239  }
240  }
241  else
242  {
244  ed << "Zero transition probability for Z=" << Z
245  << " shellIndex= " << shellIndex;
246  G4Exception(
247  "G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
248  "de0002",FatalException,"Incorrect de-excitation");
249  }
250  }
251  else
252  {
254  ed << "No deexcitation for Z=" << Z
255  << " shellIndex= " << shellIndex;
256  G4Exception(
257  "G4AtomicTransitionManager::TotalRadiativeTransitionProbability()",
258  "de0001",FatalException,ed,"Cannot compute transition probability");
259  }
260  return totalRadTransProb;
261 }
262 
264  G4int Z, size_t shellIndex) const
265 {
266  G4double prob = 1.0 - TotalRadiativeTransitionProbability(Z, shellIndex);
267  if(prob > 1.0 || prob < 0.0) {
269  ed << "Total probability mismatch Z= " << Z
270  << " shellIndex= " << shellIndex
271  << " prob= " << prob;
272  G4Exception(
273  "G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()",
274  "de0003",FatalException,ed,"Cannot compute non-radiative probability");
275  return 0.0;
276  }
277  return prob;
278 }
279 
281 {
282  fluoDirectory = ss;
283 }
284 
285 #include "G4AutoLock.hh"
286 namespace { G4Mutex AtomicTransitionManagerMutex = G4MUTEX_INITIALIZER; }
287 
289 {
290  G4AutoLock l(&AtomicTransitionManagerMutex);
291 
292  //G4cout << "!!! G4AtomicTransitionManager::Initialise " << isInitialized
293  // << G4endl;
294  if(isInitialized) { return; }
295  isInitialized = true;
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  for (shellIndex = 0; shellIndex<numberOfShells; ++shellIndex)
313  {
314  G4int shellId = shellManager->ShellId(Z,shellIndex);
315  G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex);
316 
317  G4AtomicShell * shell = new G4AtomicShell(shellId,bindingEnergy);
318 
319  vectorOfShells.push_back(shell);
320  }
321 
322  // shellTable.insert(std::make_pair(Z, vectorOfShells));
323  shellTable[Z] = vectorOfShells;
324  }
325 
326  // Fills transitionTable with the data from EADL, identities, transition
327  // energies and transition probabilities
328  for (G4int Znum= infTableLimit; Znum<=supTableLimit; ++Znum)
329  {
330  G4FluoData* fluoManager = new G4FluoData(fluoDirectory);
331  std::vector<G4FluoTransition*> vectorOfTransitions;
332  fluoManager->LoadData(Znum);
333 
334  size_t numberOfVacancies = fluoManager-> NumberOfVacancies();
335 
336  for(size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies;
337  ++vacancyIndex)
338  {
339  std::vector<G4int> vectorOfIds;
340  G4DataVector vectorOfEnergies;
341  G4DataVector vectorOfProbabilities;
342 
343  G4int finalShell = fluoManager->VacancyId(vacancyIndex);
344  size_t numberOfTransitions =
345  fluoManager->NumberOfTransitions(vacancyIndex);
346  for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions;
347  ++origShellIndex)
348  {
349  G4int originatingShellId =
350  fluoManager->StartShellId(origShellIndex,vacancyIndex);
351  vectorOfIds.push_back(originatingShellId);
352 
353  G4double transitionEnergy =
354  fluoManager->StartShellEnergy(origShellIndex,vacancyIndex);
355  vectorOfEnergies.push_back(transitionEnergy);
356  G4double transitionProbability =
357  fluoManager->StartShellProb(origShellIndex,vacancyIndex);
358  vectorOfProbabilities.push_back(transitionProbability);
359  }
360  G4FluoTransition* transition =
361  new G4FluoTransition (finalShell,vectorOfIds,
362  vectorOfEnergies,vectorOfProbabilities);
363  vectorOfTransitions.push_back(transition);
364  }
365  transitionTable[Znum] = vectorOfTransitions;
366  delete fluoManager;
367  }
368  delete shellManager;
369 }
370 
371 
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
std::map< G4int, std::vector< G4FluoTransition * >, std::less< G4int > > transitionTable
void SetFluoDirectory(const G4String &ss)
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:163
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:161
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
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