G4PenelopeIonisationCrossSection Class Reference

#include <G4PenelopeIonisationCrossSection.hh>

Inheritance diagram for G4PenelopeIonisationCrossSection:

G4VhShellCrossSection

Public Member Functions

 G4PenelopeIonisationCrossSection ()
 Constructor.
 ~G4PenelopeIonisationCrossSection ()
 Destructor. Clean all tables.
std::vector< G4doubleGetCrossSection (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)
G4double CrossSection (G4int Z, G4AtomicShellEnumerator shell, G4double incidentEnergy, G4double mass, const G4Material *mat)
std::vector< G4doubleProbabilities (G4int Z, G4double incidentEnergy, G4double mass, G4double deltaEnergy, const G4Material *mat)
void SetVerbosityLevel (G4int vl)
 Getter/setter for the verbosity level.
G4int GetVerbosityLevel ()

Detailed Description

Definition at line 58 of file G4PenelopeIonisationCrossSection.hh.


Constructor & Destructor Documentation

G4PenelopeIonisationCrossSection::G4PenelopeIonisationCrossSection (  ) 

Constructor.

NOTICE: working only for e- at the moment (no interface available for e+)

Definition at line 46 of file G4PenelopeIonisationCrossSection.cc.

References G4PenelopeOscillatorManager::GetOscillatorManager(), and G4AtomicTransitionManager::Instance().

00046                                                                    : 
00047   G4VhShellCrossSection("Penelope"),shellIDTable(0),
00048   theCrossSectionHandler(0)
00049 { 
00050   oscManager = G4PenelopeOscillatorManager::GetOscillatorManager();
00051   nMaxLevels = 9;
00052 
00053   // Verbosity scale:
00054   // 0 = nothing
00055   // 1 = calculation of cross sections, file openings, sampling of atoms
00056   // 2 = entering in methods
00057   verboseLevel = 0;
00058 
00059   fLowEnergyLimit  = 10.0*eV;
00060   fHighEnergyLimit = 100.0*GeV;
00061 
00062   transitionManager = G4AtomicTransitionManager::Instance();
00063 }

G4PenelopeIonisationCrossSection::~G4PenelopeIonisationCrossSection (  ) 

Destructor. Clean all tables.

Definition at line 67 of file G4PenelopeIonisationCrossSection.cc.

00068 {
00069   if (theCrossSectionHandler)
00070     delete theCrossSectionHandler;
00071 }


Member Function Documentation

G4double G4PenelopeIonisationCrossSection::CrossSection ( G4int  Z,
G4AtomicShellEnumerator  shell,
G4double  incidentEnergy,
G4double  mass,
const G4Material mat 
) [virtual]

Purely virtual method from the base interface. Returns the cross section for the given shell in the element Z of material mat at the specified energy

Implements G4VhShellCrossSection.

Definition at line 75 of file G4PenelopeIonisationCrossSection.cc.

References G4Electron::Electron(), FatalException, G4cout, G4endl, G4Exception(), G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple(), G4PenelopeOscillator::GetIonisationEnergy(), G4Material::GetName(), G4PenelopeOscillatorManager::GetNumberOfZAtomsPerMolecule(), G4PenelopeOscillatorManager::GetOscillatorIonisation(), G4PenelopeOscillator::GetParentZ(), G4PenelopeOscillator::GetResonanceEnergy(), G4PenelopeCrossSection::GetShellCrossSection(), G4PenelopeOscillator::GetShellFlag(), JustWarning, and G4AtomicTransitionManager::NumberOfShells().

Referenced by GetCrossSection().

