Ignore:
Timestamp:
Jun 18, 2010, 11:42:07 AM (14 years ago)
Author:
garnier
Message:

update geant4-09-04-beta-cand-01 interfaces-V09-03-09 vis-V09-03-08

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/materials/src/G4AtomicShells.cc

    r1196 r1315  
    2525//
    2626//
    27 // $Id: G4AtomicShells.cc,v 1.7 2006/10/17 15:15:46 vnivanch Exp $
    28 // GEANT4 tag $Name: materials-V09-02-18 $
     27// $Id: G4AtomicShells.cc,v 1.8 2010/04/30 13:09:22 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-04-beta-cand-01 $
    2929//
    3030//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
     
    3434// 19-07-04, add a protection in GetNumberOfShells(), mma
    3535// 11-02-05, GetNumberOfElectrons(Z,ShellNb), V.Ivanchenko
     36// 30-04-10, added fIndexOfShells, V.Ivanchenko
    3637
    3738//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
     
    4445
    4546const G4int
    46 G4AtomicShells::fNumberOfShells[101] =
     47G4AtomicShells::fNumberOfShells[101] = 
    4748{
    4849 0 ,  // nonexisting zero element
     
    7475// The total shell number is:
    7576// 1 + G4AtomicShells::TotalNumberOfShells(100) = 1 + 1539 = 1540
     77
     78//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
     79
     80const G4int   
     81G4AtomicShells::fIndexOfShells[101] =
     82  {    0,
     83       1,    2,    3,    5,    7,   10,   13,   17,   21,   24, 
     84      28,   33,   38,   44,   50,   56,   62,   68,   75,   83, 
     85      91,  100,  109,  118,  127,  136,  145,  154,  164,  174, 
     86     184,  195,  206,  217,  228,  239,  251,  264,  277,  291, 
     87     305,  319,  333,  347,  361,  375,  390,  405,  420,  436, 
     88     452,  468,  484,  500,  517,  535,  553,  572,  591,  610, 
     89     629,  648,  667,  686,  706,  725,  744,  763,  782,  801, 
     90     821,  842,  863,  884,  905,  926,  947,  968,  989, 1011, 
     91    1033, 1056, 1079, 1102, 1125, 1149, 1173, 1198, 1223, 1249, 
     92    1275, 1302, 1329, 1356, 1382, 1408, 1435, 1462, 1488, 1514
     93  };
    7694
    7795//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.... ....oooOO0OOooo....
     
    729747G4AtomicShells::GetNumberOfShells(G4int Z) 
    730748{
    731   assert (Z>=1 && Z<=101);
     749  assert (Z>0 && Z<101);
    732750  return fNumberOfShells[Z];
    733751}
     
    738756G4AtomicShells::GetBindingEnergy(G4int Z, G4int ShellNb)
    739757{
    740   assert (Z>=1 && Z<=101 && ShellNb<fNumberOfShells[Z]);
    741  
    742   G4int indice = 1;
    743   for (G4int z = 1 ; z < Z ; z++) indice += fNumberOfShells[z];
    744   indice += ShellNb; 
    745   return fBindingEnergies[indice]*eV;
     758  assert (Z>0 && Z<101 && ShellNb<fNumberOfShells[Z]);
     759  return fBindingEnergies[fIndexOfShells[Z] + ShellNb]*CLHEP::eV;
    746760}
    747761
     
    751765G4AtomicShells::GetNumberOfElectrons(G4int Z, G4int ShellNb)
    752766{
    753   assert (Z>=1 && Z<=101 && ShellNb<fNumberOfShells[Z]);
    754  
    755   G4int indice = 1;
    756   for (G4int z = 1 ; z < Z ; z++) indice += fNumberOfShells[z];
    757   indice += ShellNb; 
    758   return fNumberOfElectrons[indice];
     767  assert (Z>0 && Z<101 && ShellNb<fNumberOfShells[Z]);
     768  return fNumberOfElectrons[fIndexOfShells[Z] + ShellNb];
    759769}
    760770
     
    763773G4double G4AtomicShells::GetTotalBindingEnergy (G4int Z)
    764774{
    765   assert (Z>=1 && Z<=101);
     775  assert (Z>=1 && Z<101);
    766776 
    767   G4int idx = 1;
    768   for (G4int z = 1 ; z < Z ; z++) idx += fNumberOfShells[z];
     777  G4int idx = fIndexOfShells[Z];
     778  G4int idxmax = idx +  fNumberOfShells[Z];
    769779  G4double energy = 0.0;
    770   G4int idxmax = idx +  fNumberOfShells[Z];
    771   for (G4int i=idx; i<idxmax; i++) {energy += fBindingEnergies[i];}
    772   return energy*eV;
     780  for (G4int i=idx; i<idxmax; ++i) {energy += fBindingEnergies[i];}
     781  return energy*CLHEP::eV;
    773782}
    774783
Note: See TracChangeset for help on using the changeset viewer.