G4AtomicTransitionManager.cc

Go to the documentation of this file.
00001 //
00002 // ********************************************************************
00003 // * License and Disclaimer                                           *
00004 // *                                                                  *
00005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
00006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
00007 // * conditions of the Geant4 Software License,  included in the file *
00008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
00009 // * include a list of copyright holders.                             *
00010 // *                                                                  *
00011 // * Neither the authors of this software system, nor their employing *
00012 // * institutes,nor the agencies providing financial support for this *
00013 // * work  make  any representation or  warranty, express or implied, *
00014 // * regarding  this  software system or assume any liability for its *
00015 // * use.  Please see the license in the file  LICENSE  and URL above *
00016 // * for the full disclaimer and the limitation of liability.         *
00017 // *                                                                  *
00018 // * This  code  implementation is the result of  the  scientific and *
00019 // * technical work of the GEANT4 collaboration.                      *
00020 // * By using,  copying,  modifying or  distributing the software (or *
00021 // * any work based  on the software)  you  agree  to acknowledge its *
00022 // * use  in  resulting  scientific  publications,  and indicate your *
00023 // * acceptance of all terms of the Geant4 Software license.          *
00024 // ********************************************************************
00025 //
00026 //
00027 // $Id: G4AtomicTransitionManager.cc,v 1.2 ????
00028 // GEANT4 tag $Name: not supported by cvs2svn $
00029 //
00030 // Authors: Elena Guardincerri (Elena.Guardincerri@ge.infn.it)
00031 //          Alfonso Mantero (Alfonso.Mantero@ge.infn.it)
00032 //
00033 // History:
00034 // -----------
00035 // 16 Sep 2001 E. Guardincerri  First Committed to cvs
00036 //
00037 // -------------------------------------------------------------------
00038 
00039 #include "G4AtomicTransitionManager.hh"
00040 
00041 G4AtomicTransitionManager::G4AtomicTransitionManager(G4int minZ, G4int maxZ, 
00042   G4int limitInfTable,G4int limitSupTable)
00043   :zMin(minZ), 
00044   zMax(maxZ),
00045   infTableLimit(limitInfTable),
00046   supTableLimit(limitSupTable)
00047 {
00048   // infTableLimit is initialized to 6 because EADL lacks data for Z<=5
00049   G4ShellData* shellManager = new G4ShellData;
00050 
00051   // initialization of the data for auger effect
00052   
00053   augerData = new G4AugerData;
00054 
00055   shellManager->LoadData("/fluor/binding");
00056   
00057   // Fills shellTable with the data from EADL, identities and binding 
00058   // energies of shells
00059   for (G4int Z = zMin; Z<= zMax; Z++)
00060     {
00061       std::vector<G4AtomicShell*> vectorOfShells;  
00062       size_t shellIndex = 0; 
00063 
00064       size_t numberOfShells=shellManager->NumberOfShells(Z);
00065       for (shellIndex = 0; shellIndex<numberOfShells; shellIndex++) 
00066         { 
00067           G4int shellId = shellManager->ShellId(Z,shellIndex);
00068           G4double bindingEnergy = shellManager->BindingEnergy(Z,shellIndex);
00069          
00070           G4AtomicShell * shell = new G4AtomicShell(shellId,bindingEnergy);
00071         
00072           vectorOfShells.push_back(shell);
00073         }
00074     
00075       //     shellTable.insert(std::make_pair(Z, vectorOfShells));
00076       shellTable[Z] = vectorOfShells;
00077     }
00078   
00079   // Fills transitionTable with the data from EADL, identities, transition 
00080   // energies and transition probabilities
00081   for (G4int Znum= infTableLimit; Znum<=supTableLimit; Znum++)
00082     {  G4FluoData* fluoManager = new G4FluoData;
00083     std::vector<G4FluoTransition*> vectorOfTransitions;
00084     fluoManager->LoadData(Znum);
00085     
00086     size_t numberOfVacancies = fluoManager-> NumberOfVacancies();
00087     
00088     for (size_t vacancyIndex = 0; vacancyIndex<numberOfVacancies;  vacancyIndex++)
00089       
00090       {
00091         std::vector<G4int>  vectorOfIds;
00092         G4DataVector vectorOfEnergies;
00093         G4DataVector vectorOfProbabilities;
00094         
00095         G4int finalShell = fluoManager->VacancyId(vacancyIndex);
00096         size_t numberOfTransitions = fluoManager->NumberOfTransitions(vacancyIndex);
00097         for (size_t origShellIndex = 0; origShellIndex < numberOfTransitions;
00098              origShellIndex++)
00099             
00100           {
00101             
00102             G4int originatingShellId = fluoManager->StartShellId(origShellIndex,vacancyIndex);
00103             
00104             vectorOfIds.push_back(originatingShellId);
00105             
00106             G4double transitionEnergy = fluoManager->StartShellEnergy(origShellIndex,vacancyIndex);
00107             vectorOfEnergies.push_back(transitionEnergy);
00108             G4double transitionProbability = fluoManager->StartShellProb(origShellIndex,vacancyIndex);
00109             vectorOfProbabilities.push_back(transitionProbability);
00110           }
00111           G4FluoTransition * transition = new G4FluoTransition (finalShell,vectorOfIds,
00112                                                                     vectorOfEnergies,vectorOfProbabilities);
00113           vectorOfTransitions.push_back(transition); 
00114       }
00115     //      transitionTable.insert(std::make_pair(Znum, vectorOfTransitions));
00116     transitionTable[Znum] = vectorOfTransitions;
00117       
00118       delete fluoManager;
00119     }
00120   delete shellManager;
00121 }
00122 
00123 G4AtomicTransitionManager::~G4AtomicTransitionManager()
00124   
00125 { 
00126 
00127   delete augerData;
00128 
00129 std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::iterator pos;
00130  
00131  for (pos = shellTable.begin(); pos != shellTable.end(); pos++){
00132    
00133    std::vector< G4AtomicShell*>vec = (*pos).second;
00134    
00135    G4int vecSize=vec.size();
00136    
00137    for (G4int i=0; i< vecSize; i++){
00138      G4AtomicShell* shell = vec[i];
00139      delete shell;     
00140    }
00141    
00142  }
00143  
00144  std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator ppos;
00145  
00146  for (ppos = transitionTable.begin(); ppos != transitionTable.end(); ppos++){
00147    
00148    std::vector<G4FluoTransition*>vec = (*ppos).second;
00149    
00150    G4int vecSize=vec.size();
00151    
00152    for (G4int i=0; i< vecSize; i++){
00153          G4FluoTransition* transition = vec[i];
00154          delete transition;      
00155    }
00156    
00157  }   
00158  
00159 }
00160 
00161 G4AtomicTransitionManager* G4AtomicTransitionManager::instance = 0;
00162 
00163 G4AtomicTransitionManager* G4AtomicTransitionManager::Instance()
00164 {
00165   if (instance == 0)
00166     {
00167       instance = new G4AtomicTransitionManager;
00168      
00169     }
00170   return instance;
00171 }
00172 
00173 
00174 G4AtomicShell* G4AtomicTransitionManager::Shell(G4int Z, size_t shellIndex) const
00175 { 
00176   std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
00177   
00178   pos = shellTable.find(Z);
00179   
00180   if (pos!= shellTable.end())
00181     {
00182       std::vector<G4AtomicShell*> v = (*pos).second;
00183       if (shellIndex<v.size())
00184         {
00185           return(v[shellIndex]);
00186         }
00187       else 
00188         {
00189           size_t lastShell = v.size();
00190           G4cout << "G4AtomicTransitionManager::Shell - Z = " 
00191                  << Z << ", shellIndex = " << shellIndex 
00192                  << " not found; number of shells = " << lastShell << G4endl;
00193           //  G4Exception("G4AtomicTransitionManager:shell not found");
00194           if (lastShell > 0)
00195             {
00196               return v[lastShell - 1];
00197             }
00198           else
00199             {       
00200               return 0;
00201             }
00202         }
00203     }
00204   else
00205     {
00206       G4Exception("G4AtomicTransitionManager::Shell()","de0001",FatalErrorInArgument,"Z not found");
00207       return 0;
00208     } 
00209 }
00210 
00211 // This function gives, upon Z and the Index of the initial shell where te vacancy is, 
00212 // the radiative transition that can happen (originating shell, energy, probability)
00213 
00214 const G4FluoTransition* G4AtomicTransitionManager::ReachableShell(G4int Z,size_t shellIndex) const
00215 {
00216   std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
00217   pos = transitionTable.find(Z);
00218   if (pos!= transitionTable.end())
00219     {
00220       std::vector<G4FluoTransition*> v = (*pos).second;      
00221       if (shellIndex < v.size()) return(v[shellIndex]);
00222       else {
00223         G4Exception("G4AtomicTransitionManager::ReachebleShell()","de0002", JustWarning,"Energy Deposited Locally.");
00224         return 0;
00225       }
00226   }
00227   else{
00228     //    G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
00229     //    G4cout << "Absorbed enrgy deposited locally" << G4endl;
00230 
00231     //    G4String pippo = (G4String(Z));
00232 
00233     G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
00234 
00235     G4Exception("G4AtomicTransitionManager::ReachableShell()","de0001",JustWarning,msg);
00236     //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
00237     return 0;
00238   } 
00239 }
00240 
00241 const G4AugerTransition* G4AtomicTransitionManager::ReachableAugerShell(G4int Z, G4int vacancyShellIndex) const
00242 {
00243   
00244   G4AugerTransition* augerTransition = augerData->GetAugerTransition(Z,vacancyShellIndex);
00245   return augerTransition;
00246 }
00247 
00248 
00249 
00250 G4int G4AtomicTransitionManager::NumberOfShells (G4int Z) const
00251 {
00252 
00253 std::map<G4int,std::vector<G4AtomicShell*>,std::less<G4int> >::const_iterator pos;
00254 
00255   pos = shellTable.find(Z);
00256 
00257   if (pos!= shellTable.end()){
00258 
00259     std::vector<G4AtomicShell*> v = (*pos).second;
00260 
00261     return v.size();
00262   }
00263 
00264   else{
00265     //    G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
00266     //    G4cout << "Absorbed enrgy deposited locally" << G4endl;
00267 
00268     G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
00269 
00270     G4Exception("G4AtomicTransitionManager::NumberOfShells()","de0001",JustWarning,msg);
00271 
00272     //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
00273 
00274     return 0;
00275   } 
00276 }
00277 
00278 // This function returns the number of possible radiative transitions for the atom with atomic number Z
00279 // i.e. the number of shell in wich a vacancy can be filled with a radiative transition 
00280 
00281 G4int G4AtomicTransitionManager::NumberOfReachableShells(G4int Z) const
00282 {
00283 std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::const_iterator pos;
00284 
00285   pos = transitionTable.find(Z);
00286 
00287   if (pos!= transitionTable.end())
00288     {
00289       std::vector<G4FluoTransition*> v = (*pos).second;
00290       return v.size();
00291     }
00292   else
00293     {
00294       //      G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
00295       //      G4cout << "Absorbed enrgy deposited locally" << G4endl;
00296       
00297       G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
00298 
00299       G4Exception("G4AtomicTransitionManager::NumberOfReachebleShells()","de0001",JustWarning,msg);
00300 
00301       //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
00302 
00303       return 0;
00304     } 
00305 }
00306 
00307 // This function returns the number of possible NON-radiative transitions for the atom with atomic number Z
00308 // i.e. the number of shell in wich a vacancy can be filled with a NON-radiative transition 
00309 
00310 G4int G4AtomicTransitionManager::NumberOfReachableAugerShells(G4int Z)const 
00311 {
00312   G4int n = augerData->NumberOfVacancies(Z);
00313   return n;
00314 }
00315 
00316 
00317 
00318 G4double G4AtomicTransitionManager::TotalRadiativeTransitionProbability(G4int Z, 
00319                                                                         size_t shellIndex)
00320 
00321 {
00322 std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos;
00323 
00324   pos = transitionTable.find(Z);
00325 
00326   if (pos!= transitionTable.end())
00327     {
00328       std::vector<G4FluoTransition*> v = (*pos).second;
00329       
00330     if (shellIndex < v.size())
00331       {
00332         G4FluoTransition* transition = v[shellIndex];
00333         G4DataVector transProb = transition->TransitionProbabilities();
00334         G4double totalRadTransProb = 0;
00335         
00336         for (size_t j = 0; j<transProb.size(); j++) // AM -- corrected, it was 1
00337         {
00338           totalRadTransProb = totalRadTransProb + transProb[j];
00339         }
00340       return totalRadTransProb;   
00341       
00342     }
00343     else {
00344 
00345       G4Exception("G4AtomicTransitionManager::TotalRadiativeTransitionProbability()","de0002", JustWarning,"Energy Deposited Locally.");
00346       return 0;
00347       
00348     }
00349   }
00350   else{
00351     //G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
00352     //G4cout << "Absorbed enrgy deposited locally" << G4endl;
00353     
00354     G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
00355 
00356     G4Exception("G4AtomicTransitionManager::TotalRadiativeTransitionProbability()","de0001",JustWarning,msg);
00357     //"No deexcitation for Z=" + (G4String(Z))+". Energy Deposited Locally.");
00358 
00359 
00360     return 0;
00361   } 
00362 }
00363 
00364 G4double G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability(G4int Z, size_t shellIndex)
00365 
00366 {
00367 
00368   std::map<G4int,std::vector<G4FluoTransition*>,std::less<G4int> >::iterator pos;
00369   
00370   pos = transitionTable.find(Z);
00371   
00372   if (pos!= transitionTable.end()){
00373     
00374     std::vector<G4FluoTransition*> v = (*pos).second;
00375   
00376     
00377     if (shellIndex<v.size()){
00378 
00379       G4FluoTransition* transition=v[shellIndex];
00380       G4DataVector transProb = transition->TransitionProbabilities();
00381       G4double totalRadTransProb = 0;
00382       
00383       for(size_t j = 0; j<transProb.size(); j++) // AM -- Corrected, was 1
00384         {
00385           totalRadTransProb = totalRadTransProb + transProb[j];
00386         }
00387       
00388       if (totalRadTransProb > 1) {
00389         G4Exception( "G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0003",FatalException,"Total probability mismatch");
00390       return 0;
00391 }
00392       G4double totalNonRadTransProb= (1 - totalRadTransProb);
00393       
00394       return totalNonRadTransProb;    }
00395     
00396     else {
00397 
00398 G4Exception("G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0002", JustWarning,"Energy Deposited Locally.");
00399 
00400       return 0;
00401     }
00402   }
00403   else{
00404     //    G4cout << "G4AtomicTransitionMagare warning: No fluorescence or Auger for Z=" << Z << G4endl;
00405     //    G4cout << "Absorbed enrgy deposited locally" << G4endl;
00406 
00407     G4String msg = "No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.";
00408 
00409     G4Exception("G4AtomicTransitionManager::TotalNonRadiativeTransitionProbability()","de0001",JustWarning,msg);
00410 
00411 //"No deexcitation for Z=" + (G4String(Z))+ ". Energy Deposited Locally.");
00412 
00413     return 0;
00414   } 
00415 }
00416 
00417 
00418 
00419 
00420 
00421 
00422 
00423 
00424 
00425 

Generated on Mon May 27 17:47:41 2013 for Geant4 by  doxygen 1.4.7