Import Geant4 11.2.2 source tree

This commit is contained in:
Gabriele Cosmo
2024-06-21 15:46:33 +02:00
parent dda54bbdcf
commit f7b23877ed
411 changed files with 22817 additions and 21317 deletions
@@ -348,7 +348,7 @@ G4EmConfigurator::PrepareModels(const G4ParticleDefinition* aParticle,
if(n > 0) {
G4String particleName = aParticle->GetParticleName();
G4String processName = (nullptr == p) ? "msc" : p->GetProcessName();
G4String processName = (nullptr == p) ? G4String("msc") : p->GetProcessName();
for(size_t i=0; i<n; ++i) {
if(processName == processes[i]) {
if((particleName == particles[i]) ||
@@ -150,14 +150,16 @@ G4EmUtility::FindCrossSectionMax(G4VDiscreteProcess* p,
const G4ParticleDefinition* part)
{
std::vector<G4double>* ptr = nullptr;
if(nullptr == p || nullptr == part) { return ptr; }
/*
G4cout << "G4EmUtility::FindCrossSectionMax for "
<< p->GetProcessName() << " and " << part->GetParticleName() << G4endl;
*/
if (nullptr == p || nullptr == part) { return ptr; }
G4EmParameters* theParameters = G4EmParameters::Instance();
G4double tmin = theParameters->MinKinEnergy();
G4double tmax = theParameters->MaxKinEnergy();
const G4double tmin = theParameters->MinKinEnergy();
const G4double tmax = theParameters->MaxKinEnergy();
const G4double ee = G4Log(tmax/tmin);
const G4double scale = theParameters->NumberOfBinsPerDecade()/g4log10;
G4int nbin = static_cast<G4int>(ee*scale);
nbin = std::max(nbin, 4);
G4double x = G4Exp(ee/(G4double)nbin);
const G4ProductionCutsTable* theCoupleTable=
G4ProductionCutsTable::GetProductionCutsTable();
@@ -166,39 +168,28 @@ G4EmUtility::FindCrossSectionMax(G4VDiscreteProcess* p,
ptr->resize(n, DBL_MAX);
G4bool isPeak = false;
G4double scale = theParameters->NumberOfBinsPerDecade()/g4log10;
G4double e, sig, ee, x, sm, em, emin, emax;
// first loop on existing vectors
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);
G4int nbin = G4lrint(ee*scale);
if(nbin < 4) { nbin = 4; }
x = G4Exp(ee/nbin);
sm = 0.0;
em = 0.0;
e = emin;
for(G4int j=0; j<=nbin; ++j) {
sig = p->GetCrossSection(e, couple);
if(sig >= sm) {
const G4int nn = static_cast<G4int>(n);
for (G4int i=0; i<nn; ++i) {
G4double sm = 0.0;
G4double em = 0.0;
G4double e = tmin;
for (G4int j=0; j<=nbin; ++j) {
G4double sig = p->GetCrossSection(e, theCoupleTable->GetMaterialCutsCouple(i));
if (sig >= sm) {
em = e;
sm = sig;
e = (j+1 < nbin) ? e*x : emax;
e = (j+1 < nbin) ? e*x : tmax;
} else {
isPeak = true;
(*ptr)[i] = em;
break;
}
}
//G4cout << i << ". em=" << em << " sm=" << sm << G4endl;
}
// there is no peak for any couple
if(!isPeak) {
if (!isPeak) {
delete ptr;
ptr = nullptr;
}