Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
G4AugerData.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 // $Id: G4AugerData.cc v1.0
28 //
29 //
30 // Author: Alfonso Mmantero (Alfonso.Mantero@ge.infn.it)
31 //
32 // History:
33 // -----------
34 // Based on G4FluoData by Elena Guardincerri
35 //
36 // Modified: 30.07.02 VI Add select active Z + clean up against pedantic compiler
37 //
38 // -------------------------------------------------------------------
39 
40 #include <fstream>
41 #include <sstream>
42 
43 #include "G4AugerData.hh"
44 #include "G4SystemOfUnits.hh"
45 #include "G4DataVector.hh"
46 #include "G4Material.hh"
47 #include "G4Element.hh"
48 #include "G4ElementVector.hh"
49 
51 {
52 
53  G4int n = 0;
54  G4int pos = 0;
55 
56  for (pos = 0 ; pos < 100; pos++)
57  {
58  numberOfVacancies.push_back(n);
59  }
60 
62 
63 
64 }
65 
67 {
68  /*
69  std::map<G4int,std::vector<G4AugerTransition>,std::less<G4int> >::iterator pos;
70 
71  for (pos = augerTransitionTable.begin(); pos != augerTransitionTable.end(); pos++)
72  {
73  std::vector<G4AugerTransition> dataSet = (*pos).second;
74  delete dataSet;
75  }
76  for (pos = energyMap.begin(); pos != energyMap.end(); pos++)
77  {
78  std::map<G4Int,G4DataVector*,std::less<G4int>>* dataMap = (*pos).second;
79  for (pos2 = newIdProbabilityMap.begin(); pos2 != idMap.end(); pos2++)
80  {
81  G4DataVector* dataSet = (*pos2).second;
82  delete dataSet;
83  }
84  }
85  for (pos = probabilityMap.begin(); pos != probabilityMap.end(); pos++)
86  {
87  std::map<G4Int,G4DataVector*,std::less<G4int>>* dataMap = (*pos).second;
88  for (pos2 = newIdProbabilityMap.begin(); pos2 != idMap.end(); pos2++)
89  {
90  G4DataVector* dataSet = (*pos2).second;
91  delete dataSet;
92  }
93  }
94  for (pos2 = newIdMap.begin(); pos2 != idMap.end(); pos2++)
95  {
96  G4DataVector* dataSet = (*pos2).second;
97  delete dataSet;
98  }
99  for (pos2 = newIdEnergyMap.begin(); pos2 != idMap.end(); pos2++)
100  {
101  G4DataVector* dataSet = (*pos2).second;
102  delete dataSet;
103  }
104  for (pos2 = newIdProbabilityMap.begin(); pos2 != idMap.end(); pos2++)
105  {
106  G4DataVector* dataSet = (*pos2).second;
107  delete dataSet;
108  }
109  */
110 
111 }
112 
114 {
115  return numberOfVacancies[Z];
116 }
117 
119 {
120 
121  G4int n = 0;
122  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
123  {
124  G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
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  n = (G4int) dataSet[vacancyIndex].FinalShellId();
134  }
135 
136  return n;
137 }
138 
139 
140 // Attention: this method wants the vacancy index, not the Id
141 
142 size_t G4AugerData::NumberOfTransitions(G4int Z, G4int vacancyIndex) const
143 {
144  G4int n = 0;
145  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
146  {
147  G4Exception("G4AugerData::VacancyId()","de0002", JustWarning, "Energy deposited locally");
148  return 0;
149  }
150  else {
151  trans_Table::const_iterator element = augerTransitionTable.find(Z);
152  if (element == augerTransitionTable.end())
153  {
154  G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
155  return 0;
156  }
157  std::vector<G4AugerTransition> dataSet = (*element).second;
158  n = (G4int)dataSet[vacancyIndex].TransitionOriginatingShellIds()->size();
159  }
160  return n;
161 }
162 
163 
164 
165 size_t G4AugerData::NumberOfAuger(G4int Z, G4int initIndex, G4int vacancyId) const
166 {
167  size_t n = 0;
168  if (initIndex<0 || initIndex>=numberOfVacancies[Z])
169  {
170  G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
171  return 0;
172  }
173  else {
174  trans_Table::const_iterator element = augerTransitionTable.find(Z);
175  if (element == augerTransitionTable.end()) {
176  G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
177  return 0;
178  }
179  std::vector<G4AugerTransition> dataSet = (*element).second;
180  const std::vector<G4int>* temp = dataSet[initIndex].AugerOriginatingShellIds(vacancyId);
181  n = temp->size();
182  }
183  return n;
184 }
185 
186 size_t G4AugerData::AugerShellId(G4int Z, G4int vacancyIndex, G4int transId, G4int augerIndex) const
187 {
188  size_t n = 0;
189  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
190  {
191  G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
192  return 0;
193  }
194  else {
195  trans_Table::const_iterator element = augerTransitionTable.find(Z);
196  if (element == augerTransitionTable.end()) {
197  G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
198  return 0;
199  }
200  std::vector<G4AugerTransition> dataSet = (*element).second;
201  n = dataSet[vacancyIndex].AugerOriginatingShellId(augerIndex,transId);
202  }
203  return n;
204 }
205 
206 G4int G4AugerData::StartShellId(G4int Z, G4int vacancyIndex, G4int transitionShellIndex) const
207 {
208  G4int n = 0;
209 
210  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
211  {
212  G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
213  return 0;
214  }
215  else {
216  trans_Table::const_iterator element = augerTransitionTable.find(Z);
217  if (element == augerTransitionTable.end()) {
218  G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
219  return 0;
220  }
221  std::vector<G4AugerTransition> dataSet = (*element).second;
222  n = dataSet[vacancyIndex].TransitionOriginatingShellId(transitionShellIndex);
223  }
224 
225 
226  return n;
227 }
228 
229 G4double G4AugerData::StartShellEnergy(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
230 {
231  G4double energy = 0;
232 
233  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
234  {
235  G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
236  return 0;
237  }
238  else {
239  trans_Table::const_iterator element = augerTransitionTable.find(Z);
240  if (element == augerTransitionTable.end()) {
241  G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
242  return 0;
243  }
244  std::vector<G4AugerTransition> dataSet = (*element).second;
245  energy = dataSet[vacancyIndex].AugerTransitionEnergy(augerIndex,transitionId);
246 
247  }
248  return energy;
249 }
250 
251 
252 G4double G4AugerData::StartShellProb(G4int Z, G4int vacancyIndex,G4int transitionId,G4int augerIndex) const
253 {
254  G4double prob = 0;
255 
256  if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
257  {
258  G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
259  return 0;
260  }
261  else {
262  trans_Table::const_iterator element = augerTransitionTable.find(Z);
263  if (element == augerTransitionTable.end()) {
264  G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
265  return 0;
266  }
267  std::vector<G4AugerTransition> dataSet = (*element).second;
268  prob = dataSet[vacancyIndex].AugerTransitionProbability(augerIndex, transitionId);
269 
270 
271 
272  }
273  return prob;
274 }
275 
276 std::vector<G4AugerTransition> G4AugerData::LoadData(G4int Z)
277 {
278  // Build the complete string identifying the file with the data set
279 
280  std::ostringstream ost;
281  if(Z != 0){
282  ost << "au-tr-pr-"<< Z << ".dat";
283  }
284  else{
285  ost << "au-tr-pr-"<<".dat";
286  }
287  G4String name(ost.str());
288 
289  char* path = getenv("G4LEDATA");
290  if (!path)
291  {
292  G4String excep = "G4AugerData::LoadData";
293  G4Exception(excep,"em0006", FatalException,"" );
294  std::vector<G4AugerTransition> a;
295  return a;
296  }
297 
298  G4String pathString(path);
299  G4String dirFile = pathString + "/auger/" + name;
300  std::ifstream file(dirFile);
301  std::filebuf* lsdp = file.rdbuf();
302 
303  if (! (lsdp->is_open()) )
304  {
305  G4String excep = "G4AugerData::LoadData";
306  G4String msg = "Missing" + dirFile;
307  G4Exception(excep,"em0003", FatalException, msg);
308  }
309 
310 
311  G4double a = 0;
312  G4int k = 1;
313  G4int sLocal = 0;
314 
315  G4int vacId = 0;
316  std::vector<G4int>* initIds = new std::vector<G4int>;
317  std::vector<G4int>* newIds = new std::vector<G4int>;
318  G4DataVector* transEnergies = new G4DataVector;
319  G4DataVector* transProbabilities = new G4DataVector;
320  std::vector<G4AugerTransition> augerTransitionVector;
321  std::map<G4int,std::vector<G4int>,std::less<G4int> >* newIdMap =
322  new std::map<G4int,std::vector<G4int>,std::less<G4int> >;
323  std::map<G4int,G4DataVector,std::less<G4int> >* newEnergyMap =
324  new std::map<G4int,G4DataVector,std::less<G4int> >;
325  std::map<G4int,G4DataVector,std::less<G4int> >* newProbabilityMap =
326  new std::map<G4int,G4DataVector,std::less<G4int> >;
327 
328 
329  do {
330  file >> a;
331 
332 
333  G4int nColumns = 4;
334 
335  if (a == -1)
336  {
337 
338 
339 
340  if (sLocal == 0)
341  {
342  // End of a shell data set
343 
344 
345 
346  std::vector<G4int>::iterator vectorIndex = initIds->begin();
347 
348  vacId = *vectorIndex;
349 
350  //initIds->erase(vectorIndex);
351 
352 
353 
354  std::vector<G4int> identifiers;
355  for (vectorIndex = initIds->begin()+1 ; vectorIndex != initIds->end(); ++vectorIndex){
356 
357  identifiers.push_back(*vectorIndex);
358  }
359 
360  vectorIndex = (initIds->end())-1;
361 
362  G4int augerShellId = *(vectorIndex);
363 
364 
365  (*newIdMap)[augerShellId] = *newIds;
366  (*newEnergyMap)[augerShellId] = *transEnergies;
367  (*newProbabilityMap)[augerShellId] = *transProbabilities;
368 
369  augerTransitionVector.push_back(G4AugerTransition(vacId, identifiers, newIdMap, newEnergyMap, newProbabilityMap));
370 
371  // Now deleting all the variables I used, and creating new ones for the next shell
372 
373  delete newIdMap;
374  delete newEnergyMap;
375  delete newProbabilityMap;
376 
377  G4int n = initIds->size();
378  nInitShells.push_back(n);
379  numberOfVacancies[Z]++;
380  delete initIds;
381  delete newIds;
382  delete transEnergies;
383  delete transProbabilities;
384  initIds = new std::vector<G4int>;
385  newIds = new std::vector<G4int>;
386  transEnergies = new G4DataVector;
387  transProbabilities = new G4DataVector;
388  newIdMap = new std::map<G4int,std::vector<G4int>,std::less<G4int> >;
389  newEnergyMap = new std::map<G4int,G4DataVector,std::less<G4int> >;
390  newProbabilityMap = new std::map<G4int,G4DataVector,std::less<G4int> >;
391 
392 
393 
394  }
395  sLocal++;
396  if (sLocal == nColumns)
397  {
398  sLocal = 0;
399  }
400  }
401  // moved to the end in order to avoid leaks
402  /*
403  else if (a == -2)
404  {
405  // End of file; delete the empty vectors created
406  //when encountering the last -1 -1 row
407  delete initIds;
408  delete newIds;
409  delete transEnergies;
410  delete transProbabilities;
411  delete newIdMap ;
412  delete newEnergyMap;
413  delete newProbabilityMap;
414  }*/
415  else
416  {
417 
418  if (k%nColumns == 3){
419  // 3rd column is the transition probabilities
420  transProbabilities->push_back(a);
421 
422  k++;}
423  else if(k%nColumns == 2){
424  // 2nd column is new auger vacancy
425 
426  // 2nd column is new auger vacancy
427 
428  G4int l = (G4int)a;
429  newIds->push_back(l);
430 
431 
432  k++;
433  }
434  else if (k%nColumns == 1)
435  {
436  // 1st column is shell id
437 
438  if(initIds->size() == 0) {
439 
440  // if this is the first data of the shell, all the colums are equal
441  // to the shell Id; so we skip the next colums ang go to the next row
442 
443  initIds->push_back((G4int)a);
444  // first line of initIds is the original shell of the vacancy
445  file >> a;
446  file >> a;
447  file >> a;
448  k = k+3;
449  }
450  else {
451 
452  // std::vector<G4int>::iterator vectorIndex = (initIds->end())-1;
453  if((G4int)a != initIds->back()){
454 
455 
456  if((initIds->size()) == 1) {
457  initIds->push_back((G4int)a);
458  }
459  else {
460 
461 
462  G4int augerShellId = 0;
463  augerShellId = initIds->back();
464 
465  (*newIdMap)[augerShellId] = *newIds;
466  (*newEnergyMap)[augerShellId] = *transEnergies;
467  (*newProbabilityMap)[augerShellId] = *transProbabilities;
468  delete newIds;
469  delete transEnergies;
470  delete transProbabilities;
471  newIds = new std::vector<G4int>;
472  transEnergies = new G4DataVector;
473  transProbabilities = new G4DataVector;
474  initIds->push_back((G4int)a);
475  }
476  }
477  }
478 
479  k++;
480 
481  }
482  else if (k%nColumns == 0)
483 
484  {//fourth column is transition energies
485  G4double e = a * MeV;
486 
487  transEnergies->push_back(e);
488  k=1;
489 
490  }
491  }
492  }
493 
494 
495  while (a != -2); // end of file
496  file.close();
497  delete initIds;
498  delete newIds;
499  delete transEnergies;
500  delete transProbabilities;
501  delete newIdMap ;
502  delete newEnergyMap;
503  delete newProbabilityMap;
504  return augerTransitionVector;
505 
506 }
507 
509 {
510 
511  // trans_Table::iterator pos = augerTransitionTable.begin();
512 
513  const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
514 
516 
517  G4DataVector activeZ;
518  activeZ.clear();
519 
520  for (G4int mLocal=0; mLocal<nMaterials; mLocal++) {
521 
522  const G4Material* material= (*materialTable)[mLocal];
523  const G4ElementVector* elementVector = material->GetElementVector();
524  const size_t nElements = material->GetNumberOfElements();
525 
526  for (size_t iEl=0; iEl<nElements; iEl++) {
527  G4Element* element = (*elementVector)[iEl];
528  G4double Z = element->GetZ();
529  if (!(activeZ.contains(Z))) {
530  activeZ.push_back(Z);
531  }
532  }
533  }
534 
535 
536  for (G4int element = 6; element < 100; element++)
537  {
538  // if(nMaterials == 0 || activeZ.contains(element)) {
539  augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element)));
540  // G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl;
541  // G4cout << "G4AugerData for Element no. " << element << " are loaded" << G4endl;
542  //G4cout << "AugerTransitionTable complete"<< G4endl;
543  }
544 }
545 
547 {
548 
549  for (G4int i = 0; i < numberOfVacancies[Z]; i++)
550  {
551  G4cout << "---- TransitionData for the vacancy nb "
552  <<i
553  <<" of the atomic number elemnt "
554  << Z
555  <<"----- "
556  <<G4endl;
557 
558  for (size_t k = 0; k<=NumberOfTransitions(Z,i); k++)
559  {
560  G4int id = StartShellId(Z,i,k);
561 
562  for (size_t a = 0; a <= NumberOfAuger(Z,i,id); a++) {
563 
564  G4double e = StartShellEnergy(Z,i,id,a)/MeV;
565  G4double p = StartShellProb(Z,i,id,a);
566  G4int augerId = AugerShellId(Z, i, id, a);
567  G4cout << k <<") Shell id: " << id <<G4endl;
568  G4cout << " Auger Originatig Shell Id :"<< augerId <<G4endl;
569  G4cout << " - Transition energy = " << e << " MeV "<<G4endl;
570  G4cout << " - Transition probability = " << p <<G4endl;
571  }
572  }
573  G4cout << "-------------------------------------------------"
574  << G4endl;
575  }
576 }
578  {
579  std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
580  std::vector<G4AugerTransition>::iterator vectorIndex = dataSet->begin() + vacancyShellIndex;
581 
582  G4AugerTransition* augerTransition = &(*vectorIndex);
583  return augerTransition;
584  }
585 
586 std::vector<G4AugerTransition>* G4AugerData::GetAugerTransitions(G4int Z)
587  {
588  std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
589  return dataSet;
590  }
591 
592 
593 
594 
595 
596 
597 
598 
599 
600 
601 
602 
603 
604 
605 
606 
607 
608 
609 
610 
611 
const XML_Char * name
Definition: expat.h:151
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
static const G4double pos
static size_t GetNumberOfMaterials()
Definition: G4Material.cc:600
static constexpr double MeV
Definition: G4SIunits.hh:214
static G4MaterialTable * GetMaterialTable()
Definition: G4Material.cc:593
void PrintData(G4int Z)
Definition: G4AugerData.cc:546
#define G4endl
Definition: G4ios.hh:61
const char * p
Definition: xmltok.h:285
G4double StartShellProb(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
Definition: G4AugerData.cc:252
G4bool contains(const G4double &) const
const G4ElementVector * GetElementVector() const
Definition: G4Material.hh:191
size_t AugerShellId(G4int Z, G4int vacancyIndex, G4int transId, G4int augerIndex) const
Definition: G4AugerData.cc:186
G4int StartShellId(G4int Z, G4int initialVacancyIndex, G4int transitionShellIndex) const
Definition: G4AugerData.cc:206
size_t NumberOfAuger(G4int Z, G4int initIndex, G4int vacancyId) const
Definition: G4AugerData.cc:165
Float_t Z
G4AugerTransition * GetAugerTransition(G4int Z, G4int vacancyShellIndex)
Definition: G4AugerData.cc:577
double G4double
Definition: G4Types.hh:76
std::vector< G4int > numberOfVacancies
Definition: G4AugerData.hh:123
double energy
Definition: plottest35.C:25
std::vector< G4AugerTransition > * GetAugerTransitions(G4int Z)
Definition: G4AugerData.cc:586
std::vector< G4Material * > G4MaterialTable
void BuildAugerTransitionTable()
Definition: G4AugerData.cc:508
std::vector< G4AugerTransition > LoadData(G4int Z)
Definition: G4AugerData.cc:276
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.hh:65
std::vector< G4Element * > G4ElementVector
int G4int
Definition: G4Types.hh:78
std::vector< G4int > nInitShells
Definition: G4AugerData.hh:122
TFile * file
G4GLOB_DLL std::ostream G4cout
G4double StartShellEnergy(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
Definition: G4AugerData.cc:229
size_t NumberOfTransitions(G4int Z, G4int vacancyIndex) const
Definition: G4AugerData.cc:142
G4double GetZ() const
Definition: G4Element.hh:131
Char_t n[5]
trans_Table augerTransitionTable
Definition: G4AugerData.hh:115
G4int VacancyId(G4int Z, G4int vacancyIndex) const
Definition: G4AugerData.cc:118
size_t NumberOfVacancies(G4int Z) const
Definition: G4AugerData.cc:113
size_t GetNumberOfElements() const
Definition: G4Material.hh:187