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