00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 #include <fstream>
00041 #include <sstream>
00042
00043 #include "G4AugerData.hh"
00044 #include "G4SystemOfUnits.hh"
00045 #include "G4DataVector.hh"
00046 #include "G4Material.hh"
00047 #include "G4Element.hh"
00048 #include "G4ElementVector.hh"
00049
00050 G4AugerData::G4AugerData()
00051 {
00052
00053 G4int n = 0;
00054 G4int pos = 0;
00055
00056 for (pos = 0 ; pos < 100; pos++)
00057 {
00058 numberOfVacancies.push_back(n);
00059 }
00060
00061 BuildAugerTransitionTable();
00062
00063
00064 }
00065
00066 G4AugerData::~G4AugerData()
00067 {
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111 }
00112
00113 size_t G4AugerData::NumberOfVacancies(G4int Z) const
00114 {
00115 return numberOfVacancies[Z];
00116 }
00117
00118 G4int G4AugerData::VacancyId(G4int Z, G4int vacancyIndex) const
00119 {
00120
00121 G4int n = 0;
00122 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
00123 {
00124 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
00125 }
00126 else {
00127 trans_Table::const_iterator element = augerTransitionTable.find(Z);
00128 if (element == augerTransitionTable.end()) {
00129 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
00130 return 0;
00131 }
00132 std::vector<G4AugerTransition> dataSet = (*element).second;
00133 n = (G4int) dataSet[vacancyIndex].FinalShellId();
00134 }
00135
00136 return n;
00137 }
00138
00139
00140
00141
00142 size_t G4AugerData::NumberOfTransitions(G4int Z, G4int vacancyIndex) const
00143 {
00144 G4int n = 0;
00145 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
00146 {
00147 G4Exception("G4AugerData::VacancyId()","de0002", JustWarning, "Energy deposited locally");
00148 return 0;
00149 }
00150 else {
00151 trans_Table::const_iterator element = augerTransitionTable.find(Z);
00152 if (element == augerTransitionTable.end())
00153 {
00154 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
00155 return 0;
00156 }
00157 std::vector<G4AugerTransition> dataSet = (*element).second;
00158 n = (G4int)dataSet[vacancyIndex].TransitionOriginatingShellIds()->size();
00159 }
00160 return n;
00161 }
00162
00163
00164
00165 size_t G4AugerData::NumberOfAuger(G4int Z, G4int initIndex, G4int vacancyId) const
00166 {
00167 size_t n = 0;
00168 if (initIndex<0 || initIndex>=numberOfVacancies[Z])
00169 {
00170 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
00171 return 0;
00172 }
00173 else {
00174 trans_Table::const_iterator element = augerTransitionTable.find(Z);
00175 if (element == augerTransitionTable.end()) {
00176 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
00177 return 0;
00178 }
00179 std::vector<G4AugerTransition> dataSet = (*element).second;
00180 const std::vector<G4int>* temp = dataSet[initIndex].AugerOriginatingShellIds(vacancyId);
00181 n = temp->size();
00182 }
00183 return n;
00184 }
00185
00186 size_t G4AugerData::AugerShellId(G4int Z, G4int vacancyIndex, G4int transId, G4int augerIndex) const
00187 {
00188 size_t n = 0;
00189 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
00190 {
00191 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
00192 return 0;
00193 }
00194 else {
00195 trans_Table::const_iterator element = augerTransitionTable.find(Z);
00196 if (element == augerTransitionTable.end()) {
00197 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
00198 return 0;
00199 }
00200 std::vector<G4AugerTransition> dataSet = (*element).second;
00201 n = dataSet[vacancyIndex].AugerOriginatingShellId(augerIndex,transId);
00202 }
00203 return n;
00204 }
00205
00206 G4int G4AugerData::StartShellId(G4int Z, G4int vacancyIndex, G4int transitionShellIndex) const
00207 {
00208 G4int n = 0;
00209
00210 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
00211 {
00212 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
00213 return 0;
00214 }
00215 else {
00216 trans_Table::const_iterator element = augerTransitionTable.find(Z);
00217 if (element == augerTransitionTable.end()) {
00218 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
00219 return 0;
00220 }
00221 std::vector<G4AugerTransition> dataSet = (*element).second;
00222 n = dataSet[vacancyIndex].TransitionOriginatingShellId(transitionShellIndex);
00223 }
00224
00225
00226 return n;
00227 }
00228
00229 G4double G4AugerData::StartShellEnergy(G4int Z, G4int vacancyIndex, G4int transitionId, G4int augerIndex) const
00230 {
00231 G4double energy = 0;
00232
00233 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
00234 {
00235 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
00236 return 0;
00237 }
00238 else {
00239 trans_Table::const_iterator element = augerTransitionTable.find(Z);
00240 if (element == augerTransitionTable.end()) {
00241 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
00242 return 0;
00243 }
00244 std::vector<G4AugerTransition> dataSet = (*element).second;
00245 energy = dataSet[vacancyIndex].AugerTransitionEnergy(augerIndex,transitionId);
00246
00247 }
00248 return energy;
00249 }
00250
00251
00252 G4double G4AugerData::StartShellProb(G4int Z, G4int vacancyIndex,G4int transitionId,G4int augerIndex) const
00253 {
00254 G4double prob = 0;
00255
00256 if (vacancyIndex<0 || vacancyIndex>=numberOfVacancies[Z])
00257 {
00258 G4Exception("G4AugerData::VacancyId()","de0002", FatalErrorInArgument,"");
00259 return 0;
00260 }
00261 else {
00262 trans_Table::const_iterator element = augerTransitionTable.find(Z);
00263 if (element == augerTransitionTable.end()) {
00264 G4Exception("G4AugerData::VacancyId()","de0004", FatalErrorInArgument, "Check element");
00265 return 0;
00266 }
00267 std::vector<G4AugerTransition> dataSet = (*element).second;
00268 prob = dataSet[vacancyIndex].AugerTransitionProbability(augerIndex, transitionId);
00269
00270
00271
00272 }
00273 return prob;
00274 }
00275
00276 std::vector<G4AugerTransition> G4AugerData::LoadData(G4int Z)
00277 {
00278
00279
00280 std::ostringstream ost;
00281 if(Z != 0){
00282 ost << "au-tr-pr-"<< Z << ".dat";
00283 }
00284 else{
00285 ost << "au-tr-pr-"<<".dat";
00286 }
00287 G4String name(ost.str());
00288
00289 char* path = getenv("G4LEDATA");
00290 if (!path)
00291 {
00292 G4String excep = "G4AugerData::LoadData";
00293 G4Exception(excep,"em0006", FatalException,"" );
00294 std::vector<G4AugerTransition> a;
00295 return a;
00296 }
00297
00298 G4String pathString(path);
00299 G4String dirFile = pathString + "/auger/" + name;
00300 std::ifstream file(dirFile);
00301 std::filebuf* lsdp = file.rdbuf();
00302
00303 if (! (lsdp->is_open()) )
00304 {
00305 G4String excep = "G4AugerData::LoadData";
00306 G4String msg = "Missing" + dirFile;
00307 G4Exception(excep,"em0003", FatalException, msg);
00308 }
00309
00310
00311 G4double a = 0;
00312 G4int k = 1;
00313 G4int sLocal = 0;
00314
00315 G4int vacId = 0;
00316 std::vector<G4int>* initIds = new std::vector<G4int>;
00317 std::vector<G4int>* newIds = new std::vector<G4int>;
00318 G4DataVector* transEnergies = new G4DataVector;
00319 G4DataVector* transProbabilities = new G4DataVector;
00320 std::vector<G4AugerTransition> augerTransitionVector;
00321 std::map<G4int,std::vector<G4int>,std::less<G4int> >* newIdMap =
00322 new std::map<G4int,std::vector<G4int>,std::less<G4int> >;
00323 std::map<G4int,G4DataVector,std::less<G4int> >* newEnergyMap =
00324 new std::map<G4int,G4DataVector,std::less<G4int> >;
00325 std::map<G4int,G4DataVector,std::less<G4int> >* newProbabilityMap =
00326 new std::map<G4int,G4DataVector,std::less<G4int> >;
00327
00328
00329 do {
00330 file >> a;
00331
00332
00333 G4int nColumns = 4;
00334
00335 if (a == -1)
00336 {
00337
00338
00339
00340 if (sLocal == 0)
00341 {
00342
00343
00344
00345
00346 std::vector<G4int>::iterator vectorIndex = initIds->begin();
00347
00348 vacId = *vectorIndex;
00349
00350
00351
00352
00353
00354 std::vector<G4int> identifiers;
00355 for (vectorIndex = initIds->begin()+1 ; vectorIndex != initIds->end(); ++vectorIndex){
00356
00357 identifiers.push_back(*vectorIndex);
00358 }
00359
00360 vectorIndex = (initIds->end())-1;
00361
00362 G4int augerShellId = *(vectorIndex);
00363
00364
00365 (*newIdMap)[augerShellId] = *newIds;
00366 (*newEnergyMap)[augerShellId] = *transEnergies;
00367 (*newProbabilityMap)[augerShellId] = *transProbabilities;
00368
00369 augerTransitionVector.push_back(G4AugerTransition(vacId, identifiers, newIdMap, newEnergyMap, newProbabilityMap));
00370
00371
00372
00373 delete newIdMap;
00374 delete newEnergyMap;
00375 delete newProbabilityMap;
00376
00377 G4int n = initIds->size();
00378 nInitShells.push_back(n);
00379 numberOfVacancies[Z]++;
00380 delete initIds;
00381 delete newIds;
00382 delete transEnergies;
00383 delete transProbabilities;
00384 initIds = new std::vector<G4int>;
00385 newIds = new std::vector<G4int>;
00386 transEnergies = new G4DataVector;
00387 transProbabilities = new G4DataVector;
00388 newIdMap = new std::map<G4int,std::vector<G4int>,std::less<G4int> >;
00389 newEnergyMap = new std::map<G4int,G4DataVector,std::less<G4int> >;
00390 newProbabilityMap = new std::map<G4int,G4DataVector,std::less<G4int> >;
00391
00392
00393
00394 }
00395 sLocal++;
00396 if (sLocal == nColumns)
00397 {
00398 sLocal = 0;
00399 }
00400 }
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415 else
00416 {
00417
00418 if (k%nColumns == 3){
00419
00420 transProbabilities->push_back(a);
00421
00422 k++;}
00423 else if(k%nColumns == 2){
00424
00425
00426
00427
00428 G4int l = (G4int)a;
00429 newIds->push_back(l);
00430
00431
00432 k++;
00433 }
00434 else if (k%nColumns == 1)
00435 {
00436
00437
00438 if(initIds->size() == 0) {
00439
00440
00441
00442
00443 initIds->push_back((G4int)a);
00444
00445 file >> a;
00446 file >> a;
00447 file >> a;
00448 k = k+3;
00449 }
00450 else {
00451
00452
00453 if((G4int)a != initIds->back()){
00454
00455
00456 if((initIds->size()) == 1) {
00457 initIds->push_back((G4int)a);
00458 }
00459 else {
00460
00461
00462 G4int augerShellId = 0;
00463 augerShellId = initIds->back();
00464
00465 (*newIdMap)[augerShellId] = *newIds;
00466 (*newEnergyMap)[augerShellId] = *transEnergies;
00467 (*newProbabilityMap)[augerShellId] = *transProbabilities;
00468 delete newIds;
00469 delete transEnergies;
00470 delete transProbabilities;
00471 newIds = new std::vector<G4int>;
00472 transEnergies = new G4DataVector;
00473 transProbabilities = new G4DataVector;
00474 initIds->push_back((G4int)a);
00475 }
00476 }
00477 }
00478
00479 k++;
00480
00481 }
00482 else if (k%nColumns == 0)
00483
00484 {
00485 G4double e = a * MeV;
00486
00487 transEnergies->push_back(e);
00488 k=1;
00489
00490 }
00491 }
00492 }
00493
00494
00495 while (a != -2);
00496 file.close();
00497 delete initIds;
00498 delete newIds;
00499 delete transEnergies;
00500 delete transProbabilities;
00501 delete newIdMap ;
00502 delete newEnergyMap;
00503 delete newProbabilityMap;
00504 return augerTransitionVector;
00505
00506 }
00507
00508 void G4AugerData::BuildAugerTransitionTable()
00509 {
00510
00511
00512
00513 const G4MaterialTable* materialTable = G4Material::GetMaterialTable();
00514
00515 G4int nMaterials = G4Material::GetNumberOfMaterials();
00516
00517 G4DataVector activeZ;
00518 activeZ.clear();
00519
00520 for (G4int mLocal=0; mLocal<nMaterials; mLocal++) {
00521
00522 const G4Material* material= (*materialTable)[mLocal];
00523 const G4ElementVector* elementVector = material->GetElementVector();
00524 const size_t nElements = material->GetNumberOfElements();
00525
00526 for (size_t iEl=0; iEl<nElements; iEl++) {
00527 G4Element* element = (*elementVector)[iEl];
00528 G4double Z = element->GetZ();
00529 if (!(activeZ.contains(Z))) {
00530 activeZ.push_back(Z);
00531 }
00532 }
00533 }
00534
00535
00536 for (G4int element = 6; element < 100; element++)
00537 {
00538
00539 augerTransitionTable.insert(trans_Table::value_type(element,LoadData(element)));
00540
00541
00542
00543 }
00544 }
00545
00546 void G4AugerData::PrintData(G4int Z)
00547 {
00548
00549 for (G4int i = 0; i < numberOfVacancies[Z]; i++)
00550 {
00551 G4cout << "---- TransitionData for the vacancy nb "
00552 <<i
00553 <<" of the atomic number elemnt "
00554 << Z
00555 <<"----- "
00556 <<G4endl;
00557
00558 for (size_t k = 0; k<=NumberOfTransitions(Z,i); k++)
00559 {
00560 G4int id = StartShellId(Z,i,k);
00561
00562 for (size_t a = 0; a <= NumberOfAuger(Z,i,id); a++) {
00563
00564 G4double e = StartShellEnergy(Z,i,id,a)/MeV;
00565 G4double p = StartShellProb(Z,i,id,a);
00566 G4int augerId = AugerShellId(Z, i, id, a);
00567 G4cout << k <<") Shell id: " << id <<G4endl;
00568 G4cout << " Auger Originatig Shell Id :"<< augerId <<G4endl;
00569 G4cout << " - Transition energy = " << e << " MeV "<<G4endl;
00570 G4cout << " - Transition probability = " << p <<G4endl;
00571 }
00572 }
00573 G4cout << "-------------------------------------------------"
00574 << G4endl;
00575 }
00576 }
00577 G4AugerTransition* G4AugerData::GetAugerTransition(G4int Z,G4int vacancyShellIndex)
00578 {
00579 std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
00580 std::vector<G4AugerTransition>::iterator vectorIndex = dataSet->begin() + vacancyShellIndex;
00581
00582 G4AugerTransition* augerTransition = &(*vectorIndex);
00583 return augerTransition;
00584 }
00585
00586 std::vector<G4AugerTransition>* G4AugerData::GetAugerTransitions(G4int Z)
00587 {
00588 std::vector<G4AugerTransition>* dataSet = &augerTransitionTable[Z];
00589 return dataSet;
00590 }
00591
00592
00593
00594
00595
00596
00597
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609
00610
00611