Import Geant4 4.0.0 source tree
This commit is contained in:
@@ -21,248 +21,187 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4eIonisation.cc,v 1.11.2.2 2001/06/28 20:19:50 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
// $Id: G4eIonisation.cc,v 1.22 2001/11/09 13:59:47 maire Exp $
|
||||
// GEANT4 tag $Name: geant4-04-00 $
|
||||
//
|
||||
//
|
||||
// -------------------------------------------------------------
|
||||
// GEANT 4 class implementation file
|
||||
//
|
||||
// History: based on object model of
|
||||
// 2nd December 1995, G.Cosmo
|
||||
// ---------- G4eIonisation physics process -----------
|
||||
//--------------- G4eIonisation physics process --------------------------------
|
||||
// by Laszlo Urban, 20 March 1997
|
||||
// **************************************************************
|
||||
// It is the first implementation of the NEW IONISATION PROCESS.
|
||||
// It calculates the ionisation of e+/e-.
|
||||
// **************************************************************
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// 07-04-98: remove 'tracking cut' of the ionizing particle, MMa
|
||||
// 04-09-98: new methods SetBining() PrintInfo()
|
||||
// 07-09-98: Cleanup
|
||||
// 02/02/99: correction inDoIt , L.Urban
|
||||
// 10/02/00 modifications , new e.m. structure, L.Urban
|
||||
// 28/05/01 V.Ivanchenko minor changes to provide ANSI -wall compilation
|
||||
// --------------------------------------------------------------
|
||||
// 07-04-98 remove 'tracking cut' of the ionizing particle, mma
|
||||
// 04-09-98 new methods SetBining() PrintInfo()
|
||||
// 07-09-98 Cleanup
|
||||
// 02-02-99 correction inDoIt , L.Urban
|
||||
// 10-02-00 modifications , new e.m. structure, L.Urban
|
||||
// 28-05-01 V.Ivanchenko minor changes to provide ANSI -wall compilation
|
||||
// 09-08-01 new methods Store/Retrieve PhysicsTable (mma)
|
||||
// 13-08-01 new function ComputeRestrictedMeandEdx() (mma)
|
||||
// 17-09-01 migration of Materials to pure STL (mma)
|
||||
// 21-09-01 completion of RetrievePhysicsTable() (mma)
|
||||
// 29-10-01 all static functions no more inlined (mma)
|
||||
// 07-11-01 particleMass and Charge become local variables
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4eIonisation.hh"
|
||||
#include "G4EnergyLossTables.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
G4double G4eIonisation::LowerBoundLambda = 1.*keV ;
|
||||
G4double G4eIonisation::UpperBoundLambda = 100.*TeV ;
|
||||
G4int G4eIonisation::NbinLambda = 100 ;
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4eIonisation::LowerBoundLambda = 1.*keV;
|
||||
G4double G4eIonisation::UpperBoundLambda = 100.*TeV;
|
||||
G4int G4eIonisation::NbinLambda = 100;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
// constructor and destructor
|
||||
|
||||
G4eIonisation::G4eIonisation(const G4String& processName)
|
||||
: G4VeEnergyLoss(processName),
|
||||
theMeanFreePathTable(NULL)
|
||||
{ }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4eIonisation::~G4eIonisation()
|
||||
{
|
||||
if (theMeanFreePathTable) {
|
||||
theMeanFreePathTable->clearAndDestroy();
|
||||
delete theMeanFreePathTable;
|
||||
}
|
||||
|
||||
if (theMeanFreePathTable)
|
||||
{theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable;}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4eIonisation::SetLowerBoundLambda(G4double val)
|
||||
{LowerBoundLambda = val;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4eIonisation::SetUpperBoundLambda(G4double val)
|
||||
{UpperBoundLambda = val;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4eIonisation::SetNbinLambda(G4int n)
|
||||
{NbinLambda = n;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4eIonisation::GetLowerBoundLambda()
|
||||
{return LowerBoundLambda;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4eIonisation::GetUpperBoundLambda()
|
||||
{return UpperBoundLambda;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int G4eIonisation::GetNbinLambda()
|
||||
{return NbinLambda;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4eIonisation::BuildPhysicsTable(const G4ParticleDefinition& aParticleType)
|
||||
// just call BuildLossTable+BuildLambdaTable
|
||||
// just call BuildLossTable+BuildLambdaTable
|
||||
{
|
||||
// get bining from EnergyLoss
|
||||
LowestKineticEnergy = GetLowerBoundEloss() ;
|
||||
HighestKineticEnergy = GetUpperBoundEloss() ;
|
||||
TotBin = GetNbinEloss() ;
|
||||
// get bining from EnergyLoss
|
||||
LowestKineticEnergy = GetLowerBoundEloss();
|
||||
HighestKineticEnergy = GetUpperBoundEloss();
|
||||
TotBin = GetNbinEloss();
|
||||
|
||||
BuildLossTable(aParticleType) ;
|
||||
BuildLossTable(aParticleType);
|
||||
|
||||
if(&aParticleType==G4Electron::Electron())
|
||||
{
|
||||
RecorderOfElectronProcess[CounterOfElectronProcess] = (*this).theLossTable ;
|
||||
CounterOfElectronProcess++;
|
||||
}
|
||||
if (&aParticleType==G4Electron::Electron())
|
||||
{
|
||||
RecorderOfElectronProcess[CounterOfElectronProcess] = (*this).theLossTable;
|
||||
CounterOfElectronProcess++;
|
||||
}
|
||||
else
|
||||
{
|
||||
RecorderOfPositronProcess[CounterOfPositronProcess] = (*this).theLossTable ;
|
||||
CounterOfPositronProcess++;
|
||||
}
|
||||
{
|
||||
RecorderOfPositronProcess[CounterOfPositronProcess] = (*this).theLossTable;
|
||||
CounterOfPositronProcess++;
|
||||
}
|
||||
|
||||
BuildLambdaTable(aParticleType) ;
|
||||
BuildLambdaTable(aParticleType);
|
||||
|
||||
BuildDEDXTable(aParticleType) ;
|
||||
BuildDEDXTable(aParticleType);
|
||||
|
||||
if(&aParticleType==G4Electron::Electron())
|
||||
PrintInfoDefinition();
|
||||
if (&aParticleType==G4Electron::Electron()) PrintInfoDefinition();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4eIonisation::BuildLossTable(const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
// Build tables for the ionization energy loss
|
||||
// the tables are built for *MATERIALS*
|
||||
// Build tables of dE/dx due to the ionization process
|
||||
// the tables are built for *MATERIALS*
|
||||
|
||||
const G4double twoln10 = 2.*log(10.);
|
||||
const G4double Factor = twopi_mc2_rcl2;
|
||||
// create table
|
||||
//
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
|
||||
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
|
||||
|
||||
static const G4double Tl = 0.2*keV ;
|
||||
if (theLossTable) {theLossTable->clearAndDestroy(); delete theLossTable;}
|
||||
theLossTable = new G4PhysicsTable(numOfMaterials);
|
||||
|
||||
// get DeltaCut in energy
|
||||
G4double* DeltaCutInKineticEnergy = aParticleType.GetEnergyCuts();
|
||||
|
||||
G4double LowEdgeEnergy, ionloss;
|
||||
|
||||
// material properties
|
||||
G4double ElectronDensity,Eexc,Eexcm2,Cden,Mden,Aden,X0den,X1den ;
|
||||
// some local variables
|
||||
G4double tau,Tmax,gamma,gamma2,bg2,beta2,d,d2,d3,d4,delta,x,y ;
|
||||
|
||||
ParticleMass = aParticleType.GetPDGMass();
|
||||
G4double* ParticleCutInKineticEnergy = aParticleType.GetEnergyCuts() ;
|
||||
|
||||
// create table
|
||||
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
|
||||
G4int numOfMaterials = theMaterialTable->length();
|
||||
|
||||
if (theLossTable) { theLossTable->clearAndDestroy();
|
||||
delete theLossTable;
|
||||
}
|
||||
|
||||
theLossTable = new G4PhysicsTable(numOfMaterials);
|
||||
|
||||
// loop for materials
|
||||
|
||||
for (G4int J=0; J<numOfMaterials; J++)
|
||||
// loop for materials
|
||||
//
|
||||
for (G4int J=0; J<numOfMaterials; J++)
|
||||
{
|
||||
// create physics vector and fill it
|
||||
|
||||
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
|
||||
LowestKineticEnergy, HighestKineticEnergy, TotBin);
|
||||
// create physics vector and fill it
|
||||
G4PhysicsLogVector* aVector = new G4PhysicsLogVector(
|
||||
LowestKineticEnergy, HighestKineticEnergy, TotBin);
|
||||
|
||||
// get material parameters needed for the energy loss calculation
|
||||
const G4Material* material= (*theMaterialTable)[J];
|
||||
const G4Material* material = (*theMaterialTable)[J];
|
||||
G4double DeltaThreshold = DeltaCutInKineticEnergy[J];
|
||||
|
||||
ElectronDensity = material->GetElectronDensity();
|
||||
Eexc = material->GetIonisation()->GetMeanExcitationEnergy();
|
||||
Eexc /= ParticleMass; Eexcm2 = Eexc*Eexc;
|
||||
Cden = material->GetIonisation()->GetCdensity();
|
||||
Mden = material->GetIonisation()->GetMdensity();
|
||||
Aden = material->GetIonisation()->GetAdensity();
|
||||
X0den = material->GetIonisation()->GetX0density();
|
||||
X1den = material->GetIonisation()->GetX1density();
|
||||
|
||||
// for the lowenergy extrapolation
|
||||
G4double Zeff = material->GetTotNbOfElectPerVolume()/
|
||||
material->GetTotNbOfAtomsPerVolume() ;
|
||||
G4double Th = 0.25*sqrt(Zeff)*keV ;
|
||||
|
||||
G4double Tsav ;
|
||||
|
||||
// now comes the loop for the kinetic energy values
|
||||
|
||||
for (G4int i = 0 ; i < TotBin ; i++)
|
||||
// now comes the loop for the kinetic energy values
|
||||
//
|
||||
for (G4int i = 0; i < TotBin; i++)
|
||||
{
|
||||
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
|
||||
// low energy ?
|
||||
if(LowEdgeEnergy < Th)
|
||||
{
|
||||
Tsav = LowEdgeEnergy ;
|
||||
LowEdgeEnergy = Th ;
|
||||
}
|
||||
else
|
||||
Tsav = 0. ;
|
||||
|
||||
tau = LowEdgeEnergy/ParticleMass ;
|
||||
|
||||
// Seltzer-Berger formula
|
||||
gamma = tau + 1.; gamma2 = gamma*gamma;
|
||||
bg2 = tau*(tau+2.);
|
||||
beta2 = bg2/gamma2;
|
||||
|
||||
// electron
|
||||
if (&aParticleType==G4Electron::Electron())
|
||||
{
|
||||
Tmax = LowEdgeEnergy/2.;
|
||||
d = G4std::min(ParticleCutInKineticEnergy[J], Tmax)/ParticleMass;
|
||||
ionloss = log(2.*(tau+2.)/Eexcm2)-1.-beta2
|
||||
+ log((tau-d)*d)+tau/(tau-d)
|
||||
+ (0.5*d*d+(2.*tau+1.)*log(1.-d/tau))/gamma2;
|
||||
}
|
||||
else //positron
|
||||
{
|
||||
Tmax = LowEdgeEnergy ;
|
||||
d = G4std::min(ParticleCutInKineticEnergy[J], Tmax)/ParticleMass;
|
||||
d2=d*d/2.; d3=d*d*d/3.; d4=d*d*d*d/4.;
|
||||
y=1./(1.+gamma);
|
||||
ionloss = log(2.*(tau+2.)/Eexcm2)+log(tau*d)
|
||||
- beta2*(tau+2.*d-y*(3.*d2+y*(d-d3+y*(d2-tau*d3+d4))))/tau;
|
||||
}
|
||||
|
||||
//density correction
|
||||
x = log(bg2)/twoln10;
|
||||
if (x < X0den) delta = 0.;
|
||||
else { delta = twoln10*x - Cden;
|
||||
if (x < X1den) delta += Aden*pow((X1den-x),Mden);
|
||||
}
|
||||
|
||||
//now you can compute the total ionization loss
|
||||
ionloss -= delta ;
|
||||
ionloss *= Factor*ElectronDensity/beta2 ;
|
||||
if (ionloss <= 0.) ionloss = 0.;
|
||||
|
||||
// low energy ?
|
||||
if(Tsav > 0.)
|
||||
{
|
||||
if(Tsav >= Tl)
|
||||
ionloss *= sqrt(LowEdgeEnergy/Tsav) ;
|
||||
else
|
||||
ionloss *= sqrt(LowEdgeEnergy*Tsav)/Tl ;
|
||||
}
|
||||
|
||||
aVector->PutValue(i,ionloss) ;
|
||||
G4double dEdx = ComputeRestrictedMeandEdx(aParticleType,
|
||||
aVector->GetLowEdgeEnergy(i),
|
||||
material,
|
||||
DeltaThreshold);
|
||||
aVector->PutValue(i,dEdx);
|
||||
}
|
||||
theLossTable->insert(aVector);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4eIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
|
||||
{
|
||||
// Build mean free path tables for the delta ray production process
|
||||
// tables are built for MATERIALS
|
||||
|
||||
G4double LowEdgeEnergy, Value, SIGMA;
|
||||
|
||||
//create table
|
||||
//
|
||||
const G4MaterialTable* theMaterialTable=G4Material::GetMaterialTable();
|
||||
G4int numOfMaterials = theMaterialTable->length();
|
||||
|
||||
if (theMeanFreePathTable) { theMeanFreePathTable->clearAndDestroy();
|
||||
delete theMeanFreePathTable;
|
||||
}
|
||||
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
|
||||
|
||||
if (theMeanFreePathTable)
|
||||
{ theMeanFreePathTable->clearAndDestroy(); delete theMeanFreePathTable;}
|
||||
|
||||
theMeanFreePathTable = new G4PhysicsTable(numOfMaterials);
|
||||
|
||||
// get electron cuts in kinetic energy
|
||||
// The electron cuts needed in the case of the positron , too!
|
||||
// This is the reason why SetCut has to be called for electron first !!!!!!!
|
||||
// This is the reason why SetCut has to be called for electron first !!
|
||||
|
||||
if((G4Electron::Electron()->GetCutsInEnergy() == 0) &&
|
||||
( &aParticleType == G4Positron::Positron()))
|
||||
if((G4Electron::Electron()->GetEnergyCuts() == 0) &&
|
||||
(&aParticleType == G4Positron::Positron()))
|
||||
{
|
||||
G4cout << " The ELECTRON energy cuts needed to compute energy loss/mean free path "
|
||||
" for POSITRON , too. " << G4endl;
|
||||
G4Exception(" Call SetCut for e- first !!!!!!") ;
|
||||
G4cout << " The ELECTRON energy cuts needed to compute energy loss"
|
||||
" and mean free path; and for POSITRON, too. " << G4endl;
|
||||
G4Exception(" Call SetCut for e- first !!");
|
||||
}
|
||||
|
||||
G4double* DeltaCutInKineticEnergy = G4Electron::Electron()->GetCutsInEnergy() ;
|
||||
G4double* DeltaCutInKineticEnergy = G4Electron::Electron()->GetEnergyCuts() ;
|
||||
|
||||
// loop for materials
|
||||
|
||||
@@ -276,66 +215,143 @@ void G4eIonisation::BuildLambdaTable(const G4ParticleDefinition& aParticleType)
|
||||
// compute the (macroscopic) cross section first
|
||||
|
||||
const G4Material* material= (*theMaterialTable)[J];
|
||||
const
|
||||
G4ElementVector* theElementVector = material->GetElementVector();
|
||||
const
|
||||
G4double* theAtomicNumDensityVector = material->GetAtomicNumDensityVector();
|
||||
const
|
||||
G4int NumberOfElements = material->GetNumberOfElements() ;
|
||||
const G4ElementVector* theElementVector = material->GetElementVector();
|
||||
const G4double* NbOfAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
|
||||
G4int NumberOfElements = material->GetNumberOfElements();
|
||||
|
||||
// get the electron kinetic energy cut for the actual material,
|
||||
// it will be used in ComputeMicroscopicCrossSection
|
||||
// it will be used in ComputeCrossSectionPerAtom
|
||||
// (--> it will be the same for all the elements in this material )
|
||||
G4double DeltaThreshold = DeltaCutInKineticEnergy[J] ;
|
||||
G4double DeltaThreshold = DeltaCutInKineticEnergy[J];
|
||||
|
||||
for (G4int i = 0 ; i < NbinLambda ; i++)
|
||||
{
|
||||
LowEdgeEnergy = aVector->GetLowEdgeEnergy(i) ;
|
||||
SIGMA = 0.;
|
||||
G4double LowEdgeEnergy = aVector->GetLowEdgeEnergy(i);
|
||||
G4double SIGMA = 0.;
|
||||
for (G4int iel=0; iel<NumberOfElements; iel++ )
|
||||
{
|
||||
SIGMA += theAtomicNumDensityVector[iel]*
|
||||
ComputeMicroscopicCrossSection( aParticleType,
|
||||
LowEdgeEnergy,
|
||||
(*theElementVector)(iel)->GetZ(),
|
||||
DeltaThreshold);
|
||||
SIGMA += NbOfAtomsPerVolume[iel]*
|
||||
ComputeCrossSectionPerAtom(aParticleType,
|
||||
LowEdgeEnergy,
|
||||
(*theElementVector)[iel]->GetZ(),
|
||||
DeltaThreshold);
|
||||
}
|
||||
|
||||
// mean free path = 1./macroscopic cross section
|
||||
Value = SIGMA > DBL_MIN ? 1./SIGMA : DBL_MAX;
|
||||
aVector->PutValue(i, Value) ;
|
||||
G4double Value = SIGMA > DBL_MIN ? 1./SIGMA : DBL_MAX;
|
||||
aVector->PutValue(i, Value);
|
||||
}
|
||||
theMeanFreePathTable->insert(aVector);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4eIonisation::ComputeMicroscopicCrossSection(
|
||||
G4double G4eIonisation::ComputeRestrictedMeandEdx (
|
||||
const G4ParticleDefinition& aParticleType,
|
||||
G4double KineticEnergy,
|
||||
const G4Material* material,
|
||||
G4double DeltaThreshold)
|
||||
{
|
||||
// calculate the dE/dx due to the ionization process (Geant4 internal units)
|
||||
// Seltzer-Berger formula
|
||||
//
|
||||
G4double particleMass = aParticleType.GetPDGMass();
|
||||
|
||||
G4double ElectronDensity = material->GetElectronDensity();
|
||||
G4double Eexc = material->GetIonisation()->GetMeanExcitationEnergy();
|
||||
Eexc /= particleMass; G4double Eexcm2 = Eexc*Eexc;
|
||||
|
||||
// for the lowenergy extrapolation
|
||||
G4double Zeff = material->GetTotNbOfElectPerVolume()/
|
||||
material->GetTotNbOfAtomsPerVolume();
|
||||
G4double Th = 0.25*sqrt(Zeff)*keV;
|
||||
G4double Tsav = 0.;
|
||||
if (KineticEnergy < Th) {Tsav = KineticEnergy; KineticEnergy = Th;}
|
||||
|
||||
G4double tau = KineticEnergy/particleMass;
|
||||
G4double gamma = tau + 1., gamma2 = gamma*gamma, bg2 = tau*(tau+2.);
|
||||
G4double beta2 = bg2/gamma2;
|
||||
|
||||
G4double Tmax,d,dEdx;
|
||||
|
||||
// electron
|
||||
if (&aParticleType==G4Electron::Electron())
|
||||
{
|
||||
Tmax = KineticEnergy/2.;
|
||||
d = G4std::min(DeltaThreshold, Tmax)/particleMass;
|
||||
dEdx = log(2.*(tau+2.)/Eexcm2)-1.-beta2
|
||||
+ log((tau-d)*d)+tau/(tau-d)
|
||||
+ (0.5*d*d+(2.*tau+1.)*log(1.-d/tau))/gamma2;
|
||||
}
|
||||
|
||||
else //positron
|
||||
{
|
||||
Tmax = KineticEnergy;
|
||||
d = G4std::min(DeltaThreshold, Tmax)/particleMass;
|
||||
G4double d2=d*d/2., d3=d*d*d/3., d4=d*d*d*d/4.;
|
||||
G4double y=1./(1.+gamma);
|
||||
dEdx = log(2.*(tau+2.)/Eexcm2)+log(tau*d)
|
||||
- beta2*(tau+2.*d-y*(3.*d2+y*(d-d3+y*(d2-tau*d3+d4))))/tau;
|
||||
}
|
||||
|
||||
//density correction
|
||||
G4double Cden = material->GetIonisation()->GetCdensity();
|
||||
G4double Mden = material->GetIonisation()->GetMdensity();
|
||||
G4double Aden = material->GetIonisation()->GetAdensity();
|
||||
G4double X0den = material->GetIonisation()->GetX0density();
|
||||
G4double X1den = material->GetIonisation()->GetX1density();
|
||||
|
||||
const G4double twoln10 = 2.*log(10.);
|
||||
G4double x = log(bg2)/twoln10;
|
||||
G4double delta;
|
||||
if (x < X0den) delta = 0.;
|
||||
else {delta = twoln10*x - Cden;
|
||||
if (x < X1den) delta += Aden*pow((X1den-x),Mden);
|
||||
}
|
||||
|
||||
//now you can compute the total ionization loss
|
||||
dEdx -= delta;
|
||||
dEdx *= twopi_mc2_rcl2*ElectronDensity/beta2;
|
||||
if (dEdx <= 0.) dEdx = 0.;
|
||||
|
||||
// low energy ?
|
||||
const G4double Tl = 0.2*keV;
|
||||
if (Tsav > 0.)
|
||||
{
|
||||
if (Tsav >= Tl) dEdx *= sqrt(KineticEnergy/Tsav);
|
||||
else dEdx *= sqrt(KineticEnergy*Tsav)/Tl;
|
||||
}
|
||||
return dEdx;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4double G4eIonisation::ComputeCrossSectionPerAtom(
|
||||
const G4ParticleDefinition& aParticleType,
|
||||
G4double KineticEnergy,
|
||||
G4double AtomicNumber ,
|
||||
G4double DeltaThreshold)
|
||||
{
|
||||
// calculates the microscopic cross section
|
||||
// calculates the cross section per atom (Geant4 internal units)
|
||||
//(it is called for elements , AtomicNumber = Z )
|
||||
|
||||
G4double MaxKineticEnergyTransfer, TotalCrossSection(0.);
|
||||
|
||||
ParticleMass = aParticleType.GetPDGMass();
|
||||
G4double TotalEnergy = KineticEnergy + ParticleMass;
|
||||
G4double particleMass = aParticleType.GetPDGMass();
|
||||
G4double TotalEnergy = KineticEnergy + particleMass;
|
||||
|
||||
G4double betasquare = KineticEnergy*(TotalEnergy+ParticleMass)
|
||||
G4double betasquare = KineticEnergy*(TotalEnergy+particleMass)
|
||||
/(TotalEnergy*TotalEnergy);
|
||||
G4double gamma = TotalEnergy/ParticleMass, gamma2 = gamma*gamma;
|
||||
G4double gamma = TotalEnergy/particleMass, gamma2 = gamma*gamma;
|
||||
G4double x=DeltaThreshold/KineticEnergy, x2 = x*x;
|
||||
|
||||
G4double MaxKineticEnergyTransfer;
|
||||
if (&aParticleType==G4Electron::Electron())
|
||||
MaxKineticEnergyTransfer = 0.5*KineticEnergy;
|
||||
else MaxKineticEnergyTransfer = KineticEnergy;
|
||||
|
||||
// now you can calculate the total cross section
|
||||
MaxKineticEnergyTransfer = 0.5*KineticEnergy;
|
||||
else MaxKineticEnergyTransfer = KineticEnergy;
|
||||
|
||||
// now you can calculate the total cross section
|
||||
//
|
||||
G4double TotalCrossSection = 0.;
|
||||
if (MaxKineticEnergyTransfer > DeltaThreshold)
|
||||
{
|
||||
if (&aParticleType==G4Electron::Electron()) //Moller (e-e-) scattering
|
||||
@@ -356,26 +372,26 @@ G4double G4eIonisation::ComputeMicroscopicCrossSection(
|
||||
return TotalCrossSection ;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
const G4Step& stepData)
|
||||
{
|
||||
aParticleChange.Initialize(trackData) ;
|
||||
|
||||
G4Material* aMaterial = trackData.GetMaterial() ;
|
||||
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle() ;
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
ParticleMass = aParticle->GetDefinition()->GetPDGMass();
|
||||
G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
const G4Step& stepData)
|
||||
{
|
||||
aParticleChange.Initialize(trackData);
|
||||
|
||||
G4Material* aMaterial = trackData.GetMaterial();
|
||||
const G4DynamicParticle* aParticle = trackData.GetDynamicParticle();
|
||||
|
||||
G4double particleMass = aParticle->GetDefinition()->GetPDGMass();
|
||||
G4double Charge = aParticle->GetDefinition()->GetPDGCharge();
|
||||
G4double KineticEnergy = aParticle->GetKineticEnergy();
|
||||
G4double TotalEnergy = KineticEnergy + ParticleMass;
|
||||
G4double Psquare = KineticEnergy*(TotalEnergy+ParticleMass);
|
||||
G4double TotalEnergy = KineticEnergy + particleMass;
|
||||
G4double Psquare = KineticEnergy*(TotalEnergy+particleMass);
|
||||
G4double TotalMomentum = sqrt(Psquare);
|
||||
//G4double Esquare=TotalEnergy*TotalEnergy;
|
||||
G4ParticleMomentum ParticleDirection = aParticle->GetMomentumDirection();
|
||||
|
||||
// get kinetic energy cut for the electron
|
||||
G4double* DeltaCutInKineticEnergy = G4Electron::Electron()->GetCutsInEnergy() ;
|
||||
// get kinetic energy cut for the electron
|
||||
G4double* DeltaCutInKineticEnergy = G4Electron::Electron()->GetEnergyCuts() ;
|
||||
G4double DeltaThreshold = DeltaCutInKineticEnergy[aMaterial->GetIndex()];
|
||||
|
||||
// some kinematics
|
||||
@@ -385,15 +401,15 @@ G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
|
||||
// sampling kinetic energy of the delta ray
|
||||
|
||||
if (MaxKineticEnergyTransfer <= DeltaThreshold) // pathological case (should not happen,
|
||||
// there is no change at all)
|
||||
if (MaxKineticEnergyTransfer <= DeltaThreshold)
|
||||
// pathological case (should not happen, there is no change at all)
|
||||
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
|
||||
|
||||
|
||||
// normal case
|
||||
G4double cc,y,y2,c2,b0,b1,b2,b3,b4,x,x1,grej,grejc;
|
||||
|
||||
G4double tau = KineticEnergy/ParticleMass;
|
||||
G4double tau = KineticEnergy/particleMass;
|
||||
G4double gamma = tau+1., gamma2=gamma*gamma;
|
||||
G4double xc = DeltaThreshold/KineticEnergy, xc1=1.-xc;
|
||||
|
||||
@@ -405,7 +421,7 @@ G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
do {
|
||||
x = xc/(1.-cc*G4UniformRand()); x1 = 1.-x;
|
||||
grej = b2*x*x-b3*x/x1+b1*gamma2/(x1*x1);
|
||||
} while (G4UniformRand()>grej) ;
|
||||
} while (G4UniformRand()>grej);
|
||||
}
|
||||
else // Bhabha (e+e-) scattering
|
||||
{
|
||||
@@ -424,10 +440,10 @@ G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
|
||||
// protection :do not produce a secondary with 0. kinetic energy !
|
||||
if (DeltaKineticEnergy <= 0.)
|
||||
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
|
||||
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
|
||||
|
||||
G4double DeltaTotalMomentum = sqrt(DeltaKineticEnergy * (DeltaKineticEnergy +
|
||||
2. * electron_mass_c2 ));
|
||||
G4double DeltaTotalMomentum = sqrt(DeltaKineticEnergy*(DeltaKineticEnergy +
|
||||
2.*electron_mass_c2 ));
|
||||
|
||||
G4double costheta = DeltaKineticEnergy * (TotalEnergy + electron_mass_c2)
|
||||
/(DeltaTotalMomentum * TotalMomentum);
|
||||
@@ -439,7 +455,7 @@ G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
|
||||
G4double phi = twopi * G4UniformRand();
|
||||
G4double sintheta = sqrt((1.+costheta)*(1.-costheta));
|
||||
G4double dirx = sintheta * cos(phi), diry = sintheta * sin(phi), dirz = costheta;
|
||||
G4double dirx = sintheta*cos(phi), diry = sintheta*sin(phi), dirz = costheta;
|
||||
|
||||
G4ThreeVector DeltaDirection(dirx,diry,dirz);
|
||||
DeltaDirection.rotateUz(ParticleDirection);
|
||||
@@ -456,7 +472,7 @@ G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
// changed energy and momentum of the actual particle
|
||||
G4double finalKineticEnergy = KineticEnergy - DeltaKineticEnergy;
|
||||
|
||||
G4double Edep = 0. ;
|
||||
G4double Edep = 0.;
|
||||
|
||||
if (finalKineticEnergy > MinKineticEnergy)
|
||||
{
|
||||
@@ -467,41 +483,132 @@ G4VParticleChange* G4eIonisation::PostStepDoIt( const G4Track& trackData,
|
||||
G4double finalPz = TotalMomentum*ParticleDirection.z()
|
||||
- DeltaTotalMomentum*DeltaDirection.z();
|
||||
G4double finalMomentum =
|
||||
sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz) ;
|
||||
finalPx /= finalMomentum ;
|
||||
finalPy /= finalMomentum ;
|
||||
finalPz /= finalMomentum ;
|
||||
sqrt(finalPx*finalPx+finalPy*finalPy+finalPz*finalPz);
|
||||
finalPx /= finalMomentum;
|
||||
finalPy /= finalMomentum;
|
||||
finalPz /= finalMomentum;
|
||||
|
||||
aParticleChange.SetMomentumChange( finalPx,finalPy,finalPz );
|
||||
aParticleChange.SetMomentumChange(finalPx, finalPy, finalPz);
|
||||
}
|
||||
else
|
||||
{
|
||||
finalKineticEnergy = 0.;
|
||||
Edep = finalKineticEnergy ;
|
||||
Edep = finalKineticEnergy;
|
||||
finalKineticEnergy = 0.;
|
||||
if (Charge < 0.) aParticleChange.SetStatusChange(fStopAndKill);
|
||||
else aParticleChange.SetStatusChange(fStopButAlive);
|
||||
}
|
||||
|
||||
aParticleChange.SetEnergyChange( finalKineticEnergy );
|
||||
aParticleChange.SetEnergyChange(finalKineticEnergy);
|
||||
aParticleChange.SetNumberOfSecondaries(1);
|
||||
aParticleChange.AddSecondary( theDeltaRay );
|
||||
aParticleChange.SetLocalEnergyDeposit (Edep);
|
||||
aParticleChange.AddSecondary(theDeltaRay);
|
||||
aParticleChange.SetLocalEnergyDeposit(Edep);
|
||||
|
||||
return G4VContinuousDiscreteProcess::PostStepDoIt(trackData,stepData);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4eIonisation::StorePhysicsTable(G4ParticleDefinition* particle,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
G4String filename;
|
||||
|
||||
// store stopping power table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
|
||||
if ( !theLossTable->StorePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theLossTable->StorePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
// store mean free path table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
|
||||
if ( !theMeanFreePathTable->StorePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theMeanFreePathTable->StorePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
G4cout << GetProcessName() << " for " << particle->GetParticleName()
|
||||
<< ": Success to store the PhysicsTables in "
|
||||
<< directory << G4endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool G4eIonisation::RetrievePhysicsTable(G4ParticleDefinition* particle,
|
||||
const G4String& directory,
|
||||
G4bool ascii)
|
||||
{
|
||||
// delete theLossTable and theMeanFreePathTable
|
||||
if (theLossTable != 0) {
|
||||
theLossTable->clearAndDestroy();
|
||||
delete theLossTable;
|
||||
}
|
||||
if (theMeanFreePathTable != 0) {
|
||||
theMeanFreePathTable->clearAndDestroy();
|
||||
delete theMeanFreePathTable;
|
||||
}
|
||||
|
||||
// get bining from EnergyLoss
|
||||
LowestKineticEnergy = GetLowerBoundEloss();
|
||||
HighestKineticEnergy = GetUpperBoundEloss();
|
||||
TotBin = GetNbinEloss();
|
||||
|
||||
G4String filename;
|
||||
|
||||
// retreive stopping power table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"StoppingPower",ascii);
|
||||
theLossTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
|
||||
if ( !theLossTable->RetrievePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theLossTable->RetrievePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// retreive mean free path table
|
||||
filename = GetPhysicsTableFileName(particle,directory,"MeanFreePath",ascii);
|
||||
theMeanFreePathTable = new G4PhysicsTable(G4Material::GetNumberOfMaterials());
|
||||
if ( !theMeanFreePathTable->RetrievePhysicsTable(filename, ascii) ){
|
||||
G4cout << " FAIL theMeanFreePathTable->RetrievePhysicsTable in " << filename
|
||||
<< G4endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
G4cout << GetProcessName() << " for " << particle->GetParticleName()
|
||||
<< ": Success to retrieve the PhysicsTables from "
|
||||
<< directory << G4endl;
|
||||
|
||||
if (particle==G4Electron::Electron())
|
||||
{
|
||||
RecorderOfElectronProcess[CounterOfElectronProcess] = (*this).theLossTable;
|
||||
CounterOfElectronProcess++;
|
||||
}
|
||||
else
|
||||
{
|
||||
RecorderOfPositronProcess[CounterOfPositronProcess] = (*this).theLossTable;
|
||||
CounterOfPositronProcess++;
|
||||
}
|
||||
|
||||
BuildDEDXTable(*particle);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void G4eIonisation::PrintInfoDefinition()
|
||||
{
|
||||
G4String comments = "delta cross sections from Moller+Bhabha. ";
|
||||
comments += "Good description from 1 KeV to 100 GeV.\n";
|
||||
comments += " delta ray energy sampled from differential Xsection.";
|
||||
G4String comments = "delta cross sections from Moller+Bhabha. "
|
||||
"Good description from 1 KeV to 100 GeV.\n"
|
||||
" delta ray energy sampled from differential Xsection.";
|
||||
|
||||
G4cout << G4endl << GetProcessName() << ": " << comments
|
||||
<< "\n PhysicsTables from " << G4BestUnit(LowerBoundLambda,"Energy")
|
||||
<< "\n PhysicsTables from "
|
||||
<< G4BestUnit(LowerBoundLambda,"Energy")
|
||||
<< " to " << G4BestUnit(UpperBoundLambda,"Energy")
|
||||
<< " in " << NbinLambda << " bins. \n";
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
Reference in New Issue
Block a user