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)
78 fIntrinsicLowEnergyLimit = 100.0*
eV;
79 fIntrinsicHighEnergyLimit = 100.0*
GeV;
109 if (theCrossSectionHandler)
110 delete theCrossSectionHandler;
119 if (verboseLevel > 3)
120 G4cout <<
"Calling G4PenelopeIonisationModel::Initialise()" <<
G4endl;
124 if (!fAtomDeexcitation)
127 G4cout <<
"WARNING from G4PenelopeIonisationModel " <<
G4endl;
128 G4cout <<
"Atomic de-excitation module is not instantiated, so there will not be ";
130 G4cout <<
"Please make sure this is intended" <<
G4endl;
132 SetParticle(particle);
141 nBins =
std::max(nBins,(
size_t)100);
144 if (theCrossSectionHandler)
146 delete theCrossSectionHandler;
147 theCrossSectionHandler = 0;
160 theCrossSectionHandler->
BuildXSTable(theMat,theCuts.at(i),particle,
165 if (verboseLevel > 2) {
166 G4cout <<
"Penelope Ionisation model v2008 is initialized " << G4endl
178 isInitialised =
true;
188 if (verboseLevel > 3)
189 G4cout <<
"Calling G4PenelopeIonisationModel::InitialiseLocal()" <<
G4endl;
202 theCrossSectionHandler = theModel->theCrossSectionHandler;
205 nBins = theModel->nBins;
208 verboseLevel = theModel->verboseLevel;
240 if (verboseLevel > 3)
241 G4cout <<
"Calling CrossSectionPerVolume() of G4PenelopeIonisationModel" <<
G4endl;
250 if (!theCrossSectionHandler)
267 ed <<
"Unable to retrieve the cross section table for " << theParticle->
GetParticleName() <<
268 " in " << material->
GetName() <<
", cut = " << cutEnergy/
keV <<
" keV " <<
G4endl;
269 ed <<
"This can happen only in Unit Tests or via G4EmCalculator" <<
G4endl;
270 G4Exception(
"G4PenelopeIonisationModel::CrossSectionPerVolume()",
273 G4AutoLock lock(&PenelopeIonisationModelMutex);
274 theCrossSectionHandler->
BuildXSTable(material,cutEnergy,theParticle);
290 if (verboseLevel > 3)
291 G4cout <<
"Material " << material->
GetName() <<
" has " << atPerMol <<
292 "atoms per molecule" <<
G4endl;
296 moleculeDensity = atomDensity/atPerMol;
298 G4double crossPerVolume = crossPerMolecule*moleculeDensity;
300 if (verboseLevel > 2)
303 G4cout <<
"Mean free path for delta emission > " << cutEnergy/
keV <<
" keV at " <<
304 energy/
keV <<
" keV = " << (1./crossPerVolume)/
mm <<
" mm" << G4endl;
307 G4cout <<
"Total free path for ionisation (no threshold) at " <<
308 energy/
keV <<
" keV = " << (1./totalCross)/
mm <<
" mm" << G4endl;
310 return crossPerVolume;
325 G4cout <<
"*** G4PenelopeIonisationModel -- WARNING ***" <<
G4endl;
326 G4cout <<
"Penelope Ionisation model v2008 does not calculate cross section _per atom_ " <<
G4endl;
327 G4cout <<
"so the result is always zero. For physics values, please invoke " <<
G4endl;
328 G4cout <<
"GetCrossSectionPerVolume() or GetMeanFreePath() via the G4EmCalculator" <<
G4endl;
354 if (verboseLevel > 3)
355 G4cout <<
"Calling ComputeDEDX() of G4PenelopeIonisationModel" <<
G4endl;
359 if (!theCrossSectionHandler)
376 ed <<
"Unable to retrieve the cross section table for " << theParticle->
GetParticleName() <<
377 " in " << material->
GetName() <<
", cut = " << cutEnergy/
keV <<
" keV " <<
G4endl;
378 ed <<
"This can happen only in Unit Tests or via G4EmCalculator" <<
G4endl;
379 G4Exception(
"G4PenelopeIonisationModel::ComputeDEDXPerVolume()",
382 G4AutoLock lock(&PenelopeIonisationModelMutex);
383 theCrossSectionHandler->
BuildXSTable(material,cutEnergy,theParticle);
402 moleculeDensity = atomDensity/atPerMol;
404 G4double sPowerPerVolume = sPowerPerMolecule*moleculeDensity;
406 if (verboseLevel > 2)
409 G4cout <<
"Stopping power < " << cutEnergy/
keV <<
" keV at " <<
410 kineticEnergy/
keV <<
" keV = " <<
411 sPowerPerVolume/(
keV/
mm) <<
" keV/mm" << G4endl;
413 return sPowerPerVolume;
421 return fIntrinsicLowEnergyLimit;
463 if (verboseLevel > 3)
464 G4cout <<
"Calling SamplingSecondaries() of G4PenelopeIonisationModel" <<
G4endl;
469 if (kineticEnergy0 <= fIntrinsicLowEnergyLimit)
483 kineticEnergy1=kineticEnergy0;
486 cosThetaSecondary=1.0;
487 targetOscillator = -1;
490 SampleFinalStateElectron(material,cutE,kineticEnergy0);
492 SampleFinalStatePositron(material,cutE,kineticEnergy0);
497 G4Exception(
"G4PenelopeIonisationModel::SamplingSecondaries()",
501 if (energySecondary == 0)
return;
503 if (verboseLevel > 3)
505 G4cout <<
"G4PenelopeIonisationModel::SamplingSecondaries() for " <<
507 G4cout <<
"Final eKin = " << kineticEnergy1 <<
" keV" <<
G4endl;
508 G4cout <<
"Final cosTheta = " << cosThetaPrimary <<
G4endl;
509 G4cout <<
"Delta-ray eKin = " << energySecondary <<
" keV" <<
G4endl;
510 G4cout <<
"Delta-ray cosTheta = " << cosThetaSecondary <<
G4endl;
515 G4double sint = std::sqrt(1. - cosThetaPrimary*cosThetaPrimary);
517 G4double dirx = sint * std::cos(phiPrimary);
518 G4double diry = sint * std::sin(phiPrimary);
522 electronDirection1.
rotateUz(particleDirection0);
524 if (kineticEnergy1 > 0)
534 G4double ionEnergyInPenelopeDatabase =
535 (*theTable)[targetOscillator]->GetIonisationEnergy();
539 G4int shFlag = (*theTable)[targetOscillator]->GetShellFlag();
540 G4int Z = (
G4int) (*theTable)[targetOscillator]->GetParentZ();
549 if (Z > 0 && shFlag<30)
551 shell = transitionManager->
Shell(Z,shFlag-1);
559 energySecondary += ionEnergyInPenelopeDatabase-
bindingEnergy;
566 if (energySecondary < 0)
572 localEnergyDeposit += energySecondary;
573 energySecondary = 0.0;
578 if (fAtomDeexcitation && shell)
583 size_t nBefore = fvect->size();
585 size_t nAfter = fvect->size();
587 if (nAfter > nBefore)
589 for (
size_t j=nBefore;j<nAfter;j++)
591 G4double itsEnergy = ((*fvect)[j])->GetKineticEnergy();
592 localEnergyDeposit -= itsEnergy;
594 energyInFluorescence += itsEnergy;
596 energyInAuger += itsEnergy;
603 if (energySecondary > cutE)
606 G4double sinThetaE = std::sqrt(1.-cosThetaSecondary*cosThetaSecondary);
608 G4double xEl = sinThetaE * std::cos(phiEl);
609 G4double yEl = sinThetaE * std::sin(phiEl);
612 eDirection.
rotateUz(particleDirection0);
614 eDirection,energySecondary) ;
615 fvect->push_back(electron);
619 localEnergyDeposit += energySecondary;
623 if (localEnergyDeposit < 0)
626 <<
"G4PenelopeIonisationModel::SampleSecondaries - Negative energy deposit"
628 localEnergyDeposit=0.;
632 if (verboseLevel > 1)
634 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
635 G4cout <<
"Energy balance from G4PenelopeIonisation" <<
G4endl;
636 G4cout <<
"Incoming primary energy: " << kineticEnergy0/
keV <<
" keV" <<
G4endl;
637 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
638 G4cout <<
"Outgoing primary energy: " << kineticEnergy1/
keV <<
" keV" <<
G4endl;
640 if (energyInFluorescence)
641 G4cout <<
"Fluorescence x-rays: " << energyInFluorescence/
keV <<
" keV" <<
G4endl;
643 G4cout <<
"Auger electrons: " << energyInAuger/
keV <<
" keV" <<
G4endl;
644 G4cout <<
"Local energy deposit " << localEnergyDeposit/
keV <<
" keV" <<
G4endl;
645 G4cout <<
"Total final state: " << (energySecondary+energyInFluorescence+kineticEnergy1+
646 localEnergyDeposit+energyInAuger)/
keV <<
648 G4cout <<
"-----------------------------------------------------------" <<
G4endl;
651 if (verboseLevel > 0)
653 G4double energyDiff = std::fabs(energySecondary+energyInFluorescence+kineticEnergy1+
654 localEnergyDeposit+energyInAuger-kineticEnergy0);
655 if (energyDiff > 0.05*
keV)
656 G4cout <<
"Warning from G4PenelopeIonisation: problem with energy conservation: " <<
657 (energySecondary+energyInFluorescence+kineticEnergy1+localEnergyDeposit+energyInAuger)/
keV <<
658 " keV (final) vs. " <<
659 kineticEnergy0/
keV <<
" keV (initial)" << G4endl;
665 void G4PenelopeIonisationModel::SampleFinalStateElectron(
const G4Material*
mat,
678 size_t numberOfOscillators = theTable->size();
686 targetOscillator = numberOfOscillators-1;
689 for (
size_t i=0;i<numberOfOscillators-1;i++)
701 targetOscillator = (
G4int) i;
707 if (verboseLevel > 3)
709 G4cout <<
"SampleFinalStateElectron: sampled oscillator #" << targetOscillator <<
"." <<
G4endl;
710 G4cout <<
"Ionisation energy: " << (*theTable)[targetOscillator]->GetIonisationEnergy()/
eV <<
712 G4cout <<
"Resonance energy: : " << (*theTable)[targetOscillator]->GetResonanceEnergy()/
eV <<
" eV "
723 G4double resEne = (*theTable)[targetOscillator]->GetResonanceEnergy();
725 G4double ionEne = (*theTable)[targetOscillator]->GetIonisationEnergy();
726 G4double cutoffEne = (*theTable)[targetOscillator]->GetCutoffRecoilResonantEnergy();
734 if (resEne > cutEnergy && resEne < kineticEnergy)
736 cps = kineticEnergy*rb;
739 if (resEne > 1.0e-6*kineticEnergy)
753 XHDT = XHDT0*invResEne;
772 G4double EE = kineticEnergy + ionEne;
781 XHC = (amol*(0.5-rcl)+1.0/rcl-rrl1+
782 (1.0-amol)*std::log(rcl*rrl1))/EE;
789 if (XHTOT < 1.e-14*
barn)
791 kineticEnergy1=kineticEnergy;
794 cosThetaSecondary=1.0;
795 targetOscillator = numberOfOscillators-1;
817 rk = rcl/(1.0-fb*(1.0-(rcl+rcl)));
819 rk = rcl + (fb-1.0)*(0.5-rcl)/ARCL;
822 G4double phi = 1.0+rkf*rkf-rkf+amol*(rk2+rkf);
829 kineticEnergy1 = kineticEnergy - deltaE;
830 cosThetaPrimary = std::sqrt(kineticEnergy1*rb/(kineticEnergy*(rb-deltaE)));
832 energySecondary = deltaE - ionEne;
833 cosThetaSecondary= std::sqrt(deltaE*rb/(kineticEnergy*(deltaE+2.0*
electron_mass_c2)));
834 if (verboseLevel > 3)
835 G4cout <<
"SampleFinalStateElectron: sampled close collision " <<
G4endl;
842 kineticEnergy1 = kineticEnergy - deltaE;
851 cosThetaPrimary = (cpps+cps-QTREV)/(2.0*cp*std::sqrt(cpps));
852 if (cosThetaPrimary > 1.)
853 cosThetaPrimary = 1.0;
855 energySecondary = deltaE - ionEne;
856 cosThetaSecondary = 0.5*(deltaE*(kineticEnergy+rb-deltaE)+QTREV)/std::sqrt(cps*QTREV);
857 if (cosThetaSecondary > 1.0)
858 cosThetaSecondary = 1.0;
859 if (verboseLevel > 3)
860 G4cout <<
"SampleFinalStateElectron: sampled distant longitudinal collision " <<
G4endl;
865 cosThetaPrimary = 1.0;
867 energySecondary = deltaE - ionEne;
868 cosThetaSecondary = 0.5;
869 if (verboseLevel > 3)
870 G4cout <<
"SampleFinalStateElectron: sampled distant transverse collision " <<
G4endl;
878 void G4PenelopeIonisationModel::SampleFinalStatePositron(
const G4Material* mat,
891 size_t numberOfOscillators = theTable->size();
899 targetOscillator = numberOfOscillators-1;
901 for (
size_t i=0;i<numberOfOscillators-1;i++)
906 targetOscillator = (
G4int) i;
911 if (verboseLevel > 3)
913 G4cout <<
"SampleFinalStatePositron: sampled oscillator #" << targetOscillator <<
"." <<
G4endl;
914 G4cout <<
"Ionisation energy: " << (*theTable)[targetOscillator]->GetIonisationEnergy()/
eV
916 G4cout <<
"Resonance energy: : " << (*theTable)[targetOscillator]->GetResonanceEnergy()/
eV
928 G4double bha1 = amol*(2.0*g12-1.0)/(gam2-1.0);
930 G4double bha3 = amol*2.0*gam*(gam-1.0)/g12;
931 G4double bha4 = amol*(gam-1.0)*(gam-1.0)/g12;
936 G4double resEne = (*theTable)[targetOscillator]->GetResonanceEnergy();
938 G4double ionEne = (*theTable)[targetOscillator]->GetIonisationEnergy();
939 G4double cutoffEne = (*theTable)[targetOscillator]->GetCutoffRecoilResonantEnergy();
948 if (resEne > cutEnergy && resEne < kineticEnergy)
950 cps = kineticEnergy*rb;
953 if (resEne > 1.0e-6*kineticEnergy)
967 XHDT = XHDT0*invResEne;
992 XHC = ((1.0/rcl-1.0)+bha1*std::log(rcl)+bha2*rl1
993 + (bha3/2.0)*(rcl*rcl-1.0)
994 + (bha4/3.0)*(1.0-rcl*rcl*rcl))/kineticEnergy;
1001 if (XHTOT < 1.e-14*
barn)
1003 kineticEnergy1=kineticEnergy;
1004 cosThetaPrimary=1.0;
1005 energySecondary=0.0;
1006 cosThetaSecondary=1.0;
1007 targetOscillator = numberOfOscillators-1;
1020 G4bool loopAgain =
false;
1025 G4double phi = 1.0-rk*(bha1-rk*(bha2-rk*(bha3-bha4*rk)));
1030 G4double deltaE = rk*kineticEnergy;
1031 kineticEnergy1 = kineticEnergy - deltaE;
1032 cosThetaPrimary = std::sqrt(kineticEnergy1*rb/(kineticEnergy*(rb-deltaE)));
1034 energySecondary = deltaE - ionEne;
1035 cosThetaSecondary= std::sqrt(deltaE*rb/(kineticEnergy*(deltaE+2.0*
electron_mass_c2)));
1036 if (verboseLevel > 3)
1037 G4cout <<
"SampleFinalStatePositron: sampled close collision " <<
G4endl;
1044 kineticEnergy1 = kineticEnergy - deltaE;
1052 cosThetaPrimary = (cpps+cps-QTREV)/(2.0*cp*std::sqrt(cpps));
1053 if (cosThetaPrimary > 1.)
1054 cosThetaPrimary = 1.0;
1056 energySecondary = deltaE - ionEne;
1057 cosThetaSecondary = 0.5*(deltaE*(kineticEnergy+rb-deltaE)+QTREV)/std::sqrt(cps*QTREV);
1058 if (cosThetaSecondary > 1.0)
1059 cosThetaSecondary = 1.0;
1060 if (verboseLevel > 3)
1061 G4cout <<
"SampleFinalStatePositron: sampled distant longitudinal collision " <<
G4endl;
1066 cosThetaPrimary = 1.0;
1068 energySecondary = deltaE - ionEne;
1069 cosThetaSecondary = 0.5;
1071 if (verboseLevel > 3)
1072 G4cout <<
"SampleFinalStatePositron: sampled distant transverse collision " <<
G4endl;
void ProposeMomentumDirection(G4double Px, G4double Py, G4double Pz)
G4PenelopeOscillatorTable * GetOscillatorTableIonisation(const G4Material *)
G4double LowEnergyLimit() const
G4bool CheckDeexcitationActiveRegion(G4int coupleIndex)
static G4LossTableManager * Instance()
G4ParticleChangeForLoss * GetParticleChangeForLoss()
G4double GetSoftStoppingPower(G4double energy) const
Returns the total stopping power due to soft collisions.
std::ostringstream G4ExceptionDescription
G4double GetKineticEnergy() const
void SetVerboseLevel(G4int vl)
Setter for the verbosity level.
G4double HighEnergyLimit() const
virtual G4double CrossSectionPerVolume(const G4Material *material, const G4ParticleDefinition *theParticle, G4double kineticEnergy, G4double cutEnergy, G4double maxEnergy=DBL_MAX)
const G4String & GetName() const
virtual void SetupForMaterial(const G4ParticleDefinition *, const G4Material *, G4double kineticEnergy)
static G4Electron * Definition()
G4double GetHardCrossSection(G4double energy) const
Returns hard cross section at the given energy.
G4ParticleDefinition * GetDefinition() const
const G4PenelopeCrossSection * GetCrossSectionTableForCouple(const G4ParticleDefinition *, const G4Material *, const G4double cut) const
virtual void InitialiseLocal(const G4ParticleDefinition *, G4VEmModel *)
G4double BindingEnergy() const
#define G4MUTEX_INITIALIZER
const G4String & GetParticleName() const
void ProposeLocalEnergyDeposit(G4double anEnergyPart)
void SetHighEnergyLimit(G4double)
G4GLOB_DLL std::ostream G4cout
virtual ~G4PenelopeIonisationModel()
size_t GetTableSize() const
const G4ThreeVector & GetMomentumDirection() const
Hep3Vector & rotateUz(const Hep3Vector &)
G4double GetTotalCrossSection(G4double energy) const
Returns total cross section at the given energy.
void SetProposedKineticEnergy(G4double proposedKinEnergy)
G4ParticleChangeForLoss * fParticleChange
static G4PenelopeOscillatorManager * GetOscillatorManager()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4double GetTotNbOfAtomsPerVolume() const
static G4ProductionCutsTable * GetProductionCutsTable()
virtual G4double MinEnergyCut(const G4ParticleDefinition *, const G4MaterialCutsCouple *)
static G4Positron * Positron()
const G4MaterialCutsCouple * GetMaterialCutsCouple(G4int i) const
T max(const T t1, const T t2)
brief Return the largest of the two arguments
std::vector< G4PenelopeOscillator * > G4PenelopeOscillatorTable
G4double GetDensityCorrection(const G4Material *, const G4double energy) const
Returns the density coeection for the material at the given energy.
static G4Electron * Electron()
G4VAtomDeexcitation * AtomDeexcitation()
virtual G4double ComputeDEDXPerVolume(const G4Material *, const G4ParticleDefinition *, G4double kineticEnergy, G4double cutEnergy)
void BuildXSTable(const G4Material *, G4double cut, const G4ParticleDefinition *, G4bool isMaster=true)
This can be inkoved only by the master.
G4double GetNormalizedShellCrossSection(size_t shellID, G4double energy) const
Returns the hard cross section for the given shell (normalized to 1)
const G4ParticleDefinition * fParticle
void GenerateParticles(std::vector< G4DynamicParticle * > *secVect, const G4AtomicShell *, G4int Z, G4int coupleIndex)
void SetDeexcitationFlag(G4bool val)
virtual void Initialise(const G4ParticleDefinition *, const G4DataVector &)
G4double GetAtomsPerMolecule(const G4Material *)
Returns the total number of atoms per molecule.
G4double bindingEnergy(G4int A, G4int Z)
G4PenelopeIonisationModel(const G4ParticleDefinition *p=0, const G4String &processName="PenIoni")
static G4AtomicTransitionManager * Instance()
G4AtomicShell * Shell(G4int Z, size_t shellIndex) const
virtual void SampleSecondaries(std::vector< G4DynamicParticle * > *, const G4MaterialCutsCouple *, const G4DynamicParticle *, G4double tmin, G4double maxEnergy)
virtual G4double ComputeCrossSectionPerAtom(const G4ParticleDefinition *, G4double, G4double, G4double, G4double, G4double)
static G4Gamma * Definition()
const G4Material * GetMaterial() const