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
@@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-11 Gabriele Cosmo (emdna-V11-01-26)
- Fixed compilation error on macOS/clang with C++23 enabled, for the use
of std::function in G4OctreeFinder.
## 2024-04-19 Gabriele Cosmo
- Fixed compilation error on Windows VC++ with C++20 Standard enabled.
Added missing declarations for TG4MoleculeShoot specialisations on G4Track.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2023-11-14 Ben Morgan (emdna-V11-01-25)
- Use G4FindDataDir to access data libraries in place of raw `getenv`.
@@ -27,14 +27,17 @@
#ifndef G4OctreeFinder_hh
#define G4OctreeFinder_hh 1
#include "globals.hh"
#include <map>
#include "G4Octree.hh"
#include "G4Track.hh"
#include "G4ITType.hh"
#include "G4memory.hh"
#include "G4TrackList.hh"
#include <map>
#include <functional>
#undef DEBUG
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class G4VFinder
@@ -144,4 +147,4 @@ public:
};
#include "G4OctreeFinder.icc"
#endif
#endif
@@ -110,6 +110,15 @@ protected:
void ShootAtFixedPosition(G4MoleculeGun*){}
};
template<>
void TG4MoleculeShoot<G4Track>::ShootAtRandomPosition(G4MoleculeGun* gun);
template<>
void TG4MoleculeShoot<G4Track>::ShootAtFixedPosition(G4MoleculeGun* gun);
template<>
void TG4MoleculeShoot<G4Track>::Shoot(G4MoleculeGun* gun);
template<typename TYPE>
G4shared_ptr<G4MoleculeShoot> G4MoleculeShoot::ChangeType()
{
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-06-06 V.Ivanchenko (emstand-V11-01-26)
- G4BetheHeitler5DModel - fixed computation of sinTheta
## 2024-05-28 V.Ivanchenko
- G4BetheHeitler5DModel - added checks on arguments of G4Exp in SampleSecondaries(..)
method to avoid FPE problems in the case of -O3 optimisation
## 2024-01-23 V.Ivanchenko (emstand-V11-01-25)
- G4IonICRU73Data - fixed bug #2586 for the case if target material has
an element with Z>92, improve debug printouts. In the Lindhard-Sorensen
@@ -388,7 +388,12 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
G4LorentzVector LeptonMinus;
G4double pdf = 0.;
G4double rndmv6[6];
G4double rndmv6[6] = {0.0};
const G4double corrFac = 1.0/(correctionIndex + 1.0);
const G4double expLowLim = -20.;
const G4double logLowLim = G4Exp(expLowLim/corrFac);
G4double z0, z1, z2, x0, x1;
G4double betheheitler, sinTheta, cosTheta, dum0;
// START Sampling
do {
@@ -399,18 +404,25 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
// integral y = pow(x,(c+1))/(c+1) @ x = 1 => y = 1 /(1+c)
// invCdf exp( log(y /* *( c + 1.0 )/ (c + 1.0 ) */ ) /( c + 1.0) )
//////////////////////////////////////////////////
const G4double X1 =
G4Exp(G4Log(rndmv6[0])/(correctionIndex + 1.0));
const G4double x0 = G4Exp(xl1 + (xu1 - xl1)*rndmv6[1]);
const G4double dum0 = 1./(1.+x0);
const G4double cosTheta = (x0-1.)*dum0;
const G4double sinTheta = std::sqrt(4.*x0)*dum0;
z0 = (rndmv6[0] > logLowLim) ? G4Log(rndmv6[0])*corrFac : expLowLim;
G4double X1 = (z0 > expLowLim) ? G4Exp(z0) : 0.0;
z1 = xl1 + (xu1 - xl1)*rndmv6[1];
if (z1 > expLowLim) {
x0 = G4Exp(z1);
dum0 = 1.0/(1.0 + x0);
x1 = dum0*x0;
cosTheta = -1.0 + 2.0*x1;
sinTheta = 2*std::sqrt(x1*(1.0 - x1));
} else {
x0 = 0.0;
dum0 = 1.0;
cosTheta = -1.0;
sinTheta = 0.0;
}
const G4double PairInvMass = PairInvMassMin*G4Exp(X1*X1*lnPairInvMassRange);
// G4double rndmv3[3];
// rndmEngine->flatArray(3, rndmv3);
z2 = X1*X1*lnPairInvMassRange;
const G4double PairInvMass = PairInvMassMin*((z2 > 1.e-3) ? G4Exp(z2) : 1 + z2 + 0.5*z2*z2);
// cos and sin theta-lepton
const G4double cosThetaLept = std::cos(pi*rndmv6[2]);
@@ -423,7 +435,7 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
const G4double sinPhiLept = std::copysign(std::sqrt((1.-cosPhiLept)*(1.+cosPhiLept)),rndmv6[3]-0.5);
// cos and sin phi
const G4double cosPhi = std::cos(twoPi*rndmv6[4]-pi);
const G4double sinPhi = std::copysign(std::sqrt((1.-cosPhi)*(1.+cosPhi)),rndmv6[4]-0.5);
const G4double sinPhi = std::copysign(std::sqrt((1.-cosPhi)*(1.+cosPhi)),rndmv6[4]-0.5);
//////////////////////////////////////////////////
// frames:
@@ -550,7 +562,6 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
}
} // else FormFactor = 1 by default
G4double betheheitler;
if (GammaPolarizationMag==0.) {
const G4double pPlusSTP = PPlus*sinThetaPlus;
const G4double pMinusSTM = PMinus*sinThetaMinus;
@@ -581,7 +592,7 @@ G4BetheHeitler5DModel::SampleSecondaries(std::vector<G4DynamicParticle*>* fvect,
pdf = cross * (xu1 - xl1) / G4Exp(correctionIndex*G4Log(X1)); // cond1;
} while ( pdf < ymax * rndmv6[5] );
// END of Sampling
if ( fVerbose > 2 ) {
G4double recul = std::sqrt(Recoil.x()*Recoil.x()+Recoil.y()*Recoil.y()
+Recoil.z()*Recoil.z());
@@ -6,6 +6,15 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2024-05-22 V.Ivanchenko (emutils-V11-01-28)
- G4EmUtility - simplify computation of cross section maximum for discrete
processes to fix the problem of FPE if -O3 compiler option is used.
## 2024-04-21 Gabriele Cosmo (emutils-V11-01-27)
- Fixed compilation error in G4EmConfigurator on Windows VC++ with
C++20 Standard enabled.
Based on [GitHub PR#69](https://github.com/Geant4/geant4/pull/69).
## 2023-12-15 V.Ivanchenko (emutils-V11-01-26)
- G4VEmProcess, G4VEnergyLossProcess - minor CPU optimisation by reduction
of number of calls for Log of kinetic energy
@@ -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;
}