Import Geant4 10.7.2 source tree

This commit is contained in:
Gabriele Cosmo
2021-06-14 10:01:31 +02:00
parent 3dfcdb544e
commit c968e26a39
271 changed files with 26365 additions and 21942 deletions
@@ -16,6 +16,15 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
28 April 21: V.Ivanchenko (emmuons-V10-06-04)
- G4EnergyLossForExtrapolator, G4TablesForExtrapolator - added
more thread safety for initialisation of the next runs
06 April 21: V.Ivanchenko
- G4EnergyLossForExtrapolator, G4TablesForExtrapolator - allowed
several runs with extrapolator; fixed extrapolation for
hadrons
29 October 20: V.Ivanchenko (emmuons-V10-06-03)
- G4ModifiedMephi - new angular generator for muon/hadron
bremsstrahlung
@@ -72,11 +72,16 @@ public:
~G4EnergyLossForExtrapolator();
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*);
void Initialisation();
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*);
G4double ComputeDEDX(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*);
G4double ComputeEnergy(G4double range, const G4ParticleDefinition*);
G4double ComputeRange(G4double kinEnergy, const G4ParticleDefinition*,
const G4Material*);
G4double ComputeEnergy(G4double range, const G4ParticleDefinition*,
const G4Material*);
G4double EnergyAfterStep(G4double kinEnergy, G4double step,
const G4Material*, const G4ParticleDefinition*);
@@ -95,9 +100,9 @@ public:
const G4Material*,
const G4String& particleName);
inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition* part);
G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition* part);
inline G4double AverageScatteringAngle(G4double kinEnergy, G4double step,
const G4Material*,
@@ -107,9 +112,9 @@ public:
const G4ParticleDefinition* part,
G4double kinEnergy, G4double stepLength);
inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition*);
G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*,
const G4ParticleDefinition*);
inline G4double EnergyDispersion(G4double kinEnergy, G4double step,
const G4Material*,
@@ -122,76 +127,59 @@ public:
inline void SetMaxKinEnergy(G4double);
inline void SetMaxEnergyTransfer(G4double);
// hide assignment operator
G4EnergyLossForExtrapolator & operator=
(const G4EnergyLossForExtrapolator &right) = delete;
G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&) = delete;
private:
void Initialisation();
void BuildTables();
G4bool SetupKinematics(const G4ParticleDefinition*, const G4Material*,
G4double kinEnergy);
const G4ParticleDefinition* FindParticle(const G4String& name);
inline G4double ComputeValue(G4double x, const G4PhysicsTable* table,
size_t idx);
size_t idxMat);
inline const G4PhysicsTable* GetPhysicsTable(ExtTableType type) const;
// hide assignment operator
G4EnergyLossForExtrapolator & operator=(const G4EnergyLossForExtrapolator &right);
G4EnergyLossForExtrapolator(const G4EnergyLossForExtrapolator&);
#ifdef G4MULTITHREADED
static G4Mutex extrapolatorMutex;
static G4Mutex extrMutex;
#endif
static G4TablesForExtrapolator* tables;
const G4ParticleDefinition* currentParticle;
const G4ParticleDefinition* electron;
const G4ParticleDefinition* positron;
const G4ParticleDefinition* muonPlus;
const G4ParticleDefinition* muonMinus;
const G4ParticleDefinition* proton;
const G4ParticleDefinition* currentParticle = nullptr;
const G4ParticleDefinition* electron = nullptr;
const G4ParticleDefinition* positron = nullptr;
const G4ParticleDefinition* muonPlus = nullptr;
const G4ParticleDefinition* muonMinus= nullptr;
const G4ParticleDefinition* proton = nullptr;
const G4Material* currentMaterial = nullptr;
G4double electronDensity = 0.0;
G4double radLength = 0.0;
G4double charge2 = 0.0;
G4double kineticEnergy = 0.0;
G4double gam = 1.0;
G4double bg2 = 0.0;
G4double beta2 = 0.0;
G4double tmax = 0.0;
G4String currentParticleName;
size_t idxDedxElectron;
size_t idxDedxPositron;
size_t idxDedxMuon;
size_t idxDedxProton;
size_t idxRangeElectron;
size_t idxRangePositron;
size_t idxRangeMuon;
size_t idxRangeProton;
size_t idxInvRangeElectron;
size_t idxInvRangePositron;
size_t idxInvRangeMuon;
size_t idxInvRangeProton;
size_t idxMscElectron;
const G4Material* currentMaterial;
G4int index;
G4double linLossLimit = 0.01;
G4double emin = 0.0;
G4double emax = 0.0;
G4double maxEnergyTransfer = 0.0;
G4double electronDensity;
G4double radLength;
G4double mass;
G4double charge2;
G4double kineticEnergy;
G4double gam;
G4double bg2;
G4double beta2;
G4double tmax;
size_t index = 0;
size_t nmat = 0;
G4int nbins = 80;
G4int verbose = 0;
G4double linLossLimit;
G4double emin;
G4double emax;
G4double maxEnergyTransfer;
G4bool isMaster = false;
G4int nbins;
G4int nmat;
G4int verbose;
G4String currentParticleName = "";
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -248,24 +236,6 @@ G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(
G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double theta = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double t = stepLength/radLength;
G4double y = std::max(0.001, t);
theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
/(beta2*gam*mass);
}
return theta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
const G4ParticleDefinition* part,
@@ -276,33 +246,14 @@ G4EnergyLossForExtrapolator::ComputeTrueStep(const G4Material* mat,
return stepLength*std::sqrt(1.0 + 0.625*theta*theta);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double sig2 = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
sig2 = (1.0/beta2 - 0.5)
*CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
}
return sig2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline G4double
G4EnergyLossForExtrapolator::ComputeValue(G4double x,
const G4PhysicsTable* table,
size_t idx)
size_t idxMat)
{
G4double res = 0.0;
if(table) { res = ((*table)[index])->Value(x, idx); }
return res;
return (nullptr != table) ? ((*table)[idxMat])->Value(x, index) : 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -83,6 +83,11 @@ public:
void Initialisation();
// hide assignment operator
G4TablesForExtrapolator & operator=
(const G4TablesForExtrapolator &right) = delete;
G4TablesForExtrapolator(const G4TablesForExtrapolator&) = delete;
private:
G4PhysicsTable* PrepareTable(G4PhysicsTable*);
@@ -99,47 +104,43 @@ private:
void ComputeTrasportXS(const G4ParticleDefinition* part,
G4PhysicsTable* table);
// hide assignment operator
G4TablesForExtrapolator & operator=(const G4TablesForExtrapolator &right);
G4TablesForExtrapolator(const G4TablesForExtrapolator&);
std::vector<const G4MaterialCutsCouple*> couples;
G4DataVector cuts;
const G4ParticleDefinition* currentParticle;
const G4ParticleDefinition* electron;
const G4ParticleDefinition* positron;
const G4ParticleDefinition* muonPlus;
const G4ParticleDefinition* muonMinus;
const G4ParticleDefinition* proton;
const G4ParticleDefinition* currentParticle = nullptr;
G4DataVector cuts;
G4LossTableBuilder* builder = nullptr;
G4ProductionCuts* pcuts = nullptr;
G4LossTableBuilder* builder;
G4ProductionCuts* pcuts;
std::vector<const G4MaterialCutsCouple*> couples;
G4PhysicsTable* dedxElectron;
G4PhysicsTable* dedxPositron;
G4PhysicsTable* dedxMuon;
G4PhysicsTable* dedxProton;
G4PhysicsTable* rangeElectron;
G4PhysicsTable* rangePositron;
G4PhysicsTable* rangeMuon;
G4PhysicsTable* rangeProton;
G4PhysicsTable* invRangeElectron;
G4PhysicsTable* invRangePositron;
G4PhysicsTable* invRangeMuon;
G4PhysicsTable* invRangeProton;
G4PhysicsTable* mscElectron;
G4int verbose;
G4int nbins;
G4int nmat;
G4PhysicsTable* dedxElectron = nullptr;
G4PhysicsTable* dedxPositron = nullptr;
G4PhysicsTable* dedxMuon = nullptr;
G4PhysicsTable* dedxProton = nullptr;
G4PhysicsTable* rangeElectron = nullptr;
G4PhysicsTable* rangePositron = nullptr;
G4PhysicsTable* rangeMuon = nullptr;
G4PhysicsTable* rangeProton = nullptr;
G4PhysicsTable* invRangeElectron = nullptr;
G4PhysicsTable* invRangePositron = nullptr;
G4PhysicsTable* invRangeMuon = nullptr;
G4PhysicsTable* invRangeProton = nullptr;
G4PhysicsTable* mscElectron = nullptr;
G4double emin;
G4double emax;
G4double mass;
G4double charge2;
G4double mass = 0.0;
G4double charge2 = 0.0;
G4bool splineFlag;
G4int verbose;
G4int nbins;
G4int nmat = 0;
G4bool splineFlag = false;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -62,7 +62,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4MULTITHREADED
G4Mutex G4EnergyLossForExtrapolator::extrapolatorMutex = G4MUTEX_INITIALIZER;
G4Mutex G4EnergyLossForExtrapolator::extrMutex = G4MUTEX_INITIALIZER;
#endif
G4TablesForExtrapolator* G4EnergyLossForExtrapolator::tables = nullptr;
@@ -70,43 +70,17 @@ G4TablesForExtrapolator* G4EnergyLossForExtrapolator::tables = nullptr;
G4EnergyLossForExtrapolator::G4EnergyLossForExtrapolator(G4int verb)
: maxEnergyTransfer(DBL_MAX), verbose(verb)
{
currentParticle = nullptr;
currentMaterial = nullptr;
linLossLimit = 0.01;
emin = 1.*MeV;
emax = 10.*TeV;
nbins = 70;
nmat = index = 0;
mass = charge2 = electronDensity = radLength = bg2 = beta2
= kineticEnergy = tmax = 0.0;
gam = 1.0;
idxDedxElectron = idxDedxPositron = idxDedxMuon = idxDedxProton
= idxRangeElectron = idxRangePositron = idxRangeMuon = idxRangeProton
= idxInvRangeElectron = idxInvRangePositron = idxInvRangeMuon
= idxInvRangeProton = idxMscElectron = 0;
electron = positron = proton = muonPlus = muonMinus = nullptr;
emin = 1.*CLHEP::MeV;
emax = 100.*CLHEP::TeV;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4EnergyLossForExtrapolator::~G4EnergyLossForExtrapolator()
{
if(tables) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&extrapolatorMutex);
if (tables) {
#endif
delete tables;
tables = nullptr;
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&extrapolatorMutex);
#endif
if(isMaster) {
delete tables;
tables = nullptr;
}
}
@@ -118,18 +92,17 @@ G4EnergyLossForExtrapolator::EnergyAfterStep(G4double kinEnergy,
const G4Material* mat,
const G4ParticleDefinition* part)
{
if(0 == nmat) { Initialisation(); }
G4double kinEnergyFinal = kinEnergy;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
G4double r = ComputeRange(kinEnergy,part);
G4double r = ComputeRange(kinEnergy,part,mat);
if(r <= step) {
kinEnergyFinal = 0.0;
} else if(step < linLossLimit*r) {
kinEnergyFinal -= step*ComputeDEDX(kinEnergy,part);
kinEnergyFinal -= step*ComputeDEDX(kinEnergy,part,mat);
} else {
G4double r1 = r - step;
kinEnergyFinal = ComputeEnergy(r1,part);
kinEnergyFinal = ComputeEnergy(r1,part,mat);
}
}
return kinEnergyFinal;
@@ -143,19 +116,18 @@ G4EnergyLossForExtrapolator::EnergyBeforeStep(G4double kinEnergy,
const G4Material* mat,
const G4ParticleDefinition* part)
{
//G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
if(0 == nmat) { Initialisation(); }
// G4cout << "G4EnergyLossForExtrapolator::EnergyBeforeStep" << G4endl;
G4double kinEnergyFinal = kinEnergy;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = TrueStepLength(kinEnergy,stepLength,mat,part);
G4double r = ComputeRange(kinEnergy,part);
G4double r = ComputeRange(kinEnergy,part,mat);
if(step < linLossLimit*r) {
kinEnergyFinal += step*ComputeDEDX(kinEnergy,part);
kinEnergyFinal += step*ComputeDEDX(kinEnergy,part,mat);
} else {
G4double r1 = r + step;
kinEnergyFinal = ComputeEnergy(r1,part);
kinEnergyFinal = ComputeEnergy(r1,part,mat);
}
}
return kinEnergyFinal;
@@ -170,17 +142,16 @@ G4EnergyLossForExtrapolator::TrueStepLength(G4double kinEnergy,
const G4ParticleDefinition* part)
{
G4double res = stepLength;
if(0 == nmat) { Initialisation(); }
//G4cout << "## G4EnergyLossForExtrapolator::TrueStepLength L= " << res
// << " " << part->GetParticleName() << G4endl;
if(SetupKinematics(part, mat, kinEnergy)) {
if(part == electron || part == positron) {
G4double x = stepLength*
ComputeValue(kinEnergy, GetPhysicsTable(fMscElectron), idxMscElectron);
const G4double x = stepLength*
ComputeValue(kinEnergy, GetPhysicsTable(fMscElectron), mat->GetIndex());
//G4cout << " x= " << x << G4endl;
if(x < 0.2) { res *= (1.0 + 0.5*x + x*x/3.0); }
else if(x < 0.9999) { res = -G4Log(1.0 - x)*stepLength/x; }
else { res = ComputeRange(kinEnergy,part); }
else { res = ComputeRange(kinEnergy, part, mat); }
} else {
res = ComputeTrueStep(mat,part,kinEnergy,stepLength);
}
@@ -195,31 +166,29 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
const G4Material* mat,
G4double kinEnergy)
{
if(0 == nmat) { Initialisation(); }
if(!part || !mat || kinEnergy < keV) { return false; }
G4bool flag = false;
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
if(nullptr == part || nullptr == mat || kinEnergy < CLHEP::keV)
{ return false; }
if(part != currentParticle) {
flag = true;
currentParticle = part;
mass = part->GetPDGMass();
G4double q = part->GetPDGCharge()/eplus;
charge2 = q*q;
}
if(mat != currentMaterial) {
G4int i = mat->GetIndex();
size_t i = mat->GetIndex();
if(i >= nmat) {
G4cout << "### G4EnergyLossForExtrapolator WARNING:index i= "
<< i << " is out of table - NO extrapolation" << G4endl;
G4cout << "### G4EnergyLossForExtrapolator WARNING: material index i= "
<< i << " above number of materials " << nmat << G4endl;
return false;
} else {
flag = true;
currentMaterial = mat;
electronDensity = mat->GetElectronDensity();
radLength = mat->GetRadlen();
index = i;
}
}
if(flag || kinEnergy != kineticEnergy) {
if(kinEnergy != kineticEnergy) {
kineticEnergy = kinEnergy;
G4double mass = part->GetPDGMass();
G4double tau = kinEnergy/mass;
gam = tau + 1.0;
@@ -228,10 +197,10 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
tmax = kinEnergy;
if(part == electron) tmax *= 0.5;
else if(part != positron) {
G4double r = electron_mass_c2/mass;
tmax = 2.0*bg2*electron_mass_c2/(1.0 + 2.0*gam*r + r*r);
G4double r = CLHEP::electron_mass_c2/mass;
tmax = 2.0*bg2*CLHEP::electron_mass_c2/(1.0 + 2.0*gam*r + r*r);
}
if(tmax > maxEnergyTransfer) { tmax = maxEnergyTransfer; }
tmax = std::min(tmax, maxEnergyTransfer);
}
return true;
}
@@ -241,36 +210,38 @@ G4EnergyLossForExtrapolator::SetupKinematics(const G4ParticleDefinition* part,
const G4ParticleDefinition*
G4EnergyLossForExtrapolator::FindParticle(const G4String& name)
{
const G4ParticleDefinition* p = nullptr;
if(name != currentParticleName) {
p = G4ParticleTable::GetParticleTable()->FindParticle(name);
if(!p) {
currentParticle = G4ParticleTable::GetParticleTable()->FindParticle(name);
currentParticleName = name;
if(nullptr == currentParticle) {
G4cout << "### G4EnergyLossForExtrapolator WARNING: "
<< "FindParticle() fails to find "
<< name << G4endl;
currentParticleName = "";
}
} else {
p = currentParticle;
}
return p;
return currentParticle;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4EnergyLossForExtrapolator::ComputeDEDX(G4double ekin,
const G4ParticleDefinition* part)
const G4ParticleDefinition* part,
const G4Material* mat)
{
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
G4double x = 0.0;
if(part == electron) {
x = ComputeValue(ekin, GetPhysicsTable(fDedxElectron), idxDedxElectron);
x = ComputeValue(ekin, GetPhysicsTable(fDedxElectron), mat->GetIndex());
} else if(part == positron) {
x = ComputeValue(ekin, GetPhysicsTable(fDedxPositron), idxDedxPositron);
x = ComputeValue(ekin, GetPhysicsTable(fDedxPositron), mat->GetIndex());
} else if(part == muonPlus || part == muonMinus) {
x = ComputeValue(ekin, GetPhysicsTable(fDedxMuon), idxDedxMuon);
x = ComputeValue(ekin, GetPhysicsTable(fDedxMuon), mat->GetIndex());
} else {
G4double e = ekin*proton_mass_c2/mass;
x = ComputeValue(e, GetPhysicsTable(fDedxProton), idxDedxProton)*charge2;
G4double e = ekin*CLHEP::proton_mass_c2/part->GetPDGMass();
G4double q = part->GetPDGCharge()/CLHEP::eplus;
x = ComputeValue(e, GetPhysicsTable(fDedxProton), mat->GetIndex())*q*q;
}
return x;
}
@@ -279,20 +250,23 @@ G4EnergyLossForExtrapolator::ComputeDEDX(G4double ekin,
G4double
G4EnergyLossForExtrapolator::ComputeRange(G4double ekin,
const G4ParticleDefinition* part)
const G4ParticleDefinition* part,
const G4Material* mat)
{
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
G4double x = 0.0;
if(part == electron) {
x = ComputeValue(ekin, GetPhysicsTable(fRangeElectron), idxRangeElectron);
x = ComputeValue(ekin, GetPhysicsTable(fRangeElectron), mat->GetIndex());
} else if(part == positron) {
x = ComputeValue(ekin, GetPhysicsTable(fRangePositron), idxRangePositron);
x = ComputeValue(ekin, GetPhysicsTable(fRangePositron), mat->GetIndex());
} else if(part == muonPlus || part == muonMinus) {
x = ComputeValue(ekin, GetPhysicsTable(fRangeMuon), idxRangeMuon);
x = ComputeValue(ekin, GetPhysicsTable(fRangeMuon), mat->GetIndex());
} else {
G4double massratio = proton_mass_c2/mass;
G4double massratio = CLHEP::proton_mass_c2/part->GetPDGMass();
G4double e = ekin*massratio;
x = ComputeValue(e, GetPhysicsTable(fRangeProton), idxRangeProton)
/(charge2*massratio);
G4double q = part->GetPDGCharge()/CLHEP::eplus;
x = ComputeValue(e, GetPhysicsTable(fRangeProton), mat->GetIndex())
/(q*q*massratio);
}
return x;
}
@@ -301,71 +275,107 @@ G4EnergyLossForExtrapolator::ComputeRange(G4double ekin,
G4double
G4EnergyLossForExtrapolator::ComputeEnergy(G4double range,
const G4ParticleDefinition* part)
const G4ParticleDefinition* part,
const G4Material* mat)
{
if(mat->GetNumberOfMaterials() != nmat) { Initialisation(); }
G4double x = 0.0;
if(part == electron) {
x = ComputeValue(range, GetPhysicsTable(fInvRangeElectron),
idxInvRangeElectron);
x = ComputeValue(range,GetPhysicsTable(fInvRangeElectron),mat->GetIndex());
} else if(part == positron) {
x = ComputeValue(range, GetPhysicsTable(fInvRangePositron),
idxInvRangePositron);
x = ComputeValue(range,GetPhysicsTable(fInvRangePositron),mat->GetIndex());
} else if(part == muonPlus || part == muonMinus) {
x = ComputeValue(range, GetPhysicsTable(fInvRangeMuon), idxInvRangeMuon);
x = ComputeValue(range, GetPhysicsTable(fInvRangeMuon), mat->GetIndex());
} else {
G4double massratio = proton_mass_c2/mass;
G4double r = range*massratio*charge2;
x = ComputeValue(r, GetPhysicsTable(fInvRangeProton),
idxInvRangeProton)/massratio;
G4double massratio = CLHEP::proton_mass_c2/part->GetPDGMass();
G4double q = part->GetPDGCharge()/CLHEP::eplus;
G4double r = range*massratio*q*q;
x = ComputeValue(r, GetPhysicsTable(fInvRangeProton), mat->GetIndex())/massratio;
}
return x;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double
G4EnergyLossForExtrapolator::EnergyDispersion(G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double sig2 = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double step = ComputeTrueStep(mat,part,kinEnergy,stepLength);
sig2 = (1.0/beta2 - 0.5)
*CLHEP::twopi_mc2_rcl2*tmax*step*electronDensity*charge2;
}
return sig2;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4EnergyLossForExtrapolator::AverageScatteringAngle(
G4double kinEnergy,
G4double stepLength,
const G4Material* mat,
const G4ParticleDefinition* part)
{
G4double theta = 0.0;
if(SetupKinematics(part, mat, kinEnergy)) {
G4double t = stepLength/radLength;
G4double y = std::max(0.001, t);
theta = 19.23*CLHEP::MeV*std::sqrt(charge2*t)*(1.0 + 0.038*G4Log(y))
/(beta2*gam*part->GetPDGMass());
}
return theta;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::Initialisation()
{
if(verbose>1) {
if(verbose>0) {
G4cout << "### G4EnergyLossForExtrapolator::Initialisation" << G4endl;
}
currentParticle = nullptr;
currentMaterial = nullptr;
kineticEnergy = 0.0;
electron = G4Electron::Electron();
positron = G4Positron::Positron();
proton = G4Proton::Proton();
muonPlus = G4MuonPlus::MuonPlus();
muonMinus= G4MuonMinus::MuonMinus();
currentParticleName = "";
BuildTables();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EnergyLossForExtrapolator::BuildTables()
{
// initialisation for the 1st run
if(nullptr == tables) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&extrapolatorMutex);
G4MUTEXLOCK(&extrMutex);
if(nullptr == tables) {
#endif
isMaster = true;
tables = new G4TablesForExtrapolator(verbose, nbins, emin, emax);
tables->Initialisation();
nmat = G4Material::GetNumberOfMaterials();
if(verbose > 0) {
G4cout << "### G4EnergyLossForExtrapolator::BuildTables for "
<< nmat << " materials Nbins= "
<< nbins << " Emin(MeV)= " << emin << " Emax(MeV)= " << emax
<< G4endl;
}
#ifdef G4MULTITHREADED
}
G4MUTEXUNLOCK(&extrMutex);
#endif
}
// initialisation for the next run
if(isMaster && G4Material::GetNumberOfMaterials() != nmat) {
#ifdef G4MULTITHREADED
G4MUTEXLOCK(&extrMutex);
#endif
if(verbose > 0) {
G4cout << "### G4EnergyLossForExtrapolator::BuildTables for "
<< G4Material::GetNumberOfMaterials() << " materials Nbins= "
<< nbins << " Emin(MeV)= " << emin << " Emax(MeV)= " << emax
<< G4endl;
}
G4int newmat = G4Material::GetNumberOfMaterials();
if(!tables) {
tables = new G4TablesForExtrapolator(verbose, nbins, emin, emax);
} else if(nmat != newmat) {
tables->Initialisation();
}
nmat = newmat;
#ifdef G4MULTITHREADED
G4MUTEXUNLOCK(&extrapolatorMutex);
G4MUTEXUNLOCK(&extrMutex);
#endif
}
nmat = G4Material::GetNumberOfMaterials();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -48,6 +48,7 @@
#include "G4TablesForExtrapolator.hh"
#include "G4PhysicalConstants.hh"
#include "G4SystemOfUnits.hh"
#include "G4LossTableManager.hh"
#include "G4PhysicsLogVector.hh"
#include "G4ParticleDefinition.hh"
#include "G4Material.hh"
@@ -66,60 +67,78 @@
#include "G4ProductionCuts.hh"
#include "G4LossTableBuilder.hh"
#include "G4WentzelVIModel.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4TablesForExtrapolator::G4TablesForExtrapolator(G4int verb, G4int bins,
G4double e1, G4double e2)
: builder(nullptr), verbose(verb), nbins(bins), nmat(0), emin(e1), emax(e2)
: emin(e1), emax(e2), verbose(verb), nbins(bins)
{
electron = G4Electron::Electron();
positron = G4Positron::Positron();
proton = G4Proton::Proton();
muonPlus = G4MuonPlus::MuonPlus();
muonMinus= G4MuonMinus::MuonMinus();
dedxElectron = dedxPositron = dedxProton = dedxMuon = rangeElectron =
rangePositron = rangeProton = rangeMuon = invRangeElectron =
invRangePositron = invRangeProton = invRangeMuon = mscElectron = nullptr;
pcuts = nullptr;
Initialisation();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4TablesForExtrapolator::~G4TablesForExtrapolator()
{
for(G4int i=0; i<nmat; i++) { delete couples[i]; }
dedxElectron->clearAndDestroy();
dedxPositron->clearAndDestroy();
dedxProton->clearAndDestroy();
dedxMuon->clearAndDestroy();
rangeElectron->clearAndDestroy();
rangePositron->clearAndDestroy();
rangeProton->clearAndDestroy();
rangeMuon->clearAndDestroy();
invRangeElectron->clearAndDestroy();
invRangePositron->clearAndDestroy();
invRangeProton->clearAndDestroy();
invRangeMuon->clearAndDestroy();
mscElectron->clearAndDestroy();
delete dedxElectron;
delete dedxPositron;
delete dedxProton;
delete dedxMuon;
delete rangeElectron;
delete rangePositron;
delete rangeProton;
delete rangeMuon;
delete invRangeElectron;
delete invRangePositron;
delete invRangeProton;
delete invRangeMuon;
delete mscElectron;
if(nullptr != dedxElectron) {
dedxElectron->clearAndDestroy();
delete dedxElectron;
}
if(nullptr != dedxPositron) {
dedxPositron->clearAndDestroy();
delete dedxPositron;
}
if(nullptr != dedxProton) {
dedxProton->clearAndDestroy();
delete dedxProton;
}
if(nullptr != dedxMuon) {
dedxMuon->clearAndDestroy();
delete dedxMuon;
}
if(nullptr != rangeElectron) {
rangeElectron->clearAndDestroy();
delete rangeElectron;
}
if(nullptr != rangePositron) {
rangePositron->clearAndDestroy();
delete rangePositron;
}
if(nullptr != rangeProton) {
rangeProton->clearAndDestroy();
delete rangeProton;
}
if(nullptr != rangeMuon) {
rangeMuon->clearAndDestroy();
delete rangeMuon;
}
if(nullptr != invRangeElectron) {
invRangeElectron->clearAndDestroy();
delete invRangeElectron;
}
if(nullptr != invRangePositron) {
invRangePositron->clearAndDestroy();
delete invRangePositron;
}
if(nullptr != invRangeProton) {
invRangeProton->clearAndDestroy();
delete invRangeProton;
}
if(nullptr != invRangeMuon) {
invRangeMuon->clearAndDestroy();
delete invRangeMuon;
}
if(nullptr != mscElectron) {
mscElectron->clearAndDestroy();
delete mscElectron;
}
delete pcuts;
delete builder;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -179,24 +198,18 @@ void G4TablesForExtrapolator::Initialisation()
if(verbose>1) {
G4cout << "### G4TablesForExtrapolator::Initialisation" << G4endl;
}
currentParticle = nullptr;
mass = charge2 = 0.0;
G4int num = G4Material::GetNumberOfMaterials();
if(nmat == num) { return; }
nmat = G4Material::GetNumberOfMaterials();
cuts.resize(nmat, DBL_MAX);
couples.resize(nmat, nullptr);
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
if(!pcuts) { pcuts = new G4ProductionCuts(); }
G4int i0 = couples.size();
if(0 == i0) {
couples.reserve(nmat);
cuts.reserve(nmat);
for(G4int i=0; i<nmat; ++i) {
couples[i] = new G4MaterialCutsCouple((*mtable)[i],pcuts);
}
for(G4int i=i0; i<nmat; ++i) {
couples.push_back(new G4MaterialCutsCouple((*mtable)[i],pcuts));
cuts.push_back(DBL_MAX);
}
splineFlag = G4EmParameters::Instance()->Spline();
dedxElectron = PrepareTable(dedxElectron);
dedxPositron = PrepareTable(dedxPositron);
@@ -212,7 +225,7 @@ void G4TablesForExtrapolator::Initialisation()
invRangeProton = PrepareTable(invRangeProton);
mscElectron = PrepareTable(mscElectron);
if(!builder) { builder = new G4LossTableBuilder(); }
builder = G4LossTableManager::Instance()->GetTableBuilder();
builder->InitialiseBaseMaterials();
if(verbose>1) {
@@ -260,15 +273,10 @@ void G4TablesForExtrapolator::Initialisation()
G4PhysicsTable* G4TablesForExtrapolator::PrepareTable(G4PhysicsTable* ptr)
{
G4PhysicsTable* table;
G4int i0 = 0;
if(ptr) {
table = ptr;
i0 = ptr->size();
} else {
table = new G4PhysicsTable();
}
for(G4int i=i0; i<nmat; ++i) {
G4PhysicsTable* table = ptr;
if(nullptr == ptr) { table = new G4PhysicsTable(); }
G4int n = table->length();
for(G4int i=n; i<nmat; ++i) {
G4PhysicsVector* v = new G4PhysicsLogVector(emin, emax, nbins);
v->SetSpline(splineFlag);
table->push_back(v);
@@ -305,14 +313,13 @@ void G4TablesForExtrapolator::ComputeElectronDEDX(
if(1<verbose) {
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
}
const G4MaterialCutsCouple* couple = couples[i];
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e)
+ brem->ComputeDEDX(couple,part,e,e);
G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e)
+ brem->ComputeDEDXPerVolume(mat,part,e,e);
if(1<verbose) {
G4cout << "j= " << j
<< " e(MeV)= " << e/MeV
@@ -363,14 +370,13 @@ G4TablesForExtrapolator::ComputeMuonDEDX(const G4ParticleDefinition* part,
if(1<verbose) {
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
}
const G4MaterialCutsCouple* couple = couples[i];
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; j++) {
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e) +
pair->ComputeDEDX(couple,part,e,e) +
brem->ComputeDEDX(couple,part,e,e);
G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e) +
pair->ComputeDEDXPerVolume(mat,part,e,e) +
brem->ComputeDEDXPerVolume(mat,part,e,e);
aVector->PutValue(j,dedx);
if(1<verbose) {
G4cout << "j= " << j
@@ -413,12 +419,11 @@ G4TablesForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part,
const G4Material* mat = (*mtable)[i];
if(1<verbose)
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
const G4MaterialCutsCouple* couple = couples[i];
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; j++) {
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double dedx = ioni->ComputeDEDX(couple,part,e,e);
G4double dedx = ioni->ComputeDEDXPerVolume(mat,part,e,e);
aVector->PutValue(j,dedx);
if(1<verbose) {
G4cout << "j= " << j
@@ -437,7 +442,7 @@ G4TablesForExtrapolator::ComputeProtonDEDX(const G4ParticleDefinition* part,
void
G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
G4PhysicsTable* table)
G4PhysicsTable* table)
{
G4WentzelVIModel* msc = new G4WentzelVIModel();
msc->SetPolarAngleLimit(CLHEP::pi);
@@ -451,7 +456,7 @@ G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
if(0<verbose) {
G4cout << "G4TablesForExtrapolator::ComputeProtonDEDX for "
G4cout << "G4TablesForExtrapolator::ComputeTransportXS for "
<< part->GetParticleName()
<< G4endl;
}
@@ -463,7 +468,7 @@ G4TablesForExtrapolator::ComputeTrasportXS(const G4ParticleDefinition* part,
if(1<verbose)
G4cout << "i= " << i << " mat= " << mat->GetName() << G4endl;
G4PhysicsVector* aVector = (*table)[i];
for(G4int j=0; j<=nbins; j++) {
for(G4int j=0; j<=nbins; ++j) {
G4double e = aVector->Energy(j);
G4double xs = msc->CrossSectionPerVolume(mat,part,e);
@@ -16,6 +16,12 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06 May 21: G.Cosmo (emutils-V10-06-18)
- Fixed shadowing compilation warning in G4EmCorrections reported with gcc-11.
14 April 21: V.Ivanchenko (emutils-V10-06-17)
- G4EmParameters - fix problem #2350 (correct line break)
30 January 21: V.Ivanchenko (emutils-V10-06-16)
- G4VEnergyLossProcess, G4VEmProcess, - improved printout
G4EmExtraParameters, G4EmExtraParametersMessenger - fixed #2292
@@ -154,8 +154,8 @@ public:
G4double kineticEnergy);
// ionisation models for ions
inline void SetIonisationModels(G4VEmModel* m1 = nullptr,
G4VEmModel* m2 = nullptr);
inline void SetIonisationModels(G4VEmModel* mod1 = nullptr,
G4VEmModel* mod2 = nullptr);
inline G4int GetNumberOfStoppingVectors() const;
@@ -1392,7 +1392,7 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
<< fCParameters->DNAElectronMsc() << "\n";
os << "Use DNA e- solvation model type "
<< fCParameters->DNAeSolvationSubType() << "\n";
os << "=======================================================================" << "\n";
os << "=======================================================================" << G4endl;
}
os.precision(prec);
}
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
26 May 21: D. Sawkey (xrays-V10-06-09)
- G4Scintillation: change IsApplicable to all particles except opticalphoton
and short-lived. Address bug 2372.
5 October 20: D. Sawkey (xrays-V10-06-08)
- G4Cerenkov, G4Scintillation: apply clang-format style guidelines
@@ -123,9 +123,11 @@ G4Scintillation::~G4Scintillation()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool G4Scintillation::IsApplicable(const G4ParticleDefinition& aParticleType)
{
return (aParticleType.GetPDGCharge() == 0.0 || aParticleType.IsShortLived())
? false
: true;
if (aParticleType.GetParticleName() == "opticalphoton")
return false;
if (aParticleType.IsShortLived())
return false;
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -14,6 +14,20 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
15 April 2021 Vladimir Ivanchenko (hadr-deex-V10-06-08)
- G4DeexPrecoParameters - fixed problem #2350
07 March 2021 Vladimir Ivanchenko
- G4PolarizationTransition - J.Detwiler fixed sampling of angular
correlations (problem #2344)
18 February 2021 Alberto Ribon
- G4DeexPrecoParameters - changed half-life time threshold for isomer
production from 1 microsecond to 1 nanosecond.
The goal is to avoid unphysical missing energy cases as reported by
NA61/SHINE Collaboration. According to our CPU benchmarks, the
overhead due to this change is below the ~ 1% level.
12 August 2020 Vladimir Ivanchenko (hadr-deex-V10-06-07)
- G4NuclearLevelData - use Zmax for initialisation before the run
@@ -68,7 +68,7 @@ void G4DeexPrecoParameters::SetDefaults()
fPrecoHighEnergy = 30*CLHEP::MeV;
fPhenoFactor = 1.0;
fMinExcitation = 10*CLHEP::eV;
fMaxLifeTime = 1*CLHEP::microsecond;
fMaxLifeTime = 1*CLHEP::nanosecond;
fMinExPerNucleounForMF = 200*CLHEP::GeV;
fMinZForPreco = 3;
fMinAForPreco = 5;
@@ -330,7 +330,7 @@ std::ostream& G4DeexPrecoParameters::StreamInfo(std::ostream& os) const
<< fInternalConversionID << "\n";
os << "Correlated gamma emission flag " << fCorrelatedGamma << "\n";
os << "Max 2J for sampling of angular correlations " << fTwoJMAX << "\n";
os << "=======================================================================" << "\n";
os << "=======================================================================" << G4endl;
os.precision(prec);
return os;
}
@@ -253,24 +253,24 @@ void G4PolarizationTransition::SampleGammaTransition(
G4cout << *nucpol << G4endl;
}
const POLAR& pol = nucpol->GetPolarization();
if(fTwoJ1 == 0) {
nucpol->Unpolarize();
cosTheta = 2*G4UniformRand() - 1.0;
phi = CLHEP::twopi*G4UniformRand();
return;
}
const POLAR& pol = nucpol->GetPolarization();
cosTheta = GenerateGammaCosTheta(pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: cosTheta= "
<< cosTheta << G4endl;
}
phi = GenerateGammaPhi(cosTheta, pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: phi= "
<< phi << G4endl;
else {
cosTheta = GenerateGammaCosTheta(pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: cosTheta= "
<< cosTheta << G4endl;
}
phi = GenerateGammaPhi(cosTheta, pol);
if(fVerbose > 2) {
G4cout << "G4PolarizationTransition::SampleGammaTransition: phi= "
<< phi << G4endl;
}
}
if(fTwoJ2 == 0) {
@@ -14,6 +14,14 @@ code and to keep track of all tags.
* Please list in reverse chronological order (last date on top)
---------------------------------------------------------------
23 May 2021 Dennis Wright (hadr-hpp-V10-06-14)
----------------------------------------------
- G4ParticleHPInelasticCompFS:::CompositeApply():
in two places, replace line
if (eExcitation < 20*CLHEP::keV) {eExcitation=0;}
with eExcitation = std::max(0.,QI[0] - QI[it])
in order to implement fix of bug #2333
05 January 2021 Vladimir Ivanchenko (hadr-hpp-V10-06-13)
--------------------------------------------------------
- G4ParticleHPThermalScattering - add final state phi-rotation;
@@ -404,14 +404,16 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
//Use QI value for calculating excitation energy of residual.
G4bool useQI=false;
G4double dqi = QI[it];
if ( dqi < 0 || 849 < dqi ) useQI = true; //Former libraies does not have values of this range
if (dqi < 0 || 849 < dqi) useQI = true; // Former libraries do not have values in this range
if (useQI) {
// QI introudced since G4NDL3.15
// G4double QM=(incidReactionProduct.GetMass()+targetMass)-(aHadron.GetMass()+residualMass);
// eExcitation = QM-QI[it];
eExcitation = QI[0] - QI[it]; // Bug fix #1838
if(eExcitation < 20*CLHEP::keV) eExcitation = 0;
// eExcitation = QI[0] - QI[it]; // Bug fix #1838
// if(eExcitation < 20*CLHEP::keV) eExcitation = 0;
eExcitation = std::max(0.,QI[0] - QI[it]); // Bug fix 2333
// Re-evluate iLevel based on this eExcitation
iLevel = 0;
@@ -592,14 +594,17 @@ void G4ParticleHPInelasticCompFS::CompositeApply(const G4HadProjectile& theTrack
}
}
//G4cout << "nothingWasKnownOnHadron " << nothingWasKnownOnHadron << G4endl;
if(nothingWasKnownOnHadron)
if (nothingWasKnownOnHadron)
{
// In this case, hadron should be isotropic in CM
// Next 12 lines are Emilio's replacement
// G4double QM=(incidReactionProduct.GetMass()+targetMass)-(aHadron.GetMass()+residualMass);
// G4double eExcitation = QM-QI[it];
G4double eExcitation = QI[0] - QI[it]; // Fix of bug #1838
if(eExcitation<20*CLHEP::keV){eExcitation=0;}
// G4double eExcitation = QI[0] - QI[it]; // Fix of bug #1838
// if(eExcitation<20*CLHEP::keV){eExcitation=0;}
G4double eExcitation = std::max(0.,QI[0] - QI[it]); // Fix of bug #2333
two_body_reaction(&incidReactionProduct,&theTarget,&aHadron,eExcitation);
if(thePhotons==0 && eExcitation>0){
for(iLevel=theGammas.GetNumberOfLevels()-1; iLevel>=0; iLevel--)
@@ -14,6 +14,22 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
15 April 2021 Vladimir Ivanchenko radioactive_decay-V10-06-11
---------------------------------------------------------------
- G4RadioactiveDecayBase - fix #2350
16 February 2021 Alberto Ribon radioactive_decay-V10-06-10
------------------------------------------------------------
- G4RadioactiveDecayBase : set the weight of secondaries tracks to the
mother's weight value in the method G4RadioactiveDecayBase::DecayAnalog.
Thanks to Michael Dressel (Desy) for spotting this.
This bug, present since a long time, affects only simulations that
use Radioactive Decay in analogue mode with "external" biasing
(e.g. generic biasing, GPS generator with weights, etc.).
For completeness (but useless because this deprecated class will be
removed in Geant4 11), the corresponding fix was done also in the
class G4RadioactiveDecay in the method DecayIt.
05 August 2020 Alberto Ribon radioactive_decay-V10-06-09
----------------------------------------------------------
- G4RadioactiveDecayBaseMessenger, G4RadioactiveDecaymessenger,
@@ -1809,7 +1809,7 @@ G4RadioactiveDecay::DecayIt(const G4Track& theTrack, const G4Step&)
for (index=0; index < numberOfSecondaries; index++) {
G4Track* secondary = new G4Track(products->PopProducts(),
finalGlobalTime, currentPosition);
secondary->SetWeight(theTrack.GetWeight());
secondary->SetCreatorModelIndex(theRadDecayMode);
//Change for atomics relaxation
if (theRadDecayMode == IT && index>0){
@@ -495,7 +495,7 @@ G4RadioactiveDecayBase::StreamInfo(std::ostream& os, const G4String& endline)
os << "Use Bearden atomic level energies "
<< emparam->BeardenFluoDir() << endline;
os << "======================================================================"
<< endline;
<< G4endl;
os.precision(prec);
}
@@ -1151,6 +1151,7 @@ void G4RadioactiveDecayBase::DecayAnalog(const G4Track& theTrack)
for (G4int index = 0; index < numberOfSecondaries; index++) {
G4Track* secondary = new G4Track(products->PopProducts(), finalGlobalTime,
theTrack.GetPosition() );
secondary->SetWeight(theTrack.GetWeight());
secondary->SetCreatorModelIndex(theRadDecayMode);
//Change for atomics relaxation
if (theRadDecayMode == IT && index>0){
+4
View File
@@ -16,6 +16,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
- Apr. 26, 2021 Alberto Ribon (procman-V10-06-04)
- G4ProcessTable : added missing checks against null elements.
(Thanks to Ivana Hrivnacova for reporting it.)
- Jun. 4, 2020 Gabriele Cosmo (procman-V10-06-03)
- Fixed Coverity warning for uninitialised data in G4VProcess.
@@ -386,7 +386,7 @@ G4ProcessTable::Find(const G4String& processName)
{
anElement = (*itr);
// check name
if ( anElement->GetProcessName() == processName )
if ( anElement != nullptr && anElement->GetProcessName() == processName )
{
isFound = true;
tmpTblVector->push_back(anElement);
@@ -417,7 +417,7 @@ G4ProcessTable::Find(G4ProcessType processType)
{
anElement = (*itr);
// check name
if ( anElement->GetProcess()->GetProcessType() == processType )
if ( anElement != nullptr && anElement->GetProcess()->GetProcessType() == processType )
{
isFound = true;
tmpTblVector->push_back(anElement);
@@ -446,7 +446,7 @@ G4ProcessTable::ExtractProcesses(G4ProcTableVector* procTblVector) const
for (auto itr=procTblVector->cbegin(); itr!=procTblVector->cend(); ++itr)
{
G4ProcTblElement* anElement = (*itr);
procList->insert( anElement->GetProcess() );
if ( anElement != nullptr) procList->insert( anElement->GetProcess() );
}
return procList;
}
@@ -506,6 +506,7 @@ void G4ProcessTable::SetProcessActivation( const G4String& processName,
for (auto itr=pTblVector->cbegin(); itr!=pTblVector->cend(); ++itr)
{
anElement = (*itr);
if ( anElement == nullptr ) continue;
G4VProcess* process = anElement->GetProcess();
for (G4int idx = 0 ; idx < anElement->Length(); ++idx)
{
@@ -572,6 +573,7 @@ void G4ProcessTable::SetProcessActivation( G4ProcessType processType,
for (auto itr=pTblVector->cbegin(); itr!=pTblVector->cend(); ++itr)
{
anElement = (*itr);
if ( anElement == nullptr ) continue;
G4VProcess* process = anElement->GetProcess();
#ifdef G4VERBOSE
if (verboseLevel>1)
@@ -643,6 +645,7 @@ void G4ProcessTable::DumpInfo(G4VProcess* process,
itr!=fProcTblVector->cend(); ++itr, ++idxTbl)
{
anElement = (*itr);
if ( anElement == nullptr ) continue;
if (process == anElement->GetProcess() )
{
if (particle != nullptr)