Geant4-11
G4AugerData.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//
28//
29// Author: Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
30//
31// History:
32// -----------
33// Based on G4FluoData by Elena Guardincerri
34//
35// Modified: 30.07.02 VI Add select active Z + clean up against pedantic compiler
36//
37// -------------------------------------------------------------------
38
39#include <fstream>
40#include <sstream>
41
42#include "G4AugerData.hh"
43#include "G4SystemOfUnits.hh"
44#include "G4DataVector.hh"
45#include "G4Material.hh"
46#include "G4Element.hh"
47#include "G4ElementVector.hh"
48
49//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
50
52{
53 G4int n = 0;
54 numberOfVacancies.resize(100,n);
55
57}
58
59//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
60
62{;}
63
64//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
65
67{
68 return numberOfVacancies[Z];
69}
70
71//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
72
74{
75 G4int n = 0;
76 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
77 {
78 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
79 }
80 else {
81 trans_Table::const_iterator element = augerTransitionTable.find(Z);
82 if (element == augerTransitionTable.end()) {
83 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
84 return 0;
85 }
86 std::vector<G4AugerTransition> dataSet = (*element).second;
87 n = (G4int) dataSet[vacancyIndex].FinalShellId();
88 }
89 return n;
90}
91
92//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
93
94// Attention: this method wants the vacancy index, not the Id
95size_t G4AugerData::NumberOfTransitions(G4int Z, G4int vacancyIndex) const
96{
97 G4int n = 0;
98 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
99 {
100 G4Exception("G4AugerData::VacancyId()","de0002", JustWarning, "Energy deposited locally");
101 return 0;
102 }
103 else {
104 trans_Table::const_iterator element = augerTransitionTable.find(Z);
105 if (element == augerTransitionTable.end())
106 {
107 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
108 return 0;
109 }
110 std::vector<G4AugerTransition> dataSet = (*element).second;
111 n = (G4int)dataSet[vacancyIndex].TransitionOriginatingShellIds()->size();
112 }
113 return n;
114}
115
116//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
117
118size_t G4AugerData::NumberOfAuger(G4int Z, G4int initIndex, G4int vacancyId) const
119{
120 size_t n = 0;
121 if (initIndex<0 || initIndex>=numberOfVacancies[Z])
122 {
123 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
124 return 0;
125 }
126 else {
127 trans_Table::const_iterator element = augerTransitionTable.find(Z);
128 if (element == augerTransitionTable.end()) {
129 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
130 return 0;
131 }
132 std::vector<G4AugerTransition> dataSet = (*element).second;
133 const std::vector<G4int>* temp = dataSet[initIndex].AugerOriginatingShellIds(vacancyId);
134 n = temp->size();
135 }
136 return n;
137}
138
139//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
140
141size_t G4AugerData::AugerShellId(G4int Z, G4int vacancyIndex, G4int transId, G4int augerIndex) const
142{
143 size_t n = 0;
144 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
145 {
146 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
147 return 0;
148 }
149 else {
150 trans_Table::const_iterator element = augerTransitionTable.find(Z);
151 if (element == augerTransitionTable.end()) {
152 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
153 return 0;
154 }
155 std::vector<G4AugerTransition> dataSet = (*element).second;
156 n = dataSet[vacancyIndex].AugerOriginatingShellId(augerIndex,transId);
157 }
158 return n;
159}
160
161//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
162
163G4int G4AugerData::StartShellId(G4int Z, G4int vacancyIndex, G4int transitionShellIndex) const
164{
165 G4int n = 0;
166
167 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
168 {
169 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
170 return 0;
171 }
172 else {
173 trans_Table::const_iterator element = augerTransitionTable.find(Z);
174 if (element == augerTransitionTable.end()) {
175 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
176 return 0;
177 }
178 std::vector<G4AugerTransition> dataSet = (*element).second;
179 n = dataSet[vacancyIndex].TransitionOriginatingShellId(transitionShellIndex);
180 }
181 return n;
182}
183
184//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
185
186G4double G4AugerData::StartShellEnergy(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
187{
188 G4double energy = 0;
189
190 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
191 {
192 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
193 return 0;
194 }
195 else {
196 trans_Table::const_iterator element = augerTransitionTable.find(Z);
197 if (element == augerTransitionTable.end()) {
198 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
199 return 0;
200 }
201 std::vector<G4AugerTransition> dataSet = (*element).second;
202 energy = dataSet[vacancyIndex].AugerTransitionEnergy(augerIndex,transitionId);
203
204 }
205 return energy;
206}
207
208//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
209
210G4double G4AugerData::StartShellProb(G4int Z, G4int vacancyIndex,G4int transitionId,G4int augerIndex) const
211{
212 G4double prob = 0;
213
214 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
215 {
216 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
217 return 0;
218 }
219 else {
220 trans_Table::const_iterator element = augerTransitionTable.find(Z);
221 if (element == augerTransitionTable.end()) {
222 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
223 return 0;
224 }
225 std::vector<G4AugerTransition> dataSet = (*element).second;
226 prob = dataSet[vacancyIndex].AugerTransitionProbability(augerIndex, transitionId);
227 }
228 return prob;
229}
230
231//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
232
233std::vector<G4AugerTransition> G4AugerData::LoadData(G4int Z)
234{
235 // Build the complete string identifying the file with the data set
236 std::ostringstream ost;
237 if(Z != 0){
238 ost << "au-tr-pr-"<< Z << ".dat";
239 }
240 else{
241 ost << "au-tr-pr-"<<".dat";
242 }
243 G4String name(ost.str());
244
245 char* path = std::getenv("G4LEDATA");
246 if (!path)
247 {
248 G4String excep = "G4AugerData::LoadData";
249 G4Exception(excep,"em0006", FatalException,"" );
250 std::vector<G4AugerTransition> a;
251 return a;
252 }
253
254 G4String pathString(path);
255 G4String dirFile = pathString + "/auger/" + name;
256 std::ifstream file(dirFile);
257 std::filebuf* lsdp = file.rdbuf();
258
259 if (! (lsdp->is_open()) )
260 {
261 G4String excep = "G4AugerData::LoadData";
262 G4String msg = "Missing" + dirFile;
263 G4Exception(excep,"em0003", FatalException, msg);
264 }
265
266 G4double a = 0;
267 G4int k = 1;
268 G4int sLocal = 0;
269
270 G4int vacId = 0;
271 std::vector<G4int>* initIds = new std::vector<G4int>;
272 std::vector<G4int>* newIds = new std::vector<G4int>;
273 G4DataVector* transEnergies = new G4DataVector;
274 G4DataVector* transProbabilities = new G4DataVector;
275 std::vector<G4AugerTransition> augerTransitionVector;
276 std::map<G4int,std::vector<G4int>,std::less<G4int> >* newIdMap =
277 new std::map<G4int,std::vector<G4int>,std::less<G4int> >;
278 std::map<G4int,G4DataVector,std::less<G4int> >* newEnergyMap =
279 new std::map<G4int,G4DataVector,std::less<G4int> >;
280 std::map<G4int,G4DataVector,std::less<G4int> >* newProbabilityMap =
281 new std::map<G4int,G4DataVector,std::less<G4int> >;
282
283 do {
284 file >> a;
285 G4int nColumns = 4;
286 if (a == -1)
287 {
288 if (sLocal == 0)
289 {
290 // End of a shell data set
291 std::vector<G4int>::iterator vectorIndex = initIds->begin();
292
293 vacId = *vectorIndex;
294 std::vector<G4int> identifiers;
295 for (vectorIndex = initIds->begin()+1 ; vectorIndex != initIds->end(); ++vectorIndex){
296 identifiers.push_back(*vectorIndex);
297 }
298 vectorIndex = (initIds->end())-1;
299 G4int augerShellId = *(vectorIndex);
300
301 (*newIdMap)[augerShellId] = *newIds;
302 (*newEnergyMap)[augerShellId] = *transEnergies;
303 (*newProbabilityMap)[augerShellId] = *transProbabilities;
304
305 augerTransitionVector.push_back(G4AugerTransition(vacId, identifiers,
306 newIdMap, newEnergyMap, newProbabilityMap));
307 // Now deleting all the variables I used, and creating new ones for the next shell
308 delete newIdMap;
309 delete newEnergyMap;
310 delete newProbabilityMap;
311
312 G4int n = initIds->size();
313 nInitShells.push_back(n);
315 delete initIds;
316 delete newIds;
317 delete transEnergies;
318 delete transProbabilities;
319 initIds = new std::vector<G4int>;
320 newIds = new std::vector<G4int>;
321 transEnergies = new G4DataVector;
322 transProbabilities = new G4DataVector;
323 newIdMap = new std::map<G4int,std::vector<G4int>,std::less<G4int> >;
324 newEnergyMap = new std::map<G4int,G4DataVector,std::less<G4int> >;
325 newProbabilityMap = new std::map<G4int,G4DataVector,std::less<G4int> >;
326 }
327 sLocal++;
328 if (sLocal == nColumns)
329 {
330 sLocal = 0;
331 }
332 }
333 else
334 {
335
336 if (k%nColumns == 3){
337 // 3rd column is the transition probabilities
338 transProbabilities->push_back(a);
339 k++;
340 }
341 else if(k%nColumns == 2){
342 // 2nd column is new auger vacancy
343 G4int l = (G4int)a;
344 newIds->push_back(l);
345 k++;
346 }
347 else if (k%nColumns == 1)
348 {
349 // 1st column is shell id
350 if(initIds->size() == 0) {
351 // if this is the first data of the shell, all the colums are equal
352 // to the shell Id; so we skip the next colums ang go to the next row
353 initIds->push_back((G4int)a);
354 // first line of initIds is the original shell of the vacancy
355 file >> a;
356 file >> a;
357 file >> a;
358 k = k+3;
359 }
360 else {
361 if((G4int)a != initIds->back()){
362 if((initIds->size()) == 1) {
363 initIds->push_back((G4int)a);
364 }
365 else {
366
367
368 G4int augerShellId = 0;
369 augerShellId = initIds->back();
370
371 (*newIdMap)[augerShellId] = *newIds;
372 (*newEnergyMap)[augerShellId] = *transEnergies;
373 (*newProbabilityMap)[augerShellId] = *transProbabilities;
374 delete newIds;
375 delete transEnergies;
376 delete transProbabilities;
377 newIds = new std::vector<G4int>;
378 transEnergies = new G4DataVector;
379 transProbabilities = new G4DataVector;
380 initIds->push_back((G4int)a);
381 }
382 }
383 }
384 k++;
385 }
386 else if (k%nColumns == 0)
387 {//fourth column is transition energies
388 G4double e = a * MeV;
389 transEnergies->push_back(e);
390 k=1;
391 }
392 }
393 }
394 while (a != -2); // end of file
395 file.close();
396 delete initIds;
397 delete newIds;
398 delete transEnergies;
399 delete transProbabilities;
400 delete newIdMap ;
401 delete newEnergyMap;
402 delete newProbabilityMap;
403 return augerTransitionVector;
404}
405
406//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
407
409{
410 for (G4int element = 6; element < 100; ++element)
411 {
412 augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element)));
413 }
414}
415
416//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
417
419{
420 for (G4int i = 0; i < numberOfVacancies[Z]; ++i)
421 {
422 G4cout << "---- TransitionData for the vacancy nb "
423 <<i
424 <<" of the atomic number elemnt "
425 << Z
426 <<"----- "
427 <<G4endl;
428
429 for (size_t k = 0; k<=NumberOfTransitions(Z,i); k++)
430 {
431 G4int id = StartShellId(Z,i,k);
432
433 for (size_t a = 0; a <= NumberOfAuger(Z,i,id); a++) {
434 G4double e = StartShellEnergy(Z,i,id,a)/MeV;
435 G4double p = StartShellProb(Z,i,id,a);
436 G4int augerId = AugerShellId(Z, i, id, a);
437 G4cout << k <<") Shell id: " << id <<G4endl;
438 G4cout << " Auger Originatig Shell Id :"<< augerId <<G4endl;
439 G4cout << " - Transition energy = " << e << " MeV "<<G4endl;
440 G4cout << " - Transition probability = " << p <<G4endl;
441 }
442 }
443 G4cout << "-------------------------------------------------"
444 << G4endl;
445 }
446}
447
448//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
449
451{
452 std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
453 std::vector<G4AugerTransition>::iterator vectorIndex = dataSet->begin() + vacancyShellIndex;
454
455 G4AugerTransition* augerTransition = &(*vectorIndex);
456 return augerTransition;
457}
458
459//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
460
461std::vector<G4AugerTransition>* G4AugerData::GetAugerTransitions(G4int Z)
462{
463 std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
464 return dataSet;
465}
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
@ JustWarning
@ FatalException
@ FatalErrorInArgument
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
static constexpr double MeV
Definition: G4SIunits.hh:200
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
const G4int Z[17]
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
void BuildAugerTransitionTable()
Definition: G4AugerData.cc:408
trans_Table augerTransitionTable
Definition: G4AugerData.hh:102
std::vector< G4AugerTransition > LoadData(G4int Z)
Definition: G4AugerData.cc:233
size_t NumberOfTransitions(G4int Z, G4int vacancyIndex) const
Definition: G4AugerData.cc:95
size_t NumberOfAuger(G4int Z, G4int initIndex, G4int vacancyId) const
Definition: G4AugerData.cc:118
std::vector< G4AugerTransition > * GetAugerTransitions(G4int Z)
Given the atomic number returns a vector of possible AugerTransition objects.
Definition: G4AugerData.cc:461
G4int StartShellId(G4int Z, G4int initialVacancyIndex, G4int transitionShellIndex) const
Definition: G4AugerData.cc:163
size_t AugerShellId(G4int Z, G4int vacancyIndex, G4int transId, G4int augerIndex) const
Definition: G4AugerData.cc:141
G4AugerTransition * GetAugerTransition(G4int Z, G4int vacancyShellIndex)
Definition: G4AugerData.cc:450
std::vector< G4int > numberOfVacancies
Definition: G4AugerData.hh:105
G4double StartShellProb(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
Definition: G4AugerData.cc:210
size_t NumberOfVacancies(G4int Z) const
Definition: G4AugerData.cc:66
G4double StartShellEnergy(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
Definition: G4AugerData.cc:186
G4int VacancyId(G4int Z, G4int vacancyIndex) const
Given the index of the vacancy (and the atomic number Z) returns its identity.
Definition: G4AugerData.cc:73
void PrintData(G4int Z)
Definition: G4AugerData.cc:418
std::vector< G4int > nInitShells
Definition: G4AugerData.hh:104
G4double energy(const ThreeVector &p, const G4double m)
const char * name(G4int ptype)