Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCalculator.cc 103954 2017-05-04 11:29:22Z gcosmo $
// $Id: G4EmCalculator.cc 108306 2018-02-02 13:10:06Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -54,6 +54,8 @@
// 10 keV to 1 keV (V. Ivanchenko)
// 15.03.2007 Add ComputeEnergyCutFromRangeCut methods (V.Ivanchenko)
// 21.04.2008 Updated computations for ions (V.Ivanchenko)
// 02.02.2018 Fix the MCS (i.e. transport mean free path) case in
// GetCrossSectionPerVolume (M. Novak)
//
// Class Description:
//
@@ -281,29 +283,39 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
if(couple && UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
G4int idx = couple->GetIndex();
FindLambdaTable(p, processName, kinEnergy);
G4int idx = couple->GetIndex();
G4int procType = -1;
FindLambdaTable(p, processName, kinEnergy, procType);
G4VEmProcess* emproc = FindDiscreteProcess(p, processName);
if(emproc) {
res = emproc->CrossSectionPerVolume(kinEnergy, couple);
res = emproc->CrossSectionPerVolume(kinEnergy, couple);
} else if(currentLambda) {
G4double e = kinEnergy*massRatio;
res = (((*currentLambda)[idx])->Value(e))*chargeSquare;
// special tables are built for Msc models (procType is set in FindLambdaTable
if(procType==2) {
G4VMscModel* mscM = static_cast<G4VMscModel*>(currentModel);
mscM->SetCurrentCouple(couple);
G4double tr1Mfp = mscM->GetTransportMeanFreePath(p, kinEnergy);
if (tr1Mfp<DBL_MAX) {
res = 1./tr1Mfp;
}
} else {
G4double e = kinEnergy*massRatio;
res = (((*currentLambda)[idx])->Value(e))*chargeSquare;
}
} else {
res = ComputeCrossSectionPerVolume(kinEnergy, p, processName, mat,
kinEnergy);
res = ComputeCrossSectionPerVolume(kinEnergy, p, processName, mat, kinEnergy);
}
if(verbose>0) {
G4cout << "G4EmCalculator::GetXSPerVolume: E(MeV)= " << kinEnergy/MeV
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName();
if(verbose>1)
G4cout << " idx= " << idx << " Escaled((MeV)= "
<< kinEnergy*massRatio
<< " q2= " << chargeSquare;
G4cout << G4endl;
G4cout << "G4EmCalculator::GetXSPerVolume: E(MeV)= " << kinEnergy/MeV
<< " cross(cm-1)= " << res*cm
<< " " << p->GetParticleName()
<< " in " << mat->GetName();
if(verbose>1)
G4cout << " idx= " << idx << " Escaled((MeV)= "
<< kinEnergy*massRatio
<< " q2= " << chargeSquare;
G4cout << G4endl;
}
}
}
@@ -972,7 +984,7 @@ G4bool G4EmCalculator::UpdateCouple(const G4Material* material, G4double cut)
void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
const G4String& processName,
G4double kinEnergy)
G4double kinEnergy, G4int& proctype)
{
// Search for the process
if (!currentLambda || p != lambdaParticle || processName != lambdaName) {
@@ -991,6 +1003,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4VEnergyLossProcess* elproc = FindEnLossProcess(part, processName);
if(elproc) {
currentLambda = elproc->LambdaTable();
proctype = 0;
if(currentLambda) {
isApplicable = true;
if(verbose>1) {
@@ -1006,6 +1019,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4VEmProcess* proc = FindDiscreteProcess(part, processName);
if(proc) {
currentLambda = proc->LambdaTable();
proctype = 1;
if(currentLambda) {
isApplicable = true;
if(verbose>1) {
@@ -1020,6 +1034,7 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
G4VMultipleScattering* msc = FindMscProcess(part, processName);
if(msc) {
currentModel = msc->SelectModel(kinEnergy,0);
proctype = 2;
if(currentModel) {
currentLambda = currentModel->GetCrossSectionTable();
if(currentLambda) {
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4EmCorrections.cc 103954 2017-05-04 11:29:22Z gcosmo $
// $Id: G4EmCorrections.cc 110572 2018-05-30 13:08:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -78,7 +78,8 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4double G4EmCorrections::inveplus = 1.0/CLHEP::eplus;
const G4double inveplus = 1.0/CLHEP::eplus;
const G4double G4EmCorrections::ZD[11] =
{0., 0., 0., 1.72, 2.09, 2.48, 2.82, 3.16, 3.53, 3.84, 4.15};
const G4double G4EmCorrections::UK[20] = {1.9999, 2.0134, 2.0258, 2.0478, 2.0662,
@@ -164,6 +165,35 @@ G4EmCorrections::~G4EmCorrections()
}
}
void G4EmCorrections::SetupKinematics(const G4ParticleDefinition* p,
const G4Material* mat,
G4double kineticEnergy)
{
if(kineticEnergy != kinEnergy || p != particle) {
particle = p;
kinEnergy = kineticEnergy;
mass = p->GetPDGMass();
tau = kineticEnergy / mass;
gamma = 1.0 + tau;
bg2 = tau * (tau+2.0);
beta2 = bg2/(gamma*gamma);
beta = std::sqrt(beta2);
ba2 = beta2/alpha2;
G4double ratio = CLHEP::electron_mass_c2/mass;
tmax = 2.0*CLHEP::electron_mass_c2*bg2
/(1. + 2.0*gamma*ratio + ratio*ratio);
charge = p->GetPDGCharge()*inveplus;
if(charge > 1.5) { charge = effCharge.EffectiveCharge(p,mat,kinEnergy); }
q2 = charge*charge;
}
if(mat != material) {
material = mat;
theElementVector = material->GetElementVector();
atomDensity = material->GetAtomicNumDensityVector();
numberOfElements = material->GetNumberOfElements();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EmCorrections::HighOrderCorrections(const G4ParticleDefinition* p,
@@ -205,18 +235,8 @@ G4double G4EmCorrections::IonBarkasCorrection(const G4ParticleDefinition* p,
const G4Material* mat,
G4double e)
{
// . Z^3 Barkas effect in the stopping power of matter for charged particles
// J.C Ashley and R.H.Ritchie
// Physical review B Vol.5 No.7 1 April 1972 pagg. 2393-2397
// and ICRU49 report
// valid for kineticEnergy < 0.5 MeV
SetupKinematics(p, mat, e);
G4double res = 0.0;
if(tau > 0.0)
res = 2.0*BarkasCorrection(p, mat, e)*
return 2.0*BarkasCorrection(p, mat, e)*
material->GetElectronDensity() * q2 * twopi_mc2_rcl2 /beta2;
return res;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -336,7 +356,7 @@ G4double G4EmCorrections:: KShellCorrection(const G4ParticleDefinition* p,
for (G4int i = 0; i<numberOfElements; ++i) {
G4double Z = (*theElementVector)[i]->GetZ();
G4int iz = G4lrint(Z);
G4int iz = (*theElementVector)[i]->GetZasInt();
G4double f = 1.0;
G4double Z2= (Z-0.3)*(Z-0.3);
if(1 == iz) {
@@ -365,7 +385,7 @@ G4double G4EmCorrections:: LShellCorrection(const G4ParticleDefinition* p,
for (G4int i = 0; i<numberOfElements; ++i) {
G4double Z = (*theElementVector)[i]->GetZ();
G4int iz = G4lrint(Z);
G4int iz = (*theElementVector)[i]->GetZasInt();
if(2 < iz) {
G4double Zeff = Z - ZD[10];
if(iz < 10) { Zeff = Z - ZD[iz]; }
@@ -538,7 +558,7 @@ G4double G4EmCorrections::ShellCorrection(const G4ParticleDefinition* p,
G4double res = 0.0;
G4double res0 = 0.0;
G4double Z = (*theElementVector)[i]->GetZ();
G4int iz = G4lrint(Z);
G4int iz = (*theElementVector)[i]->GetZasInt();
G4double Z2= (Z-0.3)*(Z-0.3);
G4double f = 1.0;
if(1 == iz) {
@@ -669,7 +689,7 @@ G4double G4EmCorrections::BarkasCorrection(const G4ParticleDefinition* p,
for (G4int i = 0; i<numberOfElements; ++i) {
G4double Z = (*theElementVector)[i]->GetZ();
G4int iz = G4lrint(Z);
G4int iz = (*theElementVector)[i]->GetZasInt();
if(iz == 47) {
BarkasTerm += atomDensity[i]*0.006812*G4Exp(-G4Log(beta)*0.9);
} else if(iz >= 64) {
@@ -78,7 +78,7 @@ G4EmParameters* G4EmParameters::Instance()
theInstance = &manager;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&G4EmParameters::emParametersMutex);
G4MUTEXUNLOCK(&emParametersMutex);
#endif
}
return theInstance;
@@ -135,6 +135,7 @@ void G4EmParameters::Initialise()
dnaStationary = false;
dnaMsc = false;
gammaShark = false;
onIsolated = false;
minSubRange = 1.0;
minKinEnergy = 0.1*CLHEP::keV;
@@ -148,6 +149,7 @@ void G4EmParameters::Initialise()
lambdaFactor = 0.8;
factorForAngleLimit = 1.0;
thetaLimit = CLHEP::pi;
energyLimit = 100.0*CLHEP::MeV;
rangeFactor = 0.04;
rangeFactorMuHad = 0.2;
geomFactor = 2.5;
@@ -162,10 +164,12 @@ void G4EmParameters::Initialise()
nbinsPerDecade = 7;
verbose = 1;
workerVerbose = 0;
tripletConv = 0;
mscStepLimit = fUseSafety;
mscStepLimitMuHad = fMinimal;
nucFormfactor = fExponentialNF;
dnaElectronSolvation = fMeesungnoen2002eSolvation;
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
@@ -261,9 +265,7 @@ G4bool G4EmParameters::BeardenFluoDir() const
void G4EmParameters::SetAuger(G4bool val)
{
if(IsLocked()) { return; }
auger = val;
if(val) { fluo = true; }
SetAugerCascade(val);
}
G4bool G4EmParameters::Auger() const
@@ -275,7 +277,8 @@ void G4EmParameters::SetAugerCascade(G4bool val)
{
if(IsLocked()) { return; }
augerCascade = val;
if(val) { fluo = true; auger = true; }
auger = val;
if(val) { fluo = true; }
}
G4bool G4EmParameters::AugerCascade() const
@@ -456,6 +459,17 @@ void G4EmParameters::SetEmSaturation(G4EmSaturation* ptr)
}
}
void G4EmParameters::SetOnIsolated(G4bool val)
{
if(IsLocked()) { return; }
onIsolated = val;
}
G4bool G4EmParameters::OnIsolated() const
{
return onIsolated;
}
G4EmSaturation* G4EmParameters::GetEmSaturation()
{
if(!emSaturation) { SetBirksActive(true); }
@@ -673,6 +687,24 @@ G4double G4EmParameters::MscThetaLimit() const
return thetaLimit;
}
void G4EmParameters::SetMscEnergyLimit(G4double val)
{
if(IsLocked()) { return; }
if(val >= 0.0) {
energyLimit = val;
} else {
G4ExceptionDescription ed;
ed << "Value of msc energy limit is out of range: "
<< val << " is ignored";
PrintWarning(ed);
}
}
G4double G4EmParameters::MscEnergyLimit() const
{
return energyLimit;
}
void G4EmParameters::SetMscRangeFactor(G4double val)
{
if(IsLocked()) { return; }
@@ -886,10 +918,32 @@ G4NuclearFormfactorType G4EmParameters::NuclearFormfactorType() const
return nucFormfactor;
}
void G4EmParameters::SetDNAeSolvationSubType(G4DNAModelSubType val)
{
if(IsLocked()) { return; }
dnaElectronSolvation = val;
}
G4DNAModelSubType G4EmParameters::DNAeSolvationSubType() const
{
return dnaElectronSolvation;
}
void G4EmParameters::SetConversionType(G4int val)
{
if(IsLocked()) { return; }
tripletConv = val;
}
G4int G4EmParameters::GetConversionType() const
{
return tripletConv;
}
void G4EmParameters::SetPIXECrossSectionModel(const G4String& sss)
{
G4cout << "G4EmParameters::SetPIXECrossSectionModel " << sss << G4endl;
if(IsLocked()) { return; }
G4cout << "G4EmParameters::SetPIXECrossSectionModel " << sss << G4endl;
namePIXE = sss;
}
@@ -1142,28 +1196,28 @@ void
G4EmParameters::ActivateSecondaryBiasing(const G4String& procname,
const G4String& region,
G4double factor,
G4double energyLimit)
G4double energyLim)
{
if(IsLocked()) { return; }
G4String r = CheckRegion(region);
if(factor >= 0.0 && energyLimit >= 0.0) {
if(factor >= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procBiasedSec[i] && r == m_regnamesBiasedSec[i] ) {
m_factBiasedSec[i] = factor;
m_elimBiasedSec[i] = energyLimit;
m_elimBiasedSec[i] = energyLim;
return;
}
}
m_regnamesBiasedSec.push_back(r);
m_procBiasedSec.push_back(procname);
m_factBiasedSec.push_back(factor);
m_elimBiasedSec.push_back(energyLimit);
m_elimBiasedSec.push_back(energyLim);
} else {
G4ExceptionDescription ed;
ed << "Process: " << procname << " in region " << r
<< " : secondary bised factor= "
<< factor << ", Elim= " << energyLimit << " - ignored";
<< factor << ", Elim= " << energyLim << " - ignored";
PrintWarning(ed);
}
}
@@ -1256,9 +1310,8 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "LPM effect enabled " <<flagLPM << "\n";
os << "Spline of EM tables enabled " <<spline << "\n";
os << "Apply cuts on all EM processes " <<applyCuts << "\n";
os << "Use integral approach for tracking " << integral << "\n";
os << "Use integral approach for tracking " <<integral << "\n";
os << "X-section factor for integral approach " <<lambdaFactor << "\n";
os << "Use built-in Birks satuaration " << birks << "\n";
os << "Min kinetic energy for tables "
<<G4BestUnit(minKinEnergy,"Energy") << "\n";
os << "Max kinetic energy for tables "
@@ -1270,15 +1323,24 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Bremsstrahlung energy threshold above which \n"
<< " primary is added to the list of secondary "
<<G4BestUnit(bremsTh,"Energy") << "\n";
os << "Lowest triplet kinetic energy "
<<G4BestUnit(lowestTripletEnergy,"Energy") << "\n";
os << "5D gamma conversion model type " <<tripletConv << "\n";
os << "5D gamma conversion model on isolated ion " <<onIsolated << "\n";
os << "=======================================================================" << "\n";
os << "====== Ionisation Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Step function for e+- " <<"("<< dRoverRange
<< ", " << finalRange << " mm)\n";
<< ", " << finalRange/CLHEP::mm << " mm)\n";
os << "Step function for muons/hadrons " <<"("<< dRoverRangeMuHad
<< ", " << finalRangeMuHad << " mm)\n";
<< ", " << finalRangeMuHad/CLHEP::mm << " mm)\n";
os << "Lowest e+e- kinetic energy "
<<G4BestUnit(lowestElectronEnergy,"Energy") << "\n";
os << "Lowest muon/hadron kinetic energy "
<<G4BestUnit(lowestMuHadEnergy,"Energy") << "\n";
os << "Fluctuations of dE/dx are enabled " <<lossFluctuation << "\n";
os << "Use built-in Birks satuaration " << birks << "\n";
os << "Build CSDA range enabled " <<buildCSDARange << "\n";
os << "Use cut as a final range enabled " <<finalRange << "\n";
os << "Enable angular generator interface "
@@ -1286,12 +1348,6 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Factor of cut reduction for sub-cutoff method " << minSubRange << "\n";
os << "Max kinetic energy for CSDA tables "
<<G4BestUnit(maxKinEnergyCSDA,"Energy") << "\n";
os << "Lowest e+e- kinetic energy "
<<G4BestUnit(lowestElectronEnergy,"Energy") << "\n";
os << "Lowest muon/hadron kinetic energy "
<<G4BestUnit(lowestMuHadEnergy,"Energy") << "\n";
os << "Lowest triplet kinetic energy "
<<G4BestUnit(lowestTripletEnergy,"Energy") << "\n";
os << "Linear loss limit " <<linLossLimit << "\n";
os << "=======================================================================" << "\n";
@@ -1301,7 +1357,7 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Type of msc step limit algorithm for muons/hadrons " <<mscStepLimitMuHad << "\n";
os << "Msc lateral displacement for e+- enabled " <<lateralDisplacement << "\n";
os << "Msc lateral displacement for muons and hadrons " <<muhadLateralDisplacement << "\n";
os << "Msc lateral displacement alg96 for e+- " <<lateralDisplacementAlg96 << "\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";
@@ -1312,7 +1368,9 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
<< " limit between single and multiple scattering " << factorForAngleLimit << "\n";
os << "Fixed angular limit between single \n"
<< " and multiple scattering "
<<thetaLimit/rad << " rad" << "\n";
<< thetaLimit/CLHEP::rad << " rad" << "\n";
os << "Upper energy limit for e+- multiple scattering "
<< energyLimit/CLHEP::MeV << " MeV" << "\n";
os << "Type of nuclear form-factor " <<nucFormfactor << "\n";
os << "Screening factor " <<factorScreen << "\n";
@@ -1334,6 +1392,8 @@ std::ostream& G4EmParameters::StreamInfo(std::ostream& os) const
os << "Use fast sampling in DNA models " << dnaFast << "\n";
os << "Use Stationary option in DNA models " << dnaStationary << "\n";
os << "Use DNA with multiple scattering of e- " << dnaMsc << "\n";
os << "Use DNA e- solvation model type "
<< dnaElectronSolvation << "\n";
os << "=======================================================================" << "\n";
os.precision(prec);
return os;
@@ -64,12 +64,16 @@
G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
: theParameters(ptr)
{
gconvDirectory = new G4UIdirectory("/process/gconv/");
gconvDirectory->SetGuidance("Commands for EM gamma conversion BH5D model.");
eLossDirectory = new G4UIdirectory("/process/eLoss/");
eLossDirectory->SetGuidance("Commands for EM processes.");
mscDirectory = new G4UIdirectory("/process/msc/");
mscDirectory->SetGuidance("Commands for EM scattering processes.");
emDirectory = new G4UIdirectory("/process/em/");
emDirectory->SetGuidance("General commands for EM processes.");
dnaDirectory = new G4UIdirectory("/process/dna/");
dnaDirectory->SetGuidance("Commands for DNA processes.");
flucCmd = new G4UIcmdWithABool("/process/eLoss/fluct",this);
flucCmd->SetGuidance("Enable/disable energy loss fluctuations.");
@@ -191,19 +195,19 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
birksCmd->SetDefaultValue(false);
birksCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnafCmd = new G4UIcmdWithABool("/process/em/UseDNAFast",this);
dnafCmd = new G4UIcmdWithABool("/process/dna/UseDNAFast",this);
dnafCmd->SetGuidance("Enable usage of fast sampling for DNA models");
dnafCmd->SetParameterName("dnaf",true);
dnafCmd->SetDefaultValue(false);
dnafCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnafCmd->AvailableForStates(G4State_PreInit);
dnasCmd = new G4UIcmdWithABool("/process/em/UseDNAStationary",this);
dnasCmd = new G4UIcmdWithABool("/process/dna/UseDNAStationary",this);
dnasCmd->SetGuidance("Enable usage of Stationary option for DNA models");
dnasCmd->SetParameterName("dnas",true);
dnasCmd->SetDefaultValue(false);
dnasCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dnasCmd->AvailableForStates(G4State_PreInit);
dnamscCmd = new G4UIcmdWithABool("/process/em/UseDNAElectronMsc",this);
dnamscCmd = new G4UIcmdWithABool("/process/dna/UseDNAElectronMsc",this);
dnamscCmd->SetGuidance("Enable usage of e- msc for DNA");
dnamscCmd->SetParameterName("dnamsc",true);
dnamscCmd->SetDefaultValue(false);
@@ -285,6 +289,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
angCmd->SetUnitCategory("Angle");
angCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
msceCmd = new G4UIcmdWithADoubleAndUnit("/process/msc/EnergyLimit",this);
msceCmd->SetGuidance("Set the upper energy limit for msc");
msceCmd->SetParameterName("mscE",true);
msceCmd->SetUnitCategory("Energy");
msceCmd->AvailableForStates(G4State_PreInit);
frCmd = new G4UIcmdWithADouble("/process/msc/RangeFactor",this);
frCmd->SetGuidance("Set RangeFactor for msc processes of e+-");
frCmd->SetParameterName("Fr",true);
@@ -376,6 +386,12 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
pixeeXsCmd->SetCandidates("ECPSSR_Analytical Empirical Livermore Penelope");
pixeeXsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
dnaSolCmd = new G4UIcmdWithAString("/process/dna/e-SolvationSubType",this);
dnaSolCmd->SetGuidance("The name of e- solvation DNA model");
dnaSolCmd->SetParameterName("dnaSol",true);
dnaSolCmd->SetCandidates("Ritchie1994 Terrisol1990 Meesungnoen2002");
dnaSolCmd->AvailableForStates(G4State_PreInit);
paiCmd = new G4UIcommand("/process/em/AddPAIRegion",this);
paiCmd->SetGuidance("Activate PAI in the G4Region.");
paiCmd->SetGuidance(" partName : particle name (default - all)");
@@ -561,15 +577,35 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
nffCmd->SetParameterName("NucFF",true);
nffCmd->SetCandidates("None Exponential Gaussian Flat");
nffCmd->AvailableForStates(G4State_PreInit);
tripletCmd = new G4UIcmdWithAnInteger("/process/gconv/conversionType",this);
tripletCmd->SetGuidance("gamma conversion triplet/nuclear genaration type:");
tripletCmd->SetGuidance("0 - (default) both triplet and nuclear");
tripletCmd->SetGuidance("1 - force nuclear");
tripletCmd->SetGuidance("2 - force triplet");
tripletCmd->SetParameterName("type",false);
tripletCmd->SetRange("type >= 0 && type <= 2");
tripletCmd->SetDefaultValue(0);
tripletCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
onIsolatedCmd = new G4UIcmdWithABool("/process/gconv/onIsolated",this);
onIsolatedCmd->SetGuidance("Conversion on isolated charged particles");
onIsolatedCmd->SetGuidance("false (default) : atomic electron screening");
onIsolatedCmd->SetGuidance("true : conversion on isolated particles.");
onIsolatedCmd->SetParameterName("flag",false);
onIsolatedCmd->SetDefaultValue(false);
onIsolatedCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EmParametersMessenger::~G4EmParametersMessenger()
{
delete gconvDirectory;
delete eLossDirectory;
delete mscDirectory;
delete emDirectory;
delete dnaDirectory;
delete flucCmd;
delete rangeCmd;
@@ -608,6 +644,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete labCmd;
delete mscfCmd;
delete angCmd;
delete msceCmd;
delete frCmd;
delete fr1Cmd;
delete fgCmd;
@@ -626,6 +663,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete pixeXsCmd;
delete pixeeXsCmd;
delete dnaSolCmd;
delete paiCmd;
delete meCmd;
@@ -641,6 +679,9 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete fiCmd;
delete bsCmd;
delete nffCmd;
delete onIsolatedCmd;
delete tripletCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -709,6 +750,16 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetDNAStationary(dnasCmd->GetNewBoolValue(newValue));
} else if (command == dnamscCmd) {
theParameters->SetBirksActive(dnamscCmd->GetNewBoolValue(newValue));
} else if (command == dnaSolCmd) {
G4DNAModelSubType ttt = fDNAUnknownModel;
if(newValue == "Ritchie1994") {
ttt = fRitchie1994eSolvation;
} else if(newValue == "Terrisol1990") {
ttt = fTerrisol1990eSolvation;
} else if (newValue == "Meesungnoen2002") {
ttt = fMeesungnoen2002eSolvation;
}
theParameters->SetDNAeSolvationSubType(ttt);
} else if (command == sharkCmd) {
theParameters->SetGammaSharkActive(sharkCmd->GetNewBoolValue(newValue));
@@ -744,6 +795,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
} else if (command == angCmd) {
theParameters->SetMscThetaLimit(angCmd->GetNewDoubleValue(newValue));
physicsModified = true;
} else if (command == msceCmd) {
theParameters->SetMscEnergyLimit(msceCmd->GetNewDoubleValue(newValue));
} else if (command == frCmd) {
theParameters->SetMscRangeFactor(frCmd->GetNewDoubleValue(newValue));
physicsModified = true;
@@ -889,7 +942,14 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
return;
}
theParameters->SetNuclearFormfactorType(x);
} else if ( command==tripletCmd ) {
theParameters->SetConversionType(tripletCmd->GetNewIntValue(newValue));
physicsModified = true;
} else if ( command==onIsolatedCmd ) {
theParameters->SetOnIsolated(onIsolatedCmd->GetNewBoolValue(newValue));
physicsModified = true;
}
if(physicsModified) {
G4UImanager::GetUIpointer()->ApplyCommand("/run/physicsModified");
}
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4LossTableManager.cc 107364 2017-11-09 10:53:25Z gcosmo $
// $Id: G4LossTableManager.cc 110572 2018-05-30 13:08:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -402,6 +402,28 @@ void G4LossTableManager::RegisterExtraParticle(
all_tables_are_built = false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VEnergyLossProcess*
G4LossTableManager::GetEnergyLossProcess(const G4ParticleDefinition *aParticle)
{
//G4cout << "G4LossTableManager::GetEnergyLossProcess: "
//<< aParticle << " " << currentParticle << " " << currentLoss << G4endl;
if(aParticle != currentParticle) {
currentParticle = aParticle;
std::map<PD,G4VEnergyLossProcess*,std::less<PD> >::const_iterator pos;
if ((pos = loss_map.find(aParticle)) != loss_map.end()) {
currentLoss = (*pos).second;
} else {
currentLoss = nullptr;
if ((pos = loss_map.find(theGenericIon)) != loss_map.end()) {
currentLoss = (*pos).second;
}
}
}
return currentLoss;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
void
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VAtomDeexcitation.cc 101248 2016-11-10 08:51:37Z gcosmo $
// $Id: G4VAtomDeexcitation.cc 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -62,6 +62,10 @@
#include "G4PhysicsModelCatalog.hh"
#include "G4Gamma.hh"
#ifdef G4MULTITHREADED
G4Mutex G4VAtomDeexcitation::atomDeexcitationMutex = G4MUTEX_INITIALIZER;
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4VAtomDeexcitation::pixeIDg = -1;
@@ -78,8 +82,18 @@ G4VAtomDeexcitation::G4VAtomDeexcitation(const G4String& modname)
theCoupleTable = nullptr;
G4String gg = "gammaPIXE";
G4String ee = "e-PIXE";
if(pixeIDg < 0) { pixeIDg = G4PhysicsModelCatalog::Register(gg); }
if(pixeIDe < 0) { pixeIDe = G4PhysicsModelCatalog::Register(ee); }
if(pixeIDg < 0) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&atomDeexcitationMutex);
if(pixeIDg < 0) {
#endif
pixeIDg = G4PhysicsModelCatalog::Register(gg);
pixeIDe = G4PhysicsModelCatalog::Register(ee);
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&atomDeexcitationMutex);
#endif
}
gamma = G4Gamma::Gamma();
}
@@ -236,6 +250,29 @@ G4VAtomDeexcitation::SetDeexcitationActiveRegion(const G4String& rname,
}
}
void G4VAtomDeexcitation::GenerateParticles(std::vector<G4DynamicParticle*>* v,
const G4AtomicShell* as,
G4int Z, G4int idx)
{
G4double gCut = DBL_MAX;
if(ignoreCuts) {
gCut = 0.0;
} else if (theCoupleTable) {
gCut = (*(theCoupleTable->GetEnergyCutsVector(0)))[idx];
}
if(gCut < as->BindingEnergy()) {
G4double eCut = DBL_MAX;
if(CheckAugerActiveRegion(idx)) {
if(ignoreCuts) {
eCut = 0.0;
} else if (theCoupleTable) {
eCut = (*(theCoupleTable->GetEnergyCutsVector(1)))[idx];
}
}
GenerateParticles(v, as, Z, gCut, eCut);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmAngularDistribution.cc 92921 2015-09-21 15:06:51Z gcosmo $
// $Id: G4VEmAngularDistribution.cc 110416 2018-05-23 06:45:42Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -50,13 +50,19 @@
#include "G4VEmAngularDistribution.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmAngularDistribution::G4VEmAngularDistribution(const G4String& name)
: fLocalDirection(0.0,0.0,1.0),fName(name)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmAngularDistribution::~G4VEmAngularDistribution()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4ThreeVector& G4VEmAngularDistribution::SampleDirectionForShell(
const G4DynamicParticle* dp,
G4double finalTotalEnergy,
@@ -66,4 +72,17 @@ G4ThreeVector& G4VEmAngularDistribution::SampleDirectionForShell(
return SampleDirection(dp, finalTotalEnergy, Z, mat);
}
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4VEmAngularDistribution::SamplePairDirections(const G4DynamicParticle* dp,
G4double, G4double,
G4ThreeVector& dirElectron,
G4ThreeVector& dirPositron,
G4int, const G4Material*)
{
dirElectron = dp->GetMomentumDirection();
dirPositron = dp->GetMomentumDirection();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmModel.cc 106714 2017-10-20 09:38:06Z gcosmo $
// $Id: G4VEmModel.cc 110572 2018-05-30 13:08:12Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -63,8 +63,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const G4double G4VEmModel::inveplus = 1.0/CLHEP::eplus;
G4VEmModel::G4VEmModel(const G4String& nam):
flucModel(nullptr),anglModel(nullptr), name(nam), lowLimit(0.1*CLHEP::keV),
highLimit(100.0*CLHEP::TeV),eMinActive(0.0),eMaxActive(DBL_MAX),
@@ -72,7 +70,7 @@ G4VEmModel::G4VEmModel(const G4String& nam):
theLPMflag(false),flagDeexcitation(false),flagForceBuildTable(false),
isMaster(true),fElementData(nullptr),pParticleChange(nullptr),
xSectionTable(nullptr),theDensityFactor(nullptr),theDensityIdx(nullptr),
lossFlucFlag(true),fCurrentCouple(nullptr),
lossFlucFlag(true),inveplus(1.0/CLHEP::eplus),fCurrentCouple(nullptr),
fCurrentElement(nullptr),fCurrentIsotope(nullptr),
fTripletModel(nullptr),nsec(5)
{
@@ -94,10 +92,8 @@ G4VEmModel::G4VEmModel(const G4String& nam):
G4VEmModel::~G4VEmModel()
{
if(localElmSelectors) {
if(nSelectors > 0) {
for(G4int i=0; i<nSelectors; ++i) {
delete (*elmSelectors)[i];
}
for(G4int i=0; i<nSelectors; ++i) {
delete (*elmSelectors)[i];
}
delete elmSelectors;
}
@@ -229,16 +225,11 @@ void G4VEmModel::InitialiseForMaterial(const G4ParticleDefinition* part,
const G4Material* material)
{
if(material) {
const G4ElementVector* theElementVector = material->GetElementVector();
G4int n = material->GetNumberOfElements();
for(G4int i=0; i<n; ++i) {
G4int Z = ((*theElementVector)[i])->GetZasInt();
size_t n = material->GetNumberOfElements();
for(size_t i=0; i<n; ++i) {
G4int Z = material->GetElement(i)->GetZasInt();
InitialiseForElement(part, Z);
}
} else {
//G4cout << "G4VEmModel::InitialiseForMaterial for " << GetName();
//if(part) { G4cout << " and " << part->GetParticleName(); }
//G4cout << " with no material" << G4endl;
}
}
@@ -266,7 +257,6 @@ G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
{
SetupForMaterial(p, material, ekin);
G4double cross = 0.0;
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
G4int nelm = material->GetNumberOfElements();
@@ -276,7 +266,7 @@ G4double G4VEmModel::CrossSectionPerVolume(const G4Material* material,
}
for (G4int i=0; i<nelm; ++i) {
cross += theAtomNumDensityVector[i]*
ComputeCrossSectionPerAtom(p,(*theElementVector)[i],ekin,emin,emax);
ComputeCrossSectionPerAtom(p,material->GetElement(i),ekin,emin,emax);
xsec[i] = cross;
}
return cross;
@@ -304,21 +294,63 @@ const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* material,
G4double tcut,
G4double tmax)
{
const G4ElementVector* theElementVector = material->GetElementVector();
G4int n = material->GetNumberOfElements() - 1;
fCurrentElement = (*theElementVector)[n];
if (n > 0) {
size_t n = material->GetNumberOfElements();
fCurrentElement = material->GetElement(0);
if (n > 1) {
G4double x = G4UniformRand()*
G4VEmModel::CrossSectionPerVolume(material,pd,kinEnergy,tcut,tmax);
for(G4int i=0; i<n; ++i) {
for(size_t i=0; i<n; ++i) {
if (x <= xsec[i]) {
fCurrentElement = (*theElementVector)[i];
fCurrentElement = material->GetElement(i);
break;
}
}
}
return fCurrentElement;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4VEmModel::SelectRandomAtomNumber(const G4Material* mat)
{
// this algorith assumes that cross section is proportional to
// number electrons multiplied by number of atoms
size_t nn = mat->GetNumberOfElements();
fCurrentElement = mat->GetElement(0);
if(1 < nn) {
const G4double* at = mat->GetVecNbOfAtomsPerVolume();
G4double tot = mat->GetTotNbOfAtomsPerVolume()*G4UniformRand();
for(size_t i=0; i<nn; ++i) {
tot -= at[i];
if(tot <= 0.0) {
fCurrentElement = mat->GetElement(i);
break;
}
}
}
return fCurrentElement->GetZasInt();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4VEmModel::SelectIsotopeNumber(const G4Element* elm)
{
SetCurrentElement(elm);
size_t ni = elm->GetNumberOfIsotopes();
fCurrentIsotope = elm->GetIsotope(0);
size_t idx = 0;
if(ni > 1) {
const G4double* ab = elm->GetRelativeAbundanceVector();
G4double x = G4UniformRand();
for(; idx<ni; ++idx) {
x -= ab[idx];
if (x <= 0.0) {
fCurrentIsotope = elm->GetIsotope(idx);
break;
}
}
}
return fCurrentIsotope->GetN();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEmProcess.cc 108506 2018-02-15 15:50:39Z gcosmo $
// $Id: G4VEmProcess.cc 109178 2018-04-03 07:13:58Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -102,10 +102,10 @@ G4VEmProcess::G4VEmProcess(const G4String& name, G4ProcessType type):
startFromNull(false),
splineFlag(true),
isIon(false),
currentCouple(nullptr),
currentModel(nullptr),
particle(nullptr),
currentParticle(nullptr),
currentCouple(nullptr)
currentParticle(nullptr)
{
theParameters = G4EmParameters::Instance();
SetVerboseLevel(1);
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VEnergyLossProcess.cc 108506 2018-02-15 15:50:39Z gcosmo $
// $Id: G4VEnergyLossProcess.cc 107959 2017-12-14 13:05:59Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -23,7 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4ionEffectiveCharge.cc 100363 2016-10-19 09:24:47Z gcosmo $
// $Id: G4ionEffectiveCharge.cc 108386 2018-02-09 15:38:32Z gcosmo $
//
// -------------------------------------------------------------------
//
@@ -62,8 +62,6 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const G4double G4ionEffectiveCharge::inveplus = 1.0/CLHEP::eplus;
G4ionEffectiveCharge::G4ionEffectiveCharge()
{
chargeCorrection = 1.0;
@@ -76,6 +74,7 @@ G4ionEffectiveCharge::G4ionEffectiveCharge()
lastMat = 0;
lastKinEnergy = 0.0;
effCharge = eplus;
inveplus = 1.0/CLHEP::eplus;
g4calc = G4Pow::GetInstance();
}