Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Attributes
G4PenelopeIonisationModel Class Reference

#include <G4PenelopeIonisationModel.hh>

Inheritance diagram for G4PenelopeIonisationModel:
G4VEmModel

Public Member Functions

 G4PenelopeIonisationModel (const G4ParticleDefinition *p=0, const G4String &processName="PenIoni")
 
virtual ~G4PenelopeIonisationModel ()
 
virtual void Initialise (const G4ParticleDefinition *, const G4DataVector &)
 
virtual void InitialiseLocal (const G4ParticleDefinition *, G4VEmModel *)
 
virtual G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, G4double, G4double, G4double, G4double, G4double)
 
virtual G4double CrossSectionPerVolume (const G4Material *material, const G4ParticleDefinition *theParticle, G4double kineticEnergy, G4double cutEnergy, G4double maxEnergy=DBL_MAX)
 
virtual void SampleSecondaries (std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
 
virtual G4double ComputeDEDXPerVolume (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy)
 
virtual G4double MinEnergyCut (const G4ParticleDefinition *, const G4MaterialCutsCouple *)
 
void SetVerbosityLevel (G4int lev)
 
G4int GetVerbosityLevel ()
 
- Public Member Functions inherited from G4VEmModel
 G4VEmModel (const G4String &nam)
 
virtual ~G4VEmModel ()
 
virtual void InitialiseForMaterial (const G4ParticleDefinition *, const G4Material *)
 
virtual void InitialiseForElement (const G4ParticleDefinition *, G4int Z)
 
virtual G4double ChargeSquareRatio (const G4Track &)
 
virtual G4double GetChargeSquareRatio (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual G4double GetParticleCharge (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual void StartTracking (G4Track *)
 
virtual void CorrectionsAlongStep (const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double &eloss, G4double &niel, G4double length)
 
virtual G4double Value (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy)
 
virtual G4double MinPrimaryEnergy (const G4Material *, const G4ParticleDefinition *, G4double cut=0.0)
 
virtual void SetupForMaterial (const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
 
virtual void DefineForRegion (const G4Region *)
 
void InitialiseElementSelectors (const G4ParticleDefinition *, const G4DataVector &)
 
std::vector
< G4EmElementSelector * > * 
GetElementSelectors ()
 
void SetElementSelectors (std::vector< G4EmElementSelector * > *)
 
G4double ComputeDEDX (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=DBL_MAX)
 
G4double CrossSection (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeMeanFreePath (const G4ParticleDefinition *, G4double kineticEnergy, const G4Material *, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4double ComputeCrossSectionPerAtom (const G4ParticleDefinition *, const G4Element *, G4double kinEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4int SelectIsotopeNumber (const G4Element *)
 
const G4ElementSelectRandomAtom (const G4MaterialCutsCouple *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
const G4ElementSelectRandomAtom (const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy=0.0, G4double maxEnergy=DBL_MAX)
 
G4int SelectRandomAtomNumber (const G4Material *)
 
void SetParticleChange (G4VParticleChange *, G4VEmFluctuationModel *f=0)
 
void SetCrossSectionTable (G4PhysicsTable *, G4bool isLocal)
 
G4ElementDataGetElementData ()
 
G4PhysicsTableGetCrossSectionTable ()
 
G4VEmFluctuationModelGetModelOfFluctuations ()
 
G4VEmAngularDistributionGetAngularDistribution ()
 
void SetAngularDistribution (G4VEmAngularDistribution *)
 
G4double HighEnergyLimit () const
 
G4double LowEnergyLimit () const
 
G4double HighEnergyActivationLimit () const
 
G4double LowEnergyActivationLimit () const
 
G4double PolarAngleLimit () const
 
G4double SecondaryThreshold () const
 
G4bool LPMFlag () const
 
G4bool DeexcitationFlag () const
 
G4bool ForceBuildTableFlag () const
 
G4bool UseAngularGeneratorFlag () const
 
void SetAngularGeneratorFlag (G4bool)
 
void SetHighEnergyLimit (G4double)
 
void SetLowEnergyLimit (G4double)
 
void SetActivationHighEnergyLimit (G4double)
 
void SetActivationLowEnergyLimit (G4double)
 
G4bool IsActive (G4double kinEnergy)
 
void SetPolarAngleLimit (G4double)
 
void SetSecondaryThreshold (G4double)
 
void SetLPMFlag (G4bool val)
 
void SetDeexcitationFlag (G4bool val)
 
void SetForceBuildTable (G4bool val)
 
void SetMasterThread (G4bool val)
 
G4bool IsMaster () const
 
G4double MaxSecondaryKinEnergy (const G4DynamicParticle *dynParticle)
 
const G4StringGetName () const
 
void SetCurrentCouple (const G4MaterialCutsCouple *)
 
const G4ElementGetCurrentElement () const
 

Protected Attributes

G4ParticleChangeForLossfParticleChange
 
const G4ParticleDefinitionfParticle
 
- Protected Attributes inherited from G4VEmModel
G4ElementDatafElementData
 
G4VParticleChangepParticleChange
 
G4PhysicsTablexSectionTable
 
const std::vector< G4double > * theDensityFactor
 
const std::vector< G4int > * theDensityIdx
 
size_t idxTable
 

Additional Inherited Members

- Protected Member Functions inherited from G4VEmModel
G4ParticleChangeForLossGetParticleChangeForLoss ()
 
G4ParticleChangeForGammaGetParticleChangeForGamma ()
 
virtual G4double MaxSecondaryEnergy (const G4ParticleDefinition *, G4double kineticEnergy)
 
const G4MaterialCutsCoupleCurrentCouple () const
 
void SetCurrentElement (const G4Element *)
 

Detailed Description

Definition at line 65 of file G4PenelopeIonisationModel.hh.

Constructor & Destructor Documentation

G4PenelopeIonisationModel::G4PenelopeIonisationModel ( const G4ParticleDefinition p = 0,
const G4String processName = "PenIoni" 
)

Definition at line 70 of file G4PenelopeIonisationModel.cc.

References python.hepunit::eV, G4PenelopeOscillatorManager::GetOscillatorManager(), python.hepunit::GeV, G4VEmModel::SetDeexcitationFlag(), and G4VEmModel::SetHighEnergyLimit().

72  :G4VEmModel(nam),fParticleChange(0),fParticle(0),isInitialised(false),
73  fAtomDeexcitation(0),kineticEnergy1(0.*eV),
74  cosThetaPrimary(1.0),energySecondary(0.*eV),
75  cosThetaSecondary(0.0),targetOscillator(-1),
76  theCrossSectionHandler(0),fLocalTable(false)
77 {
78  fIntrinsicLowEnergyLimit = 100.0*eV;
79  fIntrinsicHighEnergyLimit = 100.0*GeV;
80  // SetLowEnergyLimit(fIntrinsicLowEnergyLimit);
81  SetHighEnergyLimit(fIntrinsicHighEnergyLimit);
82  nBins = 200;
83 
84  if (part)
85  SetParticle(part);
86 
87  //
89  //
90  verboseLevel= 0;
91 
92  // Verbosity scale:
93  // 0 = nothing
94  // 1 = warning for energy non-conservation
95  // 2 = details of energy budget
96  // 3 = calculation of cross sections, file openings, sampling of atoms
97  // 4 = entering in methods
98 
99  // Atomic deexcitation model activated by default
100  SetDeexcitationFlag(true);
101 }
G4VEmModel(const G4String &nam)
Definition: G4VEmModel.cc:65
void SetHighEnergyLimit(G4double)
Definition: G4VEmModel.hh:683
G4ParticleChangeForLoss * fParticleChange
static G4PenelopeOscillatorManager * GetOscillatorManager()
const G4ParticleDefinition * fParticle
void SetDeexcitationFlag(G4bool val)
Definition: G4VEmModel.hh:739
G4PenelopeIonisationModel::~G4PenelopeIonisationModel ( )
virtual

Definition at line 105 of file G4PenelopeIonisationModel.cc.

References G4VEmModel::IsMaster().

106 {
107  if (IsMaster() || fLocalTable)
108  {
109  if (theCrossSectionHandler)
110  delete theCrossSectionHandler;
111  }
112 }
G4bool IsMaster() const
Definition: G4VEmModel.hh:676

Member Function Documentation

G4double G4PenelopeIonisationModel::ComputeCrossSectionPerAtom ( const G4ParticleDefinition ,
G4double  ,
G4double  ,
G4double  ,
G4double  ,
G4double   
)
virtual

Reimplemented from G4VEmModel.

Definition at line 322 of file G4PenelopeIonisationModel.cc.

References G4cout, and G4endl.

328 {
329  G4cout << "*** G4PenelopeIonisationModel -- WARNING ***" << G4endl;
330  G4cout << "Penelope Ionisation model v2008 does not calculate cross section _per atom_ " << G4endl;
331  G4cout << "so the result is always zero. For physics values, please invoke " << G4endl;
332  G4cout << "GetCrossSectionPerVolume() or GetMeanFreePath() via the G4EmCalculator" << G4endl;
333  return 0;
334 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
G4double G4PenelopeIonisationModel::ComputeDEDXPerVolume ( const G4Material material,
const G4ParticleDefinition theParticle,
G4double  kineticEnergy,
G4double  cutEnergy 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 338 of file G4PenelopeIonisationModel.cc.

References G4PenelopeIonisationXSHandler::BuildXSTable(), G4cout, G4endl, G4Exception(), G4PenelopeOscillatorManager::GetAtomsPerMolecule(), G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), G4PenelopeCrossSection::GetSoftStoppingPower(), G4Material::GetTotNbOfAtomsPerVolume(), JustWarning, python.hepunit::keV, python.hepunit::mm, and G4TemplateAutoLock< M, L, U >::unlock().

342 {
343  // Penelope model v2008 to calculate the stopping power for soft inelastic collisions
344  // below the threshold. It makes use of the Generalised Oscillator Strength (GOS)
345  // model from
346  // D. Liljequist, J. Phys. D: Appl. Phys. 16 (1983) 1567
347  //
348  // The stopping power is calculated analytically using the dsigma/dW cross
349  // section from the GOS models, which includes separate contributions from
350  // distant longitudinal collisions, distant transverse collisions and
351  // close collisions. Only the atomic oscillators that come in the play
352  // (according to the threshold) are considered for the calculation.
353  // Differential cross sections have a different form for e+ and e-.
354  //
355  // Fermi density correction is calculated analytically according to
356  // U. Fano, Ann. Rev. Nucl. Sci. 13 (1963),1
357 
358  if (verboseLevel > 3)
359  G4cout << "Calling ComputeDEDX() of G4PenelopeIonisationModel" << G4endl;
360 
361  //Either Initialize() was not called, or we are in a slave and InitializeLocal() was
362  //not invoked
363  if (!theCrossSectionHandler)
364  {
365  //create a **thread-local** version of the table. Used only for G4EmCalculator and
366  //Unit Tests
367  fLocalTable = true;
368  theCrossSectionHandler = new G4PenelopeIonisationXSHandler(nBins);
369  }
370 
371  const G4PenelopeCrossSection* theXS =
372  theCrossSectionHandler->GetCrossSectionTableForCouple(theParticle,material,
373  cutEnergy);
374 
375  if (!theXS)
376  {
377  //If we are here, it means that Initialize() was inkoved, but the MaterialTable was
378  //not filled up. This can happen in a UnitTest or via G4EmCalculator
379  if (verboseLevel > 0)
380  {
381  //Issue a G4Exception (warning) only in verbose mode
383  ed << "Unable to retrieve the cross section table for " << theParticle->GetParticleName() <<
384  " in " << material->GetName() << ", cut = " << cutEnergy/keV << " keV " << G4endl;
385  ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
386  G4Exception("G4PenelopeIonisationModel::ComputeDEDXPerVolume()",
387  "em2038",JustWarning,ed);
388  }
389  //protect file reading via autolock
390  G4AutoLock lock(&PenelopeIonisationModelMutex);
391  theCrossSectionHandler->BuildXSTable(material,cutEnergy,theParticle);
392  lock.unlock();
393  //now it should be ok
394  theXS =
395  theCrossSectionHandler->GetCrossSectionTableForCouple(theParticle,
396  material,
397  cutEnergy);
398  }
399 
400  G4double sPowerPerMolecule = 0.0;
401  if (theXS)
402  sPowerPerMolecule = theXS->GetSoftStoppingPower(kineticEnergy);
403 
404 
405  G4double atomDensity = material->GetTotNbOfAtomsPerVolume();
406  G4double atPerMol = oscManager->GetAtomsPerMolecule(material);
407 
408  G4double moleculeDensity = 0.;
409  if (atPerMol)
410  moleculeDensity = atomDensity/atPerMol;
411 
412  G4double sPowerPerVolume = sPowerPerMolecule*moleculeDensity;
413 
414  if (verboseLevel > 2)
415  {
416  G4cout << "G4PenelopeIonisationModel " << G4endl;
417  G4cout << "Stopping power < " << cutEnergy/keV << " keV at " <<
418  kineticEnergy/keV << " keV = " <<
419  sPowerPerVolume/(keV/mm) << " keV/mm" << G4endl;
420  }
421  return sPowerPerVolume;
422 }
G4double GetSoftStoppingPower(G4double energy) const
Returns the total stopping power due to soft collisions.
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4String & GetName() const
Definition: G4Material.hh:176
const G4PenelopeCrossSection * GetCrossSectionTableForCouple(const G4ParticleDefinition *, const G4Material *, const G4double cut) const
const G4String & GetParticleName() const
G4GLOB_DLL std::ostream G4cout
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:207
#define G4endl
Definition: G4ios.hh:61
void BuildXSTable(const G4Material *, G4double cut, const G4ParticleDefinition *, G4bool isMaster=true)
This can be inkoved only by the master.
double G4double
Definition: G4Types.hh:76
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4double G4PenelopeIonisationModel::CrossSectionPerVolume ( const G4Material material,
const G4ParticleDefinition theParticle,
G4double  kineticEnergy,
G4double  cutEnergy,
G4double  maxEnergy = DBL_MAX 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 217 of file G4PenelopeIonisationModel.cc.

References G4PenelopeIonisationXSHandler::BuildXSTable(), G4cout, G4endl, G4Exception(), G4PenelopeOscillatorManager::GetAtomsPerMolecule(), G4PenelopeIonisationXSHandler::GetCrossSectionTableForCouple(), G4PenelopeCrossSection::GetHardCrossSection(), G4Material::GetName(), G4ParticleDefinition::GetParticleName(), G4PenelopeCrossSection::GetTotalCrossSection(), G4Material::GetTotNbOfAtomsPerVolume(), JustWarning, python.hepunit::keV, python.hepunit::mm, G4VEmModel::SetupForMaterial(), and G4TemplateAutoLock< M, L, U >::unlock().

223 {
224  // Penelope model v2008 to calculate the cross section for inelastic collisions above the
225  // threshold. It makes use of the Generalised Oscillator Strength (GOS) model from
226  // D. Liljequist, J. Phys. D: Appl. Phys. 16 (1983) 1567
227  //
228  // The total cross section is calculated analytically by taking
229  // into account the atomic oscillators coming into the play for a given threshold.
230  //
231  // For incident e- the maximum energy allowed for the delta-rays is energy/2.
232  // because particles are undistinghishable.
233  //
234  // The contribution is splitted in three parts: distant longitudinal collisions,
235  // distant transverse collisions and close collisions. Each term is described by
236  // its own analytical function.
237  // Fermi density correction is calculated analytically according to
238  // U. Fano, Ann. Rev. Nucl. Sci. 13 (1963),1
239  //
240  if (verboseLevel > 3)
241  G4cout << "Calling CrossSectionPerVolume() of G4PenelopeIonisationModel" << G4endl;
242 
243  SetupForMaterial(theParticle, material, energy);
244 
245  G4double totalCross = 0.0;
246  G4double crossPerMolecule = 0.;
247 
248  //Either Initialize() was not called, or we are in a slave and InitializeLocal() was
249  //not invoked
250  if (!theCrossSectionHandler)
251  {
252  //create a **thread-local** version of the table. Used only for G4EmCalculator and
253  //Unit Tests
254  fLocalTable = true;
255  theCrossSectionHandler = new G4PenelopeIonisationXSHandler(nBins);
256  }
257 
258  const G4PenelopeCrossSection* theXS =
259  theCrossSectionHandler->GetCrossSectionTableForCouple(theParticle,
260  material,
261  cutEnergy);
262  if (!theXS)
263  {
264  //If we are here, it means that Initialize() was inkoved, but the MaterialTable was
265  //not filled up. This can happen in a UnitTest or via G4EmCalculator
266  if (verboseLevel > 0)
267  {
268  //Issue a G4Exception (warning) only in verbose mode
270  ed << "Unable to retrieve the cross section table for " << theParticle->GetParticleName() <<
271  " in " << material->GetName() << ", cut = " << cutEnergy/keV << " keV " << G4endl;
272  ed << "This can happen only in Unit Tests or via G4EmCalculator" << G4endl;
273  G4Exception("G4PenelopeIonisationModel::CrossSectionPerVolume()",
274  "em2038",JustWarning,ed);
275  }
276  //protect file reading via autolock
277  G4AutoLock lock(&PenelopeIonisationModelMutex);
278  theCrossSectionHandler->BuildXSTable(material,cutEnergy,theParticle);
279  lock.unlock();
280  //now it should be ok
281  theXS =
282  theCrossSectionHandler->GetCrossSectionTableForCouple(theParticle,
283  material,
284  cutEnergy);
285  }
286 
287 
288  if (theXS)
289  crossPerMolecule = theXS->GetHardCrossSection(energy);
290 
291  G4double atomDensity = material->GetTotNbOfAtomsPerVolume();
292  G4double atPerMol = oscManager->GetAtomsPerMolecule(material);
293 
294  if (verboseLevel > 3)
295  G4cout << "Material " << material->GetName() << " has " << atPerMol <<
296  "atoms per molecule" << G4endl;
297 
298  G4double moleculeDensity = 0.;
299  if (atPerMol)
300  moleculeDensity = atomDensity/atPerMol;
301 
302  G4double crossPerVolume = crossPerMolecule*moleculeDensity;
303 
304  if (verboseLevel > 2)
305  {
306  G4cout << "G4PenelopeIonisationModel " << G4endl;
307  G4cout << "Mean free path for delta emission > " << cutEnergy/keV << " keV at " <<
308  energy/keV << " keV = " << (1./crossPerVolume)/mm << " mm" << G4endl;
309  if (theXS)
310  totalCross = (theXS->GetTotalCrossSection(energy))*moleculeDensity;
311  G4cout << "Total free path for ionisation (no threshold) at " <<
312  energy/keV << " keV = " << (1./totalCross)/mm << " mm" << G4endl;
313  }
314  return crossPerVolume;
315 }
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
const G4String & GetName() const
Definition: G4Material.hh:176
virtual void SetupForMaterial(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
Definition: G4VEmModel.cc:380
G4double GetHardCrossSection(G4double energy) const
Returns hard cross section at the given energy.
const G4PenelopeCrossSection * GetCrossSectionTableForCouple(const G4ParticleDefinition *, const G4Material *, const G4double cut) const
const G4String & GetParticleName() const
double precision function energy(A, Z)
Definition: dpm25nuc6.f:4106
G4GLOB_DLL std::ostream G4cout
G4double GetTotalCrossSection(G4double energy) const
Returns total cross section at the given energy.
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
G4double GetTotNbOfAtomsPerVolume() const
Definition: G4Material.hh:207
#define G4endl
Definition: G4ios.hh:61
void BuildXSTable(const G4Material *, G4double cut, const G4ParticleDefinition *, G4bool isMaster=true)
This can be inkoved only by the master.
double G4double
Definition: G4Types.hh:76
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4int G4PenelopeIonisationModel::GetVerbosityLevel ( )
inline

Definition at line 111 of file G4PenelopeIonisationModel.hh.

111 {return verboseLevel;};
void G4PenelopeIonisationModel::Initialise ( const G4ParticleDefinition particle,
const G4DataVector theCuts 
)
virtual

Implements G4VEmModel.

Definition at line 116 of file G4PenelopeIonisationModel.cc.

References G4LossTableManager::AtomDeexcitation(), G4PenelopeIonisationXSHandler::BuildXSTable(), fParticle, fParticleChange, G4cout, G4endl, G4MaterialCutsCouple::GetMaterial(), G4ProductionCutsTable::GetMaterialCutsCouple(), G4VEmModel::GetParticleChangeForLoss(), G4ProductionCutsTable::GetProductionCutsTable(), G4ProductionCutsTable::GetTableSize(), python.hepunit::GeV, G4VEmModel::HighEnergyLimit(), G4LossTableManager::Instance(), G4VEmModel::IsMaster(), python.hepunit::keV, G4VEmModel::LowEnergyLimit(), G4INCL::Math::max(), and G4PenelopeIonisationXSHandler::SetVerboseLevel().

118 {
119  if (verboseLevel > 3)
120  G4cout << "Calling G4PenelopeIonisationModel::Initialise()" << G4endl;
121 
122  fAtomDeexcitation = G4LossTableManager::Instance()->AtomDeexcitation();
123  //Issue warning if the AtomicDeexcitation has not been declared
124  if (!fAtomDeexcitation)
125  {
126  G4cout << G4endl;
127  G4cout << "WARNING from G4PenelopeIonisationModel " << G4endl;
128  G4cout << "Atomic de-excitation module is not instantiated, so there will not be ";
129  G4cout << "any fluorescence/Auger emission." << G4endl;
130  G4cout << "Please make sure this is intended" << G4endl;
131  }
132  SetParticle(particle);
133 
134  //Only the master model creates/manages the tables. All workers get the
135  //pointer to the table, and use it as readonly
136  if (IsMaster() && particle == fParticle)
137  {
138 
139  //Set the number of bins for the tables. 20 points per decade
140  nBins = (size_t) (20*std::log10(HighEnergyLimit()/LowEnergyLimit()));
141  nBins = std::max(nBins,(size_t)100);
142 
143  //Clear and re-build the tables
144  if (theCrossSectionHandler)
145  {
146  delete theCrossSectionHandler;
147  theCrossSectionHandler = 0;
148  }
149  theCrossSectionHandler = new G4PenelopeIonisationXSHandler(nBins);
150  theCrossSectionHandler->SetVerboseLevel(verboseLevel);
151 
152  //Build tables for all materials
153  G4ProductionCutsTable* theCoupleTable =
155  for (size_t i=0;i<theCoupleTable->GetTableSize();i++)
156  {
157  const G4Material* theMat =
158  theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial();
159  //Forces the building of the cross section tables
160  theCrossSectionHandler->BuildXSTable(theMat,theCuts.at(i),particle,
161  IsMaster());
162 
163  }
164 
165  if (verboseLevel > 2) {
166  G4cout << "Penelope Ionisation model v2008 is initialized " << G4endl
167  << "Energy range: "
168  << LowEnergyLimit() / keV << " keV - "
169  << HighEnergyLimit() / GeV << " GeV. Using "
170  << nBins << " bins."
171  << G4endl;
172  }
173  }
174 
175  if(isInitialised)
176  return;
178  isInitialised = true;
179 
180  return;
181 }
G4double LowEnergyLimit() const
Definition: G4VEmModel.hh:599
static G4LossTableManager * Instance()
G4ParticleChangeForLoss * GetParticleChangeForLoss()
Definition: G4VEmModel.cc:107
void SetVerboseLevel(G4int vl)
Setter for the verbosity level.
G4double HighEnergyLimit() const
Definition: G4VEmModel.hh:592
G4bool IsMaster() const
Definition: G4VEmModel.hh:676
G4GLOB_DLL std::ostream G4cout
G4ParticleChangeForLoss * fParticleChange
static G4ProductionCutsTable * GetProductionCutsTable()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
#define G4endl
Definition: G4ios.hh:61
G4VAtomDeexcitation * AtomDeexcitation()
void BuildXSTable(const G4Material *, G4double cut, const G4ParticleDefinition *, G4bool isMaster=true)
This can be inkoved only by the master.
const G4ParticleDefinition * fParticle
const G4Material * GetMaterial() const
void G4PenelopeIonisationModel::InitialiseLocal ( const G4ParticleDefinition part,
G4VEmModel masterModel 
)
virtual

Reimplemented from G4VEmModel.

Definition at line 185 of file G4PenelopeIonisationModel.cc.

References fParticle, G4cout, and G4endl.

187 {
188  if (verboseLevel > 3)
189  G4cout << "Calling G4PenelopeIonisationModel::InitialiseLocal()" << G4endl;
190 
191  //
192  //Check that particle matches: one might have multiple master models (e.g.
193  //for e+ and e-).
194  //
195  if (part == fParticle)
196  {
197  //Get the const table pointers from the master to the workers
198  const G4PenelopeIonisationModel* theModel =
199  static_cast<G4PenelopeIonisationModel*> (masterModel);
200 
201  //Copy pointers to the data tables
202  theCrossSectionHandler = theModel->theCrossSectionHandler;
203 
204  //copy data
205  nBins = theModel->nBins;
206 
207  //Same verbosity for all workers, as the master
208  verboseLevel = theModel->verboseLevel;
209  }
210 
211  return;
212 }
G4GLOB_DLL std::ostream G4cout
#define G4endl
Definition: G4ios.hh:61
const G4ParticleDefinition * fParticle
G4double G4PenelopeIonisationModel::MinEnergyCut ( const G4ParticleDefinition ,
const G4MaterialCutsCouple  
)
virtual

Reimplemented from G4VEmModel.

Definition at line 426 of file G4PenelopeIonisationModel.cc.

428 {
429  return fIntrinsicLowEnergyLimit;
430 }
void G4PenelopeIonisationModel::SampleSecondaries ( std::vector< G4DynamicParticle * > *  fvect,
const G4MaterialCutsCouple couple,
const G4DynamicParticle aDynamicParticle,
G4double  tmin,
G4double  maxEnergy 
)
virtual

Implements G4VEmModel.

Definition at line 434 of file G4PenelopeIonisationModel.cc.

References G4InuclSpecialFunctions::bindingEnergy(), G4AtomicShell::BindingEnergy(), G4VAtomDeexcitation::CheckDeexcitationActiveRegion(), G4Electron::Definition(), G4Gamma::Definition(), G4InuclParticleNames::electron, G4Electron::Electron(), python.hepunit::eV, FatalException, fParticleChange, G4cout, G4endl, G4Exception(), G4UniformRand, G4VAtomDeexcitation::GenerateParticles(), G4DynamicParticle::GetDefinition(), G4MaterialCutsCouple::GetIndex(), G4DynamicParticle::GetKineticEnergy(), G4MaterialCutsCouple::GetMaterial(), G4DynamicParticle::GetMomentumDirection(), G4PenelopeOscillatorManager::GetOscillatorTableIonisation(), G4ParticleDefinition::GetParticleName(), G4AtomicTransitionManager::Instance(), python.hepunit::keV, eplot::material, python.hepunit::pi, G4Positron::Positron(), G4VParticleChange::ProposeLocalEnergyDeposit(), G4ParticleChangeForLoss::ProposeMomentumDirection(), CLHEP::Hep3Vector::rotateUz(), G4ParticleChangeForLoss::SetProposedKineticEnergy(), G4AtomicTransitionManager::Shell(), and python.hepunit::twopi.

438 {
439  // Penelope model v2008 to sample the final state following an hard inelastic interaction.
440  // It makes use of the Generalised Oscillator Strength (GOS) model from
441  // D. Liljequist, J. Phys. D: Appl. Phys. 16 (1983) 1567
442  //
443  // The GOS model is used to calculate the individual cross sections for all
444  // the atomic oscillators coming in the play, taking into account the three
445  // contributions (distant longitudinal collisions, distant transverse collisions and
446  // close collisions). Then the target shell and the interaction channel are
447  // sampled. Final state of the delta-ray (energy, angle) are generated according
448  // to the analytical distributions (dSigma/dW) for the selected interaction
449  // channels.
450  // For e-, the maximum energy for the delta-ray is initialEnergy/2. (because
451  // particles are indistinghusbable), while it is the full initialEnergy for
452  // e+.
453  // The efficiency of the random sampling algorithm (e.g. for close collisions)
454  // decreases when initial and cutoff energy increase (e.g. 87% for 10-keV primary
455  // and 1 keV threshold, 99% for 10-MeV primary and 10-keV threshold).
456  // Differential cross sections have a different form for e+ and e-.
457  //
458  // WARNING: The model provides an _average_ description of inelastic collisions.
459  // Anyway, the energy spectrum associated to distant excitations of a given
460  // atomic shell is approximated as a single resonance. The simulated energy spectra
461  // show _unphysical_ narrow peaks at energies that are multiple of the shell
462  // resonance energies. The spurious speaks are automatically smoothed out after
463  // multiple inelastic collisions.
464  //
465  // The model determines also the original shell from which the delta-ray is expelled,
466  // in order to produce fluorescence de-excitation (from G4DeexcitationManager)
467  //
468  // Fermi density correction is calculated analytically according to
469  // U. Fano, Ann. Rev. Nucl. Sci. 13 (1963),1
470 
471  if (verboseLevel > 3)
472  G4cout << "Calling SamplingSecondaries() of G4PenelopeIonisationModel" << G4endl;
473 
474  G4double kineticEnergy0 = aDynamicParticle->GetKineticEnergy();
475  const G4ParticleDefinition* theParticle = aDynamicParticle->GetDefinition();
476 
477  if (kineticEnergy0 <= fIntrinsicLowEnergyLimit)
478  {
481  return ;
482  }
483 
484  const G4Material* material = couple->GetMaterial();
485  const G4PenelopeOscillatorTable* theTable = oscManager->GetOscillatorTableIonisation(material);
486 
487  G4ParticleMomentum particleDirection0 = aDynamicParticle->GetMomentumDirection();
488 
489  //Initialise final-state variables. The proper values will be set by the methods
490  // SampleFinalStateElectron() and SampleFinalStatePositron()
491  kineticEnergy1=kineticEnergy0;
492  cosThetaPrimary=1.0;
493  energySecondary=0.0;
494  cosThetaSecondary=1.0;
495  targetOscillator = -1;
496 
497  if (theParticle == G4Electron::Electron())
498  SampleFinalStateElectron(material,cutE,kineticEnergy0);
499  else if (theParticle == G4Positron::Positron())
500  SampleFinalStatePositron(material,cutE,kineticEnergy0);
501  else
502  {
504  ed << "Invalid particle " << theParticle->GetParticleName() << G4endl;
505  G4Exception("G4PenelopeIonisationModel::SamplingSecondaries()",
506  "em0001",FatalException,ed);
507 
508  }
509  if (energySecondary == 0) return;
510 
511  if (verboseLevel > 3)
512  {
513  G4cout << "G4PenelopeIonisationModel::SamplingSecondaries() for " <<
514  theParticle->GetParticleName() << G4endl;
515  G4cout << "Final eKin = " << kineticEnergy1 << " keV" << G4endl;
516  G4cout << "Final cosTheta = " << cosThetaPrimary << G4endl;
517  G4cout << "Delta-ray eKin = " << energySecondary << " keV" << G4endl;
518  G4cout << "Delta-ray cosTheta = " << cosThetaSecondary << G4endl;
519  G4cout << "Oscillator: " << targetOscillator << G4endl;
520  }
521 
522  //Update the primary particle
523  G4double sint = std::sqrt(1. - cosThetaPrimary*cosThetaPrimary);
524  G4double phiPrimary = twopi * G4UniformRand();
525  G4double dirx = sint * std::cos(phiPrimary);
526  G4double diry = sint * std::sin(phiPrimary);
527  G4double dirz = cosThetaPrimary;
528 
529  G4ThreeVector electronDirection1(dirx,diry,dirz);
530  electronDirection1.rotateUz(particleDirection0);
531 
532  if (kineticEnergy1 > 0)
533  {
534  fParticleChange->ProposeMomentumDirection(electronDirection1);
535  fParticleChange->SetProposedKineticEnergy(kineticEnergy1);
536  }
537  else
539 
540 
541  //Generate the delta ray
542  G4double ionEnergyInPenelopeDatabase =
543  (*theTable)[targetOscillator]->GetIonisationEnergy();
544 
545  //Now, try to handle fluorescence
546  //Notice: merged levels are indicated with Z=0 and flag=30
547  G4int shFlag = (*theTable)[targetOscillator]->GetShellFlag();
548  G4int Z = (G4int) (*theTable)[targetOscillator]->GetParentZ();
549 
550  //initialize here, then check photons created by Atomic-Deexcitation, and the final state e-
553  //G4int shellId = 0;
554 
555  const G4AtomicShell* shell = 0;
556  //Real level
557  if (Z > 0 && shFlag<30)
558  {
559  shell = transitionManager->Shell(Z,shFlag-1);
560  bindingEnergy = shell->BindingEnergy();
561  //shellId = shell->ShellId();
562  }
563 
564  //correct the energySecondary to account for the fact that the Penelope
565  //database of ionisation energies is in general (slightly) different
566  //from the fluorescence database used in Geant4.
567  energySecondary += ionEnergyInPenelopeDatabase-bindingEnergy;
568 
569  G4double localEnergyDeposit = bindingEnergy;
570  //testing purposes only
571  G4double energyInFluorescence = 0;
572  G4double energyInAuger = 0;
573 
574  if (energySecondary < 0)
575  {
576  //It means that there was some problem/mismatch between the two databases.
577  //In this case, the available energy is ok to excite the level according
578  //to the Penelope database, but not according to the Geant4 database
579  //Full residual energy is deposited locally
580  localEnergyDeposit += energySecondary;
581  energySecondary = 0.0;
582  }
583 
584  //Notice: shell might be NULL (invalid!) if shFlag=30. Must be protected
585  //Now, take care of fluorescence, if required
586  if (fAtomDeexcitation && shell)
587  {
588  G4int index = couple->GetIndex();
589  if (fAtomDeexcitation->CheckDeexcitationActiveRegion(index))
590  {
591  size_t nBefore = fvect->size();
592  fAtomDeexcitation->GenerateParticles(fvect,shell,Z,index);
593  size_t nAfter = fvect->size();
594 
595  if (nAfter > nBefore) //actual production of fluorescence
596  {
597  for (size_t j=nBefore;j<nAfter;j++) //loop on products
598  {
599  G4double itsEnergy = ((*fvect)[j])->GetKineticEnergy();
600  localEnergyDeposit -= itsEnergy;
601  if (((*fvect)[j])->GetParticleDefinition() == G4Gamma::Definition())
602  energyInFluorescence += itsEnergy;
603  else if (((*fvect)[j])->GetParticleDefinition() == G4Electron::Definition())
604  energyInAuger += itsEnergy;
605  }
606  }
607  }
608  }
609 
610  // Generate the delta ray --> to be done only if above cut
611  if (energySecondary > cutE)
612  {
614  G4double sinThetaE = std::sqrt(1.-cosThetaSecondary*cosThetaSecondary);
615  G4double phiEl = phiPrimary+pi; //pi with respect to the primary electron/positron
616  G4double xEl = sinThetaE * std::cos(phiEl);
617  G4double yEl = sinThetaE * std::sin(phiEl);
618  G4double zEl = cosThetaSecondary;
619  G4ThreeVector eDirection(xEl,yEl,zEl); //electron direction
620  eDirection.rotateUz(particleDirection0);
621  electron = new G4DynamicParticle (G4Electron::Electron(),
622  eDirection,energySecondary) ;
623  fvect->push_back(electron);
624  }
625  else
626  {
627  localEnergyDeposit += energySecondary;
628  energySecondary = 0;
629  }
630 
631  if (localEnergyDeposit < 0)
632  {
633  G4cout << "WARNING-"
634  << "G4PenelopeIonisationModel::SampleSecondaries - Negative energy deposit"
635  << G4endl;
636  localEnergyDeposit=0.;
637  }
638  fParticleChange->ProposeLocalEnergyDeposit(localEnergyDeposit);
639 
640  if (verboseLevel > 1)
641  {
642  G4cout << "-----------------------------------------------------------" << G4endl;
643  G4cout << "Energy balance from G4PenelopeIonisation" << G4endl;
644  G4cout << "Incoming primary energy: " << kineticEnergy0/keV << " keV" << G4endl;
645  G4cout << "-----------------------------------------------------------" << G4endl;
646  G4cout << "Outgoing primary energy: " << kineticEnergy1/keV << " keV" << G4endl;
647  G4cout << "Delta ray " << energySecondary/keV << " keV" << G4endl;
648  if (energyInFluorescence)
649  G4cout << "Fluorescence x-rays: " << energyInFluorescence/keV << " keV" << G4endl;
650  if (energyInAuger)
651  G4cout << "Auger electrons: " << energyInAuger/keV << " keV" << G4endl;
652  G4cout << "Local energy deposit " << localEnergyDeposit/keV << " keV" << G4endl;
653  G4cout << "Total final state: " << (energySecondary+energyInFluorescence+kineticEnergy1+
654  localEnergyDeposit+energyInAuger)/keV <<
655  " keV" << G4endl;
656  G4cout << "-----------------------------------------------------------" << G4endl;
657  }
658 
659  if (verboseLevel > 0)
660  {
661  G4double energyDiff = std::fabs(energySecondary+energyInFluorescence+kineticEnergy1+
662  localEnergyDeposit+energyInAuger-kineticEnergy0);
663  if (energyDiff > 0.05*keV)
664  G4cout << "Warning from G4PenelopeIonisation: problem with energy conservation: " <<
665  (energySecondary+energyInFluorescence+kineticEnergy1+localEnergyDeposit+energyInAuger)/keV <<
666  " keV (final) vs. " <<
667  kineticEnergy0/keV << " keV (initial)" << G4endl;
668  }
669 
670 }
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
G4double GetKineticEnergy() const
static G4Electron * Definition()
Definition: G4Electron.cc:49
G4ParticleDefinition * GetDefinition() const
G4double BindingEnergy() const
int G4int
Definition: G4Types.hh:78
const G4String & GetParticleName() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
string material
Definition: eplot.py:19
#define G4UniformRand()
Definition: Randomize.hh:87
G4GLOB_DLL std::ostream G4cout
const G4ThreeVector & GetMomentumDirection() const
void SetProposedKineticEnergy(G4double proposedKinEnergy)
G4ParticleChangeForLoss * fParticleChange
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
static G4Positron * Positron()
Definition: G4Positron.cc:94
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
static G4Electron * Electron()
Definition: G4Electron.cc:94
#define G4endl
Definition: G4ios.hh:61
double G4double
Definition: G4Types.hh:76
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
G4double bindingEnergy(G4int A, G4int Z)
static G4AtomicTransitionManager * Instance()
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
static G4Gamma * Definition()
Definition: G4Gamma.cc:49
const G4Material * GetMaterial() const
void G4PenelopeIonisationModel::SetVerbosityLevel ( G4int  lev)
inline

Definition at line 110 of file G4PenelopeIonisationModel.hh.

110 {verboseLevel = lev;};

Field Documentation

const G4ParticleDefinition* G4PenelopeIonisationModel::fParticle
protected

Definition at line 115 of file G4PenelopeIonisationModel.hh.

Referenced by Initialise(), and InitialiseLocal().

G4ParticleChangeForLoss* G4PenelopeIonisationModel::fParticleChange
protected

Definition at line 111 of file G4PenelopeIonisationModel.hh.

Referenced by Initialise(), and SampleSecondaries().


The documentation for this class was generated from the following files: