Import Geant4 10.7.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2020-06-26 10:23:25 +02:00
parent c02c370437
commit 67ba86d073
1871 changed files with 174422 additions and 131884 deletions
@@ -391,7 +391,7 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
if(mname == "ParamICRU73" || mname == "LinhardSorensen" || mname == "Atima") {
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
if(verbose > 1) {
G4cout << " ICRU73 ion E(MeV)= " << kinEnergy << " ";
G4cout << mname << " ion E(MeV)= " << kinEnergy << " ";
G4cout << currentModel->GetName() << ": DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
@@ -40,6 +40,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmExtraParameters.hh"
#include "G4ParticleDefinition.hh"
#include "G4PhysicalConstants.hh"
#include "G4UnitsTable.hh"
#include "G4SystemOfUnits.hh"
@@ -77,6 +78,10 @@ void G4EmExtraParameters::Initialise()
finalRange = CLHEP::mm;
dRoverRangeMuHad = 0.2;
finalRangeMuHad = 0.1*CLHEP::mm;
dRoverRangeLIons = 0.2;
finalRangeLIons = 0.1*CLHEP::mm;
dRoverRangeIons = 0.2;
finalRangeIons = 0.1*CLHEP::mm;
m_regnamesForced.clear();
m_procForced.clear();
@@ -149,6 +154,72 @@ G4double G4EmExtraParameters::GetStepFunctionMuHadP2() const
return finalRangeMuHad;
}
void G4EmExtraParameters::SetStepFunctionLightIons(G4double v1, G4double v2)
{
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRangeLIons = v1;
finalRangeLIons = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
}
G4double G4EmExtraParameters::GetStepFunctionLightIonsP1() const
{
return dRoverRangeLIons;
}
G4double G4EmExtraParameters::GetStepFunctionLightIonsP2() const
{
return finalRangeLIons;
}
void G4EmExtraParameters::SetStepFunctionIons(G4double v1, G4double v2)
{
if(v1 > 0.0 && v1 <= 1.0 && v2 > 0.0) {
dRoverRangeIons = v1;
finalRangeIons = v2;
} else {
G4ExceptionDescription ed;
ed << "Values of step function are out of range: "
<< v1 << ", " << v2/CLHEP::mm << " mm - are ignored";
PrintWarning(ed);
}
}
G4double G4EmExtraParameters::GetStepFunctionIonsP1() const
{
return dRoverRangeIons;
}
G4double G4EmExtraParameters::GetStepFunctionIonsP2() const
{
return finalRangeIons;
}
void G4EmExtraParameters::FillStepFunction(const G4ParticleDefinition* part, G4VEnergyLossProcess* proc) const
{
// electron and positron
if (11 == std::abs(part->GetPDGEncoding())) {
proc->SetStepFunction(dRoverRange, finalRange);
// all heavy ions
} else if (part->IsGeneralIon()) {
proc->SetStepFunction(dRoverRangeIons, finalRangeIons);
// light nucleus and anti-nucleus
} else if (part->GetParticleType() == "nucleus" || part->GetParticleType() == "anti_nucleus") {
proc->SetStepFunction(dRoverRangeLIons, finalRangeLIons);
// other particles
} else {
proc->SetStepFunction(dRoverRangeMuHad, finalRangeMuHad);
}
}
void G4EmExtraParameters::AddPAIModel(const G4String& particle,
const G4String& region,
const G4String& type)
@@ -307,12 +378,8 @@ G4EmExtraParameters::ActivateSecondaryBiasing(const G4String& procname,
}
}
void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr,
G4bool isElectron) const
void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr) const
{
if(isElectron) { ptr->SetStepFunction(dRoverRange, finalRange, false); }
else { ptr->SetStepFunction(dRoverRangeMuHad, finalRangeMuHad, false); }
G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int n = m_regnamesSubCut.size();
for(G4int i=0; i<n; ++i) {
@@ -131,6 +131,42 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
unitPrm1->SetDefaultValue("mm");
StepFuncCmd1->SetParameter(unitPrm1);
StepFuncCmd2 = new G4UIcommand("/process/eLoss/StepFunctionLightIons",this);
StepFuncCmd2->SetGuidance("Set the energy loss step limitation parameters for light ions.");
StepFuncCmd2->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd2->SetGuidance(" finalRange: range for final step");
StepFuncCmd2->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm2 = new G4UIparameter("dRoverRLIons",'d',false);
dRoverRPrm2->SetParameterRange("dRoverRLIons>0. && dRoverRLIons<=1.");
StepFuncCmd2->SetParameter(dRoverRPrm2);
G4UIparameter* finalRangePrm2 = new G4UIparameter("finalRangeLIons",'d',false);
finalRangePrm2->SetParameterRange("finalRangeLIons>0.");
StepFuncCmd2->SetParameter(finalRangePrm2);
G4UIparameter* unitPrm2 = new G4UIparameter("unit",'s',true);
unitPrm2->SetDefaultValue("mm");
StepFuncCmd2->SetParameter(unitPrm2);
StepFuncCmd3 = new G4UIcommand("/process/eLoss/StepFunctionIons",this);
StepFuncCmd3->SetGuidance("Set the energy loss step limitation parameters for ions.");
StepFuncCmd3->SetGuidance(" dRoverR : max Range variation per step");
StepFuncCmd3->SetGuidance(" finalRange: range for final step");
StepFuncCmd3->AvailableForStates(G4State_PreInit,G4State_Idle);
G4UIparameter* dRoverRPrm3 = new G4UIparameter("dRoverRMuHad",'d',false);
dRoverRPrm3->SetParameterRange("dRoverRIons>0. && dRoverRIons<=1.");
StepFuncCmd3->SetParameter(dRoverRPrm3);
G4UIparameter* finalRangePrm3 = new G4UIparameter("finalRangeIons",'d',false);
finalRangePrm3->SetParameterRange("finalRangeIons>0.");
StepFuncCmd3->SetParameter(finalRangePrm3);
G4UIparameter* unitPrm3 = new G4UIparameter("unit",'s',true);
unitPrm3->SetDefaultValue("mm");
StepFuncCmd3->SetParameter(unitPrm3);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
@@ -235,6 +271,8 @@ G4EmExtraParametersMessenger::~G4EmExtraParametersMessenger()
delete qeCmd;
delete StepFuncCmd;
delete StepFuncCmd1;
delete StepFuncCmd2;
delete StepFuncCmd3;
delete dirSplitCmd;
delete dirSplitTargetCmd;
delete dirSplitRadiusCmd;
@@ -257,7 +295,7 @@ void G4EmExtraParametersMessenger::SetNewValue(G4UIcommand* command,
std::istringstream is(newValue);
is >> s1 >> s2;
theParameters->AddPhysics(s1, s2);
} else if (command == StepFuncCmd || command == StepFuncCmd1) {
} else if (command == StepFuncCmd || command == StepFuncCmd1 || command == StepFuncCmd2 || command == StepFuncCmd3) {
G4double v1,v2;
G4String unt;
std::istringstream is(newValue);
@@ -265,8 +303,12 @@ void G4EmExtraParametersMessenger::SetNewValue(G4UIcommand* command,
v2 *= G4UIcommand::ValueOf(unt);
if(command == StepFuncCmd) {
theParameters->SetStepFunction(v1,v2);
} else {
} else if(command == StepFuncCmd1) {
theParameters->SetStepFunctionMuHad(v1,v2);
} else if(command == StepFuncCmd2) {
theParameters->SetStepFunctionLightIons(v1,v2);
} else {
theParameters->SetStepFunctionIons(v1,v2);
}
physicsModified = true;
} else if (command == SubSecCmd) {
@@ -80,6 +80,7 @@ void G4EmLowEParameters::Initialise()
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
livDataDir = "livermore";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -196,6 +197,16 @@ const G4String& G4EmLowEParameters::PIXEElectronCrossSectionModel()
return nameElectronPIXE;
}
void G4EmLowEParameters::SetLivermoreDataDir(const G4String& sss)
{
livDataDir = sss;
}
const G4String& G4EmLowEParameters::LivermoreDataDir()
{
return livDataDir;
}
void G4EmLowEParameters::PrintWarning(G4ExceptionDescription& ed) const
{
G4Exception("G4EmLowEParameters", "em0044", JustWarning, ed);
@@ -94,7 +94,6 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
dcutCmd->SetDefaultValue(false);
dcutCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dnafCmd = new G4UIcmdWithABool("/process/dna/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
@@ -125,6 +124,12 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
pixeeXsCmd->SetCandidates("ECPSSR_Analytical Empirical Livermore Penelope");
pixeeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
livCmd = new G4UIcmdWithAString("/process/em/LivermoreData",this);
livCmd->SetGuidance("The name of Livermore data directory");
livCmd->SetParameterName("livDir",true);
livCmd->SetCandidates("livermore epics_2017");
livCmd->AvailableForStates(G4State_PreInit);
dnaSolCmd = new G4UIcmdWithAString("/process/dna/e-SolvationSubType",this);
dnaSolCmd->SetGuidance("The name of e- solvation DNA model");
dnaSolCmd->SetParameterName("dnaSol",true);
@@ -139,7 +144,7 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
dnaCmd = new G4UIcommand("/process/em/AddDNARegion",this);
dnaCmd->SetGuidance("Activate DNA in a G4Region.");
dnaCmd->SetGuidance(" regName : G4Region name");
dnaCmd->SetGuidance(" dnaType : DNA_opt0, DNA_opt1, DNA_opt2");
dnaCmd->SetGuidance(" dnaType : DNA_opt0, DNA_Opt2, DNA_Opt4, DNA_Opt4a, DNA_Opt6, DNA_Opt6a, DNA_Opt7");
dnaCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* regName = new G4UIparameter("regName",'s',false);
@@ -147,7 +152,7 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
G4UIparameter* type = new G4UIparameter("dnaType",'s',false);
dnaCmd->SetParameter(type);
type->SetParameterCandidates("DNA_Opt0");
type->SetParameterCandidates("DNA_Opt0 DNA_Opt2 DNA_Opt4 DNA_Opt4a DNA_Opt6 DNA_Opt6a DNA_Opt7");
deexCmd = new G4UIcommand("/process/em/deexcitation",this);
deexCmd->SetGuidance("Set deexcitation flags per G4Region.");
@@ -186,6 +191,7 @@ G4EmLowEParametersMessenger::~G4EmLowEParametersMessenger()
delete dnamscCmd;
delete pixeXsCmd;
delete pixeeXsCmd;
delete livCmd;
delete dnaSolCmd;
delete meCmd;
delete dnaCmd;
@@ -241,6 +247,8 @@ void G4EmLowEParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == pixeeXsCmd) {
theParameters->SetPIXEElectronCrossSectionModel(newValue);
physicsModified = true;
} else if (command == livCmd) {
theParameters->SetLivermoreDataDir(newValue);
} else if (command == meCmd) {
theParameters->AddMicroElec(newValue);
} else if (command == dnaCmd) {
@@ -126,7 +126,6 @@ void G4EmParameters::Initialise()
lateralDisplacement = true;
lateralDisplacementAlg96 = true;
muhadLateralDisplacement = false;
latDisplacementBeyondSafety = false;
useAngGeneratorForIonisation = false;
useMottCorrection = false;
integral = true;
@@ -338,17 +337,6 @@ G4bool G4EmParameters::MuHadLateralDisplacement() const
return muhadLateralDisplacement;
}
void G4EmParameters::SetLatDisplacementBeyondSafety(G4bool val)
{
if(IsLocked()) { return; }
latDisplacementBeyondSafety = val;
}
G4bool G4EmParameters::LatDisplacementBeyondSafety() const
{
return latDisplacementBeyondSafety;
}
void G4EmParameters::ActivateAngularGeneratorForIonisation(G4bool val)
{
if(IsLocked()) { return; }
@@ -903,6 +891,23 @@ void G4EmParameters::SetStepFunctionMuHad(G4double v1, G4double v2)
fBParameters->SetStepFunctionMuHad(v1, v2);
}
void G4EmParameters::SetStepFunctionLightIons(G4double v1, G4double v2)
{
if(IsLocked()) { return; }
fBParameters->SetStepFunctionLightIons(v1, v2);
}
void G4EmParameters::SetStepFunctionIons(G4double v1, G4double v2)
{
if(IsLocked()) { return; }
fBParameters->SetStepFunctionIons(v1, v2);
}
void G4EmParameters::FillStepFunction(const G4ParticleDefinition* part, G4VEnergyLossProcess* proc) const
{
fBParameters->FillStepFunction(part, proc);
}
void G4EmParameters::SetNumberOfBins(G4int val)
{
if(IsLocked()) { return; }
@@ -1043,6 +1048,17 @@ const G4String& G4EmParameters::PIXEElectronCrossSectionModel()
return fCParameters->PIXEElectronCrossSectionModel();
}
void G4EmParameters::SetLivermoreDataDir(const G4String& sss)
{
if(IsLocked()) { return; }
fCParameters->SetLivermoreDataDir(sss);
}
const G4String& G4EmParameters::LivermoreDataDir()
{
return fCParameters->LivermoreDataDir();
}
void G4EmParameters::PrintWarning(G4ExceptionDescription& ed) const
{
G4Exception("G4EmParameters", "em0044", JustWarning, ed);
@@ -1157,10 +1173,9 @@ G4EmParameters::ActivateSecondaryBiasing(const G4String& procname,
fBParameters->ActivateSecondaryBiasing(procname, region, factor, energyLim);
}
void G4EmParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr,
G4bool isElectron) const
void G4EmParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr) const
{
fBParameters->DefineRegParamForLoss(ptr, isElectron);
fBParameters->DefineRegParamForLoss(ptr);
}
void G4EmParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
@@ -1252,6 +1267,8 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "5D gamma conversion limit for muon pair "
<< max5DEnergyForMuPair/CLHEP::GeV << " GeV\n";
}
os << "Livermore data directory "
<< fCParameters->LivermoreDataDir() << "\n";
os << "=======================================================================" << "\n";
os << "====== Ionisation Parameters ========" << "\n";
@@ -1262,6 +1279,12 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "Step function for muons/hadrons "
<<"("<<fBParameters->GetStepFunctionMuHadP1() << ", "
<< fBParameters->GetStepFunctionMuHadP2()/CLHEP::mm << " mm)\n";
os << "Step function for light ions "
<<"("<<fBParameters->GetStepFunctionLightIonsP1() << ", "
<< fBParameters->GetStepFunctionLightIonsP2()/CLHEP::mm << " mm)\n";
os << "Step function for general ions "
<<"("<<fBParameters->GetStepFunctionIonsP1() << ", "
<< fBParameters->GetStepFunctionIonsP2()/CLHEP::mm << " mm)\n";
os << "Lowest e+e- kinetic energy "
<<G4BestUnit(lowestElectronEnergy,"Energy") << "\n";
os << "Lowest muon/hadron kinetic energy "
@@ -1289,7 +1312,6 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "Msc lateral displacement for e+- enabled " <<lateralDisplacement << "\n";
os << "Msc lateral displacement for muons and hadrons " <<muhadLateralDisplacement << "\n";
os << "Urban msc model lateral displacement alg96 " <<lateralDisplacementAlg96 << "\n";
os << "Msc lateral displacement beyond geometry safety " <<latDisplacementBeyondSafety << "\n";
os << "Range factor for msc step limit for e+- " <<rangeFactor << "\n";
os << "Range factor for msc step limit for muons/hadrons " <<rangeFactorMuHad << "\n";
os << "Geometry factor for msc step limitation of e+- " <<geomFactor << "\n";
@@ -126,12 +126,6 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
mulatCmd->SetDefaultValue(true);
mulatCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
catCmd = new G4UIcmdWithABool("/process/msc/DisplacementBeyondSafety",this);
catCmd->SetGuidance("Enable/disable displacement at geometry boundary");
catCmd->SetParameterName("cat",true);
catCmd->SetDefaultValue(false);
catCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
delCmd = new G4UIcmdWithABool("/process/eLoss/UseAngularGenerator",this);
delCmd->SetGuidance("Enable usage of angular generator for ionisation");
delCmd->SetParameterName("del",true);
@@ -405,7 +399,6 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete latCmd;
delete lat96Cmd;
delete mulatCmd;
delete catCmd;
delete delCmd;
delete IntegCmd;
delete mottCmd;
@@ -485,9 +478,6 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == mulatCmd) {
theParameters->SetMuHadLateralDisplacement(mulatCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == catCmd) {
theParameters->SetLatDisplacementBeyondSafety(catCmd->GetNewBoolValue(newValue));
physicsModified = true;
} else if (command == delCmd) {
theParameters->ActivateAngularGeneratorForIonisation(delCmd->GetNewBoolValue(newValue));
} else if (command == IntegCmd) {
@@ -164,9 +164,8 @@ void G4EmProcessOptions::SetMscMuHadLateralDisplacement(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmProcessOptions::SetDisplacementBeyondSafety(G4bool val)
void G4EmProcessOptions::SetDisplacementBeyondSafety(G4bool)
{
theParameters->SetLatDisplacementBeyondSafety(val);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -112,11 +112,13 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
G4int numOfCouples = theCoupleTable->GetTableSize();
// needed for unit tests
G4int nn = std::max(numOfCouples, 1);
activeDeexcitationMedia.resize(nn, false);
activeAugerMedia.resize(nn, false);
activePIXEMedia.resize(nn, false);
activeZ.resize(93, false);
size_t nn = std::max(numOfCouples, 1);
if(activeDeexcitationMedia.size() != nn) {
activeDeexcitationMedia.resize(nn, false);
activeAugerMedia.resize(nn, false);
activePIXEMedia.resize(nn, false);
}
if(activeZ.size() != 93) { activeZ.resize(93, false); }
// initialisation of flags and options
// normally there is no locksed flags
@@ -126,7 +126,7 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
mfpKinEnergy = DBL_MAX;
massRatio = 1.0;
idxLambda = idxLambdaPrim = currentCoupleIndex = basedCoupleIndex = 0;
currentCoupleIndex = basedCoupleIndex = 0;
modelManager = new G4EmModelManager();
biasManager = nullptr;
@@ -170,7 +170,6 @@ G4VEmProcess::~G4VEmProcess()
delete modelManager;
delete biasManager;
lManager->DeRegister(this);
//std::cout << "G4VEmProcess removed " << GetProcessName() << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -179,7 +178,6 @@ void G4VEmProcess::Clear()
{
currentCouple = nullptr;
preStepLambda = 0.0;
idxLambda = idxLambdaPrim = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -604,9 +602,9 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
void G4VEmProcess::StartTracking(G4Track* track)
{
// reset parameters for the new track
currentParticle = track->GetParticleDefinition();
theNumberOfInteractionLengthLeft = -1.0;
mfpKinEnergy = DBL_MAX;
mfpKinEnergy = DBL_MAX;
if(isIon) { massRatio = proton_mass_c2/currentParticle->GetPDGMass(); }
// forced biasing only for primary particles
@@ -773,15 +771,15 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
fParticleChange.ProposeWeight(weight);
}
/*
if(0 < verboseLevel) {
if(1 < verboseLevel) {
G4cout << "G4VEmProcess::PostStepDoIt: Sample secondary; E= "
<< finalT/MeV
<< " MeV; model= (" << currentModel->LowEnergyLimit()
<< ", " << currentModel->HighEnergyLimit() << ")"
<< G4endl;
}
*/
// sample secondaries
secParticles.clear();
@@ -1013,13 +1011,15 @@ G4bool G4VEmProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
G4double
G4VEmProcess::CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple)
const G4MaterialCutsCouple* couple,
G4double logKinEnergy)
{
// Cross section per atom is calculated
DefineMaterial(couple);
G4double cross = 0.0;
if(buildLambdaTable) {
cross = GetCurrentLambda(kineticEnergy);
cross = GetCurrentLambda(kineticEnergy,
(logKinEnergy < DBL_MAX) ? logKinEnergy : G4Log(kineticEnergy));
} else {
SelectModel(kineticEnergy, currentCoupleIndex);
if(currentModel) {
@@ -1254,6 +1254,15 @@ G4VEmProcess* G4VEmProcess::GetEmProcess(const G4String& nam)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4VEmProcess::GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple)
{
CurrentSetup(couple, kinEnergy);
return GetCurrentLambda(kinEnergy, G4Log(kinEnergy));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmProcess::PrintWarning(G4String tit, G4double val)
{
G4String ss = "G4VEmProcess::" + tit;
@@ -131,7 +131,7 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
maxKinEnergyCSDA = 1.0*GeV;
nBinsCSDA = 35;
actMinKinEnergy = actMaxKinEnergy = actBinning = actLinLossLimit
= actLossFluc = actIntegral = actStepFunc = false;
= actLossFluc = actIntegral = false;
// default linear loss limit for spline
linLossLimit = 0.01;
@@ -177,10 +177,6 @@ G4VEnergyLossProcess::G4VEnergyLossProcess(const G4String& name,
isMaster = true;
lastIdx = 0;
idxDEDX = idxDEDXSub = idxDEDXunRestricted = idxIonisation =
idxIonisationSub = idxRange = idxCSDA = idxSecRange =
idxInverseRange = idxLambda = idxSubLambda = 0;
scTracks.reserve(5);
secParticles.reserve(5);
@@ -295,10 +291,11 @@ void G4VEnergyLossProcess::Clean()
scProcesses.clear();
nProcesses = 0;
/*
idxDEDX = idxDEDXSub = idxDEDXunRestricted = idxIonisation =
idxIonisationSub = idxRange = idxCSDA = idxSecRange =
idxInverseRange = idxLambda = idxSubLambda = 0;
*/
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -461,13 +458,13 @@ G4VEnergyLossProcess::PreparePhysicsTable(const G4ParticleDefinition& part)
if(isMaster) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
G4bool isElec = true;
if(particle->GetPDGMass() > CLHEP::MeV) { isElec = false; }
theParameters->DefineRegParamForLoss(this, isElec);
theParameters->DefineRegParamForLoss(this);
G4double initialCharge = particle->GetPDGCharge();
G4double initialMass = particle->GetPDGMass();
theParameters->FillStepFunction(particle, this);
if (baseParticle) {
massRatio = (baseParticle->GetPDGMass())/initialMass;
logMassRatio = G4Log(massRatio);
@@ -2299,18 +2296,14 @@ void G4VEnergyLossProcess::SetIonisation(G4bool val)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2, G4bool lock)
void G4VEnergyLossProcess::SetStepFunction(G4double v1, G4double v2)
{
if(actStepFunc) { return; }
actStepFunc = lock;
if(0.0 < v1 && 0.0 < v2 && v2 < 1.e+50) {
if(0.0 < v1 && 0.0 < v2) {
dRoverRange = std::min(1.0, v1);
finalRange = v2;
} else if(v1 <= 0.0) {
PrintWarning("SetStepFunction", v1);
finalRange = std::min(v2, 1.e+50);
} else {
PrintWarning("SetStepFunction", v2);
PrintWarning("SetStepFunctionV1", v1);
PrintWarning("SetStepFunctionV2", v2);
}
}
@@ -96,7 +96,6 @@ G4VMultipleScattering::G4VMultipleScattering(const G4String& name, G4ProcessType
facrange(0.04),
latDisplacement(true),
isIon(false),
fDispBeyondSafety(false),
fNewPosition(0.,0.,0.),
fNewDirection(0.,0.,1.)
{
@@ -236,9 +235,6 @@ G4VMultipleScattering::PreparePhysicsTable(const G4ParticleDefinition& part)
facrange = theParameters->MscRangeFactor();
latDisplacement = theParameters->LateralDisplacement();
}
if(latDisplacement) {
fDispBeyondSafety = theParameters->LatDisplacementBeyondSafety();
}
}
if(master) { SetVerboseLevel(theParameters->Verbose()); }
else { SetVerboseLevel(theParameters->WorkerVerbose()); }
@@ -523,77 +519,6 @@ G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
if(dispR < postSafety) {
fNewPosition += displacement;
// optional extra mechanism is applied only if a particle
// is stopped by the boundary
} else if(fDispBeyondSafety && 0.0 == postSafety) {
fNewPosition += displacement;
G4double maxshift =
std::min(2.0*dispR, geomLength*(physStepLimit/tPathLength - 1.0));
G4double dist = 0.0;
G4double safety = postSafety + dispR;
fNewDirection = *(fParticleChange.GetMomentumDirection());
/*
G4cout << "##MSC before Recheck maxshift= " << maxshift
<< " postsafety= " << postSafety
<< " Ekin= " << track.GetKineticEnergy()
<< " " << track.GetDefinition()->GetParticleName()
<< G4endl;
*/
// check if it is possible to shift to the boundary
// and the shift is not large
if(safetyHelper->RecheckDistanceToCurrentBoundary(fNewPosition,
fNewDirection, maxshift, &dist, &safety)
&& std::abs(dist) < maxshift) {
/*
G4cout << "##MSC after Recheck dist= " << dist
<< " postsafety= " << postSafety
<< " t= " << tPathLength
<< " g= " << geomLength
<< " p= " << physStepLimit
<< G4endl;
*/
// shift is positive
if(dist >= 0.0) {
tPathLength *= (1.0 + dist/geomLength);
fNewPosition += dist*fNewDirection;
// shift is negative cannot be larger than geomLength
} else {
maxshift = std::min(maxshift, geomLength);
if(0.0 < maxshift + dist) {
const G4ThreeVector& postpoint =
step.GetPostStepPoint()->GetPosition();
G4ThreeVector point = fNewPosition + dist*fNewDirection;
G4double R2 = (postpoint - point).mag2();
G4double newdist = dist;
// check not more than 10 extra boundaries
for(G4int i=0; i<10; ++i) {
dist = 0.0;
if(safetyHelper->RecheckDistanceToCurrentBoundary(
point, fNewDirection, maxshift, &dist, &safety)
&& std::abs(newdist + dist) < maxshift) {
point += dist*fNewDirection;
G4double R2new = (postpoint - point).mag2();
//G4cout << "Backward i= " << i << " dist= " << dist
// << " R2= " << R2new << G4endl;
if(dist >= 0.0 || R2new > R2) { break; }
R2 = R2new;
fNewPosition = point;
newdist += dist;
} else {
break;
}
}
tPathLength *= (1.0 + newdist/geomLength);
// shift on boundary is not possible for negative disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
}
// shift on boundary is not possible for any disp
} else {
fNewPosition += displacement*(postSafety/dispR - 1.0);
}
// reduced displacement
} else if(postSafety > geomMin) {
fNewPosition += displacement*(postSafety/dispR);