00080 {
00081   if (verboseLevel > 1)    
00082     G4cout << "Entering in method G4PenelopeIonisationCrossSection::CrossSection()" << G4endl;
00083         
00084   G4double cross = 0.;
00085 
00086   //Material pointer is not available
00087   if (!material)
00088     {
00089       //CRASH!
00090       G4ExceptionDescription ed;
00091       ed << "The method has been called with a NULL G4Material pointer" << G4endl;
00092       G4Exception("G4PenelopeIonisationCrossSection::CrossSection()","em2042",
00093                   FatalException,ed);
00094       return cross;
00095     }
00096 
00097   if (!theCrossSectionHandler)
00098     theCrossSectionHandler = new G4PenelopeIonisationXSHandler();
00099 
00100   G4int nmax = std::min(nMaxLevels,transitionManager->NumberOfShells(Z));
00101 
00102   if(G4int(shell) < nmax && 
00103      incidentEnergy >= fLowEnergyLimit && incidentEnergy <= fHighEnergyLimit) 
00104     {
00105       //The shells in Penelope are organized per *material*, rather than per 
00106       //element, so given a material one has to find the proper index for the 
00107       //given Z and shellID. An appropriate lookup table is used to avoid 
00108       //recalculation.
00109       G4int index = FindShellIDIndex(material,Z,shell);
00110 
00111       //Index is not available!
00112       if (index < 0)
00113         return cross;
00114 
00115       G4PenelopeCrossSection* theXS = 
00116         theCrossSectionHandler->GetCrossSectionTableForCouple(G4Electron::Electron(),
00117                                                               material,
00118                                                               0.);
00119 
00120       //Cross check that everything is fine:
00121       G4PenelopeOscillator* theOsc = oscManager->GetOscillatorIonisation(material,index);
00122       if (theOsc->GetParentZ() != Z || theOsc->GetShellFlag()-1 != G4int(shell))
00123         {
00124           //something went wrong!
00125           G4ExceptionDescription ed;
00126           ed << "There is something wrong here: it looks like the index is wrong" << G4endl;
00127           ed << "Requested: shell " << G4int(shell) << " and Z = " << Z << G4endl;
00128           ed << "Retrieved: " << theOsc->GetShellFlag()-1 << " and Z = " << theOsc->GetParentZ() << G4endl;       
00129           G4Exception("G4PenelopeIonisationCrossSection::CrossSection()","em2043",
00130                       JustWarning,ed);
00131           return cross;
00132         }
00133 
00134 
00135       G4double crossPerMolecule = (theXS) ? theXS->GetShellCrossSection(index,incidentEnergy) : 0.;
00136 
00137       //Now it must be converted in cross section per atom. I need the number of 
00138       //atoms of the given Z per molecule.
00139       G4double atomsPerMolec = oscManager->GetNumberOfZAtomsPerMolecule(material,Z);
00140       if (atomsPerMolec)
00141         cross = crossPerMolecule/atomsPerMolec;
00142      
00143 
00144       if (verboseLevel > 0)
00145         {
00146           G4cout << "Cross section of shell " << G4int(shell) << " and Z= " << Z;
00147           G4cout << " of material: " << material->GetName() << " and energy = " << incidentEnergy/keV << " keV" << G4endl;
00148           G4cout << "--> " << cross/barn << " barn" << G4endl;
00149           G4cout << "Shell binding energy: " << theOsc->GetIonisationEnergy()/eV << " eV;" ;
00150           G4cout << " resonance energy: " << theOsc->GetResonanceEnergy()/eV << "eV" << G4endl;
00151            if (verboseLevel > 2)
00152              {
00153                G4cout << "Cross section per molecule: " << crossPerMolecule/barn << " barn" << G4endl;
00154                G4cout << "Atoms " << Z << " per molecule: " << atomsPerMolec << G4endl;
00155              }
00156         }     
00157     }  
00158   
00159   return cross;
00160 }

std::vector< G4double > G4PenelopeIonisationCrossSection::GetCrossSection ( G4int  Z,
G4double  incidentEnergy,
G4double  mass,
G4double  deltaEnergy,
const G4Material mat 
) [virtual]

Purely virtual method from the base interface. Returns the cross section for all levels of element Z in material mat at the given energy

Implements G4VhShellCrossSection.

Definition at line 164 of file G4PenelopeIonisationCrossSection.cc.

References CrossSection(), and G4AtomicTransitionManager::NumberOfShells().

Referenced by Probabilities().

00168 {
00169   G4int nmax = std::min(nMaxLevels,transitionManager->NumberOfShells(Z));
00170   std::vector<G4double> vec(nmax,0.0); 
00171   for(G4int i=0; i<nmax; ++i) {
00172     vec[i] = CrossSection(Z, G4AtomicShellEnumerator(i), kinEnergy,0.,mat); 
00173   }
00174   return vec;
00175 }

G4int G4PenelopeIonisationCrossSection::GetVerbosityLevel (  )  [inline]

Definition at line 95 of file G4PenelopeIonisationCrossSection.hh.

00095 {return verboseLevel;};

std::vector< G4double > G4PenelopeIonisationCrossSection::Probabilities ( G4int  Z,
G4double  incidentEnergy,
G4double  mass,
G4double  deltaEnergy,
const G4Material mat 
) [virtual]

Purely virtual method from the base interface. Returns the shell ionisation probabilities for the given Z in the material mat at the specified energy.

Implements G4VhShellCrossSection.

Definition at line 180 of file G4PenelopeIonisationCrossSection.cc.

References GetCrossSection(), and CLHEP::detail::n.

00185 {
00186   std::vector<G4double> vec = GetCrossSection(Z, kinEnergy,0,0,mat);
00187   size_t n = vec.size();
00188   size_t i=0;
00189   G4double sum = 0.0;
00190   for(i=0; i<n; ++i) { sum += vec[i]; }
00191   if(sum > 0.0) { 
00192     sum = 1.0/sum; 
00193     for(i=0; i<n; ++i) { vec[i] = vec[i]*sum; }
00194   }
00195   return vec;
00196 }

void G4PenelopeIonisationCrossSection::SetVerbosityLevel ( G4int  vl  )  [inline]

Getter/setter for the verbosity level.

Definition at line 94 of file G4PenelopeIonisationCrossSection.hh.

00094 {verboseLevel = vl;};


The documentation for this class was generated from the following files:
Generated on Mon May 27 17:52:52 2013 for Geant4 by  doxygen 1.4.7