Import Geant4 10.6.0.beta source tree
This commit is contained in:
@@ -121,10 +121,11 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
|
||||
SetVerboseLevel(1);
|
||||
|
||||
// low energy limit
|
||||
lowestKinEnergy = theParameters->LowestElectronEnergy();
|
||||
preStepKinEnergy = 0.0;
|
||||
preStepRangeEnergy = 0.0;
|
||||
computedRange = DBL_MAX;
|
||||
lowestKinEnergy = theParameters->LowestElectronEnergy();
|
||||
preStepKinEnergy = 0.0;
|
||||
preStepLogKinEnergy = LOG_EKIN_MIN;
|
||||
preStepRangeEnergy = 0.0;
|
||||
computedRange = DBL_MAX;
|
||||
|
||||
// Size of tables assuming spline
|
||||
minKinEnergy = 0.1*keV;
|
||||
@@ -136,12 +137,13 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
|
||||
= actLossFluc = actIntegral = actStepFunc = false;
|
||||
|
||||
// default linear loss limit for spline
|
||||
linLossLimit = 0.01;
|
||||
dRoverRange = 0.2;
|
||||
finalRange = CLHEP::mm;
|
||||
linLossLimit = 0.01;
|
||||
dRoverRange = 0.2;
|
||||
finalRange = CLHEP::mm;
|
||||
|
||||
// default lambda factor
|
||||
lambdaFactor = 0.8;
|
||||
lambdaFactor = 0.8;
|
||||
logLambdafactor = G4Log(lambdaFactor);
|
||||
|
||||
// cross section biasing
|
||||
biasFactor = 1.0;
|
||||
@@ -185,7 +187,8 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
|
||||
currentMaterial = nullptr;
|
||||
currentCoupleIndex = basedCoupleIndex = 0;
|
||||
massRatio = fFactor = reduceFactor = chargeSqRatio = 1.0;
|
||||
preStepLambda = preStepScaledEnergy = fRange = 0.0;
|
||||
preStepLambda = preStepScaledEnergy = fRange = logMassRatio = 0.0;
|
||||
preStepLogScaledEnergy = LOG_EKIN_MIN;
|
||||
|
||||
secID = biasID = subsecID = -1;
|
||||
}
|
||||
@@ -369,11 +372,13 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
preStepLambda = 0.0;
|
||||
mfpKinEnergy = DBL_MAX;
|
||||
fRange = DBL_MAX;
|
||||
preStepKinEnergy = 0.0;
|
||||
preStepRangeEnergy = 0.0;
|
||||
preStepKinEnergy = 0.0;
|
||||
preStepLogKinEnergy = LOG_EKIN_MIN;
|
||||
preStepRangeEnergy = 0.0;
|
||||
chargeSqRatio = 1.0;
|
||||
massRatio = 1.0;
|
||||
reduceFactor = 1.0;
|
||||
massRatio = 1.0;
|
||||
logMassRatio = 0.;
|
||||
reduceFactor = 1.0;
|
||||
fFactor = 1.0;
|
||||
lastIdx = 0;
|
||||
|
||||
@@ -450,7 +455,8 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
nBinsCSDA = theParameters->NumberOfBinsPerDecade()
|
||||
*G4lrint(std::log10(maxKinEnergyCSDA/minKinEnergy));
|
||||
if(!actLinLossLimit) { linLossLimit = theParameters->LinearLossLimit(); }
|
||||
lambdaFactor = theParameters->LambdaFactor();
|
||||
lambdaFactor = theParameters->LambdaFactor();
|
||||
logLambdafactor = G4Log(lambdaFactor);
|
||||
if(isMaster) { SetVerboseLevel(theParameters->Verbose()); }
|
||||
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
|
||||
|
||||
@@ -462,7 +468,8 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
|
||||
G4double initialMass = particle->GetPDGMass();
|
||||
|
||||
if (baseParticle) {
|
||||
massRatio = (baseParticle->GetPDGMass())/initialMass;
|
||||
massRatio = (baseParticle->GetPDGMass())/initialMass;
|
||||
logMassRatio = G4Log(massRatio);
|
||||
G4double q = initialCharge/baseParticle->GetPDGCharge();
|
||||
chargeSqRatio = q*q;
|
||||
if(chargeSqRatio > 0.0) { reduceFactor = 1.0/(chargeSqRatio*massRatio); }
|
||||
@@ -1001,11 +1008,14 @@ void G4VEnergyLossProcess::StartTracking(G4Track* track)
|
||||
|
||||
G4double newmass = track->GetDefinition()->GetPDGMass();
|
||||
if(baseParticle) {
|
||||
massRatio = baseParticle->GetPDGMass()/newmass;
|
||||
massRatio = baseParticle->GetPDGMass()/newmass;
|
||||
logMassRatio = G4Log(massRatio);
|
||||
} else if(theGenericIon) {
|
||||
massRatio = proton_mass_c2/newmass;
|
||||
massRatio = proton_mass_c2/newmass;
|
||||
logMassRatio = G4Log(massRatio);
|
||||
} else {
|
||||
massRatio = 1.0;
|
||||
massRatio = 1.0;
|
||||
logMassRatio = 0.0;
|
||||
}
|
||||
}
|
||||
// forced biasing only for primary particles
|
||||
@@ -1027,7 +1037,8 @@ G4double G4VEnergyLossProcess::AlongStepGetPhysicalInteractionLength(
|
||||
G4double x = DBL_MAX;
|
||||
*selection = aGPILSelection;
|
||||
if(isIonisation && currentModel->IsActive(preStepScaledEnergy)) {
|
||||
fRange = GetScaledRangeForScaledEnergy(preStepScaledEnergy)*reduceFactor;
|
||||
fRange = reduceFactor*GetScaledRangeForScaledEnergy(preStepScaledEnergy,
|
||||
preStepLogScaledEnergy);
|
||||
G4double finR = (rndmStepFlag) ? std::min(finalRange,
|
||||
currentCouple->GetProductionCuts()->GetProductionCut(1)) : finalRange;
|
||||
x = (fRange > finR) ?
|
||||
@@ -1062,8 +1073,10 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
|
||||
// initialisation of material, mass, charge, model
|
||||
// at the beginning of the step
|
||||
DefineMaterial(track.GetMaterialCutsCouple());
|
||||
preStepKinEnergy = track.GetKineticEnergy();
|
||||
preStepScaledEnergy = preStepKinEnergy*massRatio;
|
||||
preStepKinEnergy = track.GetKineticEnergy();
|
||||
preStepLogKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
|
||||
preStepScaledEnergy = preStepKinEnergy*massRatio;
|
||||
preStepLogScaledEnergy = preStepLogKinEnergy + logMassRatio;
|
||||
SelectModel(preStepScaledEnergy);
|
||||
|
||||
if(!currentModel->IsActive(preStepScaledEnergy)) {
|
||||
@@ -1094,8 +1107,12 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
|
||||
|
||||
// compute mean free path
|
||||
if(preStepScaledEnergy < mfpKinEnergy) {
|
||||
if (integral) { ComputeLambdaForScaledEnergy(preStepScaledEnergy); }
|
||||
else { preStepLambda = GetLambdaForScaledEnergy(preStepScaledEnergy); }
|
||||
if (integral) {
|
||||
ComputeLambdaForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
|
||||
} else {
|
||||
preStepLambda =
|
||||
GetLambdaForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
|
||||
}
|
||||
|
||||
// zero cross section
|
||||
if(preStepLambda <= 0.0) {
|
||||
@@ -1145,30 +1162,31 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
void G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e)
|
||||
void
|
||||
G4VEnergyLossProcess::ComputeLambdaForScaledEnergy(G4double e, G4double loge)
|
||||
{
|
||||
// condition to skip recomputation of cross section
|
||||
G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
|
||||
const G4double epeak = theEnergyOfCrossSectionMax[currentCoupleIndex];
|
||||
if(e <= epeak && e/lambdaFactor >= mfpKinEnergy) { return; }
|
||||
|
||||
// recomputation is needed
|
||||
if (e <= epeak) {
|
||||
preStepLambda = GetLambdaForScaledEnergy(e);
|
||||
mfpKinEnergy = e;
|
||||
|
||||
preStepLambda = GetLambdaForScaledEnergy(e, loge);
|
||||
mfpKinEnergy = e;
|
||||
} else {
|
||||
G4double e1 = e*lambdaFactor;
|
||||
if(e1 > epeak) {
|
||||
preStepLambda = GetLambdaForScaledEnergy(e);
|
||||
mfpKinEnergy = e;
|
||||
G4double preStepLambda1 = GetLambdaForScaledEnergy(e1);
|
||||
if(preStepLambda1 > preStepLambda) {
|
||||
mfpKinEnergy = e1;
|
||||
const G4double e1 = e*lambdaFactor;
|
||||
if (e1 > epeak) {
|
||||
preStepLambda = GetLambdaForScaledEnergy(e, loge);
|
||||
mfpKinEnergy = e;
|
||||
const G4double preStepLambda1 =
|
||||
GetLambdaForScaledEnergy(e1, loge+logLambdafactor);
|
||||
if (preStepLambda1 > preStepLambda) {
|
||||
mfpKinEnergy = e1;
|
||||
preStepLambda = preStepLambda1;
|
||||
}
|
||||
} else {
|
||||
preStepLambda = fFactor*theCrossSectionMax[currentCoupleIndex];
|
||||
mfpKinEnergy = epeak;
|
||||
mfpKinEnergy = epeak;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1233,7 +1251,8 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
|
||||
// << " " << GetProcessName() << " "<< currentMaterial->GetName()<<G4endl;
|
||||
//if(particle->GetParticleName() == "e-")G4cout << (*theDEDXTable) <<G4endl;
|
||||
// Short step
|
||||
eloss = GetDEDXForScaledEnergy(preStepScaledEnergy)*length;
|
||||
eloss = GetDEDXForScaledEnergy(preStepScaledEnergy, preStepLogScaledEnergy);
|
||||
eloss *= length;
|
||||
|
||||
//G4cout << "eloss= " << eloss << G4endl;
|
||||
|
||||
@@ -1577,9 +1596,14 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
|
||||
}
|
||||
}
|
||||
|
||||
const G4DynamicParticle* dp = track.GetDynamicParticle();
|
||||
const G4double logFinalT = dp->GetLogKineticEnergy();
|
||||
// postStepLogScaledEnergy = logFinalT + logMassRatio;
|
||||
|
||||
// Integral approach
|
||||
if (integral) {
|
||||
G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy);
|
||||
const G4double lx = GetLambdaForScaledEnergy(postStepScaledEnergy,
|
||||
logFinalT + logMassRatio);
|
||||
/*
|
||||
if(preStepLambda<lx && 1 < verboseLevel) {
|
||||
G4cout << "WARNING: for " << particle->GetParticleName()
|
||||
@@ -1604,15 +1628,13 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
|
||||
fParticleChange.ProposeWeight(weight);
|
||||
}
|
||||
|
||||
const G4DynamicParticle* dynParticle = track.GetDynamicParticle();
|
||||
G4double tcut = (*theCuts)[currentCoupleIndex];
|
||||
|
||||
// sample secondaries
|
||||
secParticles.clear();
|
||||
//G4cout<< "@@@ Eprimary= "<<dynParticle->GetKineticEnergy()/MeV
|
||||
// << " cut= " << tcut/MeV << G4endl;
|
||||
currentModel->SampleSecondaries(&secParticles, currentCouple,
|
||||
dynParticle, tcut);
|
||||
currentModel->SampleSecondaries(&secParticles, currentCouple, dp, tcut);
|
||||
|
||||
G4int num0 = secParticles.size();
|
||||
|
||||
@@ -1892,14 +1914,17 @@ G4double G4VEnergyLossProcess::GetDEDXDispersion(
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
|
||||
|
||||
G4double G4VEnergyLossProcess::CrossSectionPerVolume(
|
||||
G4double kineticEnergy, const G4MaterialCutsCouple* couple)
|
||||
G4double
|
||||
G4VEnergyLossProcess::CrossSectionPerVolume(G4double kineticEnergy,
|
||||
const G4MaterialCutsCouple* couple,
|
||||
G4double logKineticEnergy)
|
||||
{
|
||||
// Cross section per volume is calculated
|
||||
DefineMaterial(couple);
|
||||
G4double cross = 0.0;
|
||||
if(theLambdaTable) {
|
||||
cross = GetLambdaForScaledEnergy(kineticEnergy*massRatio);
|
||||
if (theLambdaTable) {
|
||||
cross = GetLambdaForScaledEnergy(kineticEnergy * massRatio,
|
||||
logKineticEnergy + logMassRatio);
|
||||
} else {
|
||||
SelectModel(kineticEnergy*massRatio);
|
||||
cross = biasFactor*(*theDensityFactor)[currentCoupleIndex]
|
||||
@@ -1915,7 +1940,10 @@ G4double G4VEnergyLossProcess::CrossSectionPerVolume(
|
||||
G4double G4VEnergyLossProcess::MeanFreePath(const G4Track& track)
|
||||
{
|
||||
DefineMaterial(track.GetMaterialCutsCouple());
|
||||
G4double cs = GetLambdaForScaledEnergy(track.GetKineticEnergy()*massRatio);
|
||||
const G4double kinEnergy = track.GetKineticEnergy();
|
||||
const G4double logKinEnergy = track.GetDynamicParticle()->GetLogKineticEnergy();
|
||||
const G4double cs = GetLambdaForScaledEnergy(kinEnergy * massRatio,
|
||||
logKinEnergy + logMassRatio);
|
||||
return (0.0 < cs) ? 1.0/cs : DBL_MAX;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user