Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/eRosita/physics/src/G4RDAugerData.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 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 9.6.p2)


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