G4PenelopeIonisationXSHandler Class Reference

#include <G4PenelopeIonisationXSHandler.hh>


Public Member Functions

 G4PenelopeIonisationXSHandler (size_t nBins=200)
virtual ~G4PenelopeIonisationXSHandler ()
 Destructor. Clean all tables.
G4double GetDensityCorrection (const G4Material *, G4double energy)
 Returns the density coeection for the material at the given energy.
G4PenelopeCrossSectionGetCrossSectionTableForCouple (const G4ParticleDefinition *, const G4Material *, G4double cut)
void SetVerboseLevel (G4int vl)
 Setter for the verbosity level.


Detailed Description

Definition at line 60 of file G4PenelopeIonisationXSHandler.hh.


Constructor & Destructor Documentation

G4PenelopeIonisationXSHandler::G4PenelopeIonisationXSHandler ( size_t  nBins = 200  ) 

Constructor. nBins is the number of intervals in the energy grid. By default the energy grid goes from 100 eV to 100 GeV.

Definition at line 47 of file G4PenelopeIonisationXSHandler.cc.

References G4PenelopeOscillatorManager::GetOscillatorManager().

00048   :XSTableElectron(0),XSTablePositron(0),
00049    theDeltaTable(0),energyGrid(0)
00050 {
00051   nBins = nb;
00052   G4double LowEnergyLimit = 100.0*eV;
00053   G4double HighEnergyLimit = 100.0*GeV;
00054   oscManager = G4PenelopeOscillatorManager::GetOscillatorManager();
00055   XSTableElectron = new 
00056     std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>;
00057   XSTablePositron = new 
00058     std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>;
00059 
00060   theDeltaTable = new std::map<const G4Material*,G4PhysicsFreeVector*>;
00061   energyGrid = new G4PhysicsLogVector(LowEnergyLimit,
00062                                       HighEnergyLimit, 
00063                                       nBins-1); //one hidden bin is added
00064 
00065   verboseLevel = 0;
00066 }

G4PenelopeIonisationXSHandler::~G4PenelopeIonisationXSHandler (  )  [virtual]

Destructor. Clean all tables.

Definition at line 70 of file G4PenelopeIonisationXSHandler.cc.

References G4cout, and G4endl.

00071 {
00072   std::map< std::pair<const G4Material*,G4double>, G4PenelopeCrossSection*>::iterator i;
00073   if (XSTableElectron)
00074     {
00075       for (i=XSTableElectron->begin(); i != XSTableElectron->end(); i++)
00076         {
00077           G4PenelopeCrossSection* tab = i->second;
00078           delete tab;
00079         }
00080       delete XSTableElectron;
00081       XSTableElectron = 0;
00082     }
00083 
00084   if (XSTablePositron)
00085     {
00086       for (i=XSTablePositron->begin(); i != XSTablePositron->end(); i++)
00087         {
00088           G4PenelopeCrossSection* tab = i->second;
00089           delete tab;
00090         }
00091       delete XSTablePositron;
00092       XSTablePositron = 0;
00093     }
00094 
00095   std::map<const G4Material*,G4PhysicsFreeVector*>::iterator k;
00096   if (theDeltaTable)
00097     {
00098       for (k=theDeltaTable->begin();k!=theDeltaTable->end();k++)        
00099         delete k->second;
00100       delete theDeltaTable;
00101       theDeltaTable = 0;
00102     }
00103     
00104   if (energyGrid)
00105     delete energyGrid;
00106 
00107   if (verboseLevel > 2)
00108     G4cout << "G4PenelopeIonisationXSHandler. Tables have been cleared" 
00109            << G4endl;
00110 }


Member Function Documentation

G4PenelopeCrossSection * G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple ( const G4ParticleDefinition ,
const G4Material ,
G4double  cut 
)

Returns the table of cross sections for the given particle, given material and given cut as a G4PenelopeCrossSection* pointer.

Definition at line 115 of file G4PenelopeIonisationXSHandler.cc.

References G4Electron::Electron(), FatalException, G4endl, G4Exception(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), and G4Positron::Positron().

Referenced by G4PenelopeIonisationModel::ComputeDEDXPerVolume(), G4PenelopeIonisationCrossSection::CrossSection(), and G4PenelopeIonisationModel::CrossSectionPerVolume().

