Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:06

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 //
0028 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
0029 //          Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
0030 //
0031 // History:
0032 // -----------
0033 // 16 Sep 2001 E. Guardincerri  First Committed to cvs
0034 //
0035 // -------------------------------------------------------------------
0036 
0037 #include "G4RDAtomicTransitionManager.hh"
0038 
0039 G4RDAtomicTransitionManager::G4RDAtomicTransitionManager(G4int minZ, G4int maxZ, 
0040   G4int limitInfTable,G4int limitSupTable)
0041   :zMin(minZ), 
0042   zMax(maxZ),
0043   infTableLimit(limitInfTable),
0044   supTableLimit(limitSupTable)
0045 {
0046   // infTableLimit is initialized to 6 because EADL lacks data for Z<=5
0047   G4RDShellData* shellManager = new G4RDShellData;
0048 
0049   // initialization of the data for auger effect
0050   
0051   augerData = new G4RDAugerData;
0052 
0053   shellManager->LoadData("/fluor/binding");
0054   
0055   // Fills shellTable with the data from EADL, identities and binding 
0056   // energies of shells
0057   for (G4int Z = zMin; Z<= zMax; Z++)
0058     {
0059       std::vector<G4RDAtomicShell*> vectorOfShells;  
0060       size_t shellIndex = 0; 
0061 
0062       size_t numberOfShells=shellManager->NumberOfShells(Z);
0063       for (shellIndex = 0; shellIndex<numberOfShells; shellIndex++) 
0064     { 
0065       G4int shellId = shellManager->ShellId(Z,shellIndex);
0066       G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex);
0067      
0068       G4RDAtomicShell * shell = new G4RDAtomicShell(shellId,bindingEnergy);
0069     
0070       vectorOfShells.push_back(shell);
0071     }
0072     
0073       //     shellTable.insert(std::make_pair(Z, vectorOfShells));
0074       shellTable[Z] = vectorOfShells;
0075     }
0076   
0077   // Fills transitionTable with the data from EADL, identities, transition 
0078   // energies and transition probabilities
0079   for (G4int Znum= infTableLimit; Znum<=supTableLimit; Znum++)
0080     {  G4RDFluoData* fluoManager = new G4RDFluoData;
0081     std::vector<G4RDFluoTransition*> vectorOfTransitions;
0082     fluoManager->LoadData(Znum);
0083     
0084     size_t numberOfVacancies = fluoManager-> NumberOfVacancies();
0085     
0086     for (size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies;  vacancyIndex++)
0087       
0088       {
0089     std::vector<G4int>  vectorOfIds;
0090     G4DataVector vectorOfEnergies;
0091     G4DataVector vectorOfProbabilities;
0092     
0093     G4int finalShell = fluoManager->VacancyId(vacancyIndex);
0094     size_t numberOfTransitions = fluoManager->NumberOfTransitions(vacancyIndex);
0095     for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions;
0096          origShellIndex++)
0097         
0098       {
0099         
0100         G4int originatingShellId = fluoManager->StartShellId(origShellIndex,vacancyIndex);
0101         
0102         vectorOfIds.push_back(originatingShellId);
0103         
0104         G4double transitionEnergy = fluoManager->StartShellEnergy(origShellIndex,vacancyIndex);
0105         vectorOfEnergies.push_back(transitionEnergy);
0106         G4double transitionProbability = fluoManager->StartShellProb(origShellIndex,vacancyIndex);
0107         vectorOfProbabilities.push_back(transitionProbability);
0108       }
0109       G4RDFluoTransition * transition = new G4RDFluoTransition (finalShell,vectorOfIds,
0110                                     vectorOfEnergies,vectorOfProbabilities);
0111       vectorOfTransitions.push_back(transition); 
0112       }
0113     //      transitionTable.insert(std::make_pair(Znum, vectorOfTransitions));
0114     transitionTable[Znum] = vectorOfTransitions;
0115       
0116       delete fluoManager;
0117     }
0118   delete shellManager;
0119 }
0120 
0121 G4RDAtomicTransitionManager::~G4RDAtomicTransitionManager()
0122   
0123 { 
0124 
0125   delete augerData;
0126 
0127 std::map<G4int,std::vector<G4RDAtomicShell*>,std::less<G4int> >::iterator pos;
0128  
0129  for (pos = shellTable.begin(); pos != shellTable.end(); pos++){
0130    
0131    std::vector< G4RDAtomicShell*>vec = (*pos).second;
0132    
0133    G4int vecSize=vec.size();
0134    
0135    for (G4int i=0; i< vecSize; i++){
0136      G4RDAtomicShell* shell = vec[i];
0137      delete shell;     
0138    }
0139    
0140  }
0141  
0142  std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::iterator ppos;
0143  
0144  for (ppos = transitionTable.begin(); ppos != transitionTable.end(); ppos++){
0145    
0146    std::vector<G4RDFluoTransition*>vec = (*ppos).second;
0147    
0148    G4int vecSize=vec.size();
0149    
0150    for (G4int i=0; i< vecSize; i++){
0151      G4RDFluoTransition* transition = vec[i];
0152      delete transition;      
0153    }
0154    
0155  }   
0156  
0157 }
0158 
0159 G4RDAtomicTransitionManager* G4RDAtomicTransitionManager::instance = 0;
0160 
0161 G4RDAtomicTransitionManager* G4RDAtomicTransitionManager::Instance()
0162 {
0163   if (instance == 0)
0164     {
0165       instance = new G4RDAtomicTransitionManager;
0166      
0167     }
0168   return instance;
0169 }
0170 
0171 
0172 G4RDAtomicShell* G4RDAtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const
0173 { 
0174   std::map<G4int,std::vector<G4RDAtomicShell*>,std::less<G4int> >::const_iterator pos;
0175   
0176   pos = shellTable.find(Z);
0177   
0178   if (pos!= shellTable.end())
0179     {
0180       std::vector<G4RDAtomicShell*> v = (*pos).second;
0181       if (shellIndex<v.size())
0182     {
0183       return(v[shellIndex]);
0184     }
0185       else 
0186     {
0187       size_t lastShell = v.size();
0188       G4cout << "G4RDAtomicTransitionManager::Shell - Z = " 
0189          << Z << ", shellIndex = " << shellIndex 
0190          << " not found; number of shells = " << lastShell << G4endl;
0191       //  G4Exception("G4RDAtomicTransitionManager:shell not found");
0192       if (lastShell > 0)
0193         {
0194           return v[lastShell - 1];
0195         }
0196       else
0197         {       
0198           return 0;
0199         }
0200     }
0201     }
0202   else
0203     {
0204       G4Exception("G4RDAtomicTransitionManager::Shell()",
0205                   "InvalidSetup", FatalException, "Z not found!");
0206       return 0;
0207     } 
0208 }
0209 
0210 // This function gives, upon Z and the Index of the initial shell where te vacancy is, 
0211 // the radiative transition that can happen (originating shell, energy, probability)
0212 
0213 const G4RDFluoTransition* G4RDAtomicTransitionManager::ReachableShell(G4int Z,size_t shellIndex) const
0214 {
0215   std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::const_iterator pos;
0216   pos = transitionTable.find(Z);
0217   if (pos!= transitionTable.end())
0218     {
0219       std::vector<G4RDFluoTransition*> v = (*pos).second;      
0220       if (shellIndex < v.size()) return(v[shellIndex]);
0221       else {
0222     G4Exception("G4RDAtomicTransitionManager::ReachableShell()",
0223                     "InvalidCondition", FatalException,
0224                     "Reachable shell not found!");
0225     return 0;
0226       }
0227   }
0228   else{
0229     G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
0230     G4cout << "Absorbed enrgy deposited locally" << G4endl;
0231 
0232     //    G4Exception("G4RDAtomicTransitionManager:Z not found");
0233     return 0;
0234   } 
0235 }
0236 
0237 const G4RDAugerTransition* G4RDAtomicTransitionManager::ReachableAugerShell(G4int Z, G4int vacancyShellIndex) const
0238 {
0239   
0240   G4RDAugerTransition* augerTransition = augerData->GetAugerTransition(Z,vacancyShellIndex);
0241   return augerTransition;
0242 }
0243 
0244 
0245 
0246 G4int G4RDAtomicTransitionManager::NumberOfShells (G4int Z) const
0247 {
0248 
0249 std::map<G4int,std::vector<G4RDAtomicShell*>,std::less<G4int> >::const_iterator pos;
0250 
0251   pos = shellTable.find(Z);
0252 
0253   if (pos!= shellTable.end()){
0254 
0255     std::vector<G4RDAtomicShell*> v = (*pos).second;
0256 
0257     return v.size();
0258   }
0259 
0260   else{
0261     G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
0262     G4cout << "Absorbed enrgy deposited locally" << G4endl;
0263 
0264     //    G4Exception("G4RDAtomicTransitionManager:Z not found");
0265     return 0;
0266   } 
0267 }
0268 
0269 // This function returns the number of possible radiative transitions for the atom with atomic number Z
0270 // i.e. the number of shell in wich a vacancy can be filled with a radiative transition 
0271 
0272 G4int G4RDAtomicTransitionManager::NumberOfReachableShells(G4int Z) const
0273 {
0274 std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::const_iterator pos;
0275 
0276   pos = transitionTable.find(Z);
0277 
0278   if (pos!= transitionTable.end())
0279     {
0280       std::vector<G4RDFluoTransition*> v = (*pos).second;
0281       return v.size();
0282     }
0283   else
0284     {
0285       G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
0286       G4cout << "Absorbed enrgy deposited locally" << G4endl;
0287 
0288       //    G4Exception("G4RDAtomicTransitionManager:Z not found");
0289       return 0;
0290     } 
0291 }
0292 
0293 // This function returns the number of possible NON-radiative transitions for the atom with atomic number Z
0294 // i.e. the number of shell in wich a vacancy can be filled with a NON-radiative transition 
0295 
0296 G4int G4RDAtomicTransitionManager::NumberOfReachableAugerShells(G4int Z)const 
0297 {
0298   G4int n = augerData->NumberOfVacancies(Z);
0299   return n;
0300 }
0301 
0302 
0303 
0304 G4double G4RDAtomicTransitionManager::TotalRadiativeTransitionProbability(G4int Z, 
0305                                     size_t shellIndex)
0306 
0307 {
0308 std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::iterator pos;
0309 
0310   pos = transitionTable.find(Z);
0311 
0312   if (pos!= transitionTable.end())
0313     {
0314       std::vector<G4RDFluoTransition*> v = (*pos).second;
0315       
0316     if (shellIndex < v.size())
0317       {
0318     G4RDFluoTransition* transition = v[shellIndex];
0319     G4DataVector transProb = transition->TransitionProbabilities();
0320     G4double totalRadTransProb = 0;
0321     
0322     for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1
0323     {
0324       totalRadTransProb = totalRadTransProb + transProb[j];
0325     }
0326       return totalRadTransProb;   
0327       
0328     }
0329     else {
0330       G4Exception("G4RDAtomicTransitionManager::TotalRadiativeTransitionProbability()",
0331                   "InvalidCondition", FatalException, "Shell not found!" );
0332       return 0;
0333       
0334     }
0335   }
0336   else{
0337     G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
0338     G4cout << "Absorbed enrgy deposited locally" << G4endl;
0339 
0340     //    G4Exception("G4RDAtomicTransitionManager:Z not found");
0341 
0342     return 0;
0343   } 
0344 }
0345 
0346 G4double G4RDAtomicTransitionManager::TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex)
0347 
0348 {
0349 
0350   std::map<G4int,std::vector<G4RDFluoTransition*>,std::less<G4int> >::iterator pos;
0351   
0352   pos = transitionTable.find(Z);
0353   
0354   if (pos!= transitionTable.end()){
0355     
0356     std::vector<G4RDFluoTransition*> v = (*pos).second;
0357   
0358     
0359     if (shellIndex<v.size()){
0360 
0361       G4RDFluoTransition* transition=v[shellIndex];
0362       G4DataVector transProb = transition->TransitionProbabilities();
0363       G4double totalRadTransProb = 0;
0364       
0365       for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1
0366     {
0367       totalRadTransProb = totalRadTransProb + transProb[j];
0368     }
0369       
0370       G4double totalNonRadTransProb= (1 - totalRadTransProb);
0371       
0372       return totalNonRadTransProb;    }
0373     
0374     else {
0375       G4Exception("G4RDAtomicTransitionManager::TotalNonRadiativeTransitionProbability()",
0376                   "InvalidCondition", FatalException, "Shell not found!");
0377       return 0;
0378     }
0379   }
0380   else{
0381     G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
0382     G4cout << "Absorbed enrgy deposited locally" << G4endl;
0383 
0384     //    G4Exception("G4RDAtomicTransitionManager:Z not found");
0385     return 0;
0386   } 
0387 }
0388 
0389 
0390 
0391 
0392 
0393 
0394 
0395 
0396 
0397