Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 // 28 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it) 29 // Alfonso Mantero (Alfonso.Mantero@ge.infn.it) 30 // 31 // History: 32 // ----------- 33 // 16 Sep 2001 E. Guardincerri First Committed to cvs 34 // 35 // ------------------------------------------------------------------- 36 37 #include "G4RDAtomicTransitionManager.hh" 38 39 G4RDAtomicTransitionManager::G4RDAtomicTransitionManager(G4int minZ, G4int maxZ, 40 G4int limitInfTable,G4int limitSupTable) 41 :zMin(minZ), 42 zMax(maxZ), 43 infTableLimit(limitInfTable), 44 supTableLimit(limitSupTable) 45 { 46 // infTableLimit is initialized to 6 because EADL lacks data for Z<=5 47 G4RDShellData* shellManager = new G4RDShellData; 48 49 // initialization of the data for auger effect 50 51 augerData = new G4RDAugerData; 52 53 shellManager->LoadData("/fluor/binding"); 54 55 // Fills shellTable with the data from EADL, identities and binding 56 // energies of shells 57 for (G4int Z = zMin; Z<= zMax; Z++) 58 { 59 std::vector<G4RDAtomicShell*> vectorOfShells; 60 size_t shellIndex = 0; 61 62 size_t numberOfShells=shellManager->NumberOfShells(Z); 63 for (shellIndex = 0; shellIndex<numberOfShells; shellIndex++) 64 { 65 G4int shellId = shellManager->ShellId(Z,shellIndex); 66 G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex); 67 68 G4RDAtomicShell * shell = new G4RDAtomicShell(shellId,bindingEnergy); 69 70 vectorOfShells.push_back(shell); 71 } 72 73 // shellTable.insert(std::make_pair(Z, vectorOfShells)); 74 shellTable[Z] = vectorOfShells; 75 } 76 77 // Fills transitionTable with the data from EADL, identities, transition 78 // energies and transition probabilities 79 for (G4int Znum= infTableLimit; Znum<=supTableLimit; Znum++) 80 { G4RDFluoData* fluoManager = new G4RDFluoData; 81 std::vector<G4RDFluoTransition*> vectorOfTransitions; 82 fluoManager->LoadData(Znum); 83 84 size_t numberOfVacancies = fluoManager-> NumberOfVacancies(); 85 86 for (size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies; vacancyIndex++) 87 88 { 89 std::vector<G4int> vectorOfIds; 90 G4DataVector vectorOfEnergies; 91 G4DataVector vectorOfProbabilities; 92 93 G4int finalShell = fluoManager->VacancyId(vacancyIndex); 94 size_t numberOfTransitions = fluoManager->NumberOfTransitions(vacancyIndex); 95 for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions; 96 origShellIndex++) 97 98 { 99 100 G4int originatingShellId = fluoManager->StartShellId(origShellIndex,vacancyIndex); 101 102 vectorOfIds.push_back(originatingShellId); 103 104 G4double transitionEnergy = fluoManager->StartShellEnergy(origShellIndex,vacancyIndex); 105 vectorOfEnergies.push_back(transitionEnergy); 106 G4double transitionProbability = fluoManager->StartShellProb(origShellIndex,vacancyIndex); 107 vectorOfProbabilities.push_back(transitionProbability); 108 } 109 G4RDFluoTransition * transition = new G4RDFluoTransition (finalShell,vectorOfIds, 110 vectorOfEnergies,vectorOfProbabilities); 111 vectorOfTransitions.push_back(transition); 112 } 113 // transitionTable.insert(std::make_pair(Znum, vectorOfTransitions)); 114 transitionTable[Znum] = vectorOfTransitions; 115 116 delete fluoManager; 117 } 118 delete shellManager; 119 } 120 121 G4RDAtomicTransitionManager::~G4RDAtomicTransitionManager() 122 123 { 124 125 delete augerData; 126 127 std::map<G4int,std::vector<G4RDAtomicShell*>,std::less<G4int> >::iterator pos; 128 129 for (pos = shellTable.begin(); pos != shellTable.end(); pos++){ 130 131 std::vector< G4RDAtomicShell*>vec = (*pos).second; 132 133 G4int vecSize=vec.size(); 134 135 for (G4int i=0; i< vecSize; i++){ 136 G4RDAtomicShell* shell = vec[i]; 137 delete shell; 138 } 139 140 } 141 142 std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::iterator ppos; 143 144 for (ppos = transitionTable.begin(); ppos != transitionTable.end(); ppos++){ 145 146 std::vector<G4RDFluoTransition*>vec = (*ppos).second; 147 148 G4int vecSize=vec.size(); 149 150 for (G4int i=0; i< vecSize; i++){ 151 G4RDFluoTransition* transition = vec[i]; 152 delete transition; 153 } 154 155 } 156 157 } 158 159 G4RDAtomicTransitionManager* G4RDAtomicTransitionManager::instance = 0; 160 161 G4RDAtomicTransitionManager* G4RDAtomicTransitionManager::Instance() 162 { 163 if (instance == 0) 164 { 165 instance = new G4RDAtomicTransitionManager; 166 167 } 168 return instance; 169 } 170 171 172 G4RDAtomicShell* G4RDAtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const 173 { 174 std::map<G4int,std::vector<G4RDAtomicShell*>,std::less<G4int> >::const_iterator pos; 175 176 pos = shellTable.find(Z); 177 178 if (pos!= shellTable.end()) 179 { 180 std::vector<G4RDAtomicShell*> v = (*pos).second; 181 if (shellIndex<v.size()) 182 { 183 return(v[shellIndex]); 184 } 185 else 186 { 187 size_t lastShell = v.size(); 188 G4cout << "G4RDAtomicTransitionManager::Shell - Z = " 189 << Z << ", shellIndex = " << shellIndex 190 << " not found; number of shells = " << lastShell << G4endl; 191 // G4Exception("G4RDAtomicTransitionManager:shell not found"); 192 if (lastShell > 0) 193 { 194 return v[lastShell - 1]; 195 } 196 else 197 { 198 return 0; 199 } 200 } 201 } 202 else 203 { 204 G4Exception("G4RDAtomicTransitionManager::Shell()", 205 "InvalidSetup", FatalException, "Z not found!"); 206 return 0; 207 } 208 } 209 210 // This function gives, upon Z and the Index of the initial shell where te vacancy is, 211 // the radiative transition that can happen (originating shell, energy, probability) 212 213 const G4RDFluoTransition* G4RDAtomicTransitionManager::ReachableShell(G4int Z,size_t shellIndex) const 214 { 215 std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::const_iterator pos; 216 pos = transitionTable.find(Z); 217 if (pos!= transitionTable.end()) 218 { 219 std::vector<G4RDFluoTransition*> v = (*pos).second; 220 if (shellIndex < v.size()) return(v[shellIndex]); 221 else { 222 G4Exception("G4RDAtomicTransitionManager::ReachableShell()", 223 "InvalidCondition", FatalException, 224 "Reachable shell not found!"); 225 return 0; 226 } 227 } 228 else{ 229 G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; 230 G4cout << "Absorbed enrgy deposited locally" << G4endl; 231 232 // G4Exception("G4RDAtomicTransitionManager:Z not found"); 233 return 0; 234 } 235 } 236 237 const G4RDAugerTransition* G4RDAtomicTransitionManager::ReachableAugerShell(G4int Z, G4int vacancyShellIndex) const 238 { 239 240 G4RDAugerTransition* augerTransition = augerData->GetAugerTransition(Z,vacancyShellIndex); 241 return augerTransition; 242 } 243 244 245 246 G4int G4RDAtomicTransitionManager::NumberOfShells (G4int Z) const 247 { 248 249 std::map<G4int,std::vector<G4RDAtomicShell*>,std::less<G4int> >::const_iterator pos; 250 251 pos = shellTable.find(Z); 252 253 if (pos!= shellTable.end()){ 254 255 std::vector<G4RDAtomicShell*> v = (*pos).second; 256 257 return v.size(); 258 } 259 260 else{ 261 G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; 262 G4cout << "Absorbed enrgy deposited locally" << G4endl; 263 264 // G4Exception("G4RDAtomicTransitionManager:Z not found"); 265 return 0; 266 } 267 } 268 269 // This function returns the number of possible radiative transitions for the atom with atomic number Z 270 // i.e. the number of shell in wich a vacancy can be filled with a radiative transition 271 272 G4int G4RDAtomicTransitionManager::NumberOfReachableShells(G4int Z) const 273 { 274 std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::const_iterator pos; 275 276 pos = transitionTable.find(Z); 277 278 if (pos!= transitionTable.end()) 279 { 280 std::vector<G4RDFluoTransition*> v = (*pos).second; 281 return v.size(); 282 } 283 else 284 { 285 G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; 286 G4cout << "Absorbed enrgy deposited locally" << G4endl; 287 288 // G4Exception("G4RDAtomicTransitionManager:Z not found"); 289 return 0; 290 } 291 } 292 293 // This function returns the number of possible NON-radiative transitions for the atom with atomic number Z 294 // i.e. the number of shell in wich a vacancy can be filled with a NON-radiative transition 295 296 G4int G4RDAtomicTransitionManager::NumberOfReachableAugerShells(G4int Z)const 297 { 298 G4int n = augerData->NumberOfVacancies(Z); 299 return n; 300 } 301 302 303 304 G4double G4RDAtomicTransitionManager::TotalRadiativeTransitionProbability(G4int Z, 305 size_t shellIndex) 306 307 { 308 std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::iterator pos; 309 310 pos = transitionTable.find(Z); 311 312 if (pos!= transitionTable.end()) 313 { 314 std::vector<G4RDFluoTransition*> v = (*pos).second; 315 316 if (shellIndex < v.size()) 317 { 318 G4RDFluoTransition* transition = v[shellIndex]; 319 G4DataVector transProb = transition->TransitionProbabilities(); 320 G4double totalRadTransProb = 0; 321 322 for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1 323 { 324 totalRadTransProb = totalRadTransProb + transProb[j]; 325 } 326 return totalRadTransProb; 327 328 } 329 else { 330 G4Exception("G4RDAtomicTransitionManager::TotalRadiativeTransitionProbability()", 331 "InvalidCondition", FatalException, "Shell not found!" ); 332 return 0; 333 334 } 335 } 336 else{ 337 G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; 338 G4cout << "Absorbed enrgy deposited locally" << G4endl; 339 340 // G4Exception("G4RDAtomicTransitionManager:Z not found"); 341 342 return 0; 343 } 344 } 345 346 G4double G4RDAtomicTransitionManager::TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex) 347 348 { 349 350 std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::iterator pos; 351 352 pos = transitionTable.find(Z); 353 354 if (pos!= transitionTable.end()){ 355 356 std::vector<G4RDFluoTransition*> v = (*pos).second; 357 358 359 if (shellIndex<v.size()){ 360 361 G4RDFluoTransition* transition=v[shellIndex]; 362 G4DataVector transProb = transition->TransitionProbabilities(); 363 G4double totalRadTransProb = 0; 364 365 for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1 366 { 367 totalRadTransProb = totalRadTransProb + transProb[j]; 368 } 369 370 G4double totalNonRadTransProb= (1 - totalRadTransProb); 371 372 return totalNonRadTransProb; } 373 374 else { 375 G4Exception("G4RDAtomicTransitionManager::TotalNonRadiativeTransitionProbability()", 376 "InvalidCondition", FatalException, "Shell not found!"); 377 return 0; 378 } 379 } 380 else{ 381 G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl; 382 G4cout << "Absorbed enrgy deposited locally" << G4endl; 383 384 // G4Exception("G4RDAtomicTransitionManager:Z not found"); 385 return 0; 386 } 387 } 388 389 390 391 392 393 394 395 396 397 398