00118 {
00119   if (part != G4Electron::Electron() && part != G4Positron::Positron())
00120     {
00121       G4ExceptionDescription ed;
00122       ed << "Invalid particle: " << part->GetParticleName() << G4endl;
00123       G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
00124                   "em0001",FatalException,ed);
00125       return NULL;
00126     }
00127 
00128   if (part == G4Electron::Electron())
00129     {
00130       if (!XSTableElectron)
00131         {
00132           G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
00133                       "em0028",FatalException,  
00134                       "The Cross Section Table for e- was not initialized correctly!");
00135           return NULL;
00136         }
00137       std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
00138       if (XSTableElectron->count(theKey)) //table already built 
00139         return XSTableElectron->find(theKey)->second;
00140       else
00141         {
00142           BuildXSTable(mat,cut,part);
00143           if (XSTableElectron->count(theKey)) //now it should be ok!
00144             return XSTableElectron->find(theKey)->second;
00145           else
00146             {
00147               G4ExceptionDescription ed;
00148               ed << "Unable to build e- table for " << mat->GetName() << G4endl;
00149               G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
00150                           "em0029",FatalException,ed);     
00151             }
00152         }
00153     }
00154 
00155   if (part == G4Positron::Positron())
00156     {
00157       if (!XSTablePositron)
00158         {
00159           G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
00160                       "em0028",FatalException,  
00161                       "The Cross Section Table for e+ was not initialized correctly!");
00162           return NULL;
00163         }
00164       std::pair<const G4Material*,G4double> theKey = std::make_pair(mat,cut);
00165       if (XSTablePositron->count(theKey)) //table already built 
00166         return XSTablePositron->find(theKey)->second;
00167       else
00168         {
00169           BuildXSTable(mat,cut,part);
00170           if (XSTablePositron->count(theKey)) //now it should be ok!
00171             return XSTablePositron->find(theKey)->second;
00172           else
00173             {
00174               G4ExceptionDescription ed;
00175               ed << "Unable to build e+ table for " << mat->GetName() << G4endl;
00176               G4Exception("G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple()",
00177                           "em0029",FatalException,ed);             
00178             }
00179         }
00180     }
00181   return NULL;
00182 }

G4double G4PenelopeIonisationXSHandler::GetDensityCorrection ( const G4Material ,
G4double  energy 
)

Returns the density coeection for the material at the given energy.

Definition at line 286 of file G4PenelopeIonisationXSHandler.cc.

References FatalException, G4cout, and G4Exception().

00288 {
00289   G4double result = 0;
00290   if (!theDeltaTable)
00291     {
00292       G4Exception("G4PenelopeIonisationXSHandler::GetDensityCorrection()",
00293                   "em2032",FatalException,
00294                   "Delta Table not initialized. Was Initialise() run?");
00295       return 0;
00296     }
00297   if (energy <= 0*eV)
00298     {
00299       G4cout << "G4PenelopeIonisationXSHandler::GetDensityCorrection()" << G4endl;
00300       G4cout << "Invalid energy " << energy/eV << " eV " << G4endl;
00301       return 0;
00302     }
00303   G4double logene = std::log(energy);
00304 
00305   //check if the material has been built
00306   if (!(theDeltaTable->count(mat)))
00307     BuildDeltaTable(mat);
00308 
00309   if (theDeltaTable->count(mat))
00310     {
00311       G4PhysicsFreeVector* vec = theDeltaTable->find(mat)->second;
00312       result = vec->Value(logene); //the table has delta vs. ln(E)      
00313     }
00314   else
00315     {
00316       G4ExceptionDescription ed;      
00317       ed << "Unable to build table for " << mat->GetName() << G4endl;
00318       G4Exception("G4PenelopeIonisationXSHandler::GetDensityCorrection()",
00319                   "em2033",FatalException,ed);
00320     }
00321 
00322   return result;
00323 }

void G4PenelopeIonisationXSHandler::SetVerboseLevel ( G4int  vl  )  [inline]

Setter for the verbosity level.

Definition at line 80 of file G4PenelopeIonisationXSHandler.hh.

Referenced by G4PenelopeIonisationModel::Initialise().

00080 {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