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 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/eRosita/physics/src/G4RDAugerData.cc (Version 11.3.0) and /examples/advanced/eRosita/physics/src/G4RDAugerData.cc (Version 6.0.p1)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25 //                                                
 26 //                                                
 27 //                                                
 28 //                                                
 29 // Author: Alfonso Mmantero (Alfonso.Mantero@g    
 30 //                                                
 31 // History:                                       
 32 // -----------                                    
 33 // Based on G4RDFluoData by Elena Guardincerri    
 34 //                                                
 35 // Modified: 30.07.02 VI Add select active Z +    
 36 //                                                
 37 // -------------------------------------------    
 38                                                   
 39 #include <fstream>                                
 40 #include <sstream>                                
 41                                                   
 42 #include "G4RDAugerData.hh"                       
 43 #include "G4PhysicalConstants.hh"                 
 44 #include "G4SystemOfUnits.hh"                     
 45 #include "G4DataVector.hh"                        
 46 #include "G4Material.hh"                          
 47 #include "G4Element.hh"                           
 48 #include "G4ElementVector.hh"                     
 49                                                   
 50 G4RDAugerData::G4RDAugerData()                    
 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                                                   
 61   BuildAugerTransitionTable();                    
 62                                                   
 63                                                   
 64 }                                                 
 65                                                   
 66 G4RDAugerData::~G4RDAugerData()                   
 67 {                                                 
 68   /*                                              
 69   std::map<G4int,std::vector<G4RDAugerTransiti    
 70                                                   
 71   for (pos = augerTransitionTable.begin(); pos    
 72     {                                             
 73       std::vector<G4RDAugerTransition> dataSet    
 74       delete dataSet;                             
 75     }                                             
 76   for (pos = energyMap.begin(); pos != energyM    
 77     {                                             
 78       std::map<G4Int,G4DataVector*,std::less<G    
 79       for (pos2 = newIdProbabilityMap.begin();    
 80   {                                               
 81     G4DataVector* dataSet = (*pos2).second;       
 82     delete dataSet;                               
 83   }                                               
 84     }                                             
 85   for (pos = probabilityMap.begin(); pos != pr    
 86     {                                             
 87       std::map<G4Int,G4DataVector*,std::less<G    
 88       for (pos2 = newIdProbabilityMap.begin();    
 89   {                                               
 90     G4DataVector* dataSet = (*pos2).second;       
 91     delete dataSet;                               
 92   }                                               
 93     }                                             
 94   for (pos2 = newIdMap.begin(); pos2 != idMap.    
 95     {                                             
 96       G4DataVector* dataSet = (*pos2).second;     
 97       delete dataSet;                             
 98     }                                             
 99   for (pos2 = newIdEnergyMap.begin(); pos2 !=     
100     {                                             
101       G4DataVector* dataSet = (*pos2).second;     
102       delete dataSet;                             
103     }                                             
104   for (pos2 = newIdProbabilityMap.begin(); pos    
105     {                                             
106       G4DataVector* dataSet = (*pos2).second;     
107       delete dataSet;                             
108     }                                             
109   */                                              
110                                                   
111 }                                                 
112                                                   
113 size_t G4RDAugerData::NumberOfVacancies(G4int     
114 {                                                 
115   return numberOfVacancies[Z];                    
116 }                                                 
117                                                   
118 G4int G4RDAugerData::VacancyId(G4int Z, G4int     
119 {                                                 
120                                                   
121   G4int n = 0;                                    
122   if (vacancyIndex<0 || vacancyIndex>=numberOf    
123     {G4Exception("G4RDAugerData::VacancyId()",    
124                  FatalException, "VacancyIndex    
125   else {                                          
126     trans_Table::const_iterator element = auge    
127     if (element == augerTransitionTable.end())    
128       {G4Exception("G4RDAugerData::VacancyId()    
129                    FatalException, "Data not l    
130     std::vector<G4RDAugerTransition> dataSet =    
131     n = (G4int) dataSet[vacancyIndex].FinalShe    
132   }                                               
133                                                   
134   return n;                                       
135 }                                                 
136                                                   
137                                                   
138                                                   
139 // Attenzione: questa funzione vuole l'indice     
140                                                   
141                                                   
142 size_t G4RDAugerData::NumberOfTransitions(G4in    
143 {                                                 
144   G4int n = 0;                                    
145   if (vacancyIndex<0 || vacancyIndex>=numberOf    
146     {G4Exception("G4RDAugerData::NumberOfTrans    
147                  FatalException, "VacancyIndex    
148   else {                                          
149     trans_Table::const_iterator element = auge    
150     if (element == augerTransitionTable.end())    
151       {G4Exception("G4RDAugerData::NumberOfTra    
152                    FatalException, "Data not l    
153     std::vector<G4RDAugerTransition> dataSet =    
154     n = (G4int)dataSet[vacancyIndex].Transitio    
155   }                                               
156  return  n;                                       
157 }                                                 
158                                                   
159                                                   
160                                                   
161 size_t G4RDAugerData::NumberOfAuger(G4int Z, G    
162 {                                                 
163   size_t n = 0;                                   
164   if (initIndex<0 || initIndex>=numberOfVacanc    
165     {G4Exception("G4RDAugerData::NumberOfAuger    
166                  FatalException, "VacancyIndex    
167   else {                                          
168     trans_Table::const_iterator element = auge    
169     if (element == augerTransitionTable.end())    
170       {G4Exception("G4RDAugerData::NumberOfAug    
171                    FatalException, "Data not l    
172     std::vector<G4RDAugerTransition> dataSet =    
173     const std::vector<G4int>* temp =  dataSet[    
174     n = temp->size();                             
175   }                                               
176   return n;                                       
177 }                                                 
178                                                   
179 size_t G4RDAugerData::AugerShellId(G4int Z, G4    
180 {                                                 
181   size_t n = 0;                                   
182   if (vacancyIndex<0 || vacancyIndex>=numberOf    
183     {G4Exception("G4RDAugerData::AugerShellId(    
184                  FatalException, "VacancyIndex    
185   else {                                          
186     trans_Table::const_iterator element = auge    
187     if (element == augerTransitionTable.end())    
188       {G4Exception("G4RDAugerData::AugerShellI    
189                    FatalException, "Data not l    
190     std::vector<G4RDAugerTransition> dataSet =    
191     n = dataSet[vacancyIndex].AugerOriginating    
192   }                                               
193   return n;                                       
194 }                                                 
195                                                   
196 G4int G4RDAugerData::StartShellId(G4int Z, G4i    
197 {                                                 
198   G4int n = 0;                                    
199                                                   
200   if (vacancyIndex<0 || vacancyIndex>=numberOf    
201     {G4Exception("G4RDAugerData::StartShellId(    
202                  FatalException, "VacancyIndex    
203   else {                                          
204     trans_Table::const_iterator element = auge    
205     if (element == augerTransitionTable.end())    
206       {G4Exception("G4RDAugerData::StartShellI    
207                    FatalException, "Data not l    
208     std::vector<G4RDAugerTransition> dataSet =    
209      n = dataSet[vacancyIndex].TransitionOrigi    
210   }                                               
211                                                   
212                                                   
213  return n;                                        
214 }                                                 
215                                                   
216 G4double G4RDAugerData::StartShellEnergy(G4int    
217 {                                                 
218   G4double energy = 0;                            
219                                                   
220   if (vacancyIndex<0 || vacancyIndex>=numberOf    
221     {G4Exception("G4RDAugerData::StartShellEne    
222                  FatalException, "VacancyIndex    
223   else {                                          
224     trans_Table::const_iterator element = auge    
225     if (element == augerTransitionTable.end())    
226       {G4Exception("G4RDAugerData::StartShellE    
227                    FatalException, "Data not l    
228     std::vector<G4RDAugerTransition> dataSet =    
229     energy = dataSet[vacancyIndex].AugerTransi    
230                                                   
231   }                                               
232   return energy;                                  
233 }                                                 
234                                                   
235                                                   
236 G4double G4RDAugerData::StartShellProb(G4int Z    
237 {                                                 
238   G4double prob = 0;                              
239                                                   
240   if (vacancyIndex<0 || vacancyIndex>=numberOf    
241     {G4Exception("G4RDAugerData::StartShellPro    
242                  FatalException, "VacancyIndex    
243   else {                                          
244     trans_Table::const_iterator element = auge    
245     if (element == augerTransitionTable.end())    
246       {G4Exception("G4RDAugerData::StartShellP    
247                    FatalException, "Data not l    
248     std::vector<G4RDAugerTransition> dataSet =    
249     prob = dataSet[vacancyIndex].AugerTransiti    
250                                                   
251                                                   
252                                                   
253   }                                               
254      return prob;                                 
255 }                                                 
256                                                   
257 std::vector<G4RDAugerTransition> G4RDAugerData    
258 {                                                 
259   // Build the complete string identifying the    
260                                                   
261     std::ostringstream ost;                       
262     if(Z != 0){                                   
263       ost << "au-tr-pr-"<< Z << ".dat";           
264     }                                             
265     else{                                         
266       ost << "au-tr-pr-"<<".dat";                 
267     }                                             
268     G4String name(ost.str());                     
269                                                   
270     const char* path = G4FindDataDir("G4LEDATA    
271     if (!path)                                    
272       {                                           
273   G4String excep = "G4LEDATA environment varia    
274   G4Exception("G4RDAugerData::LoadData()", "In    
275                     FatalException, excep);       
276       }                                           
277                                                   
278     G4String pathString(path);                    
279     G4String dirFile = pathString + "/auger/"     
280     std::ifstream file(dirFile);                  
281     std::filebuf* lsdp = file.rdbuf();            
282                                                   
283     if (! (lsdp->is_open()) )                     
284       {                                           
285   G4String excep = "Data file: " + dirFile + "    
286   G4Exception("G4RDAugerData::LoadData()", "Da    
287                     FatalException, excep);       
288       }                                           
289                                                   
290                                                   
291     G4double a = 0;                               
292     G4int k = 1;                                  
293     G4int s = 0;                                  
294                                                   
295     G4int vacId = 0;                              
296     std::vector<G4int>* initIds = new std::vec    
297     std::vector<G4int>* newIds = new std::vect    
298     G4DataVector* transEnergies = new G4DataVe    
299     G4DataVector* transProbabilities = new G4D    
300     std::vector<G4RDAugerTransition> augerTran    
301     std::map<G4int,std::vector<G4int>,std::les    
302       new std::map<G4int,std::vector<G4int>,st    
303     std::map<G4int,G4DataVector,std::less<G4in    
304       new std::map<G4int,G4DataVector,std::les    
305     std::map<G4int,G4DataVector,std::less<G4in    
306       new std::map<G4int,G4DataVector,std::les    
307                                                   
308                                                   
309     do {                                          
310       file >> a;                                  
311                                                   
312                                                   
313       G4int nColumns = 4;                         
314                                                   
315       if (a == -1)                                
316   {                                               
317                                                   
318                                                   
319                                                   
320     if (s == 0)                                   
321       {                                           
322         // End of a shell data set                
323                                                   
324                                                   
325                                                   
326         std::vector<G4int>::iterator vectorInd    
327                                                   
328         vacId = *vectorIndex;                     
329                                                   
330         //initIds->erase(vectorIndex);            
331                                                   
332                                                   
333                                                   
334         std::vector<G4int> identifiers;           
335         for (vectorIndex = initIds->begin()+1     
336                                                   
337     identifiers.push_back(*vectorIndex);          
338         }                                         
339                                                   
340         vectorIndex = (initIds->end())-1;         
341                                                   
342         G4int augerShellId = *(vectorIndex);      
343                                                   
344                                                   
345         (*newIdMap)[augerShellId] = *newIds;      
346         (*newEnergyMap)[augerShellId] = *trans    
347         (*newProbabilityMap)[augerShellId] = *    
348                                                   
349         augerTransitionVector.push_back(G4RDAu    
350                                                   
351         // Now deleting all the variables I us    
352                                                   
353         delete newIdMap;                          
354         delete newEnergyMap;                      
355         delete newProbabilityMap;                 
356                                                   
357         G4int n = initIds->size();                
358         nInitShells.push_back(n);                 
359         numberOfVacancies[Z]++;                   
360         delete initIds;                           
361         delete newIds;                            
362         delete transEnergies;                     
363         delete transProbabilities;                
364         initIds = new std::vector<G4int>;         
365         newIds = new std::vector<G4int>;          
366         transEnergies = new G4DataVector;         
367         transProbabilities = new G4DataVector;    
368         newIdMap = new std::map<G4int,std::vec    
369         newEnergyMap = new std::map<G4int,G4Da    
370         newProbabilityMap = new std::map<G4int    
371                                                   
372                                                   
373                                                   
374       }                                           
375     s++;                                          
376     if (s == nColumns)                            
377       {                                           
378         s = 0;                                    
379       }                                           
380   }                                               
381       else if (a == -2)                           
382   {                                               
383     // End of file; delete the empty vectors c    
384     //when encountering the last -1 -1 row        
385     delete initIds;                               
386     delete newIds;                                
387     delete transEnergies;                         
388     delete transProbabilities;                    
389     delete newIdMap ;                             
390     delete newEnergyMap;                          
391     delete newProbabilityMap;                     
392   }                                               
393       else                                        
394   {                                               
395                                                   
396     if (k%nColumns == 3){                         
397       // 3rd column is the transition probabil    
398       transProbabilities->push_back(a);           
399                                                   
400       k++;}                                       
401     else if(k%nColumns == 2){                     
402       // 2nd column is new auger vacancy          
403                                                   
404       // 2nd column is new auger vacancy          
405                                                   
406       G4int l = (G4int)a;                         
407       newIds->push_back(l);                       
408                                                   
409                                                   
410       k++;                                        
411     }                                             
412     else if (k%nColumns == 1)                     
413       {                                           
414         // 1st column is shell id                 
415                                                   
416         if(initIds->size() == 0) {                
417                                                   
418     // if this is the first data of the shell,    
419     // to the shell Id; so we skip the next co    
420                                                   
421     initIds->push_back((G4int)a);                 
422     // first line of initIds is the original s    
423     file >> a;                                    
424     file >> a;                                    
425     file >> a;                                    
426     k = k+3;                                      
427         }                                         
428         else {                                    
429                                                   
430     //        std::vector<G4int>::iterator vec    
431     if((G4int)a != initIds->back()){              
432                                                   
433                                                   
434       if((initIds->size()) == 1) {                
435         initIds->push_back((G4int)a);             
436       }                                           
437       else {                                      
438                                                   
439                                                   
440         G4int augerShellId = 0;                   
441         augerShellId = initIds->back();           
442                                                   
443         (*newIdMap)[augerShellId] = *newIds;      
444         (*newEnergyMap)[augerShellId] = *trans    
445         (*newProbabilityMap)[augerShellId] = *    
446         delete newIds;                            
447         delete transEnergies;                     
448         delete transProbabilities;                
449         newIds = new std::vector<G4int>;          
450         transEnergies = new G4DataVector;         
451         transProbabilities = new G4DataVector;    
452         initIds->push_back((G4int)a);             
453       }                                           
454     }                                             
455         }                                         
456                                                   
457         k++;                                      
458                                                   
459       }                                           
460     else if (k%nColumns == 0)                     
461                                                   
462       {//fourth column is transition energies     
463         G4double e = a * MeV;                     
464                                                   
465         transEnergies->push_back(e);              
466         k=1;                                      
467                                                   
468       }                                           
469   }                                               
470     }                                             
471                                                   
472                                                   
473     while (a != -2); // end of file               
474     file.close();                                 
475     return augerTransitionVector;                 
476                                                   
477 }                                                 
478                                                   
479 void G4RDAugerData::BuildAugerTransitionTable(    
480 {                                                 
481                                                   
482   //  trans_Table::iterator pos = augerTransit    
483                                                   
484   const G4MaterialTable* materialTable = G4Mat    
485                                                   
486   G4int nMaterials = G4Material::GetNumberOfMa    
487                                                   
488   G4DataVector activeZ;                           
489   activeZ.clear();                                
490                                                   
491   for (G4int m=0; m<nMaterials; m++) {            
492                                                   
493     const G4Material* material= (*materialTabl    
494     const G4ElementVector* elementVector = mat    
495     const size_t nElements = material->GetNumb    
496                                                   
497     for (size_t iEl=0; iEl<nElements; iEl++) {    
498       G4Element* element = (*elementVector)[iE    
499       G4double Z = element->GetZ();               
500       if (!(activeZ.contains(Z))) {               
501   activeZ.push_back(Z);                           
502       }                                           
503     }                                             
504   }                                               
505                                                   
506                                                   
507   for (G4int element = 6; element < 101; eleme    
508     {                                             
509       if(nMaterials == 0 || activeZ.contains(e    
510         augerTransitionTable.insert(trans_Tabl    
511                                                   
512         G4cout << "G4RDAugerData for Element n    
513       //      PrintData(element);                 
514       }                                           
515     }                                             
516                                                   
517   G4cout << "AugerTransitionTable complete"<<     
518 }                                                 
519                                                   
520 void G4RDAugerData::PrintData(G4int Z)            
521 {                                                 
522                                                   
523   for (G4int i = 0; i < numberOfVacancies[Z];     
524     {                                             
525       G4cout << "---- TransitionData for the v    
526        <<i                                        
527        <<" of the atomic number elemnt "          
528        << Z                                       
529        <<"----- "                                 
530        <<G4endl;                                  
531                                                   
532       for (size_t k = 0; k<=NumberOfTransition    
533   {                                               
534     G4int id = StartShellId(Z,i,k);               
535                                                   
536     for (size_t a = 0; a <= NumberOfAuger(Z,i,    
537                                                   
538       G4double e = StartShellEnergy(Z,i,id,a)     
539       G4double p = StartShellProb(Z,i,id,a);      
540       G4int augerId = AugerShellId(Z, i, id, a    
541       G4cout << k <<") Shell id: " << id <<G4e    
542       G4cout << "    Auger Originatig Shell Id    
543       G4cout << " - Transition energy = " << e    
544       G4cout   << " - Transition probability =    
545     }                                             
546   }                                               
547       G4cout << "-----------------------------    
548        << G4endl;                                 
549     }                                             
550 }                                                 
551 G4RDAugerTransition* G4RDAugerData::GetAugerTr    
552     {                                             
553       std::vector<G4RDAugerTransition>* dataSe    
554       std::vector<G4RDAugerTransition>::iterat    
555                                                   
556       G4RDAugerTransition* augerTransition = &    
557       return augerTransition;                     
558     }                                             
559                                                   
560 std::vector<G4RDAugerTransition>* G4RDAugerDat    
561   {                                               
562     std::vector<G4RDAugerTransition>* dataSet     
563     return dataSet;                               
564   }                                               
565                                                   
566                                                   
567                                                   
568                                                   
569                                                   
570                                                   
571                                                   
572                                                   
573                                                   
574                                                   
575                                                   
576                                                   
577                                                   
578                                                   
579                                                   
580                                                   
581                                                   
582                                                   
583                                                   
584                                                   
585                                                   
586