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
+34 -2
View File
@@ -16,10 +16,42 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
28 April 19: V.Ivanchenko (emutils-V10-05-24)
11 June 20: V.Ivanchenko (emutils-V10-06-07)
- G4EmParameters, G4EmExtraParameters - FillStepFunction method is
applied in each thread - critical fix may affect Shielding CPU
- G4VEnergyLossProcess - better printout in a warning
30 May 20: V.Ivanchenko (emutils-V10-06-06)
- G4LossTableManager - make ResetParameters() method public
- G4VAtomicDeexcitation - optimized arrays initialisation
03 May 20: V.Ivanchenko (emutils-V10-06-05)
- G4EmParameters, G4EmParametersMessenger, G4EmExtraParametersMessenger,
G4VEnergyLossProcess - added two extra set of StepFunction parameters
for light ions and generic ions; added extra UI commands; modified
interfaces accordingly; removed old comments
28 April 20: V.Ivanchenko (emutils-V10-06-04)
- G4LossTableBuilder - fixed #2230 (typo in the code)
13 January 19: V.Ivanchenko (emutils-V10-05-23)
26 April 20: V.Ivanchenko (emutils-V10-06-03)
- G4EmParameters, G4EmParametersMessenger, G4VMultipleScattering
removed displacement beyond safety option - L.Urban studied
in details and we come to conclusion, that it does not bring
an advantages but may provoke crashes in some circomstances
- G4EmLowEParametersMessenger - extend number of DNA PhysicsList options
- G4EmCalculator - fixed printout
09 March 20: V.Ivanchenko (emutils-V10-06-02)
- G4VEmProcess - removed old not used methods; DefinedMaterial(..)
method is now protected (needed for AtRest processes)
06 March 20: V.Ivanchenko (emutils-V10-06-01)
- G4EmParameters, G4EmLowEParameters, G4EmLowEParametersMessenger
added a new parameter - name of the sub-directory with data for
Livermore models with variants: "livermore" (default), "epics_2017"
13 January 20: V.Ivanchenko (emutils-V10-06-00)
- G4EmParameters, G4EmParametersMessenger - added new parameter
to enable read of e+e- production table from file (CMS request)
@@ -56,6 +56,7 @@
class G4EmExtraParametersMessenger;
class G4VEnergyLossProcess;
class G4VEmProcess;
class G4ParticleDefinition;
class G4VAtomDeexcitation;
class G4EmExtraParameters
@@ -88,6 +89,16 @@ public:
G4double GetStepFunctionMuHadP1() const;
G4double GetStepFunctionMuHadP2() const;
void SetStepFunctionLightIons(G4double v1, G4double v2);
G4double GetStepFunctionLightIonsP1() const;
G4double GetStepFunctionLightIonsP2() const;
void SetStepFunctionIons(G4double v1, G4double v2);
G4double GetStepFunctionIonsP1() const;
G4double GetStepFunctionIonsP2() const;
void FillStepFunction(const G4ParticleDefinition*, G4VEnergyLossProcess*) const;
// parameters per region or per process
void AddPAIModel(const G4String& particle,
const G4String& region,
@@ -116,8 +127,7 @@ public:
G4double energyLimit);
// initialisation methods
void DefineRegParamForLoss(G4VEnergyLossProcess*,
G4bool isElectron) const;
void DefineRegParamForLoss(G4VEnergyLossProcess*) const;
void DefineRegParamForEM(G4VEmProcess*) const;
G4EmExtraParameters(G4EmExtraParameters &) = delete;
@@ -139,6 +149,10 @@ private:
G4double finalRange;
G4double dRoverRangeMuHad;
G4double finalRangeMuHad;
G4double dRoverRangeLIons;
G4double finalRangeLIons;
G4double dRoverRangeIons;
G4double finalRangeIons;
G4double directionalSplittingRadius;
G4ThreeVector directionalSplittingTarget;
@@ -88,6 +88,8 @@ private:
G4UIcommand* bsCmd;
G4UIcommand* StepFuncCmd;
G4UIcommand* StepFuncCmd1;
G4UIcommand* StepFuncCmd2;
G4UIcommand* StepFuncCmd3;
G4UIcmdWith3VectorAndUnit* dirSplitTargetCmd;
};
@@ -101,6 +101,9 @@ public:
void SetPIXEElectronCrossSectionModel(const G4String&);
const G4String& PIXEElectronCrossSectionModel();
void SetLivermoreDataDir(const G4String&);
const G4String& LivermoreDataDir();
// parameters per region or per process
void AddMicroElec(const G4String& region);
const std::vector<G4String>& RegionsMicroElec() const;
@@ -141,6 +144,7 @@ private:
G4String namePIXE;
G4String nameElectronPIXE;
G4String livDataDir;
std::vector<G4String> m_regnamesME;
@@ -86,6 +86,7 @@ private:
G4UIcmdWithAString* pixeXsCmd;
G4UIcmdWithAString* pixeeXsCmd;
G4UIcmdWithAString* livCmd;
G4UIcmdWithAString* dnaSolCmd;
G4UIcmdWithAString* meCmd;
@@ -132,9 +132,6 @@ public:
void SetMuHadLateralDisplacement(G4bool val);
G4bool MuHadLateralDisplacement() const;
void SetLatDisplacementBeyondSafety(G4bool val);
G4bool LatDisplacementBeyondSafety() const;
void ActivateAngularGeneratorForIonisation(G4bool val);
G4bool UseAngularGeneratorForIonisation() const;
@@ -251,8 +248,10 @@ public:
G4double MaxEnergyFor5DMuPair() const;
void SetStepFunction(G4double v1, G4double v2);
void SetStepFunctionMuHad(G4double v1, G4double v2);
void SetStepFunctionLightIons(G4double v1, G4double v2);
void SetStepFunctionIons(G4double v1, G4double v2);
void FillStepFunction(const G4ParticleDefinition*, G4VEnergyLossProcess*) const;
void SetDirectionalSplittingRadius(G4double r);
G4double GetDirectionalSplittingRadius();
@@ -296,6 +295,9 @@ public:
void SetPIXEElectronCrossSectionModel(const G4String&);
const G4String& PIXEElectronCrossSectionModel();
void SetLivermoreDataDir(const G4String&);
const G4String& LivermoreDataDir();
// parameters per region or per process
void AddPAIModel(const G4String& particle,
const G4String& region,
@@ -337,8 +339,7 @@ public:
G4EmSaturation* GetEmSaturation();
// initialisation methods
void DefineRegParamForLoss(G4VEnergyLossProcess*,
G4bool isElectron) const;
void DefineRegParamForLoss(G4VEnergyLossProcess*) const;
void DefineRegParamForEM(G4VEmProcess*) const;
void DefineRegParamForDeex(G4VAtomDeexcitation*) const;
@@ -372,7 +373,6 @@ private:
G4bool lateralDisplacement;
G4bool lateralDisplacementAlg96;
G4bool muhadLateralDisplacement;
G4bool latDisplacementBeyondSafety;
G4bool useAngGeneratorForIonisation;
G4bool useMottCorrection;
G4bool integral;
@@ -90,7 +90,6 @@ private:
G4UIcmdWithABool* latCmd;
G4UIcmdWithABool* lat96Cmd;
G4UIcmdWithABool* mulatCmd;
G4UIcmdWithABool* catCmd;
G4UIcmdWithABool* delCmd;
G4UIcmdWithABool* IntegCmd;
G4UIcmdWithABool* mottCmd;
@@ -181,6 +181,8 @@ public:
void SetVerbose(G4int val);
void ResetParameters();
void SetAtomDeexcitation(G4VAtomDeexcitation*);
void SetSubCutProducer(G4VSubCutProducer*);
@@ -235,8 +237,6 @@ private:
void Clear();
void ResetParameters();
G4VEnergyLossProcess* BuildTables(const G4ParticleDefinition* aParticle);
void CopyTables(const G4ParticleDefinition* aParticle,
@@ -152,7 +152,8 @@ public:
// It returns the cross section per volume for energy/ material
G4double CrossSectionPerVolume(G4double kineticEnergy,
const G4MaterialCutsCouple* couple);
const G4MaterialCutsCouple* couple,
G4double logKinEnergy = DBL_MAX);
// It returns the cross section of the process per atom
G4double ComputeCrossSectionPerAtom(G4double kineticEnergy,
@@ -161,9 +162,10 @@ public:
G4double MeanFreePath(const G4Track& track);
// It returns cross section per volume
inline G4double GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple);
// Obsolete method to access cross section per volume
G4double GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple);
// The main method to access cross section per volume
inline G4double GetLambda(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
G4double logKinEnergy);
@@ -266,6 +268,8 @@ protected:
G4PhysicsVector* LambdaPhysicsVector(const G4MaterialCutsCouple*);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
inline G4int LambdaBinning() const;
inline G4double MinKinEnergy() const;
@@ -319,16 +323,14 @@ private:
void ComputeIntegralLambda(G4double kinEnergy, G4double logKinEnergy);
inline void DefineMaterial(const G4MaterialCutsCouple* couple);
inline G4double GetLambdaFromTable(G4double kinEnergy);
// inline G4double GetLambdaFromTable(G4double kinEnergy);
inline G4double GetLambdaFromTable(G4double kinEnergy, G4double logKinEnergy);
inline G4double GetLambdaFromTablePrim(G4double kinEnergy);
// inline G4double GetLambdaFromTablePrim(G4double kinEnergy);
inline G4double GetLambdaFromTablePrim(G4double kinEnergy,
G4double logKinEnergy);
inline G4double GetCurrentLambda(G4double kinEnergy);
// inline G4double GetCurrentLambda(G4double kinEnergy);
inline G4double GetCurrentLambda(G4double kinEnergy, G4double logKinEnergy);
inline G4double ComputeCurrentLambda(G4double kinEnergy);
@@ -356,9 +358,6 @@ private:
std::vector<G4double> theEnergyOfCrossSectionMax;
std::vector<G4double> theCrossSectionMax;
size_t idxLambda;
size_t idxLambdaPrim;
const std::vector<G4double>* theCuts;
const std::vector<G4double>* theCutsGamma;
const std::vector<G4double>* theCutsElectron;
@@ -424,9 +423,9 @@ private:
G4VEmModel* currentModel;
const G4ParticleDefinition* particle;
const G4ParticleDefinition* currentParticle;
// cache
const G4ParticleDefinition* currentParticle;
const G4Material* baseMaterial;
G4double fFactor;
@@ -482,8 +481,6 @@ inline void G4VEmProcess::DefineMaterial(const G4MaterialCutsCouple* couple)
basedCoupleIndex = (*theDensityIdx)[currentCoupleIndex];
fFactor = biasFactor*(*theDensityFactor)[currentCoupleIndex];
mfpKinEnergy = DBL_MAX;
preStepKinEnergy = 0.0;
idxLambda = idxLambdaPrim = 0;
}
}
@@ -510,11 +507,6 @@ G4VEmModel* G4VEmProcess::SelectModelForMaterial(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e)
{
return ((*theLambdaTable)[basedCoupleIndex])->Value(e, idxLambda);
}
inline G4double G4VEmProcess::GetLambdaFromTable(G4double e, G4double loge)
{
return ((*theLambdaTable)[basedCoupleIndex])->LogVectorValue(e, loge);
@@ -522,11 +514,6 @@ inline G4double G4VEmProcess::GetLambdaFromTable(G4double e, G4double loge)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e)
{
return ((*theLambdaTablePrim)[basedCoupleIndex])->Value(e, idxLambdaPrim)/e;
}
inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e, G4double loge)
{
return ((*theLambdaTablePrim)[basedCoupleIndex])->LogVectorValue(e, loge)/e;
@@ -536,21 +523,11 @@ inline G4double G4VEmProcess::GetLambdaFromTablePrim(G4double e, G4double loge)
inline G4double G4VEmProcess::ComputeCurrentLambda(G4double e)
{
return currentModel->CrossSectionPerVolume(
baseMaterial,currentParticle, e,(*theCuts)[currentCoupleIndex]);
return currentModel->CrossSectionPerVolume(baseMaterial, currentParticle, e);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4VEmProcess::GetCurrentLambda(G4double e)
{
G4double x(0.0);
if(e >= minKinEnergyPrim) { x = GetLambdaFromTablePrim(e); }
else if(theLambdaTable) { x = GetLambdaFromTable(e); }
else if(currentModel) { x = ComputeCurrentLambda(e); }
return fFactor*x;
}
inline G4double G4VEmProcess::GetCurrentLambda(G4double e, G4double loge)
{
G4double x(0.0);
@@ -566,16 +543,7 @@ inline void
G4VEmProcess::CurrentSetup(const G4MaterialCutsCouple* couple, G4double energy)
{
DefineMaterial(couple);
SelectModel(energy, currentCoupleIndex);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEmProcess::GetLambda(G4double kinEnergy, const G4MaterialCutsCouple* couple)
{
CurrentSetup(couple, kinEnergy);
return GetCurrentLambda(kinEnergy);
SelectModel(energy*massRatio, currentCoupleIndex);
}
inline G4double
@@ -335,7 +335,7 @@ public:
// Redefine parameteters for stepping control
void SetLinearLossLimit(G4double val);
void SetStepFunction(G4double v1, G4double v2, G4bool lock=true);
void SetStepFunction(G4double v1, G4double v2);
void SetLowestEnergyLimit(G4double);
inline G4int NumberOfSubCutoffRegions() const;
@@ -489,17 +489,17 @@ private:
G4PhysicsTable* theLambdaTable;
G4PhysicsTable* theSubLambdaTable;
size_t idxDEDX;
size_t idxDEDXSub;
size_t idxDEDXunRestricted;
size_t idxIonisation;
size_t idxIonisationSub;
size_t idxRange;
size_t idxCSDA;
size_t idxSecRange;
size_t idxInverseRange;
size_t idxLambda;
size_t idxSubLambda;
size_t idxDEDX = 0;
size_t idxDEDXSub = 0;
size_t idxDEDXunRestricted = 0;
size_t idxIonisation = 0;
size_t idxIonisationSub = 0;
size_t idxRange = 0;
size_t idxCSDA = 0;
size_t idxSecRange = 0;
size_t idxInverseRange = 0;
size_t idxLambda = 0;
size_t idxSubLambda = 0;
std::vector<G4double> theDEDXAtMaxEnergy;
std::vector<G4double> theRangeAtMaxEnergy;
@@ -541,7 +541,6 @@ private:
G4bool weightFlag;
G4bool isMaster;
G4bool actIntegral;
G4bool actStepFunc;
G4bool actLinLossLimit;
G4bool actLossFluc;
G4bool actBinning;
@@ -743,6 +742,7 @@ G4VEnergyLossProcess::GetScaledRangeForScaledEnergy(G4double e, G4double loge)
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4VEnergyLossProcess::GetLimitScaledRangeForScaledEnergy(G4double e)
{
@@ -888,6 +888,7 @@ G4VEnergyLossProcess::GetRangeForLoss(G4double kinEnergy,
return reduceFactor * GetScaledRangeForScaledEnergy(kinEnergy*massRatio);
}
inline G4double
G4VEnergyLossProcess::GetRangeForLoss(G4double kinEnergy,
const G4MaterialCutsCouple* couple,
@@ -1051,7 +1052,7 @@ inline G4double G4VEnergyLossProcess::CrossSectionBiasingFactor() const
inline G4bool G4VEnergyLossProcess::TablesAreBuilt() const
{
return tablesAreBuilt;
return tablesAreBuilt;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -277,7 +277,6 @@ private:
G4bool latDisplacement;
G4bool isIon;
G4bool fDispBeyondSafety;
// ======== Cached values - may be state dependent ================
@@ -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);