Import Geant4 11.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2022-12-09 14:43:28 +01:00
parent c07cea1fe0
commit 9f34590941
3810 changed files with 200490 additions and 182326 deletions
@@ -148,7 +148,7 @@ G4ElectronIonPair::FindG4MeanEnergyPerIonPair(const G4Material* mat) const
G4double res = 0.0;
// is this material in the vector?
for(G4int j=0; j<nMaterials; j++) {
for(G4int j=0; j<nMaterials; ++j) {
if(name == g4MatNames[j]) {
res = g4MatData[j];
mat->GetIonisation()->SetMeanEnergyPerIonPair(res);
@@ -167,12 +167,12 @@ G4ElectronIonPair::FindG4MeanEnergyPerIonPair(const G4Material* mat) const
void G4ElectronIonPair:: DumpMeanEnergyPerIonPair() const
{
G4int nmat = G4Material::GetNumberOfMaterials();
std::size_t nmat = G4Material::GetNumberOfMaterials();
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
if(nmat > 0) {
G4cout << "### G4ElectronIonPair: mean energy per ion pair available:"
<< G4endl;
for(G4int i=0; i<nmat; ++i) {
for(std::size_t i=0; i<nmat; ++i) {
const G4Material* mat = (*mtable)[i];
G4double x = mat->GetIonisation()->GetMeanEnergyPerIonPair();
if(x > 0.0) {
@@ -241,7 +241,7 @@ void G4ElectronIonPair::Initialise()
g4MatNames.push_back("G4_AIR");
g4MatData.push_back(35.1*eV);
nMaterials = g4MatData.size();
nMaterials = (G4int)g4MatData.size();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -86,13 +86,13 @@ void G4EmBiasingManager::Initialise(const G4ParticleDefinition& part,
// << " and " << procName << G4endl;
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
G4int numOfCouples = (G4int)theCoupleTable->GetTableSize();
if(0 < nForcedRegions) { idxForcedCouple.resize(numOfCouples, -1); }
if(0 < nSecBiasedRegions) { idxSecBiasedCouple.resize(numOfCouples, -1); }
// Deexcitation
for (size_t j=0; j<numOfCouples; ++j) {
for (G4int j=0; j<numOfCouples; ++j) {
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(j);
const G4ProductionCuts* pcuts = couple->GetProductionCuts();
@@ -298,7 +298,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4int index = idxSecBiasedCouple[coupleIdx];
G4double weight = 1.;
if(0 <= index) {
size_t n = vd.size();
std::size_t n = vd.size();
// the check cannot be applied per secondary particle
// because weight correction is common, so the first
@@ -351,7 +351,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(
G4int index = idxSecBiasedCouple[coupleIdx];
G4double weight = 1.;
if(0 <= index) {
size_t n = vd.size();
std::size_t n = vd.size();
// the check cannot be applied per secondary particle
// because weight correction is common, so the first
@@ -398,7 +398,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
G4int index = idxSecBiasedCouple[coupleIdx];
G4double weight = 1.;
if(0 <= index) {
size_t n = track.size();
std::size_t n = track.size();
// the check cannot be applied per secondary particle
// because weight correction is common, so the first
@@ -410,7 +410,7 @@ G4EmBiasingManager::ApplySecondaryBiasing(std::vector<G4Track*>& track,
// Russian Roulette only
if(1 == nsplit) {
weight = secBiasedWeight[index];
for(size_t k=0; k<n; ++k) {
for(std::size_t k=0; k<n; ++k) {
if(G4UniformRand()*weight > 1.0) {
const G4Track* t = track[k];
delete t;
@@ -430,13 +430,13 @@ G4EmBiasingManager::ApplyRangeCut(std::vector<G4DynamicParticle*>& vd,
const G4Track& track,
G4double& eloss, G4double safety)
{
size_t n = vd.size();
std::size_t n = vd.size();
if(!eIonisation) {
eIonisation =
G4LossTableManager::Instance()->GetEnergyLossProcess(theElectron);
}
if(eIonisation) {
for(size_t k=0; k<n; ++k) {
for(std::size_t k=0; k<n; ++k) {
const G4DynamicParticle* dp = vd[k];
if(dp->GetDefinition() == theElectron) {
G4double e = dp->GetKineticEnergy();
@@ -476,7 +476,7 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
// method is applied only if 1 secondary created PostStep
// in the case of many secondaries there is a contradiction
G4double weight = 1.;
size_t n = vd.size();
std::size_t n = vd.size();
G4double w = secBiasedWeight[index];
if(1 != n || 1.0 <= w) { return weight; }
@@ -499,7 +499,7 @@ G4EmBiasingManager::ApplySplitting(std::vector<G4DynamicParticle*>& vd,
tmpSecondaries.clear();
currentModel->SampleSecondaries(&tmpSecondaries, couple, dynParticle,
tcut);
for (size_t kk=0; kk<tmpSecondaries.size(); ++kk) {
for (std::size_t kk=0; kk<tmpSecondaries.size(); ++kk) {
vd.push_back(tmpSecondaries[kk]);
}
}
@@ -555,7 +555,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
track.GetMaterialCutsCouple(),
track.GetDynamicParticle(), tcut);
}
for (size_t kk=0; kk<tmpSecondaries.size(); ++kk) {
for (std::size_t kk=0; kk<tmpSecondaries.size(); ++kk) {
if (tmpSecondaries[kk]->GetParticleDefinition() == theGamma) {
if (CheckDirection(pos, tmpSecondaries[kk]->GetMomentumDirection())){
vd.push_back(tmpSecondaries[kk]);
@@ -615,7 +615,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
partChange->SetProposedKineticEnergy(primaryEnergy);
partChange->ProposeMomentumDirection(primaryMomdir);
} else {
for (size_t i = 0; i < vd.size(); ++i) {
for (std::size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(1.);
}
}
@@ -677,7 +677,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
track.GetDynamicParticle(), tcut);
}
//for (auto sec : tmpSecondaries) {
for (size_t kk=0; kk < tmpSecondaries.size(); ++kk) {
for (std::size_t kk=0; kk < tmpSecondaries.size(); ++kk) {
if (CheckDirection(pos, tmpSecondaries[kk]->GetMomentumDirection())) {
vd.push_back(tmpSecondaries[kk]);
fDirectionalSplittingWeights.push_back(1.);
@@ -691,7 +691,7 @@ G4EmBiasingManager::ApplyDirectionalSplitting(
}
} // end of loop over nsplit
} else { // no splitting was done; still need weights
for (size_t i = 0; i < vd.size(); ++i) {
for (std::size_t i = 0; i < vd.size(); ++i) {
fDirectionalSplittingWeights.push_back(1.0);
}
}
@@ -106,7 +106,7 @@ G4double G4EmCalculator::GetDEDX(G4double kinEnergy,
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat, region);
if(couple && UpdateParticle(p, kinEnergy) ) {
if(nullptr != couple && UpdateParticle(p, kinEnergy) ) {
res = manager->GetDEDX(p, kinEnergy, couple);
if(isIon) {
@@ -178,7 +178,7 @@ G4double G4EmCalculator::GetCSDARange(G4double kinEnergy,
}
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, kinEnergy)) {
if(nullptr != couple && UpdateParticle(p, kinEnergy)) {
res = manager->GetCSDARange(p, kinEnergy, couple);
if(verbose>1) {
G4cout << " G4EmCalculator::GetCSDARange: E(MeV)= " << kinEnergy/MeV
@@ -216,7 +216,7 @@ G4double G4EmCalculator::GetKinEnergy(G4double range,
{
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, 1.0*GeV)) {
if(nullptr != couple && UpdateParticle(p, 1.0*GeV)) {
res = manager->GetEnergy(p, range, couple);
if(verbose>0) {
G4cout << "G4EmCalculator::GetKinEnergy: Range(mm)= " << range/mm
@@ -240,21 +240,22 @@ G4double G4EmCalculator::GetCrossSectionPerVolume(G4double kinEnergy,
G4double res = 0.0;
const G4MaterialCutsCouple* couple = FindCouple(mat,region);
if(couple && UpdateParticle(p, kinEnergy)) {
if(nullptr != couple && UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
G4int idx = couple->GetIndex();
G4int procType = -1;
FindLambdaTable(p, processName, kinEnergy, procType);
G4VEmProcess* emproc = FindDiscreteProcess(p, processName);
if(emproc) {
if(nullptr != emproc) {
res = emproc->GetCrossSection(kinEnergy, couple);
} else if(currentLambda) {
// special tables are built for Msc models (procType is set in FindLambdaTable
// special tables are built for Msc models
// procType is set in FindLambdaTable
if(procType==2) {
auto mscM = static_cast<G4VMscModel*>(currentModel);
mscM->SetCurrentCouple(couple);
G4double tr1Mfp = mscM->GetTransportMeanFreePath(p, kinEnergy);
G4double tr1Mfp = mscM->GetTransportMeanFreePath(p, kinEnergy);
if (tr1Mfp<DBL_MAX) {
res = 1./tr1Mfp;
}
@@ -292,7 +293,7 @@ G4double G4EmCalculator::GetShellIonisationCrossSectionPerAtom(
G4double res = 0.0;
const G4ParticleDefinition* p = FindParticle(particle);
G4VAtomDeexcitation* ad = manager->AtomDeexcitation();
if(p && ad) {
if(nullptr != p && nullptr != ad) {
res = ad->GetShellIonisationCrossSectionPerAtom(p, Z, shell, kinEnergy);
}
return res;
@@ -323,28 +324,28 @@ G4double G4EmCalculator::GetMeanFreePath(G4double kinEnergy,
void G4EmCalculator::PrintDEDXTable(const G4ParticleDefinition* p)
{
const G4VEnergyLossProcess* elp = FindEnergyLossProcess(p);
const G4VEnergyLossProcess* elp = manager->GetEnergyLossProcess(p);
G4cout << "##### DEDX Table for " << p->GetParticleName() << G4endl;
if(elp) G4cout << *(elp->DEDXTable()) << G4endl;
if(nullptr != elp) G4cout << *(elp->DEDXTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmCalculator::PrintRangeTable(const G4ParticleDefinition* p)
{
const G4VEnergyLossProcess* elp = FindEnergyLossProcess(p);
const G4VEnergyLossProcess* elp = manager->GetEnergyLossProcess(p);
G4cout << "##### Range Table for " << p->GetParticleName() << G4endl;
if(elp) G4cout << *(elp->RangeTableForLoss()) << G4endl;
if(nullptr != elp) G4cout << *(elp->RangeTableForLoss()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void G4EmCalculator::PrintInverseRangeTable(const G4ParticleDefinition* p)
{
const G4VEnergyLossProcess* elp = FindEnergyLossProcess(p);
const G4VEnergyLossProcess* elp = manager->GetEnergyLossProcess(p);
G4cout << "### G4EmCalculator: Inverse Range Table for "
<< p->GetParticleName() << G4endl;
if(elp) G4cout << *(elp->InverseRangeTable()) << G4endl;
if(nullptr != elp) G4cout << *(elp->InverseRangeTable()) << G4endl;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -365,101 +366,81 @@ G4double G4EmCalculator::ComputeDEDX(G4double kinEnergy,
}
if(UpdateParticle(p, kinEnergy)) {
if(FindEmModel(p, processName, kinEnergy)) {
// Special case of ICRU'73 model
const G4String& mname = currentModel->GetName();
if(mname == "ParamICRU73" || mname == "LinhardSorensen" ||
mname == "Atima") {
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
if(verbose > 1) {
G4cout << mname << " ion E(MeV)= " << kinEnergy << " ";
G4cout << currentModel->GetName() << ": DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
G4double escaled = kinEnergy*massRatio;
if(nullptr != baseParticle) {
res = currentModel->ComputeDEDXPerVolume(mat, baseParticle,
escaled, cut) * chargeSquare;
if(verbose > 1) {
G4cout << "Particle: " << p->GetParticleName()
<< " E(MeV)=" << kinEnergy
<< " Base particle: " << baseParticle->GetParticleName()
<< " Escaled(MeV)= " << escaled
<< " q2=" << chargeSquare << G4endl;
}
} else {
G4double escaled = kinEnergy*massRatio;
if(baseParticle) {
res = currentModel->ComputeDEDXPerVolume(
mat, baseParticle, escaled, cut) * chargeSquare;
if(verbose > 1) {
G4cout << baseParticle->GetParticleName()
<< " Escaled(MeV)= " << escaled;
}
} else {
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
if(verbose > 1) {
G4cout << " no basePart E(MeV)= " << kinEnergy << " ";
}
}
if(verbose > 1) {
G4cout << currentModel->GetName() << ": DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
// emulate smoothing procedure
G4double eth = currentModel->LowEnergyLimit();
// G4cout << "massRatio= " << massRatio << " eth= " << eth << G4endl;
if(loweModel) {
G4double res0 = 0.0;
G4double res1 = 0.0;
if(baseParticle) {
res1 = chargeSquare*
currentModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut);
res0 = chargeSquare*
loweModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut);
} else {
res1 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
res0 = loweModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
if(verbose > 1) {
G4cout << "At boundary energy(MeV)= " << eth/MeV
<< " DEDX(MeV/mm)= " << res1*mm/MeV
<< G4endl;
}
//G4cout << "eth= " << eth << " escaled= " << escaled
// << " res0= " << res0 << " res1= "
// << res1 << " q2= " << chargeSquare << G4endl;
if(res1 > 0.0 && escaled > 0.0) {
res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
}
}
// low energy correction for ions
if(isIon) {
G4double length = CLHEP::nm;
const G4Region* r = nullptr;
const G4MaterialCutsCouple* couple = FindCouple(mat, r);
G4double eloss = res*length;
dynParticle->SetKineticEnergy(kinEnergy);
currentModel->GetChargeSquareRatio(p, mat, kinEnergy);
currentModel->CorrectionsAlongStep(couple,dynParticle,length,eloss);
res = eloss/length;
if(verbose > 1) {
G4cout << "After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity()) << G4endl;
}
}
res = currentModel->ComputeDEDXPerVolume(mat, p, kinEnergy, cut);
if(verbose > 1) {
G4cout << "Particle: " << p->GetParticleName()
<< " E(MeV)=" << kinEnergy << G4endl;
}
}
if(verbose > 1) {
G4cout << currentModel->GetName() << ": DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity())
<< G4endl;
}
// emulate smoothing procedure
if(applySmoothing && nullptr != loweModel) {
G4double eth = currentModel->LowEnergyLimit();
G4double res0 = 0.0;
G4double res1 = 0.0;
if(nullptr != baseParticle) {
res1 = chargeSquare*
currentModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut);
res0 = chargeSquare*
loweModel->ComputeDEDXPerVolume(mat, baseParticle, eth, cut);
} else {
res1 = currentModel->ComputeDEDXPerVolume(mat, p, eth, cut);
res0 = loweModel->ComputeDEDXPerVolume(mat, p, eth, cut);
}
if(res1 > 0.0 && escaled > 0.0) {
res *= (1.0 + (res0/res1 - 1.0)*eth/escaled);
}
if(verbose > 1) {
G4cout << "At boundary energy(MeV)= " << eth/MeV
<< " DEDX(MeV/mm)= " << res0*mm/MeV << " " << res1*mm/MeV
<< " after correction DEDX(MeV/mm)=" << res*mm/MeV << G4endl;
}
}
// correction for ions
if(isIon) {
const G4double length = CLHEP::nm;
if(UpdateCouple(mat, cut)) {
G4double eloss = res*length;
dynParticle->SetKineticEnergy(kinEnergy);
currentModel->CorrectionsAlongStep(currentCouple,dynParticle,
length,eloss);
res = eloss/length;
if(verbose > 1) {
G4cout << "After Corrections: DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= "
<< res*gram/(MeV*cm2*mat->GetDensity()) << G4endl;
}
}
}
if(verbose > 0) {
G4cout << "## E(MeV)= " << kinEnergy/MeV
<< " DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< " cut(MeV)= " << cut/MeV
<< " " << p->GetParticleName()
<< " in " << currentMaterialName
<< " Zi^2= " << chargeSquare
<< " isIon=" << isIon
<< G4endl;
}
}
if(verbose > 0) {
G4cout << "Sum: E(MeV)= " << kinEnergy/MeV
<< " DEDX(MeV/mm)= " << res*mm/MeV
<< " DEDX(MeV*cm^2/g)= " << res*gram/(MeV*cm2*mat->GetDensity())
<< " cut(MeV)= " << cut/MeV
<< " " << p->GetParticleName()
<< " in " << currentMaterialName
<< " Zi^2= " << chargeSquare
<< " isIon=" << isIon
<< G4endl;
}
}
return res;
@@ -479,14 +460,14 @@ G4double G4EmCalculator::ComputeElectronicDEDX(G4double kinEnergy,
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
std::size_t n = vel.size();
//G4cout << "ComputeElectronicDEDX for " << part->GetParticleName()
// << " n= " << n << G4endl;
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
if(vel[i]) {
auto p = reinterpret_cast<G4VProcess*>(vel[i]);
auto p = static_cast<G4VProcess*>(vel[i]);
if(ActiveForParticle(part, p)) {
//G4cout << "idx= " << i << " " << (vel[i])->GetProcessName()
// << " " << (vel[i])->Particle()->GetParticleName() << G4endl;
@@ -513,7 +494,7 @@ G4EmCalculator::ComputeDEDXForCutInRange(G4double kinEnergy,
G4LossTableManager* lManager = G4LossTableManager::Instance();
const std::vector<G4VEnergyLossProcess*> vel =
lManager->GetEnergyLossProcessVector();
G4int n = vel.size();
std::size_t n = vel.size();
if(mat != cutMaterial) {
cutMaterial = mat;
@@ -528,14 +509,14 @@ G4EmCalculator::ComputeDEDXForCutInRange(G4double kinEnergy,
//G4cout << "ComputeElectronicDEDX for " << part->GetParticleName()
// << " n= " << n << G4endl;
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
if(vel[i]) {
auto p = reinterpret_cast<G4VProcess*>(vel[i]);
auto p = static_cast<G4VProcess*>(vel[i]);
if(ActiveForParticle(part, p)) {
//G4cout << "idx= " << i << " " << (vel[i])->GetProcessName()
// << " " << (vel[i])->Particle()->GetParticleName() << G4endl;
const G4ParticleDefinition* sec = (vel[i])->SecondaryParticle();
G4int idx = 0;
std::size_t idx = 0;
if(sec == G4Electron::Electron()) { idx = 1; }
else if(sec == G4Positron::Positron()) { idx = 2; }
@@ -675,7 +656,7 @@ G4EmCalculator::ComputeCrossSectionPerShell(G4double kinEnergy,
if(FindEmModel(p, processName, kinEnergy)) {
G4double e = kinEnergy;
G4double aCut = std::max(cut, theParameters->LowestElectronEnergy());
if(baseParticle) {
if(nullptr != baseParticle) {
e *= kinEnergy*massRatio;
currentModel->InitialiseForElement(baseParticle, Z);
res =
@@ -782,52 +763,35 @@ G4bool G4EmCalculator::UpdateParticle(const G4ParticleDefinition* p,
massRatio = 1.0;
mass = p->GetPDGMass();
chargeSquare = 1.0;
currentProcess = FindEnergyLossProcess(p);
currentProcess = manager->GetEnergyLossProcess(p);
currentProcessName = "";
isIon = false;
// ionisation process exist
if(currentProcess) {
if(nullptr != currentProcess) {
currentProcessName = currentProcess->GetProcessName();
baseParticle = currentProcess->BaseParticle();
if(currentProcessName == "ionIoni" && p->GetParticleName() != "alpha") {
baseParticle = theGenericIon;
isIon = true;
}
// base particle is used
if(baseParticle) {
if(nullptr != baseParticle) {
massRatio = baseParticle->GetPDGMass()/p->GetPDGMass();
G4double q = p->GetPDGCharge()/baseParticle->GetPDGCharge();
chargeSquare = q*q;
}
if(p->GetParticleType() == "nucleus"
&& currentParticleName != "deuteron"
&& currentParticleName != "triton"
&& currentParticleName != "alpha+"
&& currentParticleName != "alpha"
) {
isIon = true;
massRatio = theGenericIon->GetPDGMass()/p->GetPDGMass();
baseParticle = theGenericIon;
if(verbose>1) {
G4cout << "\n G4EmCalculator::UpdateParticle: isIon 1 "
<< p->GetParticleName()
<< " in " << currentMaterial->GetName()
<< " e= " << kinEnergy << G4endl;
}
}
}
}
// Effective charge for ions
if(isIon) {
if(isIon && nullptr != currentProcess) {
chargeSquare =
corr->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy)
* corr->EffectiveChargeCorrection(p,currentMaterial,kinEnergy);
if(currentProcess) {
currentProcess->SetDynamicMassCharge(massRatio,chargeSquare);
if(verbose>1) {
G4cout <<"\n NewIon: massR= "<< massRatio << " q2= "
<< chargeSquare << " " << currentProcess << G4endl;
}
corr->EffectiveChargeSquareRatio(p, currentMaterial, kinEnergy);
currentProcess->SetDynamicMassCharge(massRatio,chargeSquare);
if(verbose>1) {
G4cout <<"\n NewIon: massR= "<< massRatio << " q2= "
<< chargeSquare << " " << currentProcess << G4endl;
}
}
return true;
@@ -840,7 +804,7 @@ const G4ParticleDefinition* G4EmCalculator::FindParticle(const G4String& name)
const G4ParticleDefinition* p = nullptr;
if(name != currentParticleName) {
p = G4ParticleTable::GetParticleTable()->FindParticle(name);
if(!p) {
if(nullptr == p) {
G4cout << "### WARNING: G4EmCalculator::FindParticle fails to find "
<< name << G4endl;
}
@@ -864,7 +828,7 @@ const G4Material* G4EmCalculator::FindMaterial(const G4String& name)
{
if(name != currentMaterialName) {
SetupMaterial(G4Material::GetMaterial(name, false));
if(!currentMaterial) {
if(nullptr == currentMaterial) {
G4cout << "### WARNING: G4EmCalculator::FindMaterial fails to find "
<< name << G4endl;
}
@@ -887,27 +851,27 @@ const G4MaterialCutsCouple* G4EmCalculator::FindCouple(
{
const G4MaterialCutsCouple* couple = nullptr;
SetupMaterial(material);
if(currentMaterial) {
if(nullptr != currentMaterial) {
// Access to materials
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
const G4Region* r = region;
if(r) {
if(nullptr != r) {
couple = theCoupleTable->GetMaterialCutsCouple(material,
r->GetProductionCuts());
} else {
G4RegionStore* store = G4RegionStore::GetInstance();
size_t nr = store->size();
std::size_t nr = store->size();
if(0 < nr) {
for(size_t i=0; i<nr; ++i) {
for(std::size_t i=0; i<nr; ++i) {
couple = theCoupleTable->GetMaterialCutsCouple(
material, ((*store)[i])->GetProductionCuts());
if(couple) { break; }
if(nullptr != couple) { break; }
}
}
}
}
if(!couple) {
if(nullptr == couple) {
G4ExceptionDescription ed;
ed << "G4EmCalculator::FindCouple: fail for material <"
<< currentMaterialName << ">";
@@ -936,7 +900,7 @@ G4bool G4EmCalculator::UpdateCouple(const G4Material* material, G4double cut)
localMaterials.push_back(material);
localCouples.push_back(cc);
localCuts.push_back(cut);
nLocalMaterials++;
++nLocalMaterials;
currentCouple = cc;
currentCoupleIndex = currentCouple->GetIndex();
currentCut = cut;
@@ -954,9 +918,9 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
lambdaName = processName;
currentLambda = nullptr;
lambdaParticle = p;
isApplicable = false;
const G4ParticleDefinition* part = p;
if(isIon) { part = theGenericIon; }
const G4ParticleDefinition* part = (isIon) ? theGenericIon : p;
// Search for energy loss process
currentName = processName;
@@ -964,10 +928,10 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
loweModel = nullptr;
G4VEnergyLossProcess* elproc = FindEnLossProcess(part, processName);
if(elproc) {
if(nullptr != elproc) {
currentLambda = elproc->LambdaTable();
proctype = 0;
if(currentLambda) {
if(nullptr != currentLambda) {
isApplicable = true;
if(verbose>1) {
G4cout << "G4VEnergyLossProcess is found out: " << currentName
@@ -980,10 +944,10 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
// Search for discrete process
G4VEmProcess* proc = FindDiscreteProcess(part, processName);
if(proc) {
if(nullptr != proc) {
currentLambda = proc->LambdaTable();
proctype = 1;
if(currentLambda) {
if(nullptr != currentLambda) {
isApplicable = true;
if(verbose>1) {
G4cout << "G4VEmProcess is found out: " << currentName << G4endl;
@@ -995,12 +959,12 @@ void G4EmCalculator::FindLambdaTable(const G4ParticleDefinition* p,
// Search for msc process
G4VMultipleScattering* msc = FindMscProcess(part, processName);
if(msc) {
if(nullptr != msc) {
currentModel = msc->SelectModel(kinEnergy,0);
proctype = 2;
if(currentModel) {
if(nullptr != currentModel) {
currentLambda = currentModel->GetCrossSectionTable();
if(currentLambda) {
if(nullptr != currentLambda) {
isApplicable = true;
if(verbose>1) {
G4cout << "G4VMultipleScattering is found out: " << currentName
@@ -1020,15 +984,14 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
G4double kinEnergy)
{
isApplicable = false;
if(!p || !currentMaterial) {
if(nullptr == p || nullptr == currentMaterial) {
G4cout << "G4EmCalculator::FindEmModel WARNING: no particle"
<< " or materail defined; particle: " << p << G4endl;
return isApplicable;
}
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
G4double scaledEnergy = kinEnergy*massRatio;
if(isIon) { part = theGenericIon; }
const G4ParticleDefinition* part = (isIon) ? theGenericIon : p;
if(verbose > 1) {
G4cout << "## G4EmCalculator::FindEmModel for " << partname
@@ -1042,10 +1005,10 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
currentName = processName;
currentModel = nullptr;
loweModel = nullptr;
size_t idx = 0;
std::size_t idx = 0;
G4VEnergyLossProcess* elproc = FindEnLossProcess(part, processName);
if(elproc) {
if(nullptr != elproc) {
currentModel = elproc->SelectModelForMaterial(scaledEnergy, idx);
currentModel->InitialiseForMaterial(part, currentMaterial);
currentModel->SetupForMaterial(part, currentMaterial, scaledEnergy);
@@ -1061,9 +1024,9 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
}
// Search for discrete process
if(!currentModel) {
if(nullptr == currentModel) {
G4VEmProcess* proc = FindDiscreteProcess(part, processName);
if(proc) {
if(nullptr != proc) {
currentModel = proc->SelectModelForMaterial(kinEnergy, idx);
currentModel->InitialiseForMaterial(part, currentMaterial);
currentModel->SetupForMaterial(part, currentMaterial, kinEnergy);
@@ -1080,14 +1043,14 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
}
// Search for msc process
if(!currentModel) {
if(nullptr == currentModel) {
G4VMultipleScattering* proc = FindMscProcess(part, processName);
if(proc) {
if(nullptr != proc) {
currentModel = proc->SelectModel(kinEnergy, idx);
loweModel = nullptr;
}
}
if(currentModel) {
if(nullptr != currentModel) {
if(loweModel == currentModel) { loweModel = nullptr; }
isApplicable = true;
currentModel->InitialiseForMaterial(part, currentMaterial);
@@ -1098,11 +1061,11 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
G4cout << " Model <" << currentModel->GetName()
<< "> Emin(MeV)= " << currentModel->LowEnergyLimit()/MeV
<< " for " << part->GetParticleName();
if(elproc) {
if(nullptr != elproc) {
G4cout << " and " << elproc->GetProcessName() << " " << elproc
<< G4endl;
}
if(loweModel) {
if(nullptr != loweModel) {
G4cout << " LowEnergy model <" << loweModel->GetName() << ">";
}
G4cout << G4endl;
@@ -1113,31 +1076,6 @@ G4bool G4EmCalculator::FindEmModel(const G4ParticleDefinition* p,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEnergyLossProcess* G4EmCalculator::FindEnergyLossProcess(
const G4ParticleDefinition* p)
{
G4VEnergyLossProcess* elp = nullptr;
G4String partname = p->GetParticleName();
const G4ParticleDefinition* part = p;
if(p->GetParticleType() == "nucleus"
&& currentParticleName != "deuteron"
&& currentParticleName != "triton"
&& currentParticleName != "alpha"
&& currentParticleName != "alpha+"
) { part = theGenericIon; }
elp = manager->GetEnergyLossProcess(part);
/*
G4cout << "\n G4EmCalculator::FindEnergyLossProcess: for " << p->GetParticleName()
<< " found " << elp->GetProcessName() << " of "
<< elp->Particle()->GetParticleName() << " " << elp << G4endl;
*/
return elp;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEnergyLossProcess*
G4EmCalculator::FindEnLossProcess(const G4ParticleDefinition* part,
const G4String& processName)
@@ -1145,10 +1083,10 @@ G4EmCalculator::FindEnLossProcess(const G4ParticleDefinition* part,
G4VEnergyLossProcess* proc = nullptr;
const std::vector<G4VEnergyLossProcess*> v =
manager->GetEnergyLossProcessVector();
G4int n = v.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = v.size();
for(std::size_t i=0; i<n; ++i) {
if((v[i])->GetProcessName() == processName) {
auto p = reinterpret_cast<G4VProcess*>(v[i]);
auto p = static_cast<G4VProcess*>(v[i]);
if(ActiveForParticle(part, p)) {
proc = v[i];
break;
@@ -1166,14 +1104,14 @@ G4EmCalculator::FindDiscreteProcess(const G4ParticleDefinition* part,
{
G4VEmProcess* proc = nullptr;
auto v = manager->GetEmProcessVector();
G4int n = v.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = v.size();
for(std::size_t i=0; i<n; ++i) {
auto pName = v[i]->GetProcessName();
if(pName == "GammaGeneralProc") {
proc = v[i]->GetEmProcess(processName);
break;
} else if(pName == processName) {
auto p = reinterpret_cast<G4VProcess*>(v[i]);
auto p = static_cast<G4VProcess*>(v[i]);
if(ActiveForParticle(part, p)) {
proc = v[i];
break;
@@ -1192,10 +1130,10 @@ G4EmCalculator::FindMscProcess(const G4ParticleDefinition* part,
G4VMultipleScattering* proc = nullptr;
const std::vector<G4VMultipleScattering*> v =
manager->GetMultipleScatteringVector();
G4int n = v.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = v.size();
for(std::size_t i=0; i<n; ++i) {
if((v[i])->GetProcessName() == processName) {
auto p = reinterpret_cast<G4VProcess*>(v[i]);
auto p = static_cast<G4VProcess*>(v[i]);
if(ActiveForParticle(part, p)) {
proc = v[i];
break;
@@ -1213,7 +1151,7 @@ G4VProcess* G4EmCalculator::FindProcess(const G4ParticleDefinition* part,
G4VProcess* proc = nullptr;
const G4ProcessManager* procman = part->GetProcessManager();
G4ProcessVector* pv = procman->GetProcessList();
G4int nproc = pv->size();
G4int nproc = (G4int)pv->size();
for(G4int i=0; i<nproc; ++i) {
if(processName == (*pv)[i]->GetProcessName()) {
proc = (*pv)[i];
@@ -1230,7 +1168,7 @@ G4bool G4EmCalculator::ActiveForParticle(const G4ParticleDefinition* part,
{
G4ProcessManager* pm = part->GetProcessManager();
G4ProcessVector* pv = pm->GetProcessList();
G4int n = pv->size();
G4int n = (G4int)pv->size();
G4bool res = false;
for(G4int i=0; i<n; ++i) {
if((*pv)[i] == proc) {
@@ -1266,9 +1204,9 @@ void G4EmCalculator::SetupMaterial(const G4String& mname)
void G4EmCalculator::CheckMaterial(G4int Z)
{
G4bool isFound = false;
if(currentMaterial) {
size_t nn = currentMaterial->GetNumberOfElements();
for(size_t i=0; i<nn; ++i) {
if(nullptr != currentMaterial) {
G4int nn = (G4int)currentMaterial->GetNumberOfElements();
for(G4int i=0; i<nn; ++i) {
if(Z == currentMaterial->GetElement(i)->GetZasInt()) {
isFound = true;
break;
@@ -181,7 +181,7 @@ void G4EmCorrections::SetupKinematics(const G4ParticleDefinition* p,
material = mat;
theElementVector = material->GetElementVector();
atomDensity = material->GetAtomicNumDensityVector();
numberOfElements = material->GetNumberOfElements();
numberOfElements = (G4int)material->GetNumberOfElements();
}
}
@@ -286,7 +286,7 @@ G4double G4EmCorrections::IonHighOrderCorrections(const G4ParticleDefinition* p,
G4int ionPDG = p->GetPDGEncoding();
if(thcorr.find(ionPDG)==thcorr.end()) { // Not found: fill the map
std::vector<G4double> v;
for(size_t i=0; i<ncouples; ++i){
for(std::size_t i=0; i<ncouples; ++i){
v.push_back(ethscaled*ComputeIonCorrections(p,currmat[i],ethscaled));
}
thcorr.insert(std::pair< G4int, std::vector<G4double> >(ionPDG,v));
@@ -297,7 +297,7 @@ G4double G4EmCorrections::IonHighOrderCorrections(const G4ParticleDefinition* p,
// it = thcorr.begin(); it != thcorr.end(); ++it){
// G4cout << "\t map element: first (key)=" << it->first
// << "\t second (vector): vec size=" << (it->second).size() << G4endl;
// for(size_t i=0; i<(it->second).size(); ++i){
// for(std::size_t i=0; i<(it->second).size(); ++i){
// G4cout << "\t \t vec element: [" << i << "]=" << (it->second)[i]
//<< G4endl; } }
@@ -907,8 +907,8 @@ void G4EmCorrections::InitialiseForNewRun()
(it->second).clear();
}
thcorr.clear();
for(size_t i=0; i<ncouples; ++i) {
currmat[i] = tb->GetMaterialCutsCouple(i)->GetMaterial();
for(std::size_t i=0; i<ncouples; ++i) {
currmat[i] = tb->GetMaterialCutsCouple((G4int)i)->GetMaterial();
G4String nam = currmat[i]->GetName();
for(G4int j=0; j<nIons; ++j) {
if(nam == materialName[j]) { materialList[j] = currmat[i]; }
@@ -60,7 +60,7 @@ G4EmElementSelector::G4EmElementSelector(G4VEmModel* mod,
model(mod), material(mat), nbins(bins), cutEnergy(-1.0),
lowEnergy(emin), highEnergy(emax)
{
G4int n = material->GetNumberOfElements();
G4int n = (G4int)material->GetNumberOfElements();
nElmMinusOne = n - 1;
theElementVector = material->GetElementVector();
if(nElmMinusOne > 0) {
@@ -206,7 +206,7 @@ void G4EmExtraParameters::FillStepFunction(const G4ParticleDefinition* part, G4V
proc->SetStepFunction(dRoverRange, finalRange);
// all heavy ions
} else if (part->IsGeneralIon()) {
} else if ("GenericIon" == part->GetParticleName()) {
proc->SetStepFunction(dRoverRangeIons, finalRangeIons);
// light nucleus and anti-nucleus
@@ -224,8 +224,8 @@ void G4EmExtraParameters::AddPAIModel(const G4String& particle,
const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPAI.size();
for(G4int i=0; i<nreg; ++i) {
std::size_t nreg = m_regnamesPAI.size();
for(std::size_t i=0; i<nreg; ++i) {
if((m_particlesPAI[i] == particle ||
m_particlesPAI[i] == "all" ||
particle == "all") &&
@@ -263,8 +263,8 @@ void G4EmExtraParameters::AddPhysics(const G4String& region,
const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesPhys.size();
for(G4int i=0; i<nreg; ++i) {
std::size_t nreg = m_regnamesPhys.size();
for(std::size_t i=0; i<nreg; ++i) {
if(r == m_regnamesPhys[i]) { return; }
}
m_regnamesPhys.push_back(r);
@@ -284,8 +284,8 @@ const std::vector<G4String>& G4EmExtraParameters::TypesPhysics() const
void G4EmExtraParameters::SetSubCutRegion(const G4String& region)
{
const G4String& r = CheckRegion(region);
G4int nreg = m_regnamesSubCut.size();
for(G4int i=0; i<nreg; ++i) {
std::size_t nreg = m_regnamesSubCut.size();
for(std::size_t i=0; i<nreg; ++i) {
if(r == m_regnamesSubCut[i]) {
return;
}
@@ -298,8 +298,8 @@ G4EmExtraParameters::SetProcessBiasingFactor(const G4String& procname,
G4double val, G4bool wflag)
{
if(val > 0.0) {
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = m_procBiasedXS.size();
for(std::size_t i=0; i<n; ++i) {
if(procname == m_procBiasedXS[i]) {
m_factBiasedXS[i] = val;
m_weightBiasedXS[i]= wflag;
@@ -325,8 +325,8 @@ G4EmExtraParameters::ActivateForcedInteraction(const G4String& procname,
{
const G4String& r = CheckRegion(region);
if(length >= 0.0) {
G4int n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = m_procForced.size();
for(std::size_t i=0; i<n; ++i) {
if(procname == m_procForced[i] && r == m_regnamesForced[i] ) {
m_lengthForced[i] = length;
m_weightForced[i] = wflag;
@@ -354,8 +354,8 @@ G4EmExtraParameters::ActivateSecondaryBiasing(const G4String& procname,
{
const G4String& r = CheckRegion(region);
if(factor >= 0.0 && energyLim >= 0.0) {
G4int n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = m_procBiasedSec.size();
for(std::size_t i=0; i<n; ++i) {
if(procname == m_procBiasedSec[i] && r == m_regnamesBiasedSec[i] ) {
m_factBiasedSec[i] = factor;
m_elimBiasedSec[i] = energyLim;
@@ -378,13 +378,13 @@ G4EmExtraParameters::ActivateSecondaryBiasing(const G4String& procname,
void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr) const
{
const G4RegionStore* regionStore = G4RegionStore::GetInstance();
G4int n = m_regnamesSubCut.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = m_regnamesSubCut.size();
for(std::size_t i=0; i<n; ++i) {
const G4Region* reg = regionStore->GetRegion(m_regnamesSubCut[i], false);
if(nullptr != reg) { ptr->ActivateSubCutoff(reg); }
}
n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
@@ -392,7 +392,7 @@ void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr) const
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
@@ -401,7 +401,7 @@ void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr) const
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
@@ -413,8 +413,8 @@ void G4EmExtraParameters::DefineRegParamForLoss(G4VEnergyLossProcess* ptr) const
void G4EmExtraParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
{
G4int n = m_procBiasedXS.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = m_procBiasedXS.size();
for(std::size_t i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedXS[i]) {
ptr->SetCrossSectionBiasingFactor(m_factBiasedXS[i],
m_weightBiasedXS[i]);
@@ -422,7 +422,7 @@ void G4EmExtraParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
}
}
n = m_procForced.size();
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procForced[i]) {
ptr->ActivateForcedInteraction(m_lengthForced[i],
m_regnamesForced[i],
@@ -431,7 +431,7 @@ void G4EmExtraParameters::DefineRegParamForEM(G4VEmProcess* ptr) const
}
}
n = m_procBiasedSec.size();
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
if(ptr->GetProcessName() == m_procBiasedSec[i]) {
ptr->ActivateSecondaryBiasing(m_regnamesBiasedSec[i],
m_factBiasedSec[i],
@@ -68,8 +68,6 @@ G4EmLowEParameters::~G4EmLowEParameters()
void G4EmLowEParameters::Initialise()
{
fluo = false;
beardenFluoDir = false;
fANSTOFluoDir = false;
auger = false;
pixe = false;
deexIgnoreCut = false;
@@ -79,6 +77,7 @@ void G4EmLowEParameters::Initialise()
dnaMsc = false;
dnaElectronSolvation = fMeesungnoen2002eSolvation;
fFluoDirectory = fluoDefault;
namePIXE = "Empirical";
nameElectronPIXE = "Livermore";
livDataDir = "epics_2017";
@@ -96,24 +95,32 @@ G4bool G4EmLowEParameters::Fluo() const
return fluo;
}
void G4EmLowEParameters::SetBeardenFluoDir(G4bool val)
G4EmFluoDirectory G4EmLowEParameters::FluoDirectory() const
{
beardenFluoDir = val;
return fFluoDirectory;
}
G4bool G4EmLowEParameters::BeardenFluoDir() const
void G4EmLowEParameters::SetFluoDirectory(G4EmFluoDirectory val)
{
return beardenFluoDir;
fFluoDirectory = fluoDefault;
if(fluoBearden == val) { fFluoDirectory = fluoBearden; }
else if(fluoANSTO == val) { fFluoDirectory = fluoANSTO; }
else if(fluoXDB_EADL == val) { fFluoDirectory = fluoXDB_EADL; }
}
void G4EmLowEParameters::SetBeardenFluoDir(G4bool val)
{
fFluoDirectory = val ? fluoBearden : fluoDefault;
}
void G4EmLowEParameters::SetANSTOFluoDir(G4bool val)
{
fANSTOFluoDir = val;
fFluoDirectory = val ? fluoANSTO : fluoDefault;
}
G4bool G4EmLowEParameters::ANSTOFluoDir() const
void G4EmLowEParameters::SetXDB_EADLFluoDir(G4bool val)
{
return fANSTOFluoDir;
fFluoDirectory = val ? fluoXDB_EADL : fluoDefault;
}
void G4EmLowEParameters::SetAuger(G4bool val)
@@ -235,8 +242,8 @@ G4String G4EmLowEParameters::CheckRegion(const G4String& reg) const
void G4EmLowEParameters::AddMicroElec(const G4String& region)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesME.size();
for(G4int i=0; i<nreg; ++i) {
std::size_t nreg = m_regnamesME.size();
for(std::size_t i=0; i<nreg; ++i) {
if(r == m_regnamesME[i]) { return; }
}
m_regnamesME.push_back(r);
@@ -250,8 +257,8 @@ const std::vector<G4String>& G4EmLowEParameters::RegionsMicroElec() const
void G4EmLowEParameters::AddDNA(const G4String& region, const G4String& type)
{
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDNA.size();
for(G4int i=0; i<nreg; ++i) {
std::size_t nreg = m_regnamesDNA.size();
for(std::size_t i=0; i<nreg; ++i) {
if(r == m_regnamesDNA[i]) { return; }
}
m_regnamesDNA.push_back(r);
@@ -274,7 +281,7 @@ G4EmLowEParameters::SetDeexActiveRegion(const G4String& region, G4bool fdeex,
{
if(fdeex) { fluo = true; }
G4String r = CheckRegion(region);
G4int nreg = m_regnamesDeex.size();
std::size_t nreg = m_regnamesDeex.size();
if(0 == nreg && r != "DefaultRegionForTheWorld") {
m_regnamesDeex.push_back("DefaultRegionForTheWorld");
m_fluo.push_back(false);
@@ -282,7 +289,7 @@ G4EmLowEParameters::SetDeexActiveRegion(const G4String& region, G4bool fdeex,
m_pixe.push_back(false);
nreg = 1;
}
for(G4int i=0; i<nreg; ++i) {
for(std::size_t i=0; i<nreg; ++i) {
if(r == m_regnamesDeex[i]) {
m_fluo[i] = fdeex;
m_auger[i]= fauger;
@@ -298,8 +305,8 @@ G4EmLowEParameters::SetDeexActiveRegion(const G4String& region, G4bool fdeex,
void G4EmLowEParameters::DefineRegParamForDeex(G4VAtomDeexcitation* ptr) const
{
G4int n = m_regnamesDeex.size();
for(G4int i=0; i<n; ++i) {
std::size_t n = m_regnamesDeex.size();
for(std::size_t i=0; i<n; ++i) {
ptr->SetDeexcitationActiveRegion(m_regnamesDeex[i],
m_fluo[i], m_auger[i], m_pixe[i]);
}
@@ -40,6 +40,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4EmLowEParametersMessenger.hh"
#include "G4EmFluoDirectory.hh"
#include "G4UIcommand.hh"
#include "G4UIparameter.hh"
#include "G4UIcmdWithABool.hh"
@@ -69,14 +70,14 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
dirFluoCmd->SetGuidance("Enable/disable usage of Bearden fluorescence files");
dirFluoCmd->SetParameterName("fluoBeardenFlag",true);
dirFluoCmd->SetDefaultValue(false);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dirFluoCmd->AvailableForStates(G4State_PreInit,G4State_Init);
dirFluoCmd->SetToBeBroadcasted(false);
dirFluoCmd1 = new G4UIcmdWithABool("/process/em/fluoANSTO",this);
dirFluoCmd1->SetGuidance("Enable/disable usage of ANSTO fluorescence files");
dirFluoCmd1->SetParameterName("fluoANSTOFlag",true);
dirFluoCmd1->SetDefaultValue(false);
dirFluoCmd1->AvailableForStates(G4State_PreInit,G4State_Init,G4State_Idle);
dirFluoCmd1->AvailableForStates(G4State_PreInit,G4State_Init);
dirFluoCmd1->SetToBeBroadcasted(false);
auCmd = new G4UIcmdWithABool("/process/em/auger",this);
@@ -128,6 +129,13 @@ G4EmLowEParametersMessenger::G4EmLowEParametersMessenger(G4EmLowEParameters* ptr
dnamscCmd->AvailableForStates(G4State_PreInit);
dnamscCmd->SetToBeBroadcasted(false);
direFluoCmd = new G4UIcmdWithAString("/process/em/fluoDirectory",this);
direFluoCmd->SetGuidance("The name of PIXE cross section");
direFluoCmd->SetParameterName("fluoDirectory",true);
direFluoCmd->SetCandidates("Default Bearden ANSTO XDB_EADL");
direFluoCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
direFluoCmd->SetToBeBroadcasted(false);
pixeXsCmd = new G4UIcmdWithAString("/process/em/pixeXSmodel",this);
pixeXsCmd->SetGuidance("The name of PIXE cross section");
pixeXsCmd->SetParameterName("pixeXS",true);
@@ -217,6 +225,7 @@ G4EmLowEParametersMessenger::~G4EmLowEParametersMessenger()
delete pixeeXsCmd;
delete livCmd;
delete dnaSolCmd;
delete direFluoCmd;
delete meCmd;
delete dnaCmd;
delete deexCmd;
@@ -269,6 +278,12 @@ void G4EmLowEParametersMessenger::SetNewValue(G4UIcommand* command,
ttt = fKreipl2009eSolvation;
}
theParameters->SetDNAeSolvationSubType(ttt);
} else if (command == direFluoCmd) {
G4EmFluoDirectory ttt = fluoDefault;
if(newValue == "Bearden") { ttt = fluoBearden; }
else if(newValue == "ANSTO") { ttt = fluoANSTO; }
else if(newValue == "XDB_EADL") { ttt = fluoXDB_EADL; }
theParameters->SetFluoDirectory(ttt);
} else if (command == pixeXsCmd) {
theParameters->SetPIXECrossSectionModel(newValue);
physicsModified = true;
@@ -119,8 +119,8 @@ void G4EmModelManager::Clear()
if(1 < verboseLevel) {
G4cout << "G4EmModelManager::Clear()" << G4endl;
}
size_t n = setOfRegionModels.size();
for(size_t i=0; i<n; ++i) {
std::size_t n = setOfRegionModels.size();
for(std::size_t i=0; i<n; ++i) {
delete setOfRegionModels[i];
setOfRegionModels[i] = nullptr;
}
@@ -165,7 +165,7 @@ G4VEmModel* G4EmModelManager::GetModel(G4int idx, G4bool ver) const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VEmModel* G4EmModelManager::GetRegionModel(G4int k, size_t idx)
G4VEmModel* G4EmModelManager::GetRegionModel(G4int k, std::size_t idx)
{
G4RegionModels* rm = setOfRegionModels[idxOfRegionModels[idx]];
return (k < rm->NumberOfModels()) ? models[rm->ModelIndex(k)] : nullptr;
@@ -173,7 +173,7 @@ G4VEmModel* G4EmModelManager::GetRegionModel(G4int k, size_t idx)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4int G4EmModelManager::NumberOfRegionModels(size_t idx) const
G4int G4EmModelManager::NumberOfRegionModels(std::size_t idx) const
{
G4RegionModels* rm = setOfRegionModels[idxOfRegionModels[idx]];
return rm->NumberOfModels();
@@ -242,13 +242,13 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
std::size_t numOfCouples = theCoupleTable->GetTableSize();
// prepare vectors, shortcut for the case of only 1 model
// or only one region
if(nRegions > 1 && nEmModels > 1) {
idxOfRegionModels.resize(numOfCouples,0);
setOfRegionModels.resize((size_t)nRegions,nullptr);
setOfRegionModels.resize((std::size_t)nRegions,nullptr);
} else {
idxOfRegionModels.resize(1,0);
setOfRegionModels.resize(1,nullptr);
@@ -460,7 +460,7 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
currModel = models[0];
// Access to materials and build cuts
size_t idx = 1;
std::size_t idx = 1;
if(nullptr != secondaryParticle) {
if( secondaryParticle == G4Gamma::Gamma() ) { idx = 0; }
else if( secondaryParticle == G4Electron::Electron()) { idx = 1; }
@@ -476,10 +476,10 @@ G4EmModelManager::Initialise(const G4ParticleDefinition* p,
// G4cout << "========Start define cuts" << G4endl;
// define cut values
for(size_t i=0; i<numOfCouples; ++i) {
for(std::size_t i=0; i<numOfCouples; ++i) {
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
theCoupleTable->GetMaterialCutsCouple((G4int)i);
const G4Material* material = couple->GetMaterial();
const G4ProductionCuts* pcuts = couple->GetProductionCuts();
@@ -563,7 +563,7 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
const G4MaterialCutsCouple* couple,
G4EmTableType tType)
{
size_t i = couple->GetIndex();
std::size_t i = couple->GetIndex();
G4double cut = (fTotal == tType) ? DBL_MAX : (*theCuts)[i];
if(1 < verboseLevel) {
@@ -581,11 +581,11 @@ void G4EmModelManager::FillDEDXVector(G4PhysicsVector* aVector,
G4int nmod = regModels->NumberOfModels();
// Calculate energy losses vector
size_t totBinsLoss = aVector->GetVectorLength();
std::size_t totBinsLoss = aVector->GetVectorLength();
G4double del = 0.0;
G4int k0 = 0;
for(size_t j=0; j<totBinsLoss; ++j) {
for(std::size_t j=0; j<totBinsLoss; ++j) {
G4double e = aVector->Energy(j);
// Choose a model of energy losses
@@ -630,7 +630,7 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
G4bool startFromNull,
G4EmTableType tType)
{
size_t i = couple->GetIndex();
std::size_t i = couple->GetIndex();
G4double cut = (*theCuts)[i];
G4double tmax = DBL_MAX;
@@ -651,12 +651,12 @@ void G4EmModelManager::FillLambdaVector(G4PhysicsVector* aVector,
}
// Calculate lambda vector
size_t totBinsLambda = aVector->GetVectorLength();
std::size_t totBinsLambda = aVector->GetVectorLength();
G4double del = 0.0;
G4int k0 = 0;
G4int k = 0;
G4VEmModel* mod = models[regModels->ModelIndex(0)];
for(size_t j=0; j<totBinsLambda; ++j) {
for(std::size_t j=0; j<totBinsLambda; ++j) {
G4double e = aVector->Energy(j);
@@ -720,11 +720,11 @@ void G4EmModelManager::DumpModelList(std::ostream& out, G4int verb)
<< std::setw(5) << G4BestUnit(emax,"Energy");
G4PhysicsTable* table = model->GetCrossSectionTable();
if(table) {
size_t kk = table->size();
for(size_t k=0; k<kk; ++k) {
std::size_t kk = table->size();
for(std::size_t k=0; k<kk; ++k) {
const G4PhysicsVector* v = (*table)[k];
if(v) {
G4int nn = v->GetVectorLength() - 1;
G4int nn = G4int(v->GetVectorLength() - 1);
out << " Nbins=" << nn << " "
<< std::setw(3) << G4BestUnit(v->Energy(0),"Energy")
<< " - "
@@ -134,6 +134,7 @@ void G4EmParameters::Initialise()
fSamplingTable = false;
fPolarisation = false;
fMuDataFromFile = false;
fPEKShell = true;
fDNA = false;
fIsPrinted = false;
@@ -238,26 +239,33 @@ G4bool G4EmParameters::Fluo() const
return fCParameters->Fluo();
}
G4EmFluoDirectory G4EmParameters::FluoDirectory() const
{
return fCParameters->FluoDirectory();
}
void G4EmParameters::SetFluoDirectory(G4EmFluoDirectory val)
{
if(IsLocked()) { return; }
fCParameters->SetFluoDirectory(val);
}
void G4EmParameters::SetBeardenFluoDir(G4bool val)
{
if(IsLocked()) { return; }
fCParameters->SetBeardenFluoDir(val);
}
G4bool G4EmParameters::BeardenFluoDir() const
{
return fCParameters->BeardenFluoDir();
}
void G4EmParameters::SetANSTOFluoDir(G4bool val)
{
if(IsLocked()) { return; }
fCParameters->SetANSTOFluoDir(val);
}
G4bool G4EmParameters::ANSTOFluoDir() const
void G4EmParameters::SetXDB_EADLFluoDir(G4bool val)
{
return fCParameters->ANSTOFluoDir();
if(IsLocked()) { return; }
fCParameters->SetXDB_EADLFluoDir(val);
}
void G4EmParameters::SetAuger(G4bool val)
@@ -266,6 +274,18 @@ void G4EmParameters::SetAuger(G4bool val)
fCParameters->SetAuger(val);
}
G4bool G4EmParameters::BeardenFluoDir()
{
auto dir = fCParameters->FluoDirectory();
return (dir == fluoBearden);
}
G4bool G4EmParameters::ANSTOFluoDir()
{
auto dir = fCParameters->FluoDirectory();
return (dir == fluoANSTO);
}
G4bool G4EmParameters::Auger() const
{
return fCParameters->Auger();
@@ -482,6 +502,17 @@ G4bool G4EmParameters::EnableSamplingTable() const
return fSamplingTable;
}
G4bool G4EmParameters::PhotoeffectBelowKShell() const
{
return fPEKShell;
}
void G4EmParameters::SetPhotoeffectBelowKShell(G4bool v)
{
if(IsLocked()) { return; }
fPEKShell = v;
}
void G4EmParameters::ActivateDNA()
{
if(IsLocked()) { return; }
@@ -1250,7 +1281,7 @@ void G4EmParameters::DefineRegParamForDeex(G4VAtomDeexcitation* ptr) const
void G4EmParameters::StreamInfo(std::ostream& os) const
{
G4int prec = os.precision(5);
G4long prec = os.precision(5);
os << "=======================================================================" << "\n";
os << "====== Electromagnetic Physics Parameters ========" << "\n";
os << "=======================================================================" << "\n";
@@ -1266,6 +1297,7 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "Use combined TransportationWithMsc " <<transportationWithMsc << "\n";
os << "Use general process " <<gener << "\n";
os << "Enable linear polarisation for gamma " <<fPolarisation << "\n";
os << "Enable photoeffect sampling below K-shell " <<fPEKShell << "\n";
os << "Enable sampling of quantum entanglement "
<<fBParameters->QuantumEntanglement() << "\n";
os << "X-section factor for integral approach " <<lambdaFactor << "\n";
@@ -1315,7 +1347,10 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
<<G4BestUnit(lowestMuHadEnergy,"Energy") << "\n";
os << "Use ICRU90 data " << fICRU90 << "\n";
os << "Fluctuations of dE/dx are enabled " <<lossFluctuation << "\n";
os << "Type of fluctuation model " << fFluct << "\n";
G4String namef = "Universal";
if(fFluct == fUrbanFluctuation) { namef = "Urban"; }
else if(fFluct == fDummyFluctuation) { namef = "Dummy"; }
os << "Type of fluctuation model for leptons and hadrons " << namef << "\n";
os << "Use built-in Birks satuaration " << birks << "\n";
os << "Build CSDA range enabled " <<buildCSDARange << "\n";
os << "Use cut as a final range enabled " <<cutAsFinalRange << "\n";
@@ -1359,10 +1394,12 @@ void G4EmParameters::StreamInfo(std::ostream& os) const
os << "====== Atomic Deexcitation Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Fluorescence enabled " <<fCParameters->Fluo() << "\n";
os << "Fluorescence Bearden data files enabled "
<<fCParameters->BeardenFluoDir() << "\n";
os << "Fluorescence ANSTO data files enabled "
<<fCParameters->ANSTOFluoDir() << "\n";
G4String named = "fluor";
G4EmFluoDirectory fdir = FluoDirectory();
if(fdir == fluoBearden) { named = "fluor_Bearden"; }
else if(fdir == fluoANSTO) { named = "fluor_ANSTO"; }
else if(fdir == fluoXDB_EADL) { named = "fluor_XDB_EADL"; }
os << "Directory in G4LEDATA for fluorescence data files " << named << "\n";
os << "Auger electron cascade enabled "
<<fCParameters->Auger() << "\n";
os << "PIXE atomic de-excitation enabled " <<fCParameters->Pixe() << "\n";
@@ -189,6 +189,13 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
mudatCmd->AvailableForStates(G4State_PreInit);
mudatCmd->SetToBeBroadcasted(false);
peKCmd = new G4UIcmdWithABool("/process/em/PhotoeffectBelowKShell",this);
peKCmd->SetGuidance("Enable sampling of photoeffect below K-shell");
peKCmd->SetParameterName("peK",true);
peKCmd->SetDefaultValue(true);
peKCmd->AvailableForStates(G4State_PreInit);
peKCmd->SetToBeBroadcasted(false);
minEnCmd = new G4UIcmdWithADoubleAndUnit("/process/eLoss/minKinEnergy",this);
minEnCmd->SetGuidance("Set the min kinetic energy for EM tables");
minEnCmd->SetParameterName("emin",true);
@@ -342,7 +349,7 @@ G4EmParametersMessenger::G4EmParametersMessenger(G4EmParameters* ptr)
llimCmd->AvailableForStates(G4State_PreInit);
llimCmd->SetToBeBroadcasted(false);
amCmd = new G4UIcmdWithAnInteger("/process/eLoss/binsPerDecade",this);
amCmd = new G4UIcmdWithAnInteger("/process/em/binsPerDecade",this);
amCmd->SetGuidance("Set number of bins per decade for EM tables");
amCmd->SetParameterName("bins",true);
amCmd->SetDefaultValue(7);
@@ -466,6 +473,7 @@ G4EmParametersMessenger::~G4EmParametersMessenger()
delete poCmd;
delete icru90Cmd;
delete mudatCmd;
delete peKCmd;
delete minEnCmd;
delete maxEnCmd;
@@ -553,6 +561,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetEnableSamplingTable(sampleTCmd->GetNewBoolValue(newValue));
} else if (command == mudatCmd) {
theParameters->SetRetrieveMuDataFromFile(mudatCmd->GetNewBoolValue(newValue));
} else if (command == peKCmd) {
theParameters->SetPhotoeffectBelowKShell(peKCmd->GetNewBoolValue(newValue));
} else if (command == minEnCmd) {
theParameters->SetMinEnergy(minEnCmd->GetNewDoubleValue(newValue));
@@ -610,6 +620,8 @@ void G4EmParametersMessenger::SetNewValue(G4UIcommand* command,
theParameters->SetMscLambdaLimit(llimCmd->GetNewDoubleValue(newValue));
} else if (command == screCmd) {
theParameters->SetScreeningFactor(screCmd->GetNewDoubleValue(newValue));
} else if (command == amCmd) {
theParameters->SetNumberOfBinsPerDecade(amCmd->GetNewIntValue(newValue));
} else if (command == verCmd) {
theParameters->SetVerbose(verCmd->GetNewIntValue(newValue));
} else if (command == ver1Cmd) {
@@ -53,7 +53,7 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
size_t G4EmSaturation::nMaterials = 0;
std::size_t G4EmSaturation::nMaterials = 0;
std::vector<G4double> G4EmSaturation::massFactors;
std::vector<G4double> G4EmSaturation::effCharges;
std::vector<G4double> G4EmSaturation::g4MatData;
@@ -119,7 +119,7 @@ G4double G4EmSaturation::VisibleEnergyDeposition(
}
// non-ionizing energy loss
if(nloss > 0.0) {
G4int idx = couple->GetMaterial()->GetIndex();
std::size_t idx = couple->GetMaterial()->GetIndex();
G4double escaled = nloss*massFactors[idx];
/*
G4cout << "%% p edep= " << nloss/keV << " keV Escaled= "
@@ -149,7 +149,7 @@ void G4EmSaturation::InitialiseG4Saturation()
if(0 == nG4Birks) { InitialiseG4materials(); }
for(size_t i=0; i<nMaterials; ++i) {
for(std::size_t i=0; i<nMaterials; ++i) {
InitialiseBirksCoefficient((*G4Material::GetMaterialTable())[i]);
}
if(verbose > 0) { DumpBirksCoefficients(); }
@@ -214,8 +214,8 @@ void G4EmSaturation::InitialiseBirksCoefficient(const G4Material* mat)
G4double norm = 0.0;
const G4ElementVector* theElementVector = mat->GetElementVector();
const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume();
size_t nelm = mat->GetNumberOfElements();
for (size_t i=0; i<nelm; ++i) {
std::size_t nelm = mat->GetNumberOfElements();
for (std::size_t i=0; i<nelm; ++i) {
const G4Element* elm = (*theElementVector)[i];
G4double Z = elm->GetZ();
G4double w = Z*Z*theAtomNumDensityVector[i];
@@ -227,7 +227,7 @@ void G4EmSaturation::InitialiseBirksCoefficient(const G4Material* mat)
curChargeSq /= norm;
// store results
G4int idx = mat->GetIndex();
std::size_t idx = mat->GetIndex();
massFactors[idx] = curRatio;
effCharges[idx] = curChargeSq;
}
@@ -238,7 +238,7 @@ void G4EmSaturation::DumpBirksCoefficients()
{
G4cout << "### Birks coefficients used in run time" << G4endl;
const G4MaterialTable* mtable = G4Material::GetMaterialTable();
for(size_t i=0; i<nMaterials; ++i) {
for(std::size_t i=0; i<nMaterials; ++i) {
const G4Material* mat = (*mtable)[i];
G4double br = mat->GetIonisation()->GetBirksConstant();
if(br > 0.0) {
@@ -209,7 +209,7 @@ void G4EmTableUtil::BuildLambdaTable(G4VEmProcess* proc,
// Access to materials
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
std::size_t numOfCouples = theCoupleTable->GetTableSize();
G4PhysicsLogVector* aVector = nullptr;
G4PhysicsLogVector* aVectorPrim = nullptr;
@@ -217,12 +217,12 @@ void G4EmTableUtil::BuildLambdaTable(G4VEmProcess* proc,
G4double emax1 = std::min(maxKinEnergy, minKinEnergyPrim);
for(size_t i=0; i<numOfCouples; ++i) {
for(std::size_t i=0; i<numOfCouples; ++i) {
if (bld->GetFlag(i)) {
// create physics vector and fill it
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
theCoupleTable->GetMaterialCutsCouple((G4int)i);
// build main table
if(nullptr != theLambdaTable) {
@@ -297,14 +297,14 @@ void G4EmTableUtil::BuildLambdaTable(G4VEnergyLossProcess* proc,
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
std::size_t numOfCouples = theCoupleTable->GetTableSize();
G4PhysicsLogVector* aVector = nullptr;
for(size_t i=0; i<numOfCouples; ++i) {
for(std::size_t i=0; i<numOfCouples; ++i) {
if (bld->GetFlag(i)) {
// create physics vector and fill it
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
theCoupleTable->GetMaterialCutsCouple((G4int)i);
delete (*theLambdaTable)[i];
G4bool startNull = true;
@@ -359,8 +359,8 @@ G4EmTableUtil::CheckIon(G4VEnergyLossProcess* proc,
if(particle != theGIon) {
G4ProcessManager* pm = theGIon->GetProcessManager();
G4ProcessVector* v = pm->GetAlongStepProcessVector();
size_t n = v->size();
for(size_t j=0; j<n; ++j) {
G4int n = (G4int)v->size();
for(G4int j=0; j<n; ++j) {
if((*v)[j] == proc) {
particle = theGIon;
break;
@@ -453,7 +453,7 @@ void G4EmTableUtil::BuildDEDXTable(G4VEnergyLossProcess* proc,
// Access to materials
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t numOfCouples = theCoupleTable->GetTableSize();
std::size_t numOfCouples = theCoupleTable->GetTableSize();
if(1 < verbose) {
G4cout << numOfCouples << " couples" << " minKinEnergy(MeV)= " << emin
@@ -462,7 +462,7 @@ void G4EmTableUtil::BuildDEDXTable(G4VEnergyLossProcess* proc,
G4PhysicsLogVector* aVector = nullptr;
G4PhysicsLogVector* bVector = nullptr;
for(size_t i=0; i<numOfCouples; ++i) {
for(std::size_t i=0; i<numOfCouples; ++i) {
if(1 < verbose) {
G4cout << "G4VEnergyLossProcess::BuildDEDXVector idx= " << i
@@ -473,7 +473,7 @@ void G4EmTableUtil::BuildDEDXTable(G4VEnergyLossProcess* proc,
// create physics vector and fill it
const G4MaterialCutsCouple* couple =
theCoupleTable->GetMaterialCutsCouple(i);
theCoupleTable->GetMaterialCutsCouple((G4int)i);
delete (*table)[i];
if(nullptr != bVector) {
aVector = new G4PhysicsLogVector(*bVector);
@@ -66,12 +66,12 @@ G4EmUtility::FindRegion(const G4String& regionName, const G4int verbose)
const G4Element* G4EmUtility::SampleRandomElement(const G4Material* mat)
{
const G4Element* elm = mat->GetElement(0);
size_t nElements = mat->GetNumberOfElements();
std::size_t nElements = mat->GetNumberOfElements();
if(1 < nElements) {
G4double x = mat->GetTotNbOfElectPerVolume()*G4UniformRand();
const G4double* y = mat->GetVecNbOfAtomsPerVolume();
for(size_t i=0; i<nElements; ++i) {
elm = mat->GetElement(i);
for(std::size_t i=0; i<nElements; ++i) {
elm = mat->GetElement((G4int)i);
x -= y[i]*elm->GetZ();
if(x <= 0.0) { break; }
}
@@ -83,15 +83,15 @@ const G4Element* G4EmUtility::SampleRandomElement(const G4Material* mat)
const G4Isotope* G4EmUtility::SampleRandomIsotope(const G4Element* elm)
{
const size_t ni = elm->GetNumberOfIsotopes();
const std::size_t ni = elm->GetNumberOfIsotopes();
const G4Isotope* iso = elm->GetIsotope(0);
if(ni > 1) {
const G4double* ab = elm->GetRelativeAbundanceVector();
G4double x = G4UniformRand();
for(size_t idx=0; idx<ni; ++idx) {
for(std::size_t idx=0; idx<ni; ++idx) {
x -= ab[idx];
if (x <= 0.0) {
iso = elm->GetIsotope(idx);
iso = elm->GetIsotope((G4int)idx);
break;
}
}
@@ -106,7 +106,7 @@ std::vector<G4double>* G4EmUtility::FindCrossSectionMax(G4PhysicsTable* p)
std::vector<G4double>* ptr = nullptr;
if(nullptr == p) { return ptr; }
const G4int n = p->length();
const std::size_t n = p->length();
ptr = new std::vector<G4double>;
ptr->resize(n, DBL_MAX);
@@ -114,11 +114,11 @@ std::vector<G4double>* G4EmUtility::FindCrossSectionMax(G4PhysicsTable* p)
G4double e, ss, ee, xs;
// first loop on existing vectors
for (G4int i=0; i<n; ++i) {
for (std::size_t i=0; i<n; ++i) {
const G4PhysicsVector* pv = (*p)[i];
xs = ee = 0.0;
if(nullptr != pv) {
G4int nb = pv->GetVectorLength();
G4int nb = (G4int)pv->GetVectorLength();
for (G4int j=0; j<nb; ++j) {
e = pv->Energy(j);
ss = (*pv)(j);
@@ -161,7 +161,7 @@ G4EmUtility::FindCrossSectionMax(G4VDiscreteProcess* p,
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
size_t n = theCoupleTable->GetTableSize();
std::size_t n = theCoupleTable->GetTableSize();
ptr = new std::vector<G4double>;
ptr->resize(n, DBL_MAX);
@@ -171,8 +171,8 @@ G4EmUtility::FindCrossSectionMax(G4VDiscreteProcess* p,
G4double e, sig, ee, x, sm, em, emin, emax;
// first loop on existing vectors
for (size_t i=0; i<n; ++i) {
auto couple = theCoupleTable->GetMaterialCutsCouple(i);
for (std::size_t i=0; i<n; ++i) {
auto couple = theCoupleTable->GetMaterialCutsCouple((G4int)i);
emin = std::max(p->MinPrimaryEnergy(part, couple->GetMaterial()), tmin);
emax = std::max(tmax, 2*emin);
ee = G4Log(emax/emin);
@@ -213,7 +213,7 @@ G4EmUtility::FillPeaksStructure(G4PhysicsTable* p, G4LossTableBuilder* bld)
std::vector<G4TwoPeaksXS*>* ptr = nullptr;
if(nullptr == p) { return ptr; }
const G4int n = p->length();
const G4int n = (G4int)p->length();
ptr = new std::vector<G4TwoPeaksXS*>;
ptr->resize(n, nullptr);
@@ -227,7 +227,7 @@ G4EmUtility::FillPeaksStructure(G4PhysicsTable* p, G4LossTableBuilder* bld)
ee = xs = 0.0;
e1peak = e1deep = e2peak = e2deep = e3peak = DBL_MAX;
if(nullptr != pv) {
G4int nb = pv->GetVectorLength();
G4int nb = (G4int)pv->GetVectorLength();
for (G4int j=0; j<nb; ++j) {
e = pv->Energy(j);
ss = (*pv)(j);
@@ -344,28 +344,28 @@ void G4EmUtility::InitialiseElementSelectors(G4VEmModel* mod,
G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
G4int numOfCouples = theCoupleTable->GetTableSize();
std::size_t numOfCouples = theCoupleTable->GetTableSize();
// prepare vector
auto elmSelectors = mod->GetElementSelectors();
if(nullptr == elmSelectors) {
elmSelectors = new std::vector<G4EmElementSelector*>;
}
G4int nSelectors = elmSelectors->size();
std::size_t nSelectors = elmSelectors->size();
if(numOfCouples > nSelectors) {
for(G4int i=nSelectors; i<numOfCouples; ++i) {
for(std::size_t i=nSelectors; i<numOfCouples; ++i) {
elmSelectors->push_back(nullptr);
}
nSelectors = numOfCouples;
}
// initialise vector
for(G4int i=0; i<numOfCouples; ++i) {
for(std::size_t i=0; i<numOfCouples; ++i) {
// no need in element selectors for infinite cuts
if(cuts[i] == DBL_MAX) { continue; }
auto couple = theCoupleTable->GetMaterialCutsCouple(i);
auto couple = theCoupleTable->GetMaterialCutsCouple((G4int)i);
auto mat = couple->GetMaterial();
mod->SetCurrentCouple(couple);
@@ -227,7 +227,7 @@ G4double G4EnergyLossTables::GetDEDX(
return 0.0;
}
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t->theMassRatio;
G4double dEdx;
G4bool isOut;
@@ -276,7 +276,7 @@ G4double G4EnergyLossTables::GetLabTime(
}
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t->theMassRatio;
G4double time;
G4bool isOut;
@@ -331,7 +331,7 @@ G4double G4EnergyLossTables::GetDeltaLabTime(
G4double timestart,timeend,deltatime,dTT;
G4bool isOut;
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergyStart*t->theMassRatio;
if (scaledKineticEnergy<t->theLowestKineticEnergy) {
@@ -410,7 +410,7 @@ G4double G4EnergyLossTables::GetProperTime(
}
const G4double parlowen=0.4 , ppar=0.5-parlowen ;
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t->theMassRatio;
G4double time;
G4bool isOut;
@@ -465,7 +465,7 @@ G4double G4EnergyLossTables::GetDeltaProperTime(
G4double timestart,timeend,deltatime,dTT;
G4bool isOut;
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergyStart*t->theMassRatio;
if (scaledKineticEnergy<t->theLowestKineticEnergy) {
@@ -547,7 +547,7 @@ G4double G4EnergyLossTables::GetRange(
return 0.0;
}
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t->theMassRatio;
G4double Range;
G4bool isOut;
@@ -606,7 +606,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
G4double scaledrange,scaledKineticEnergy ;
G4bool isOut ;
G4int materialIndex = aMaterial->GetIndex() ;
G4int materialIndex = (G4int)aMaterial->GetIndex() ;
if(materialIndex != oldIndex)
{
@@ -670,7 +670,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
return 0.0;
}
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double scaledKineticEnergy = KineticEnergy*t->theMassRatio;
G4double dEdx;
G4bool isOut;
@@ -721,7 +721,7 @@ G4double G4EnergyLossTables::GetPreciseEnergyFromRange(
ParticleHaveNoLoss(aParticle,"Range");
return 0.0;
}
G4int materialIndex = aMaterial->GetIndex();
G4int materialIndex = (G4int)aMaterial->GetIndex();
G4double Thighr = t->theHighestKineticEnergy*t->theLowestKineticEnergy/
(*rangeTable)(materialIndex)->
@@ -129,7 +129,7 @@ const std::vector<G4double>* G4LossTableBuilder::GetDensityFactors() const
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool G4LossTableBuilder::GetFlag(size_t idx)
G4bool G4LossTableBuilder::GetFlag(std::size_t idx)
{
if(theFlag->empty()) { InitialiseBaseMaterials(); }
return (idx < theFlag->size()) ? (*theFlag)[idx] : false;
@@ -150,22 +150,22 @@ G4LossTableBuilder::BuildDEDXTable(G4PhysicsTable* dedxTable,
const std::vector<G4PhysicsTable*>& list)
{
InitialiseBaseMaterials(dedxTable);
size_t n_processes = list.size();
std::size_t n_processes = list.size();
if(1 >= n_processes) { return; }
size_t nCouples = dedxTable->size();
std::size_t nCouples = dedxTable->size();
//G4cout << "Nproc= " << n_processes << " nCouples=" << nCouples << " Nv= "
// << dedxTable->size() << G4endl;
if(0 >= nCouples) { return; }
for (size_t i=0; i<nCouples; ++i) {
for (std::size_t i=0; i<nCouples; ++i) {
auto pv0 = static_cast<G4PhysicsLogVector*>((*(list[0]))[i]);
if(pv0 == nullptr) { continue; }
size_t npoints = pv0->GetVectorLength();
std::size_t npoints = pv0->GetVectorLength();
auto pv = new G4PhysicsLogVector(*pv0);
for (size_t j=0; j<npoints; ++j) {
for (std::size_t j=0; j<npoints; ++j) {
G4double dedx = 0.0;
for (size_t k=0; k<n_processes; ++k) {
for (std::size_t k=0; k<n_processes; ++k) {
const G4PhysicsVector* pv1 = (*(list[k]))[i];
dedx += (*pv1)[j];
}
@@ -304,7 +304,7 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
*/
// define base material flag
if(isBaseMatActive && !baseMatFlag) {
for(std::size_t i=0; i<nCouples; ++i) {
for(G4int i=0; i<(G4int)nCouples; ++i) {
if(nullptr != theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial()->GetBaseMaterial()) {
baseMatFlag = true;
isInitialized = false;
@@ -326,14 +326,14 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
}
// define default flag and index of used material cut couple
for(std::size_t i=0; i<nCouples; ++i) {
for(G4int i=0; i<(G4int)nCouples; ++i) {
(*theFlag)[i] = table->GetFlag(i);
if(baseMatFlag) { (*theDensityIdx)[i] = i; }
}
isInitialized = true;
if(baseMatFlag) {
// use base materials
for(std::size_t i=0; i<nCouples; ++i) {
for(G4int i=0; i<(G4int)nCouples; ++i) {
// base material is needed only for a couple which is not
// initialised and for which tables will be computed
auto couple = theCoupleTable->GetMaterialCutsCouple(i);
@@ -343,7 +343,7 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
// base material exists - find it and check if it can be reused
if(nullptr != bmat) {
for(std::size_t j=0; j<nCouples; ++j) {
for(G4int j=0; j<(G4int)nCouples; ++j) {
if(j == i) { continue; }
auto bcouple = theCoupleTable->GetMaterialCutsCouple(j);
@@ -368,7 +368,7 @@ void G4LossTableBuilder::InitialiseBaseMaterials(const G4PhysicsTable* table)
/*
G4cout << "### G4LossTableBuilder::InitialiseBaseMaterials: flag="
<< baseMatFlag << G4endl;
for(size_t i=0; i<nCouples; ++i) {
for(std::size_t i=0; i<nCouples; ++i) {
G4cout << "CoupleIdx=" << i << " Flag= " << (*theFlag)[i] << " "
<< theCoupleTable->GetMaterialCutsCouple(i)->GetMaterial()->GetName()
<< " TableFlag= " << table->GetFlag(i)
@@ -406,7 +406,7 @@ G4LossTableBuilder::BuildTableForModel(G4PhysicsTable* aTable,
G4PhysicsLogVector* aVector = nullptr;
for(std::size_t i=0; i<numOfCouples; ++i) {
for(G4int i=0; i<(G4int)numOfCouples; ++i) {
if ((*theFlag)[i]) {
// create physics vector and fill it
@@ -100,25 +100,25 @@ G4LossTableManager::~G4LossTableManager()
for (G4int i=0; i<n_loss; ++i) {
delete loss_vector[i];
}
size_t msc = msc_vector.size();
for (size_t j=0; j<msc; ++j) {
std::size_t msc = msc_vector.size();
for (std::size_t j=0; j<msc; ++j) {
delete msc_vector[j];
}
size_t emp = emp_vector.size();
for (size_t k=0; k<emp; ++k) {
std::size_t emp = emp_vector.size();
for (std::size_t k=0; k<emp; ++k) {
delete emp_vector[k];
}
emp = p_vector.size();
for (size_t k=0; k<emp; ++k) {
for (std::size_t k=0; k<emp; ++k) {
delete p_vector[k];
}
size_t mod = mod_vector.size();
size_t fmod = fmod_vector.size();
std::size_t mod = mod_vector.size();
std::size_t fmod = fmod_vector.size();
//G4cout << " Nmod" << mod << " Nfluc= " << fmod << G4endl;
for (size_t a=0; a<mod; ++a) {
for (std::size_t a=0; a<mod; ++a) {
//G4cout << "Delete model #" << a << " " << mod_vector[a] << G4endl;
if( nullptr != mod_vector[a] ) {
for (size_t b=0; b<fmod; ++b) {
for (std::size_t b=0; b<fmod; ++b) {
if((G4VEmModel*)(fmod_vector[b]) == mod_vector[a]) {
fmod_vector[b] = nullptr;
}
@@ -127,7 +127,7 @@ G4LossTableManager::~G4LossTableManager()
mod_vector[a] = nullptr;
}
}
for (size_t b=0; b<fmod; ++b) {
for (std::size_t b=0; b<fmod; ++b) {
delete fmod_vector[b];
}
Clear();
@@ -254,8 +254,8 @@ void G4LossTableManager::DeRegister(G4VEnergyLossProcess* p)
void G4LossTableManager::Register(G4VMultipleScattering* p)
{
if(!p) { return; }
G4int n = msc_vector.size();
for (G4int i=0; i<n; ++i) {
std::size_t n = msc_vector.size();
for (std::size_t i=0; i<n; ++i) {
if(msc_vector[i] == p) { return; }
}
if(verbose > 1) {
@@ -270,8 +270,8 @@ void G4LossTableManager::Register(G4VMultipleScattering* p)
void G4LossTableManager::DeRegister(G4VMultipleScattering* p)
{
if(!p) { return; }
size_t msc = msc_vector.size();
for (size_t i=0; i<msc; ++i) {
std::size_t msc = msc_vector.size();
for (std::size_t i=0; i<msc; ++i) {
if(msc_vector[i] == p) {
msc_vector[i] = nullptr;
break;
@@ -284,8 +284,8 @@ void G4LossTableManager::DeRegister(G4VMultipleScattering* p)
void G4LossTableManager::Register(G4VEmProcess* p)
{
if(!p) { return; }
G4int n = emp_vector.size();
for (G4int i=0; i<n; ++i) {
std::size_t n = emp_vector.size();
for (std::size_t i=0; i<n; ++i) {
if(emp_vector[i] == p) { return; }
}
if(verbose > 1) {
@@ -300,8 +300,8 @@ void G4LossTableManager::Register(G4VEmProcess* p)
void G4LossTableManager::DeRegister(G4VEmProcess* p)
{
if(!p) { return; }
size_t emp = emp_vector.size();
for (size_t i=0; i<emp; ++i) {
std::size_t emp = emp_vector.size();
for (std::size_t i=0; i<emp; ++i) {
if(emp_vector[i] == p) {
emp_vector[i] = nullptr;
break;
@@ -314,8 +314,8 @@ void G4LossTableManager::DeRegister(G4VEmProcess* p)
void G4LossTableManager::Register(G4VProcess* p)
{
if(!p) { return; }
G4int n = p_vector.size();
for (G4int i=0; i<n; ++i) {
std::size_t n = p_vector.size();
for (std::size_t i=0; i<n; ++i) {
if(p_vector[i] == p) { return; }
}
if(verbose > 1) {
@@ -330,8 +330,8 @@ void G4LossTableManager::Register(G4VProcess* p)
void G4LossTableManager::DeRegister(G4VProcess* p)
{
if(!p) { return; }
size_t emp = p_vector.size();
for (size_t i=0; i<emp; ++i) {
std::size_t emp = p_vector.size();
for (std::size_t i=0; i<emp; ++i) {
if(p_vector[i] == p) {
p_vector[i] = nullptr;
break;
@@ -355,8 +355,8 @@ void G4LossTableManager::Register(G4VEmModel* p)
void G4LossTableManager::DeRegister(G4VEmModel* p)
{
//G4cout << "G4LossTableManager::DeRegister G4VEmModel : " << p << G4endl;
size_t n = mod_vector.size();
for (size_t i=0; i<n; ++i) {
std::size_t n = mod_vector.size();
for (std::size_t i=0; i<n; ++i) {
if(mod_vector[i] == p) {
mod_vector[i] = nullptr;
break;
@@ -379,8 +379,8 @@ void G4LossTableManager::Register(G4VEmFluctuationModel* p)
void G4LossTableManager::DeRegister(G4VEmFluctuationModel* p)
{
size_t n = fmod_vector.size();
for (size_t i=0; i<n; ++i) {
std::size_t n = fmod_vector.size();
for (std::size_t i=0; i<n; ++i) {
if(fmod_vector[i] == p) { fmod_vector[i] = nullptr; }
}
}
@@ -416,8 +416,6 @@ void G4LossTableManager::RegisterExtraParticle(
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;
@@ -425,8 +423,9 @@ G4LossTableManager::GetEnergyLossProcess(const G4ParticleDefinition *aParticle)
currentLoss = (*pos).second;
} else {
currentLoss = nullptr;
if ((pos = loss_map.find(theGenericIon)) != loss_map.end()) {
currentLoss = (*pos).second;
if(0.0 != aParticle->GetPDGCharge() &&
(pos = loss_map.find(theGenericIon)) != loss_map.end()) {
currentLoss = (*pos).second;
}
}
}
@@ -796,7 +795,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(
G4ProcessVector* pvec =
aParticle->GetProcessManager()->GetProcessList();
G4int nvec = pvec->size();
G4int nvec = (G4int)pvec->size();
for (i=0; i<n_loss; ++i) {
p = loss_vector[i];
@@ -839,7 +838,7 @@ G4VEnergyLossProcess* G4LossTableManager::BuildTables(
}
}
G4int n_dedx = t_list.size();
G4int n_dedx = (G4int)t_list.size();
if (0 == n_dedx || !em) {
G4cout << "G4LossTableManager WARNING: no DEDX processes for "
<< aParticle->GetParticleName() << G4endl;
@@ -477,7 +477,7 @@ void G4OpticalParameters::PrintWarning(G4ExceptionDescription& ed) const
void G4OpticalParameters::StreamInfo(std::ostream& os) const
{
G4int prec = os.precision(5);
G4long prec = os.precision(5);
os
<< "======================================================================="
<< "\n";
@@ -208,6 +208,9 @@ void G4TransportationWithMsc::StartTracking(G4Track* track)
msc->StartTracking(track);
msc->SetIonisation(ionisation, currParticle);
}
// Ensure that field propagation state is also cleared / prepared
G4Transportation::StartTracking(track);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -90,10 +90,10 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
// Define list of couples
theCoupleTable = G4ProductionCutsTable::GetProductionCutsTable();
nCouples = theCoupleTable->GetTableSize();
nCouples = (G4int)theCoupleTable->GetTableSize();
// needed for unit tests
size_t nn = std::max(nCouples, 1);
std::size_t nn = std::max(nCouples, 1);
if(activeDeexcitationMedia.size() != nn) {
activeDeexcitationMedia.resize(nn, false);
activeAugerMedia.resize(nn, false);
@@ -109,7 +109,7 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
ignoreCuts = theParameters->DeexcitationIgnoreCut();
// Define list of regions
size_t nRegions = deRegions.size();
std::size_t nRegions = deRegions.size();
// check if deexcitation is active for the given run
if(!isActive && 0 == nRegions) { return; }
@@ -129,7 +129,7 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
// Identify active media
const G4RegionStore* regionStore = G4RegionStore::GetInstance();
for(size_t j=0; j<nRegions; ++j) {
for(std::size_t j=0; j<nRegions; ++j) {
const G4Region* reg = regionStore->GetRegion(activeRegions[j], false);
if(nullptr != reg && 0 < nCouples) {
const G4ProductionCuts* rpcuts = reg->GetProductionCuts();
@@ -149,9 +149,9 @@ void G4VAtomDeexcitation::InitialiseAtomicDeexcitation()
}
}
}
G4int nelm = G4Element::GetNumberOfElements();
std::size_t nelm = G4Element::GetNumberOfElements();
//G4cout << nelm << G4endl;
for(G4int k=0; k<nelm; ++k) {
for(std::size_t k=0; k<nelm; ++k) {
G4int Z = (*(G4Element::GetElementTable()))[k]->GetZasInt();
if(Z > 5 && Z < 93) {
activeZ[Z] = true;
@@ -200,8 +200,8 @@ G4VAtomDeexcitation::SetDeexcitationActiveRegion(const G4String& rname,
if(ss == "world" || ss == "World" || ss == "WORLD") {
ss = "DefaultRegionForTheWorld";
}
size_t n = deRegions.size();
for(size_t i=0; i<n; ++i) {
std::size_t n = deRegions.size();
for(std::size_t i=0; i<n; ++i) {
// Region already exist
if(ss == activeRegions[i]) {
@@ -221,8 +221,8 @@ G4VAtomDeexcitation::SetDeexcitationActiveRegion(const G4String& rname,
// it should be active for all G4Regions
if(ss == "DefaultRegionForTheWorld") {
G4RegionStore* regions = G4RegionStore::GetInstance();
G4int nn = regions->size();
for(G4int i=0; i<nn; ++i) {
std::size_t nn = regions->size();
for(std::size_t i=0; i<nn; ++i) {
if(ss == (*regions)[i]->GetName()) { continue; }
SetDeexcitationActiveRegion((*regions)[i]->GetName(), valDeexcitation,
valAuger, valPIXE);
@@ -294,10 +294,10 @@ G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
const G4ElementVector* theElementVector = material->GetElementVector();
const G4double* theAtomNumDensityVector =
material->GetVecNbOfAtomsPerVolume();
const G4int nelm = material->GetNumberOfElements();
const std::size_t nelm = material->GetNumberOfElements();
// loop over deexcitations
for(G4int i=0; i<nelm; ++i) {
for(std::size_t i=0; i<nelm; ++i) {
G4int Z = (*theElementVector)[i]->GetZasInt();
if(activeZ[Z] && Z < 93) {
G4int nshells =
@@ -327,11 +327,11 @@ G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
// sample deexcitation
vdyn.clear();
GenerateParticles(&vdyn, shell, Z, gCut, eCut);
G4int nsec = vdyn.size();
std::size_t nsec = vdyn.size();
if(nsec > 0) {
G4ThreeVector r = prePos + stot*delta;
G4double time = preTime + stot*dt;
for(G4int j=0; j<nsec; ++j) {
for(std::size_t j=0; j<nsec; ++j) {
G4DynamicParticle* dp = vdyn[j];
G4double e = dp->GetKineticEnergy();
@@ -154,8 +154,8 @@ void G4VEmModel::InitialiseForMaterial(const G4ParticleDefinition* part,
const G4Material* material)
{
if(material != nullptr) {
size_t n = material->GetNumberOfElements();
for(size_t i=0; i<n; ++i) {
G4int n = (G4int)material->GetNumberOfElements();
for(G4int i=0; i<n; ++i) {
G4int Z = material->GetElement(i)->GetZasInt();
InitialiseForElement(part, Z);
}
@@ -186,7 +186,7 @@ G4double G4VEmModel::CrossSectionPerVolume(const G4Material* mat,
{
SetupForMaterial(p, mat, ekin);
const G4double* theAtomNumDensityVector = mat->GetVecNbOfAtomsPerVolume();
G4int nelm = mat->GetNumberOfElements();
G4int nelm = (G4int)mat->GetNumberOfElements();
if(nelm > nsec) {
xsec.resize(nelm);
nsec = nelm;
@@ -222,12 +222,12 @@ const G4Element* G4VEmModel::SelectRandomAtom(const G4Material* mat,
G4double tcut,
G4double tmax)
{
size_t n = mat->GetNumberOfElements();
G4int n = (G4int)mat->GetNumberOfElements();
fCurrentElement = mat->GetElement(0);
if (n > 1) {
const G4double x = G4UniformRand()*
G4VEmModel::CrossSectionPerVolume(mat,pd,kinEnergy,tcut,tmax);
for(size_t i=0; i<n; ++i) {
for(G4int i=0; i<n; ++i) {
if (x <= xsec[i]) {
fCurrentElement = mat->GetElement(i);
break;
@@ -282,7 +282,7 @@ void G4VEmProcess::StreamInfo(std::ostream& out,
out << " Lambda table from ";
G4double emin = v->Energy(0);
G4double emax = v->GetMaxEnergy();
G4int nbin = v->GetVectorLength() - 1;
G4int nbin = G4int(v->GetVectorLength() - 1);
if(emin > minKinEnergy) { out << "threshold "; }
else { out << G4BestUnit(emin,"Energy"); }
out << " to "
@@ -377,8 +377,8 @@ G4double G4VEmProcess::PostStepGetPhysicalInteractionLength(
if(biasManager) {
if(0 == track.GetParentID()) {
if(biasFlag &&
biasManager->ForcedInteractionRegion(currentCoupleIndex)) {
return biasManager->GetStepLimit(currentCoupleIndex, previousStepSize);
biasManager->ForcedInteractionRegion((G4int)currentCoupleIndex)) {
return biasManager->GetStepLimit((G4int)currentCoupleIndex, previousStepSize);
}
}
}
@@ -472,7 +472,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
// forced process - should happen only once per track
if(biasFlag) {
if(biasManager->ForcedInteractionRegion(currentCoupleIndex)) {
if(biasManager->ForcedInteractionRegion((G4int)currentCoupleIndex)) {
biasFlag = false;
}
}
@@ -526,15 +526,15 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
track.GetDynamicParticle(),
(*theCuts)[currentCoupleIndex]);
G4int num0 = secParticles.size();
G4int num0 = (G4int)secParticles.size();
// splitting or Russian roulette
if(biasManager) {
if(biasManager->SecondaryBiasingRegion(currentCoupleIndex)) {
if(biasManager->SecondaryBiasingRegion((G4int)currentCoupleIndex)) {
G4double eloss = 0.0;
weight *= biasManager->ApplySecondaryBiasing(
secParticles, track, currentModel, &fParticleChange, eloss,
currentCoupleIndex, (*theCuts)[currentCoupleIndex],
(G4int)currentCoupleIndex, (*theCuts)[currentCoupleIndex],
step.GetPostStepPoint()->GetSafety());
if(eloss > 0.0) {
eloss += fParticleChange.GetLocalEnergyDeposit();
@@ -544,7 +544,7 @@ G4VParticleChange* G4VEmProcess::PostStepDoIt(const G4Track& track,
}
// save secondaries
G4int num = secParticles.size();
G4int num = (G4int)secParticles.size();
if(num > 0) {
fParticleChange.SetNumberOfSecondaries(num);
@@ -498,7 +498,7 @@ void G4VEnergyLossProcess::StreamInfo(std::ostream& out,
<< " regions" << G4endl;
}
if(2 < verboseLevel) {
for(size_t i=0; i<7; ++i) {
for(std::size_t i=0; i<7; ++i) {
auto ta = theData->Table(i);
out << " " << tnames[i] << " address: " << ta << G4endl;
if(nullptr != ta) { out << *ta << G4endl; }
@@ -622,13 +622,17 @@ G4double G4VEnergyLossProcess::PostStepGetPhysicalInteractionLength(
reduceFactor = 1.0/(fFactor*massRatio);
chargeSqRatio = q2;
}
if (lossFluctuationFlag) {
auto fluc = currentModel->GetModelOfFluctuations();
fluc->SetParticleAndCharge(track.GetDefinition(), q2);
}
}
// forced biasing only for primary particles
if(biasManager) {
if(0 == track.GetParentID() && biasFlag &&
biasManager->ForcedInteractionRegion(currentCoupleIndex)) {
return biasManager->GetStepLimit(currentCoupleIndex, previousStepSize);
biasManager->ForcedInteractionRegion((G4int)currentCoupleIndex)) {
return biasManager->GetStepLimit((G4int)currentCoupleIndex, previousStepSize);
}
}
@@ -809,7 +813,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
eloss = preStepKinEnergy;
if (useDeexcitation) {
atomDeexcitation->AlongStepDeexcitation(scTracks, step,
eloss, currentCoupleIndex);
eloss, (G4int)currentCoupleIndex);
if(scTracks.size() > 0) { FillSecondariesAlongStep(weight); }
eloss = std::max(eloss, 0.0);
}
@@ -885,7 +889,7 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
G4double esecfluo = preStepKinEnergy;
G4double de = esecfluo;
atomDeexcitation->AlongStepDeexcitation(scTracks, step,
de, currentCoupleIndex);
de, (G4int)currentCoupleIndex);
// sum of de-excitation energies
esecfluo -= de;
@@ -938,21 +942,21 @@ G4VParticleChange* G4VEnergyLossProcess::AlongStepDoIt(const G4Track& track,
void G4VEnergyLossProcess::FillSecondariesAlongStep(G4double wt)
{
const G4int n0 = scTracks.size();
const std::size_t n0 = scTracks.size();
G4double weight = wt;
// weight may be changed by biasing manager
if(biasManager) {
if(biasManager->SecondaryBiasingRegion(currentCoupleIndex)) {
if(biasManager->SecondaryBiasingRegion((G4int)currentCoupleIndex)) {
weight *=
biasManager->ApplySecondaryBiasing(scTracks, currentCoupleIndex);
biasManager->ApplySecondaryBiasing(scTracks, (G4int)currentCoupleIndex);
}
}
// fill secondaries
const G4int n = scTracks.size();
fParticleChange.SetNumberOfSecondaries(n);
const std::size_t n = scTracks.size();
fParticleChange.SetNumberOfSecondaries((G4int)n);
for(G4int i=0; i<n; ++i) {
for(std::size_t i=0; i<n; ++i) {
G4Track* t = scTracks[i];
if(nullptr != t) {
t->SetWeight(weight);
@@ -988,7 +992,7 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
*/
// forced process - should happen only once per track
if(biasFlag) {
if(biasManager->ForcedInteractionRegion(currentCoupleIndex)) {
if(biasManager->ForcedInteractionRegion((G4int)currentCoupleIndex)) {
biasFlag = false;
}
}
@@ -1020,17 +1024,17 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
secParticles.clear();
currentModel->SampleSecondaries(&secParticles, currentCouple, dp, tcut);
const G4int num0 = secParticles.size();
const G4int num0 = (G4int)secParticles.size();
// bremsstrahlung splitting or Russian roulette
if(biasManager) {
if(biasManager->SecondaryBiasingRegion(currentCoupleIndex)) {
if(biasManager->SecondaryBiasingRegion((G4int)currentCoupleIndex)) {
G4double eloss = 0.0;
weight *= biasManager->ApplySecondaryBiasing(
secParticles,
track, currentModel,
&fParticleChange, eloss,
currentCoupleIndex, tcut,
(G4int)currentCoupleIndex, tcut,
step.GetPostStepPoint()->GetSafety());
if(eloss > 0.0) {
eloss += fParticleChange.GetLocalEnergyDeposit();
@@ -1040,7 +1044,7 @@ G4VParticleChange* G4VEnergyLossProcess::PostStepDoIt(const G4Track& track,
}
// save secondaries
const G4int num = secParticles.size();
const G4int num = (G4int)secParticles.size();
if(num > 0) {
fParticleChange.SetNumberOfSecondaries(num);
@@ -1104,7 +1108,7 @@ G4bool G4VEnergyLossProcess::StorePhysicsTable(
const G4ParticleDefinition* part, const G4String& dir, G4bool ascii)
{
if (!isMaster || nullptr != baseParticle || part != particle ) return true;
for(size_t i=0; i<7; ++i) {
for(std::size_t i=0; i<7; ++i) {
if(nullptr != theData->Table(i)) {
if(1 < verboseLevel) {
G4cout << "G4VEnergyLossProcess::StorePhysicsTable i=" << i
@@ -1128,7 +1132,7 @@ G4VEnergyLossProcess::RetrievePhysicsTable(const G4ParticleDefinition* part,
const G4String& dir, G4bool ascii)
{
if (!isMaster || nullptr != baseParticle || part != particle ) return true;
for(size_t i=0; i<7; ++i) {
for(std::size_t i=0; i<7; ++i) {
if(!G4EmTableUtil::RetrieveTable(this, part, theData->Table(i), dir, tnames[i],
verboseLevel, ascii, spline)) {
return false;
@@ -103,7 +103,7 @@ G4VMscModel::GetParticleChangeForMSC(const G4ParticleDefinition* p)
emax = std::min(emax, param->MaxKinEnergy());
if(emin < emax) {
xSectionTable = builder->BuildTableForModel(xSectionTable, this, p,
emin, emax, true);
emin, emax, useSpline);
}
}
}
@@ -289,10 +289,8 @@ G4VMultipleScattering::PostStepGetPhysicalInteractionLength(
G4VParticleChange*
G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
{
fParticleChange.ProposeMomentumDirection(
step.GetPostStepPoint()->GetMomentumDirection());
fNewPosition = step.GetPostStepPoint()->GetPosition();
fParticleChange.ProposePosition(fNewPosition);
fParticleChange.InitialiseMSC(track, step);
fNewPosition = fParticleChange.GetProposedPosition();
fPositionChanged = false;
G4double geomLength = step.GetStepLength();
@@ -374,15 +372,6 @@ G4VMultipleScattering::AlongStepDoIt(const G4Track& track, const G4Step& step)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VParticleChange*
G4VMultipleScattering::PostStepDoIt(const G4Track& track, const G4Step&)
{
fParticleChange.Initialize(track);
return &fParticleChange;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4double G4VMultipleScattering::GetContinuousStepLimit(
const G4Track& track,
G4double previousStepSize,
@@ -88,10 +88,11 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
lastMat = material;
lastKinEnergy = kineticEnergy;
G4double mass = p->GetPDGMass();
G4double mass = p->GetPDGMass();
effCharge = p->GetPDGCharge();
G4int Zi = G4lrint(effCharge*inveplus);
chargeCorrection = 1.0;
if(Zi <= 1) { return effCharge; }
// The aproximation of ion effective charge from:
// J.F.Ziegler, J.P. Biersack, U. Littmark
@@ -103,7 +104,7 @@ G4double G4ionEffectiveCharge::EffectiveCharge(const G4ParticleDefinition* p,
//G4cout << "e= " << reducedEnergy << " Zi= " << Zi << " "
//<< material->GetName() << G4endl;
if(Zi <= 1 || reducedEnergy > effCharge*energyHighLimit ) {
if(reducedEnergy > effCharge*energyHighLimit ) {
return effCharge;
}
G4double z = material->GetIonisation()->GetZeffective();