Import Geant4 10.7.1 source tree

This commit is contained in:
Gabriele Cosmo
2021-02-05 15:10:05 +01:00
parent dab42d2018
commit 3dfcdb544e
281 changed files with 37738 additions and 47638 deletions
@@ -16,6 +16,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
29.01.2021 V.Ivanchenko, emlowen-V10-06-14
- G4MicroElecLOPhononModel - fixed Coverity warning; removed debug
printout; rename member of class
06.12.2020 V.Ivanchenko,
- G4MicroElecSurface, G4MicroElecLOPhononModel - fixed trivial
Coverity warnings
17.11.2020 V.Ivanchenko, emlowen-V10-06-13
- G4MicroElecInelasticModel_new, G4MicroElecInelastic_new,
G4MicroElecSurface - fixed Coverity warnings (non-initialized
@@ -59,7 +59,7 @@
class G4MicroElecLOPhononModel : public G4VEmModel
{
public:
G4MicroElecLOPhononModel(const G4ParticleDefinition*p = 0,
G4MicroElecLOPhononModel(const G4ParticleDefinition*p = nullptr,
const G4String& nam = "G4MicroElecLOPhononModel");
~G4MicroElecLOPhononModel() override;
@@ -81,14 +81,13 @@ protected:
G4ParticleChangeForGamma* fParticleChangeForGamma;
private:
G4bool Interband;
G4MicroElecLOPhononModel & operator=(const G4MicroElecLOPhononModel &right);
G4MicroElecLOPhononModel(const G4MicroElecLOPhononModel&);
G4bool isOkToBeInitialised;
G4bool isInitialised;
G4bool abs = false;
G4double Eprim = 0, signe = -1,phononEnergy=0;
G4bool Interband = false;
G4bool isInitialised = false;
G4bool absor = false;
G4double phononEnergy = 0.;
};
#endif
@@ -60,11 +60,10 @@
G4MicroElecLOPhononModel::G4MicroElecLOPhononModel(const G4ParticleDefinition*,
const G4String& nam)
: G4VEmModel(nam),isInitialised(false)
: G4VEmModel(nam)
{
abs = false;
fParticleChangeForGamma = GetParticleChangeForGamma();
G4cout << "SiO2 Phonon model is constructed " << G4endl;
//G4cout << "SiO2 Phonon model is constructed " << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -74,60 +73,42 @@ G4MicroElecLOPhononModel::~G4MicroElecLOPhononModel()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void G4MicroElecLOPhononModel::Initialise(const G4ParticleDefinition* /*particle*/,
const G4DataVector& /*cuts*/)
void G4MicroElecLOPhononModel::Initialise(const G4ParticleDefinition*,
const G4DataVector& /*cuts*/)
{
if (isOkToBeInitialised == true && isInitialised == false) {
G4cout << "Calling G4MicroElecLOPhononModel" << "::Initialise()" << G4endl;
if (isInitialised) { return; }
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
if (isInitialised) { return; }
//G4cout << "Calling G4MicroElecLOPhononModel::Initialise()" << G4endl;
fParticleChangeForGamma = GetParticleChangeForGamma();
isInitialised = true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4double G4MicroElecLOPhononModel::CrossSectionPerVolume(const G4Material* material,
const G4ParticleDefinition* p,
const G4ParticleDefinition*,
G4double ekin,
G4double, G4double)
{
G4double e = CLHEP::eplus / coulomb,
if (material->GetName()!="G4_SILICON_DIOXIDE") return 0.0;
m0 = CLHEP::electron_mass_c2 / c_squared / kg,
h = CLHEP::hbar_Planck / (m2*kg / s),
eps0 = CLHEP::epsilon0 / (farad / m),
kb = CLHEP::k_Boltzmann / (joule / kelvin);
G4double eps = 9,
einf = 3,
T = 300;
isOkToBeInitialised = true;
const G4double e = CLHEP::eplus / CLHEP::coulomb;
const G4double m0 = CLHEP::electron_mass_c2 / (CLHEP::c_squared*CLHEP::kg);
const G4double h = CLHEP::hbar_Planck * CLHEP::s/ (CLHEP::m2*CLHEP::kg);
const G4double eps0 = CLHEP::epsilon0 * CLHEP::m/ (CLHEP::farad);
const G4double kb = CLHEP::k_Boltzmann * CLHEP::kelvin/ CLHEP::joule;
const G4DataVector cuts;
Initialise(p, cuts);
if (material->GetName()!="G4_SILICON_DIOXIDE") return 1/DBL_MAX;
G4double E =(ekin/eV)*e;
// Parameters SiO2
eps = 3.84;
einf = 2.25;
phononEnergy = (0.75*0.153+0.25*0.063 )* eV;
G4double hw = (phononEnergy / eV) * e;
G4double n = 1.0 / (std::exp(hw / (kb*T)) - 1); //Phonon distribution
phononEnergy = (0.75*0.153+0.25*0.063 )* CLHEP::eV;
const G4double eps = 3.84;
const G4double einf = 2.25;
const G4double T = 300; // should be taken from material property
G4double E =(ekin/CLHEP::eV)*e;
if (abs) { //Absorption
Eprim = E + hw;
signe = -1;
}
else { //Emission
Eprim = E - hw;
signe = +1;
}
G4double hw = (phononEnergy / CLHEP::eV) * e;
G4double n = 1.0 / (std::exp(hw / (kb*T)) - 1); //Phonon distribution
G4double signe = (absor) ? -1. : 1.;
G4double racine = std::sqrt(1. + ((-signe*hw) / E));
@@ -135,7 +116,7 @@ G4double G4MicroElecLOPhononModel::CrossSectionPerVolume(const G4Material* mater
G4double MFP = (std::sqrt(2. * E / m0) / P)*m;
return 2 / MFP;
return 2. / MFP;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -148,13 +129,8 @@ void G4MicroElecLOPhononModel::SampleSecondaries(
{
G4double E = aDynamicElectron->GetKineticEnergy();
if (abs) {
Eprim = E + phononEnergy;
}
else {
Eprim = E - phononEnergy;
}
G4double Eprim = (absor) ? E + phononEnergy : E - phononEnergy;
G4double rand = G4UniformRand();
G4double B = (E + Eprim + 2 * std::sqrt(E*Eprim)) / (E + Eprim - 2 * std::sqrt(E*Eprim));
G4double cosTheta = ((E + Eprim) / (2 * std::sqrt(E*Eprim)))*(1 - std::pow(B, rand)) + std::pow(B, rand);
@@ -162,7 +138,7 @@ void G4MicroElecLOPhononModel::SampleSecondaries(
if(Interband){
cosTheta = 1 - 2 * G4UniformRand(); //Isotrope
}
G4double phi = 2. * pi * G4UniformRand();
G4double phi = twopi * G4UniformRand();
G4ThreeVector zVers = aDynamicElectron->GetMomentumDirection();
G4ThreeVector xVers = zVers.orthogonal();
G4ThreeVector yVers = zVers.cross(xVers);
@@ -221,36 +221,34 @@ G4VParticleChange* G4MicroElecSurface::PostStepDoIt(const G4Track& aTrack, const
if (aTrack.GetStepLength()<=kCarTolerance)
{
theStatus = StepTooSmallSurf;
if (pPostStepPoint) {
WorkFunctionTable::iterator postStepWF;
postStepWF = tableWF.find(pPostStepPoint->GetMaterial()->GetName());
WorkFunctionTable::iterator preStepWF;
preStepWF = tableWF.find(pPreStepPoint->GetMaterial()->GetName());
WorkFunctionTable::iterator postStepWF;
postStepWF = tableWF.find(pPostStepPoint->GetMaterial()->GetName());
WorkFunctionTable::iterator preStepWF;
preStepWF = tableWF.find(pPreStepPoint->GetMaterial()->GetName());
if (postStepWF == tableWF.end()) {
G4String str = "Material ";
str += pPostStepPoint->GetMaterial()->GetName() + " not found!";
G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
return 0;
}
if (postStepWF == tableWF.end()) {
G4String str = "Material ";
str += pPostStepPoint->GetMaterial()->GetName() + " not found!";
G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
return 0;
}
else if (preStepWF == tableWF.end()) {
G4String str = "Material ";
str += pPreStepPoint->GetMaterial()->GetName() + " not found!";
G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
return 0;
}
else if (preStepWF == tableWF.end()) {
G4String str = "Material ";
str += pPreStepPoint->GetMaterial()->GetName() + " not found!";
G4Exception("G4Surface::G4Surface", "em0002", FatalException, str);
return 0;
}
if (pPreStepPoint->GetMaterial() != pPostStepPoint->GetMaterial()) {
if (pPreStepPoint->GetMaterial() != pPostStepPoint->GetMaterial()) {
flag_franchissement_surface = false;
flag_franchissement_surface = false;
if (flag_reflexion == true && flag_normal == true) {
aParticleChange.ProposeMomentumDirection(-Reflexion(aStep.GetPostStepPoint()));
flag_reflexion = false;
flag_normal = false;
}
if (flag_reflexion == true && flag_normal == true) {
aParticleChange.ProposeMomentumDirection(-Reflexion(aStep.GetPostStepPoint()));
flag_reflexion = false;
flag_normal = false;
}
}
return G4VDiscreteProcess::PostStepDoIt(aTrack, aStep);
@@ -17,6 +17,11 @@ committal in the CVS repository !
----------------------------------------------------------
26 January 21: V.Ivanchenko (emstand-V10-06-20)
- G4BetheBlochModel, G4LindhardSorensenIonModel - fixed problem #2312,
restore computation of maximum energy transfer from Geant4 10.4,
affect only ultrarelativistic ions
11 November 20: V.Ivanchenko (emstand-V10-06-19)
- G4UrbanMscModel - restored parameterisation of step limit to
the variant of emstand-V10-06-13
@@ -166,15 +166,14 @@ void G4BetheBlochModel::SetupParameters()
formfact = 0.0;
tlimit = DBL_MAX;
if(particle->GetLeptonNumber() == 0) {
G4int iz = G4lrint(q);
if(iz <= 1) {
formfact = (spin == 0.0 && mass < GeV) ? 1.181e-6 : 1.548e-6;
} else {
G4double x = nist->GetA27(iz);
formfact = 3.969e-6*x*x;
G4double x = 0.8426*CLHEP::GeV;
if(spin == 0.0 && mass < GeV) { x = 0.736*CLHEP::GeV; }
else if (mass > CLHEP::GeV) {
G4int iz = G4lrint(std::abs(q));
if(iz > 1) { x /= nist->GetA27(iz); }
}
tlimit = std::sqrt(0.414/formfact +
electron_mass_c2*electron_mass_c2) - electron_mass_c2;
formfact = 2.0*CLHEP::electron_mass_c2/(x*x);
tlimit = 2.0/formfact;
}
}
@@ -252,7 +251,8 @@ G4double G4BetheBlochModel::ComputeDEDXPerVolume(const G4Material* material,
G4double cut)
{
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double cutEnergy = std::min(cut,tmax);
// projectile formfactor limit energy loss
G4double cutEnergy = std::min(std::min(cut,tmax), tlimit);
G4double tau = kineticEnergy/mass;
G4double gam = tau + 1.0;
@@ -405,7 +405,7 @@ void G4BetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
// projectile formfactor - suppresion of high energy
// delta-electron production at high energy
G4double x = formfact*deltaKinEnergy*(deltaKinEnergy + 2*electron_mass_c2);
G4double x = formfact*deltaKinEnergy;
if(x > 1.e-6) {
G4double x1 = 1.0 + x;
@@ -440,8 +440,8 @@ void G4BetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * dp->GetTotalMomentum());
if(cost > 1.0) { cost = 1.0; }
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
cost = std::min(cost, 1.0);
G4double sint = std::sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi*rndmEngineMod->flat();
@@ -479,12 +479,12 @@ void G4BetheBlochModel::SampleSecondaries(vector<G4DynamicParticle*>* vdp,
G4double G4BetheBlochModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
G4double kinEnergy)
{
// here particle type is checked for any method
// here particle type is checked for the case,
// when this model is shared between particles
SetParticle(pd);
G4double tau = kinEnergy/mass;
G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
(1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
return std::min(tmax,tlimit);
return 2.0*CLHEP::electron_mass_c2*tau*(tau + 2.) /
(1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -135,20 +135,18 @@ void G4LindhardSorensenIonModel::SetupParameters()
mass = particle->GetPDGMass();
spin = particle->GetPDGSpin();
charge = particle->GetPDGCharge()*inveplus;
Zin = G4lrint(charge);
Zin = G4lrint(std::abs(charge));
chargeSquare = charge*charge;
ratio = electron_mass_c2/mass;
static const G4double aMag = 1./(0.5*eplus*hbar_Planck*c_squared);
G4double magmom = particle->GetPDGMagneticMoment()*mass*aMag;
magMoment2 = magmom*magmom - 1.0;
if(Zin <= 1) {
formfact = (spin == 0.0 && mass < GeV) ? 1.181e-6 : 1.548e-6;
} else {
G4double x = nist->GetA27(Zin);
formfact = 3.969e-6*x*x;
}
tlimit = std::sqrt(0.414/formfact +
electron_mass_c2*electron_mass_c2) - electron_mass_c2;
G4double x = 0.8426*CLHEP::GeV;
if(spin == 0.0 && mass < GeV) { x = 0.736*CLHEP::GeV; }
else if (Zin > 1) { x /= nist->GetA27(Zin); }
formfact = 2.0*CLHEP::electron_mass_c2/(x*x);
tlimit = 2.0/formfact;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -170,7 +168,7 @@ G4LindhardSorensenIonModel::ComputeCrossSectionPerElectron(
{
G4double cross = 0.0;
// take into account formfactor
G4double tmax = std::min(MaxSecondaryEnergy(p, kineticEnergy),tlimit);
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double maxEnergy = std::min(tmax,maxKinEnergy);
if(cutEnergy < maxEnergy) {
@@ -228,7 +226,7 @@ G4LindhardSorensenIonModel::ComputeDEDXPerVolume(const G4Material* material,
{
// formfactor is taken into account in CorrectionsAlongStep(..)
G4double tmax = MaxSecondaryEnergy(p, kineticEnergy);
G4double cutEnergy = std::min(cut,tmax);
G4double cutEnergy = std::min(std::min(cut,tmax), tlimit);
G4double tau = kineticEnergy/mass;
G4double gam = tau + 1.0;
@@ -317,8 +315,7 @@ void G4LindhardSorensenIonModel::SampleSecondaries(
{
G4double kineticEnergy = dp->GetKineticEnergy();
// take into account formfactor
G4double tmax =
std::min(MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy),tlimit);
G4double tmax = MaxSecondaryEnergy(dp->GetDefinition(),kineticEnergy);
G4double maxKinEnergy = std::min(maxEnergy,tmax);
if(minKinEnergy >= maxKinEnergy) { return; }
@@ -356,7 +353,7 @@ void G4LindhardSorensenIonModel::SampleSecondaries(
// projectile formfactor - suppresion of high energy
// delta-electron production at high energy
G4double x = formfact*deltaKinEnergy*(deltaKinEnergy + 2*electron_mass_c2);
G4double x = formfact*deltaKinEnergy;
if(x > 1.e-6) {
G4double x1 = 1.0 + x;
@@ -391,7 +388,7 @@ void G4LindhardSorensenIonModel::SampleSecondaries(
sqrt(deltaKinEnergy * (deltaKinEnergy + 2.0*electron_mass_c2));
G4double cost = deltaKinEnergy * (totEnergy + electron_mass_c2) /
(deltaMomentum * dp->GetTotalMomentum());
if(cost > 1.0) { cost = 1.0; }
cost = std::min(cost, 1.0);
G4double sint = sqrt((1.0 - cost)*(1.0 + cost));
G4double phi = twopi*rndmEngineMod->flat();
@@ -434,10 +431,8 @@ G4LindhardSorensenIonModel::MaxSecondaryEnergy(const G4ParticleDefinition* pd,
// here particle type is checked for any method
SetParticle(pd);
G4double tau = kinEnergy/mass;
G4double tmax = 2.0*electron_mass_c2*tau*(tau + 2.) /
(1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
// formfactor is not taken into account
return tmax;
return 2.0*CLHEP::electron_mass_c2*tau*(tau + 2.) /
(1. + 2.0*(tau + 1.)*ratio + ratio*ratio);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -16,6 +16,15 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
30 January 21: V.Ivanchenko (emutils-V10-06-16)
- G4VEnergyLossProcess, G4VEmProcess, - improved printout
G4EmExtraParameters, G4EmExtraParametersMessenger - fixed #2292
11 January 21: V.Ivanchenko
- G4EmCorrections - fix 2-D interpolation of shell corrections
(problem #2308), which provides minor change of ranges of
charge particles (< 0.1 mm)
12 November 20: B. Morgan (emutils-V10-06-15)
- Apply typo fixes from Gurkan Myczko (https://github.com/Geant4/geant4/pull/15)
@@ -287,9 +287,8 @@ inline G4double G4EmCorrections::Value2(G4double xv, G4double yv,
G4double z11, G4double z21,
G4double z12, G4double z22) const
{
return (z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*(yv-y1) +
0.5*(z12*((x2-xv)*(yv-y1)+(xv-x1)*(y2-yv))+
z21*((xv-x1)*(y2-yv)+(yv-y1)*(x2-xv))))
return ( z11*(x2-xv)*(y2-yv) + z22*(xv-x1)*(yv-y1) +
z12*(x2-xv)*(yv-y1) + z21*(xv-x1)*(y2-yv) )
/ ((x2-x1)*(y2-y1));
}
@@ -284,7 +284,7 @@ const std::vector<G4String>& G4EmExtraParameters::TypesPhysics() const
void G4EmExtraParameters::SetSubCutoff(G4bool val, const G4String& region)
{
G4String r = CheckRegion(region);
const G4String& r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
if(r == m_regnamesSubCut[i]) {
@@ -326,13 +326,13 @@ G4EmExtraParameters::ActivateForcedInteraction(const G4String& procname,
G4double length,
G4bool wflag)
{
G4String r = CheckRegion(region);
const G4String& r = CheckRegion(region);
if(length >= 0.0) {
G4int n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
if(procname == m_procForced[i] && r == m_regnamesForced[i] ) {
m_lengthForced[i] = length;
m_weightForced[i]= wflag;
m_weightForced[i] = wflag;
return;
}
}
@@ -355,7 +355,7 @@ G4EmExtraParameters::ActivateSecondaryBiasing(const G4String& procname,
G4double factor,
G4double energyLim)
{
G4String r = CheckRegion(region);
const G4String& r = CheckRegion(region);
if(factor >= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
@@ -94,6 +94,12 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
SubSecCmd->SetGuidance(" Region : region name");
SubSecCmd->AvailableForStates(G4State_PreInit);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
SubSecCmd->SetParameter(subSecReg);
StepFuncCmd = new G4UIcommand("/process/eLoss/StepFunction",this);
StepFuncCmd->SetGuidance("Set the energy loss step limitation parameters for e+-.");
StepFuncCmd->SetGuidance(" dRoverR : max Range variation per step");
@@ -167,12 +173,6 @@ G4EmExtraParametersMessenger::G4EmExtraParametersMessenger(G4EmExtraParameters*
unitPrm3->SetDefaultValue("mm");
StepFuncCmd3->SetParameter(unitPrm3);
G4UIparameter* subSec = new G4UIparameter("subSec",'s',false);
SubSecCmd->SetParameter(subSec);
G4UIparameter* subSecReg = new G4UIparameter("Region",'s',false);
SubSecCmd->SetParameter(subSecReg);
bfCmd = new G4UIcommand("/process/em/setBiasingFactor",this);
bfCmd->SetGuidance("Set factor for the process cross section.");
bfCmd->SetGuidance(" procName : process name");
@@ -897,10 +897,7 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
yes = theLambdaTable->StorePhysicsTable(nam,ascii);
if ( yes ) {
G4cout << "Physics table is stored for " << particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
if(0 < verboseLevel) G4cout << "Stored: " << nam << G4endl;
} else {
G4cout << "Fail to store Physics Table for "
<< particle->GetParticleName()
@@ -915,11 +912,13 @@ G4bool G4VEmProcess::StorePhysicsTable(const G4ParticleDefinition* part,
yes = theLambdaTablePrim->StorePhysicsTable(name,ascii);
if ( yes ) {
G4cout << "Physics table prim is stored for "
<< particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
if(0 < verboseLevel) {
G4cout << "Physics table prim is stored for "
<< particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
}
} else {
G4cout << "Fail to store Physics Table Prim for "
<< particle->GetParticleName()
@@ -1738,21 +1738,6 @@ G4bool G4VEnergyLossProcess::StorePhysicsTable(
if(!StoreTable(part,theSubLambdaTable,ascii,directory,"SubLambda"))
{res = false;}
if ( !res ) {
if(1 < verboseLevel) {
G4cout << "Physics tables are stored for "
<< particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
}
} else {
G4cout << "Fail to store Physics Tables for "
<< particle->GetParticleName()
<< " and process " << GetProcessName()
<< " in the directory <" << directory
<< "> " << G4endl;
}
return res;
}
@@ -1765,7 +1750,7 @@ G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
{
G4bool res = true;
if (!isMaster) return res;
const G4String particleName = part->GetParticleName();
const G4String& particleName = part->GetParticleName();
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::RetrievePhysicsTable() for "
@@ -1830,14 +1815,15 @@ G4bool G4VEnergyLossProcess::StoreTable(const G4ParticleDefinition* part,
const G4String& directory,
const G4String& tname)
{
//G4cout << "G4VEnergyLossProcess::StoreTable: " << aTable
// << " " << directory << " " << tname << G4endl;
G4bool res = true;
if ( aTable ) {
const G4String name = GetPhysicsTableFileName(part,directory,tname,ascii);
G4cout << name << G4endl;
//G4cout << *aTable << G4endl;
if( !aTable->StorePhysicsTable(name,ascii)) res = false;
const G4String& name = GetPhysicsTableFileName(part, directory, tname, ascii);
if ( aTable->StorePhysicsTable(name,ascii) ) {
if (0 < verboseLevel) G4cout << "Stored: " << name << G4endl;
} else {
res = false;
G4cout << "Fail to store: " << name << G4endl;
}
}
return res;
}
@@ -14,6 +14,32 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
17 December 2020 - Vladimir Ivanchenko (hadr-cross-V10-06-18)
- G4GammaNuclearXS - fixed duplicated name of static variable
- G4ParticleInelasticXS, G4NeutronCaptureXS, G4NeutronElasticXS,
G4NeutronInelasticXS - make MAXZ variable static class member
16 December 2020 - Guilherme Amadio
- Drop cache for per-element G4CrossSectionDataStore::GetCrossSection(),
since the cache is never used in practice. This method is always called
by G4CrossSectionDataStore::ComputeCrossSection() inside a for loop in
which the element changes for each iteration, which ensures the cache
is always missed. Note that material, particle, and energy are still
cached by G4CrossSectionDataStore::ComputeCrossSection(), and that cache
hit rate has been measured to be about 6.9% for a full CMS ttbar event
simulation at 14 TeV. The condition to check for the cache in that case
has been optimized to minimize unnecessary checks by reordering checked
conditions from most to least discriminant.
11 December 2020 - Vladimir Ivanchenko
- G4VCrossSectionRatio - use inheritance from G4VCrossSectionDataSet
in order to guarantee deletion of object end of run
06 December 2020 - Vladimir Ivanchenko
- G4ParticleInelasticXS, G4CrossSectionInelastic, G4CrossSectionElastic
extended maximum energy range for ion cross sections (QBBC and other
Physics Lists has the same high energy limits)
24 November 2020 - A. Ribon (hadr-cross-V10-06-17)
- G4EMDissociationCrossSection : apply fixes suggested by Laurie Nevay and
Andrey Abramov (bug report #2254) to avoid numerical crashes for ions
@@ -122,12 +122,6 @@ private:
G4double matKinEnergy;
G4double matCrossSection;
const G4Material* elmMaterial;
const G4Element* currentElement;
const G4ParticleDefinition* elmParticle;
G4double elmKinEnergy;
G4double elmCrossSection;
G4int nDataSetList;
G4int verboseLevel;
//Fast path: caching
@@ -48,8 +48,6 @@
#include "G4Threading.hh"
#include <vector>
const G4int MAXZEL = 93;
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -101,8 +99,9 @@ private:
G4VCrossSectionDataSet* ggXsection;
const G4ParticleDefinition* gamma;
static G4PhysicsVector* data[MAXZEL];
static G4double coeff[MAXZEL];
static const G4int MAXZGAMMAN = 93;
static G4PhysicsVector* data[MAXZGAMMAN];
static G4double coeff[MAXZGAMMAN];
static G4String gDataDirectory;
G4bool isMaster;
@@ -51,8 +51,6 @@
#include <vector>
#include <iostream>
const G4int MAXZCAPTURE = 93;
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -113,6 +111,7 @@ private:
G4bool isMaster;
static const G4int MAXZCAPTURE = 93;
static G4ElementData* data;
static G4String gDataDirectory;
@@ -48,8 +48,6 @@
#include "G4Threading.hh"
#include <vector>
const G4int MAXZEL = 93;
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -102,6 +100,7 @@ private:
G4VComponentCrossSection* ggXsection;
const G4ParticleDefinition* neutron;
static const G4int MAXZEL = 93;
static G4PhysicsVector* data[MAXZEL];
static G4double coeff[MAXZEL];
static G4String gDataDirectory;
@@ -48,8 +48,6 @@
#include "G4Threading.hh"
#include <vector>
const G4int MAXZINEL = 93;
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -111,6 +109,7 @@ private:
G4bool isMaster;
static const G4int MAXZINEL = 93;
static G4ElementData* data;
static G4double coeff[MAXZINEL];
static G4String gDataDirectory;
@@ -49,8 +49,6 @@
#include "G4Threading.hh"
#include <vector>
const G4int MAXZINELP = 93;
class G4DynamicParticle;
class G4ParticleDefinition;
class G4Element;
@@ -113,6 +111,7 @@ private:
G4int index;
G4bool isMaster;
static const G4int MAXZINELP = 93;
static G4ElementData* data[5];
static G4double coeff[MAXZINELP][5];
static G4String gDataDirectory[5];
@@ -143,8 +143,6 @@ public: //with description
virtual void CrossSectionDescription(std::ostream&) const;
public: // Without Description
virtual G4int GetVerboseLevel() const;
virtual void SetVerboseLevel(G4int value);
@@ -163,12 +161,14 @@ public: // Without Description
inline const G4String& GetName() const;
inline void SetName(const G4String& nam);
protected:
inline void SetName(const G4String&);
G4int verboseLevel;
G4String name;
private:
G4VCrossSectionDataSet & operator=(const G4VCrossSectionDataSet &right);
@@ -181,7 +181,6 @@ private:
G4bool isForAllAtomsAndEnergies;
G4String name;
};
inline G4double
@@ -45,60 +45,28 @@
#ifndef G4VCrossSectionRatio_h
#define G4VCrossSectionRatio_h 1
#include "globals.hh"
#include "G4VCrossSectionDataSet.hh"
class G4ParticleDefinition;
class G4VCrossSectionRatio
class G4VCrossSectionRatio : G4VCrossSectionDataSet
{
public:
G4VCrossSectionRatio(const G4String& nam = "", G4int verb = 0);
G4VCrossSectionRatio(const G4String& nam = "XSRatio", G4int verb = 0);
virtual ~G4VCrossSectionRatio();
~G4VCrossSectionRatio() override;
virtual
G4double ComputeRatio(const G4ParticleDefinition*,
G4double kinEnergy,
G4int /*Z*/, G4int /*A*/) = 0;
virtual
void BuildPhysicsTable(const G4ParticleDefinition&);
virtual
void DumpPhysicsTable(const G4ParticleDefinition&);
virtual
void Description() const;
inline void SetVerboseLevel(G4int value);
inline G4int GetVerboseLevel() const;
inline const G4String& GetName() const;
private:
G4VCrossSectionRatio & operator=(const G4VCrossSectionRatio &right);
G4VCrossSectionRatio(const G4VCrossSectionRatio&);
G4int verboseLevel;
const G4String name;
};
inline void G4VCrossSectionRatio::SetVerboseLevel(G4int value)
{
verboseLevel = value;
}
inline G4int G4VCrossSectionRatio::GetVerboseLevel() const
{
return verboseLevel;
}
inline const G4String& G4VCrossSectionRatio::GetName() const
{
return name;
}
#endif
@@ -57,16 +57,19 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4CrossSectionDataStore::G4CrossSectionDataStore() :
nDataSetList(0), verboseLevel(0),fastPathFlags(),fastPathParams(),
counters(),fastPathCache()
{
nist = G4NistManager::Instance();
currentMaterial = elmMaterial = nullptr;
currentElement = nullptr; //ALB 14-Aug-2012 Coverity fix.
matParticle = elmParticle = nullptr;
matKinEnergy = elmKinEnergy = matCrossSection = elmCrossSection = 0.0;
}
G4CrossSectionDataStore::G4CrossSectionDataStore()
: nist(G4NistManager::Instance())
, currentMaterial(nullptr)
, matParticle(nullptr)
, matKinEnergy(0.0)
, matCrossSection(0.0)
, nDataSetList(0)
, verboseLevel(0)
, fastPathFlags()
, fastPathParams()
, counters()
, fastPathCache()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -268,10 +271,10 @@ G4double
G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
const G4Material* mat)
{
if(mat == currentMaterial && part->GetDefinition() == matParticle
&& part->GetKineticEnergy() == matKinEnergy) {
if(part->GetKineticEnergy() == matKinEnergy && mat == currentMaterial &&
part->GetDefinition() == matParticle)
return matCrossSection;
}
currentMaterial = mat;
matParticle = part->GetDefinition();
matKinEnergy = part->GetKineticEnergy();
@@ -292,58 +295,36 @@ G4CrossSectionDataStore::ComputeCrossSection(const G4DynamicParticle* part,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
G4double
G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
const G4Element* elm,
const G4Material* mat)
G4double G4CrossSectionDataStore::GetCrossSection(const G4DynamicParticle* part,
const G4Element* elm,
const G4Material* mat)
{
if(mat == elmMaterial && elm == currentElement &&
part->GetDefinition() == elmParticle &&
part->GetKineticEnergy() == elmKinEnergy)
{ return elmCrossSection; }
elmMaterial = mat;
currentElement = elm;
elmParticle = part->GetDefinition();
elmKinEnergy = part->GetKineticEnergy();
elmCrossSection = 0.0;
G4int i = nDataSetList-1;
G4int i = nDataSetList - 1;
G4int Z = elm->GetZasInt();
if (elm->GetNaturalAbundanceFlag() &&
dataSetList[i]->IsElementApplicable(part, Z, mat)) {
if(elm->GetNaturalAbundanceFlag() &&
dataSetList[i]->IsElementApplicable(part, Z, mat))
{
// element wise cross section
elmCrossSection = dataSetList[i]->GetElementCrossSection(part, Z, mat);
//G4cout << "Element wise " << elmParticle->GetParticleName()
// << " xsec(barn)= " << elmCrossSection/barn
// << " E(MeV)= " << elmKinEnergy/MeV
// << " Z= " << Z << " AbundFlag= " << elm->GetNaturalAbandancesFlag()
// <<G4endl;
} else {
// isotope wise cross section
size_t nIso = elm->GetNumberOfIsotopes();
// user-defined isotope abundances
const G4double* abundVector = elm->GetRelativeAbundanceVector();
for (size_t j=0; j<nIso; ++j) {
if(abundVector[j] > 0.0) {
const G4Isotope* iso = elm->GetIsotope(j);
elmCrossSection += abundVector[j]*
GetIsoCrossSection(part, Z, iso->GetN(), iso, elm, mat, i);
//G4cout << "Isotope wise " << elmParticle->GetParticleName()
// << " xsec(barn)= " << elmCrossSection/barn
// << " E(MeV)= " << elmKinEnergy/MeV
// << " Z= " << Z << " A= " << iso->GetN() << " j= " << j << G4endl;
}
}
return dataSetList[i]->GetElementCrossSection(part, Z, mat);
}
//G4cout << " E(MeV)= " << elmKinEnergy/MeV
// << "xsec(barn)= " << elmCrossSection/barn <<G4endl;
return elmCrossSection;
// isotope wise cross section
size_t nIso = elm->GetNumberOfIsotopes();
// user-defined isotope abundances
const G4double* abundVector = elm->GetRelativeAbundanceVector();
G4double sigma = 0.0;
for(size_t j = 0; j < nIso; ++j)
{
const G4Isotope* iso = elm->GetIsotope(j);
sigma += abundVector[j] *
GetIsoCrossSection(part, Z, iso->GetN(), iso, elm, mat, i);
}
return sigma;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo.....
@@ -91,8 +91,9 @@ void G4CrossSectionElastic::BuildPhysicsTable(const G4ParticleDefinition& p)
// often shared between the different types of ions (d, t, He3, alpha, and
// genericIon) therefore we scale by Zmax - which is safely larger than the
// number of nucleons of the heaviest nuclides.
SetMaxKinEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() *
( std::abs( p.GetBaryonNumber() ) > 1 ? Zmax : 1 ) );
G4int fact = (std::abs(p.GetBaryonNumber()) > 1 ||
p.GetParticleName() == "GenericIon") ? Zmax : 1;
SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
}
void G4CrossSectionElastic::DumpPhysicsTable(const G4ParticleDefinition& p)
@@ -91,8 +91,9 @@ void G4CrossSectionInelastic::BuildPhysicsTable(const G4ParticleDefinition& p)
// often shared between the different types of ions (d, t, He3, alpha, and
// genericIon) therefore we scale by Zmax - which is safely larger than the
// number of nucleons of the heaviest nuclides.
SetMaxKinEnergy( G4HadronicParameters::Instance()->GetMaxEnergy() *
( std::abs( p.GetBaryonNumber() ) > 1 ? Zmax : 1 ) );
G4int fact = (std::abs(p.GetBaryonNumber()) > 1 ||
p.GetParticleName() == "GenericIon") ? Zmax : 1;
SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
}
void G4CrossSectionInelastic::DumpPhysicsTable(const G4ParticleDefinition& p)
@@ -73,7 +73,7 @@ G4GammaNuclearXS::G4GammaNuclearXS()
// verboseLevel = 0;
if(verboseLevel > 0){
G4cout << "G4GammaNuclearXS::G4GammaNuclearXS Initialise for Z < "
<< MAXZEL << G4endl;
<< MAXZGAMMAN << G4endl;
}
ggXsection = G4CrossSectionDataSetRegistry::Instance()->GetCrossSectionDataSet("PhotoNuclearXS");
if(ggXsection == nullptr) ggXsection = new G4PhotoNuclearCrossSection();
@@ -83,7 +83,7 @@ G4GammaNuclearXS::G4GammaNuclearXS()
G4GammaNuclearXS::~G4GammaNuclearXS()
{
if(isMaster) {
for(G4int i=0; i<MAXZEL; ++i) {
for(G4int i=0; i<MAXZGAMMAN; ++i) {
delete data[i];
data[i] = nullptr;
}
@@ -120,7 +120,7 @@ G4GammaNuclearXS::GetElementCrossSection(const G4DynamicParticle* aParticle,
G4double xs = 0.0;
G4double ekin = aParticle->GetKineticEnergy();
G4int Z = (ZZ >= MAXZEL) ? MAXZEL - 1 : ZZ;
G4int Z = (ZZ >= MAXZGAMMAN) ? MAXZGAMMAN - 1 : ZZ;
auto pv = GetPhysicsVector(Z);
if(pv == nullptr) { return xs; }
@@ -217,7 +217,7 @@ G4GammaNuclearXS::BuildPhysicsTable(const G4ParticleDefinition& p)
auto elmVec = mat->GetElementVector();
size_t numOfElem = mat->GetNumberOfElements();
for (size_t ie = 0; ie < numOfElem; ++ie) {
G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(), MAXZEL-1));
G4int Z = std::max(1,std::min(((*elmVec)[ie])->GetZasInt(), MAXZGAMMAN-1));
if(data[Z] == nullptr) { Initialise(Z); }
}
}
@@ -49,6 +49,7 @@
#include "Randomize.hh"
#include "G4SystemOfUnits.hh"
#include "G4IsotopeList.hh"
#include "G4HadronicParameters.hh"
#include <fstream>
#include <sstream>
@@ -297,6 +298,9 @@ G4ParticleInelasticXS::BuildPhysicsTable(const G4ParticleDefinition& p)
return;
}
G4int fact = (p.GetParticleName() == "proton") ? 1 : 256;
SetMaxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy() * fact);
if(data[index] == nullptr) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&particleInelasticXSMutex);
@@ -47,9 +47,9 @@
#include "G4HadronicParameters.hh"
G4VCrossSectionDataSet::G4VCrossSectionDataSet(const G4String& nam) :
verboseLevel(0),minKinEnergy(0.0),
verboseLevel(0),name(nam),minKinEnergy(0.0),
maxKinEnergy(G4HadronicParameters::Instance()->GetMaxEnergy()),
isForAllAtomsAndEnergies(false),name(nam)
isForAllAtomsAndEnergies(false)
{
registry = G4CrossSectionDataSetRegistry::Instance();
registry->Register(this);
@@ -37,23 +37,13 @@
//
#include "G4VCrossSectionRatio.hh"
#include "G4ParticleDefinition.hh"
G4VCrossSectionRatio::G4VCrossSectionRatio(const G4String& nam, G4int verb)
: verboseLevel(verb),name(nam)
{}
: G4VCrossSectionDataSet(nam)
{
SetVerboseLevel(verb);
}
G4VCrossSectionRatio::~G4VCrossSectionRatio()
{}
void
G4VCrossSectionRatio::Description() const
{}
void
G4VCrossSectionRatio::BuildPhysicsTable(const G4ParticleDefinition&)
{}
void
G4VCrossSectionRatio::DumpPhysicsTable(const G4ParticleDefinition&)
{}
@@ -14,6 +14,11 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
05 January 2021 Vladimir Ivanchenko (hadr-hpp-V10-06-13)
--------------------------------------------------------
- G4ParticleHPThermalScattering - add final state phi-rotation;
fixed problems #2290 and #1856
05 November 2020 Alberto Ribon (hadr-hpp-V10-06-12)
--------------------------------------------------
- G4ParticleHPInelastic, G4ParticleHPInelasticData : improved error message
@@ -65,74 +65,19 @@ G4ParticleHPThermalScattering::G4ParticleHPThermalScattering()
SetMaxEnergy( 4*eV );
theXSection = new G4ParticleHPThermalScatteringData();
//sizeOfMaterialTable = G4Material::GetMaterialTable()->size();
//buildPhysicsTable();
nMaterial = 0;
nElement = 0;
}
G4ParticleHPThermalScattering::~G4ParticleHPThermalScattering()
{
/*
for ( std::map < G4int , std::map < G4double , std::vector < E_isoAng* >* >* >::iterator it = incoherentFSs->begin() ; it != incoherentFSs->end() ; it++ )
{
std::map < G4double , std::vector < E_isoAng* >* >::iterator itt;
for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
{
std::vector< E_isoAng* >::iterator ittt;
for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
{
delete *ittt;
}
delete itt->second;
}
delete it->second;
}
for ( std::map < G4int , std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >* >::iterator it = coherentFSs->begin() ; it != coherentFSs->end() ; it++ )
{
std::map < G4double , std::vector < std::pair< G4double , G4double >* >* >::iterator itt;
for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
{
std::vector < std::pair< G4double , G4double >* >::iterator ittt;
for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
{
delete *ittt;
}
delete itt->second;
}
delete it->second;
}
for ( std::map < G4int , std::map < G4double , std::vector < E_P_E_isoAng* >* >* >::iterator it = inelasticFSs->begin() ; it != inelasticFSs->end() ; it++ )
{
std::map < G4double , std::vector < E_P_E_isoAng* >* >::iterator itt;
for ( itt = it->second->begin() ; itt != it->second->end() ; itt++ )
{
std::vector < E_P_E_isoAng* >::iterator ittt;
for ( ittt = itt->second->begin(); ittt != itt->second->end() ; ittt++ )
{
std::vector < E_isoAng* >::iterator it4;
for ( it4 = (*ittt)->vE_isoAngle.begin() ; it4 != (*ittt)->vE_isoAngle.end() ; it4++ )
{
delete *it4;
}
delete *ittt;
}
delete itt->second;
}
delete it->second;
}
*/
delete theHPElastic;
//TKDB 160506
//delete theXSection;
}
void G4ParticleHPThermalScattering::clearCurrentFSData() {
if ( incoherentFSs != NULL ) {
@@ -392,20 +337,11 @@ E_isoAng* G4ParticleHPThermalScattering::readAnE_isoAng( std::istream* file )
G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProjectile& aTrack, G4Nucleus& aNucleus )
{
/*
//Trick for dynamically generated materials
if ( sizeOfMaterialTable != G4Material::GetMaterialTable()->size() ) {
sizeOfMaterialTable = G4Material::GetMaterialTable()->size();
buildPhysicsTable();
theXSection->BuildPhysicsTable( *aTrack.GetDefinition() );
}
*/
// Select Element > Reaction >
const G4Material * theMaterial = aTrack.GetMaterial();
G4double aTemp = theMaterial->GetTemperature();
G4int n = theMaterial->GetNumberOfElements();
//static const G4ElementTable* theElementTable = G4Element::GetElementTable();
G4bool findThermalElement = false;
G4int ielement;
@@ -521,10 +457,11 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
//set
theParticleChange.SetEnergyChange( sE );
theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
G4double phi = CLHEP::twopi*G4UniformRand();
G4double sint= std::sqrt ( 1 - mu*mu );
theParticleChange.SetMomentumChange( sint*std::cos(phi), sint*std::sin(phi), mu );
}
//else if ( random <= ( inelastic + theXSection->GetCoherentCrossSection( dp , (*theElementTable)[ ielement ] , aTemp ) ) / total )
else if ( random <= ( inelastic + theXSection->GetCoherentCrossSection( dp , theElement , theMaterial ) ) / total )
{
// Coherent Elastic
@@ -582,7 +519,6 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
std::vector< G4double > vp_T;
G4int n1 = pvE_p_TL->size();
//G4int n2 = pvE_p_TH->size();
//171005 fix bug, contribution from H.N. TRAN@CEA
for ( G4int i=0 ; i < n1 ; i++ )
@@ -623,7 +559,9 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
//G4cout << "E= " << E/eV << ", Ei= " << Ei << ", mu= " << mu << G4endl;
theParticleChange.SetEnergyChange( E );
theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
G4double phi = CLHEP::twopi*G4UniformRand();
G4double sint= std::sqrt ( 1 - mu*mu );
theParticleChange.SetMomentumChange( sint*std::cos(phi), sint*std::sin(phi), mu );
}
else
@@ -693,7 +631,9 @@ G4HadFinalState* G4ParticleHPThermalScattering::ApplyYourself(const G4HadProject
// Set Final State
theParticleChange.SetEnergyChange( aTrack.GetKineticEnergy() ); // No energy change in Elastic
theParticleChange.SetMomentumChange( 0.0 , std::sqrt ( 1 - mu*mu ) , mu );
G4double phi = CLHEP::twopi*G4UniformRand();
G4double sint= std::sqrt ( 1 - mu*mu );
theParticleChange.SetMomentumChange( sint*std::cos(phi), sint*std::sin(phi), mu );
}
delete dp;
@@ -14,6 +14,15 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
29 January 2021 V.Ivanchenko (hadr-stopping-V10-06-03)
--------------------------------------------------------------------
- G4MuonicAtomDecay - fixed remaining Coverity warning, removed
commented code
05 December 2020 V.Ivanchenko
--------------------------------------------------------------------
- G4MuonicAtomDecay - fixed Coverity warning, removed commented code
01 April 2020 V.Ivanchenko (hadr-stopping-V10-06-02)
--------------------------------------------------------------------
- G4MuonicAtomDecay - fixed Coverity warning
@@ -84,7 +84,6 @@ G4MuonicAtomDecay::G4MuonicAtomDecay(G4HadronicInteraction* hiptr,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4MuonicAtomDecay::~G4MuonicAtomDecay()
//{delete theTotalResult;}
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -176,7 +175,7 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
G4ForceCondition* condition = nullptr; // it is unused in the following call anyway
G4double meanlife = GetMeanLifeTime(aTrack, condition);
G4HadFinalState* result = nullptr; // result before converting to G4VParticleChange*
G4HadFinalState* result = nullptr; // result before converting to G4VParticleChange*
// G4int nSecondaries = 0;
// save track time and start from zero time
// G4double time0 = aTrack.GetGlobalTime(); FillResult does it
@@ -220,7 +219,7 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
G4VDecayChannel* decaychannel = nullptr;
G4double massParent = aParticle->GetMass();
decaychannel = decaytable->SelectADecayChannel(massParent);
if ( decaychannel ==0) {
if (decaychannel == nullptr) {
// decay channel not found
G4ExceptionDescription ed;
ed << "Can not determine decay channel for "
@@ -256,17 +255,18 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
}
#endif
products = decaychannel->DecayIt(aParticle->GetMass());
if(!products) {
if(products == nullptr) {
G4ExceptionDescription ed;
ed << "No products are generated for "
<< aParticleDef->GetParticleName();
G4Exception("G4MuonicAtomDecay::DecayIt","DECAY003",FatalException,ed);
return &theTotalResult;
}
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
decaychannel->SetVerboseLevel(temp);
}
if (GetVerboseLevel()>2 && products) {
if (GetVerboseLevel()>2) {
if (! products->IsChecked() ) products->DumpInfo();
}
#endif
@@ -304,11 +304,11 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
// PostStep case
products->Boost( ParentEnergy, ParentDirection);
}
// G4ParticleChangeForDecay fParticleChangeForDecay; // is it equivalent to G4ParticleChange* theTotalResult;
//add products in theTotalResult
G4int numberOfSecondaries = products->entries();
G4int numberOfSecondaries = (nullptr != products) ? products->entries() : 0;
theTotalResult.SetNumberOfSecondaries(numberOfSecondaries);
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
G4cout << "G4MuonicAtomDecay::DecayIt : Decay vertex :";
@@ -414,7 +414,7 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
FatalException, ed);
}
// Loop checking, 06-Aug-2015, Vladimir Ivanchenko
} while(!result);
} while(result == nullptr);
// add delay time of capture (inter + intra)
G4int nsec = result->GetNumberOfSecondaries();
@@ -432,8 +432,6 @@ G4VParticleChange* G4MuonicAtomDecay::DecayIt(const G4Track& aTrack,
FillResult(result,aTrack);
// delete result;// causes bad free check fixme; move to the class members?
ClearNumberOfInteractionLengthLeft();
return &theTotalResult;
+7 -1
View File
@@ -16,8 +16,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Oct 26th 2020, G. Amadio & J.Apostolakis transport-V10-06-00
Dec 16th 2020, G. Amadio transport-V10-06-01
----------------------------
Limit reporting of number of calls to G4Transportation::AlongStepDoIt()
to when either G4VERBOSE or G4DEBUG_TRANSPORT is defined, which allows to
avoid using a thread local variable for a slight performance gain.
Oct 26th 2020, G. Amadio & J.Apostolakis transport-V10-06-00
----------------------------
A substantial reorganisation of G4Transportation::AlongStepGPIL
to use values already in cache, reduce the number of branches, and
use extra local variables for track properties to avoid indirections.
@@ -492,9 +492,12 @@ G4double G4Transportation::AlongStepGetPhysicalInteractionLength(
G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
const G4Step& stepData )
{
#if defined(G4VERBOSE) || defined(G4DEBUG_TRANSPORT)
static G4ThreadLocal G4long noCallsASDI=0;
const char *methodName= "AlongStepDoIt";
noCallsASDI++;
#else
#define noCallsASDI 0
#endif
fParticleChange.Initialize(track) ;
@@ -591,7 +594,7 @@ G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
if( endEnergy > fThreshold_Warning_Energy && ! fSilenceLooperWarnings )
{
fpLogger->ReportLoopingTrack( track, stepData, fNoLooperTrials,
noCallsASDI, methodName );
noCallsASDI, __func__ );
}
fNoLooperTrials=0;
}
@@ -606,7 +609,7 @@ G4VParticleChange* G4Transportation::AlongStepDoIt( const G4Track& track,
#ifdef G4VERBOSE
if( verboseLevel > 2 && ! fSilenceLooperWarnings )
{
G4cout << " " << methodName
G4cout << " " << __func__
<< " Particle is looping but is saved ..." << G4endl
<< " Number of trials = " << fNoLooperTrials << G4endl
<< " No of calls to = " << noCallsASDI << G4endl;
@@ -129,10 +129,11 @@ void G4TransportationLogger::ReportLoopingTrack( const G4Track & track,
<< G4endl
<< " Number of propagation trials = " << numTrials
<< " ( vs maximum = " << GetThresholdTrials() << " for 'important' particles ) "
<< G4endl
<< " ( Number of *calls* of Transport/AlongStepDoIt = " << noCalls << " )"
<< G4endl;
if (noCalls)
msg << " ( Number of *calls* of Transport/AlongStepDoIt = " << noCalls << " )" << G4endl;
const G4int numPrints= 5;
if( numAdviceExcessSteps++ < numPrints )
{