Import Geant4 11.3.2 source tree

This commit is contained in:
Gabriele Cosmo
2025-04-28 13:52:33 +02:00
parent df176550b3
commit 20a218bbe1
266 changed files with 8007 additions and 7819 deletions
+6 -2
View File
@@ -1,9 +1,13 @@
# Category decay History
See `CONTRIBUTING.rst` for details of **required** info/format for each entry,
which **must** added in reverse chronological order (newest at the top). It must **not**
be used as a substitute for writing good git commit messages!
which **must** added in reverse chronological order (newest at the top).
It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-04-03 Alvaro Tolosa-Delgado (decay-V11-02-00)
- Remove approximation in calculation of G4Decay path length, fix issue #2645
## 2021-12-10 Ben Morgan (decay-V11-00-00)
- Change to new Markdown History format
@@ -166,8 +166,6 @@ class G4Decay : public G4VRestDiscreteProcess
// 2: More
protected:
// HighestValue.
const G4double HighestValue;
// Remainder of life time at rest
G4double fRemainderLifeTime;
+1 -5
View File
@@ -62,7 +62,6 @@
G4Decay::G4Decay(const G4String& processName)
:G4VRestDiscreteProcess(processName, fDecay),
verboseLevel(1),
HighestValue(20.0),
fRemainderLifeTime(-1.0),
pExtDecayer(nullptr)
{
@@ -151,10 +150,7 @@ G4double G4Decay::GetMeanFreePath(const G4Track& aTrack,G4double, G4ForceConditi
//calculate the mean free path
// by using normalized kinetic energy (= Ekin/mass)
G4double rKineticEnergy = aParticle->GetKineticEnergy()/aMass;
if ( rKineticEnergy > HighestValue) {
// gamma >> 1
pathlength = ( rKineticEnergy + 1.0)* aCtau;
} else if ( rKineticEnergy < DBL_MIN ) {
if ( rKineticEnergy < DBL_MIN ) {
// too slow particle
#ifdef G4VERBOSE
if (GetVerboseLevel()>1) {
@@ -6,6 +6,13 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-04-04 G.Cosmo (emutils-V11-02-21)
- Fix in G4EmTableType header to make self-consistent.
Reported in [GitHub PR#85](https://github.com/Geant4/geant4/pull/85).
## 2025-03-27 V.Ivanchenko
- G4VAtomDeexcitation - fixed problem #2650 - allowed to simulate PIXE
## 2024-10-31 V.Ivanchenko (emutils-V11-02-20)
- G4EmCalculator - fixed Coverity warning
@@ -39,10 +39,11 @@
// 06.04.21 Removed two types (V.Ivanchenko)
//
//---------------------------------------------------------------
#ifndef G4EmTableType_h
#define G4EmTableType_h 1
#include "G4Types.hh"
enum G4EmTableType
{
fTotal = 0,
@@ -60,7 +61,8 @@ enum G4CrossSectionType
fEmTwoPeaks
};
struct G4TwoPeaksXS {
struct G4TwoPeaksXS
{
G4double e1peak;
G4double e1deep;
G4double e2peak;
@@ -262,9 +262,9 @@ G4VAtomDeexcitation::AlongStepDeexcitation(std::vector<G4Track*>& tracks,
G4double& eLossMax,
G4int coupleIndex)
{
if (!activePIXEMedia[coupleIndex] || eLossMax <= 0.0) { return; }
G4double truelength = step.GetStepLength();
if(!flagPIXE && !activePIXEMedia[coupleIndex]) { return; }
if(eLossMax <= 0.0 || truelength <= 0.0) { return; }
if (truelength <= 0.0) { return; }
// step parameters
const G4StepPoint* preStep = step.GetPreStepPoint();
@@ -6,6 +6,23 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-04-22 Alberto Ribon (hadr-casc-V11-02-05)
- G4CascadeFinalStateAlgorithm, G4NucleiModel : introduced the possibility to
retrieve either the behavior of these classes as in Geant4 version 11.3
(default) or as in 11.2 according to the value of boolean flags in
G4HadronicParameters.
In the case that the behavior of the class G4CascadeFinalStateAlgorithm
is chosen as in Geant4 version 11.2, the change introduced in
hadr-casc-V11-02-02 is skipped; similarly, but independently, if the
behavior of the class G4NucleiModel is chosen as in Geant4 version 11.2,
the change introduced in hadr-casc-V11-02-00 is skipped.
( Note that the changes introduced in the two above classes in
hadr-casc-V11-02-02 and hadr-casc-V11-02-00 can be considered as real
improvements of the Bertini model, some degradation of thin-target data -
in particular for the pion production in HARP data - are observed.
This is likely due to the fact that a complete retuning of the parameters
of the Bertini model would have been necessary after these changes. )
## 2024-08-21 Gabriele Cosmo (hadr-casc-V11-02-04)
- Fixed reported Coverity defect in G4NucleiModel for use of std::move().
@@ -53,6 +53,7 @@
#include "G4TwoBodyAngularDist.hh"
#include "G4VMultiBodyMomDst.hh"
#include "G4VTwoBodyAngDst.hh"
#include "G4HadronicParameters.hh"
#include "Randomize.hh"
#include <vector>
#include <numeric>
@@ -60,7 +61,6 @@
using namespace G4InuclSpecialFunctions;
// Cut-offs and iteration limits for generation
const G4double G4CascadeFinalStateAlgorithm::maxCosTheta = 0.9999;
@@ -420,14 +420,43 @@ GenerateCosTheta(G4int ptype, G4double pmod) const {
}
// Throw multi-body distribution
if ( G4HadronicParameters::Instance()->IsBertiniAngularEmissionsAs11_2() ) {
G4double p0 = ptype<3 ? 0.36 : 0.25; // Nucleon vs. everything else
G4double alf = 1.0 / p0 / (p0 - (pmod+p0)*G4Exp(-pmod / p0));
G4double sinth = 2.0;
G4int itry1 = -1; /* Loop checking 08.06.2015 MHK */
while (std::fabs(sinth) > maxCosTheta && ++itry1 < itry_max) {
G4double s1 = pmod * G4UniformRand();
G4double s2 = alf * oneOverE * p0 * G4UniformRand();
G4double salf = s1 * alf * G4Exp(-s1 / p0);
if (GetVerboseLevel() > 3) {
G4cout << " s1 * alf * G4Exp(-s1 / p0) " << salf
<< " s2 " << s2 << G4endl;
}
if (salf > s2) sinth = s1 / pmod;
}
if (GetVerboseLevel() > 3) G4cout << " itry1 " << itry1 << " sinth " << sinth << G4endl;
if (itry1 == itry_max) {
if (GetVerboseLevel() > 2) G4cout << " high energy angles generation: itry1 " << itry1 << G4endl;
sinth = 0.5 * G4UniformRand();
}
// Convert generated sin(theta) to cos(theta) with random sign
G4double costh = std::sqrt(1.0 - sinth * sinth);
if (G4UniformRand() > 0.5) costh = -costh;
return costh;
} else {
// Sample costheta directly from exp(-a*pmod*(1 - costheta) )
// Previous method sampled from a*sintheta*exp(-a*sintheta),
// converted to costheta and (incorrectly) reflected around 180 degrees
//
G4double p0 = ptype < 3 ? 0.36 : 0.25; // 0.36 for nucleon, 0.25 for all others
G4double alf = 3.*pmod/p0;
return G4Log(G4UniformRand()*(G4Exp(2.*alf) - 1.) + 1.)/alf - 1.;
// Sample costheta directly from exp(-a*pmod*(1 - costheta) )
// Previous method sampled from a*sintheta*exp(-a*sintheta),
// converted to costheta and (incorrectly) reflected around 180 degrees
//
G4double p0 = ptype < 3 ? 0.36 : 0.25; // 0.36 for nucleon, 0.25 for all others
G4double alf = 3.*pmod/p0;
return G4Log(G4UniformRand()*(G4Exp(2.*alf) - 1.) + 1.)/alf - 1.;
}
}
@@ -183,6 +183,7 @@
#include "G4PhysicalConstants.hh"
#include "G4Proton.hh"
#include "G4SystemOfUnits.hh"
#include "G4HadronicParameters.hh"
#include <vector>
#include <algorithm>
#include <functional>
@@ -379,7 +380,7 @@ void G4NucleiModel::generateModel(G4int a, G4int z) {
zone_potentials.push_back(std::move(kp));
zone_potentials.push_back(std::move(hp));
setDinucleonDensityScale();
if ( ! G4HadronicParameters::Instance()->IsBertiniNucleiModelAs11_2() ) setDinucleonDensityScale();
nuclei_radius = zone_radii.back();
nuclei_volume = std::accumulate(zone_volumes.begin(),zone_volumes.end(),0.);
@@ -1439,8 +1440,8 @@ void G4NucleiModel::setDinucleonDensityScale() {
G4double G4NucleiModel::getCurrentDensity(G4int ip, G4int izone) const {
// const G4double pn_spec = 1.0; // Scale factor for pn vs. pp/nn
const G4double combinatoric_factor = 0.5;
const G4double combinatoric_factor =
( G4HadronicParameters::Instance()->IsBertiniNucleiModelAs11_2() ? 1.0 : 0.5 );
G4double dens = 0.;
if (ip < 100) dens = getDensity(ip,izone);
+4
View File
@@ -7,6 +7,10 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-04-22 Alberto Ribon (hadr-util-V11-02-07)
- G4HadronicDeveloperParameters : introduced Getter/Setter for selecting the
Bertini model behavior as Geant4 version 11.3 (default) or 11.2.
## 2025-03-05 Vladimir Ivanchenko (hadr-util-V11-02-06)
- G4HadronicDeveloperParameters - added limitation of warning printout on
change of parameters (NA64 request).
@@ -181,6 +181,29 @@ class G4HadronicParameters {
// Getter/Setter for the time threshold of radioactive decays
// (i.e. radioactive decays that happen later than this value are ignored).
inline G4bool IsBertiniAs11_2() const;
void SetBertiniAs11_2( G4bool val );
inline G4bool IsBertiniAngularEmissionsAs11_2() const;
void SetBertiniAngularEmissionsAs11_2( G4bool val );
inline G4bool IsBertiniNucleiModelAs11_2() const;
void SetBertiniNucleiModelAs11_2( G4bool val );
// Getter/Setter for the Bertini model behavior with respect to the
// Geant4 version 11.2.
// The first two methods "*BertiniAs11_2" refer to the overall behavior
// of the Bertini model - the one which should matter the most for the
// majority of applications.
// The methods "*BertiniAngularEmissionsAs11_2" refer to the angular
// distributions of the >= 4-body final state emissions.
// The last two methods "*BertiniNucleiModelAs11_2" refer to the
// modelling of nuclei.
// The overall behavior of Bertini with respect to the version Geant4
// version 11.2 depends on both the angular distributios of the
// >= 4-body final state emissions, and the modelling of nuclei.
// "True" in these methods means that the corresponding behavior of
// the Geant4 version 11.2 is retrieved;
// "False" means that the corresponding behavior of the Geant4 version
// 11.3 is retrieved.
private:
G4HadronicParameters();
@@ -226,6 +249,8 @@ class G4HadronicParameters {
G4bool fNeutronGeneral = false;
G4bool fChargeExchange = false;
G4bool fBinaryDebug = false;
G4bool fBertiniAngularEmissionsAs11_2 = false; // Keep the new G4 11.3 behavior
G4bool fBertiniNucleiModelAs11_2 = false; // Keep the new G4 11.3 behavior
G4String fTypeTablePT = "";
G4String fDirPARTICLEXS = "";
@@ -258,7 +283,6 @@ inline G4double G4HadronicParameters::GetMinEnergyINCLXX_Pbar() const {
inline G4double G4HadronicParameters::GetMaxEnergyINCLXX_Pbar() const {
return fMaxEnergyINCLXX_Pbar;
}
inline G4double G4HadronicParameters::EnergyThresholdForHeavyHadrons() const {
return fEnergyThresholdForHeavyHadrons;
@@ -360,13 +384,11 @@ inline const G4String& G4HadronicParameters::GetDirPARTICLEXS() const {
return fDirPARTICLEXS;
}
inline const G4String& G4HadronicParameters::GetPhysListDocDir() const
{
inline const G4String& G4HadronicParameters::GetPhysListDocDir() const {
return fPhysListDocDir;
}
inline const G4String& G4HadronicParameters::GetPhysListName() const
{
inline const G4String& G4HadronicParameters::GetPhysListName() const {
return fPhysListName;
}
@@ -378,4 +400,16 @@ inline G4double G4HadronicParameters::GetTimeThresholdForRadioactiveDecay() cons
return fTimeThresholdForRadioactiveDecays;
}
inline G4bool G4HadronicParameters::IsBertiniAs11_2() const {
return ( fBertiniAngularEmissionsAs11_2 && fBertiniNucleiModelAs11_2 );
}
inline G4bool G4HadronicParameters::IsBertiniAngularEmissionsAs11_2() const {
return fBertiniAngularEmissionsAs11_2;
}
inline G4bool G4HadronicParameters::IsBertiniNucleiModelAs11_2() const {
return fBertiniNucleiModelAs11_2;
}
#endif
@@ -46,11 +46,11 @@
G4HadronicParameters* G4HadronicParameters::sInstance = nullptr;
namespace
{
namespace {
G4Mutex paramMutex = G4MUTEX_INITIALIZER;
}
G4HadronicParameters* G4HadronicParameters::Instance() {
if ( sInstance == nullptr ) {
G4AutoLock l(&paramMutex);
@@ -140,12 +140,14 @@ void G4HadronicParameters::SetMinEnergyTransitionQGS_FTF( const G4double val ) {
}
}
void G4HadronicParameters::SetMaxEnergyTransitionQGS_FTF( const G4double val ) {
if ( ! IsLocked() && val > fMinEnergyTransitionQGS_FTF ) {
fMaxEnergyTransitionQGS_FTF = val;
}
}
void G4HadronicParameters::SetMinEnergyINCLXX_Pbar( const G4double val ) {
if ( ! IsLocked() && val >= 0.0 ) {
fMinEnergyINCLXX_Pbar = val;
@@ -159,6 +161,7 @@ void G4HadronicParameters::SetMaxEnergyINCLXX_Pbar( const G4double val ) {
}
}
void G4HadronicParameters::SetEnableBCParticles( G4bool val ) {
if ( ! IsLocked() ) fEnableBC = val;
}
@@ -291,3 +294,21 @@ void G4HadronicParameters::SetTypeTablePT( const G4String& typeTablePT ) {
void G4HadronicParameters::SetEnableCoherentChargeExchange( G4bool val ) {
if ( ! IsLocked() ) fChargeExchange = val;
}
void G4HadronicParameters::SetBertiniAs11_2( G4bool val ) {
if ( ! IsLocked() ) {
fBertiniAngularEmissionsAs11_2 = val;
fBertiniNucleiModelAs11_2 = val;
}
}
void G4HadronicParameters::SetBertiniAngularEmissionsAs11_2( G4bool val ) {
if ( ! IsLocked() ) fBertiniAngularEmissionsAs11_2 = val;
}
void G4HadronicParameters::SetBertiniNucleiModelAs11_2( G4bool val ) {
if ( ! IsLocked() ) fBertiniNucleiModelAs11_2 = val;
}