Import Geant4 11.4.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2025-06-26 09:17:29 +02:00
parent 20a218bbe1
commit a499fb82e9
1941 changed files with 203285 additions and 95593 deletions
+11 -3
View File
@@ -7,15 +7,23 @@ It must **not** be used as a substitute for writing good git commit messages!
-------------------------------------------------------------------------------
## 2025-04-22 Alberto Ribon (hadr-util-V11-02-07)
## 2025-05-20 Ben Morgan (hadr-util-V11-03-04)
- G4HadronicParameters: Implement pretty-print to ostream to allow users to check
values at runtime, ala G4EmParameters (request from ATLAS).
## 2025-04-22 Alberto Ribon (hadr-util-V11-03-03)
- 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)
## 2025-03-31 Vladimir Ivanchenko (hadr-util-V11-03-02)
- G4Nucleus - added move operator suggested by Coverity, make copy constructor and
assignment operator default.
## 2025-03-05 Vladimir Ivanchenko (hadr-util-V11-03-01)
- G4HadronicDeveloperParameters - added limitation of warning printout on
change of parameters (NA64 request).
## 2025-01-09 Vladimir Ivanchenko
## 2025-01-09 Vladimir Ivanchenko (hadr-util-V11-03-00)
- G4Fragment - added protection against precision loss in computation of a boost
vector at rest
@@ -50,6 +50,10 @@ class G4HadronicParameters {
static G4HadronicParameters* Instance();
~G4HadronicParameters();
// printing
void StreamInfo(std::ostream& os) const;
void Dump() const;
inline G4double GetMaxEnergy() const;
void SetMaxEnergy( const G4double val );
// Getter/Setter for the upper limit for Geant4 hadronic physics, for any application.
@@ -412,4 +416,10 @@ inline G4bool G4HadronicParameters::IsBertiniNucleiModelAs11_2() const {
return fBertiniNucleiModelAs11_2;
}
inline std::ostream& operator<<(std::ostream& os, const G4HadronicParameters& p)
{
p.StreamInfo(os);
return os;
}
#endif
@@ -55,6 +55,7 @@ class G4HadronicParametersMessenger : public G4UImessenger {
G4UIcmdWithAnInteger* theVerboseCmd;
G4UIcmdWithADoubleAndUnit* theMaxEnergyCmd;
G4UIcmdWithABool* theCRCoalescenceCmd;
G4UIcommand* theDumpCmd;
};
#endif
@@ -59,31 +59,10 @@ class G4Nucleus
~G4Nucleus();
inline G4Nucleus( const G4Nucleus &right )
{ *this = right; }
inline G4Nucleus& operator = (const G4Nucleus& right)
{
if (this != &right) {
theA=right.theA;
theZ=right.theZ;
theL=right.theL;
aEff=right.aEff;
zEff=right.zEff;
fIsotope = right.fIsotope;
pnBlackTrackEnergy=right.pnBlackTrackEnergy;
dtaBlackTrackEnergy=right.dtaBlackTrackEnergy;
pnBlackTrackEnergyfromAnnihilation =
right.pnBlackTrackEnergyfromAnnihilation;
dtaBlackTrackEnergyfromAnnihilation =
right.dtaBlackTrackEnergyfromAnnihilation;
theTemp = right.theTemp;
excitationEnergy = right.excitationEnergy;
momentum = right.momentum;
fermiMomentum = right.fermiMomentum;
}
return *this;
}
G4Nucleus(const G4Nucleus&) = default;
G4Nucleus(G4Nucleus&&) = default;
G4Nucleus& operator = (const G4Nucleus&) = default;
G4Nucleus& operator = (G4Nucleus&&) = default;
inline G4bool operator==( const G4Nucleus &right ) const
{ return ( this == (G4Nucleus *) &right ); }
@@ -43,6 +43,7 @@
#include "G4HadronicParametersMessenger.hh"
#include "G4Threading.hh"
#include "G4AutoLock.hh"
#include "G4UnitsTable.hh"
G4HadronicParameters* G4HadronicParameters::sInstance = nullptr;
@@ -113,6 +114,113 @@ G4bool G4HadronicParameters::IsLocked() const {
}
void G4HadronicParameters::StreamInfo( std::ostream& os ) const {
G4long prec = os.precision(5);
// Lambda function to convert boolean to "true"/"false" string
auto boolToString = [](G4bool value) -> const char* {
return value ? "true" : "false";
};
os << "=======================================================================" << "\n";
os << "====== Hadronic Physics Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Maximum energy for hadronic physics "
<< G4BestUnit(fMaxEnergy, "Energy") << "\n";
os << "Energy threshold for heavy hadrons "
<< G4BestUnit(fEnergyThresholdForHeavyHadrons, "Energy") << "\n";
os << "Neutron kinetic energy threshold for SVT algorithm ";
if (fNeutronEkinThresholdForSVT < 0.0) {
os <<"not set" << "\n";
} else {
os << G4BestUnit(fNeutronEkinThresholdForSVT, "Energy") << "\n";
}
os << "Time threshold for radioactive decays ";
if (fTimeThresholdForRadioactiveDecays < 0.0) {
os << "not set" << "\n";
} else {
os << G4BestUnit(fTimeThresholdForRadioactiveDecays, "Time") << "\n";
}
os << "=======================================================================" << "\n";
os << "====== Model Transition Regions ========" << "\n";
os << "=======================================================================" << "\n";
os << "FTF to Cascade transition region "
<< G4BestUnit(fMinEnergyTransitionFTF_Cascade, "Energy") << " - "
<< G4BestUnit(fMaxEnergyTransitionFTF_Cascade, "Energy") << "\n";
os << "QGS to FTF transition region "
<< G4BestUnit(fMinEnergyTransitionQGS_FTF, "Energy") << " - "
<< G4BestUnit(fMaxEnergyTransitionQGS_FTF, "Energy") << "\n";
os << "INCLXX antiproton model energy range "
<< G4BestUnit(fMinEnergyINCLXX_Pbar, "Energy") << " - "
<< G4BestUnit(fMaxEnergyINCLXX_Pbar, "Energy") << "\n";
os << "=======================================================================" << "\n";
os << "====== Cross Section Factors ========" << "\n";
os << "=======================================================================" << "\n";
os << "Apply cross section factors " << boolToString(fApplyFactorXS) << "\n";
os << "Nucleon inelastic cross section factor " << fXSFactorNucleonInelastic << "\n";
os << "Nucleon elastic cross section factor " << fXSFactorNucleonElastic << "\n";
os << "Pion inelastic cross section factor " << fXSFactorPionInelastic << "\n";
os << "Pion elastic cross section factor " << fXSFactorPionElastic << "\n";
os << "Hadron inelastic cross section factor " << fXSFactorHadronInelastic << "\n";
os << "Hadron elastic cross section factor " << fXSFactorHadronElastic << "\n";
os << "EM cross section factor " << fXSFactorEM << "\n";
os << "=======================================================================" << "\n";
os << "====== Process Control Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "Enable integral method for inelastic cross sections " << boolToString(fEnableIntegralInelasticXS) << "\n";
os << "Enable integral method for elastic cross sections " << boolToString(fEnableIntegralElasticXS) << "\n";
os << "Enable diffraction dissociation for B > 10 " << boolToString(fEnableDiffDissociationForBGreater10) << "\n";
os << "Enable neutron general process " << boolToString(fNeutronGeneral) << "\n";
os << "Enable NUDEX gamma de-excitation " << boolToString(fEnableNUDEX) << "\n";
os << "Enable coherent charge exchange " << boolToString(fChargeExchange) << "\n";
os << "=======================================================================" << "\n";
os << "====== Particle Production Control ========" << "\n";
os << "=======================================================================" << "\n";
os << "Enable B/C particles " << boolToString(fEnableBC) << "\n";
os << "Enable hyper-nuclei " << boolToString(fEnableHyperNuclei) << "\n";
os << "Enable cosmic ray coalescence " << boolToString(fEnableCRCoalescence) << "\n";
os << "=======================================================================" << "\n";
os << "====== Model Control Parameters ========" << "\n";
os << "=======================================================================" << "\n";
os << "PT table type for URR neutrons ";
// A ternary operation can't be used here as it leads to a C2445 error on Windows with C++20 and newer
if (fTypeTablePT.empty()) {
os << "not set" << "\n";
} else {
os << fTypeTablePT << "\n";
}
os << "Bertini angular emissions as in G4 11.2 " << boolToString(fBertiniAngularEmissionsAs11_2) << "\n";
os << "Bertini nuclei model as in G4 11.2 " << boolToString(fBertiniNucleiModelAs11_2) << "\n";
os << "Bertini overall behavior as in G4 11.2 " << boolToString(IsBertiniAs11_2()) << "\n";
os << "=======================================================================" << "\n";
os << "====== Debugging Options ========" << "\n";
os << "=======================================================================" << "\n";
os << "Verbose level " << fVerboseLevel << "\n";
os << "Binary cascade debug " << boolToString(fBinaryDebug) << "\n";
os << "Environment reporting level " << fReportLevel << "\n";
if (fRelativeDiff < DBL_MAX) {
os << "Environment relative difference level " << fRelativeDiff << "\n";
}
if (fAbsoluteDiff < DBL_MAX) {
os << "Environment absolute difference level " << fAbsoluteDiff << "\n";
}
os << "=======================================================================" << G4endl;
os.precision(prec);
}
void G4HadronicParameters::Dump() const {
StreamInfo(G4cout);
}
void G4HadronicParameters::SetMaxEnergy( const G4double val ) {
if ( ! IsLocked() && val > 0.0 ) {
fMaxEnergy = val;
@@ -69,6 +69,12 @@ G4HadronicParametersMessenger::G4HadronicParametersMessenger( G4HadronicParamete
theCRCoalescenceCmd->SetGuidance( "Enable Cosmic Ray (CR) coalescence." );
theCRCoalescenceCmd->SetParameterName( "EnableCRCoalescence", false );
theCRCoalescenceCmd->SetDefaultValue( false );
// This command dumps the hadronic parameters to G4cout
theDumpCmd = new G4UIcommand( "/process/had/printParameters", this );
theDumpCmd->SetGuidance( "Print all Hadronic parameters." );
theDumpCmd->AvailableForStates( G4State_PreInit, G4State_Idle );
theDumpCmd->SetToBeBroadcasted( false );
}
@@ -77,6 +83,7 @@ G4HadronicParametersMessenger::~G4HadronicParametersMessenger() {
delete theVerboseCmd;
delete theMaxEnergyCmd;
delete theCRCoalescenceCmd;
delete theDumpCmd;
}
@@ -91,4 +98,7 @@ void G4HadronicParametersMessenger::SetNewValue( G4UIcommand *command, G4String
} else if ( command == theCRCoalescenceCmd ) {
theHadronicParameters->SetEnableCRCoalescence( theCRCoalescenceCmd->GetNewBoolValue( newValues ) );
}
else if ( command == theDumpCmd ) {
theHadronicParameters->Dump();
}
}