diff --git a/CMakeLists.txt b/CMakeLists.txt index bda82abc..e12e228e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,6 +70,12 @@ if(Geant4_FOUND) message(STATUS "Found Geant4 v" ${Geant4_VERSION}) endif() +if (Geant4_VERSION VERSION_GREATER_EQUAL "11.2.0") + set(RMG_HAS_GEANT4_11_2_OR_LATER 1) +else() + set(RMG_HAS_GEANT4_11_2_OR_LATER 0) +endif() + # check for optional components find_package(Geant4 QUIET OPTIONAL_COMPONENTS hdf5 usolids multithreaded gdml ui_all vis_all) diff --git a/cmake/RMGConfig.hh.in b/cmake/RMGConfig.hh.in index c7eed3f1..29a741c2 100644 --- a/cmake/RMGConfig.hh.in +++ b/cmake/RMGConfig.hh.in @@ -12,5 +12,6 @@ #define RMG_HAS_BXDECAY0_THREADSAFE @BxDecay0_THREADSAFE@ #define RMG_HAS_GDML @RMG_HAS_GDML@ #define RMG_HAS_HDF5 @RMG_HAS_HDF5@ +#define RMG_HAS_GEANT4_11_2_OR_LATER @RMG_HAS_GEANT4_11_2_OR_LATER@ #endif diff --git a/src/RMGPhysics.cc b/src/RMGPhysics.cc index beb034a9..6e8e88ac 100644 --- a/src/RMGPhysics.cc +++ b/src/RMGPhysics.cc @@ -36,6 +36,7 @@ #include "G4HadronPhysicsQGSP_BIC_AllHP.hh" #include "G4HadronPhysicsQGSP_BIC_HP.hh" #include "G4HadronPhysicsShielding.hh" +#include "G4HadronicParameters.hh" #include "G4HadronicProcessStore.hh" #include "G4IonConstructor.hh" #include "G4IonPhysics.hh" @@ -65,6 +66,7 @@ #include "G4StoppingPhysics.hh" #include "G4ThermalNeutrons.hh" +#include "RMGConfig.hh" #include "RMGLog.hh" #include "RMGNeutronCaptureProcess.hh" #include "RMGOpWLSProcess.hh" @@ -179,6 +181,14 @@ void RMGPhysics::ConstructProcess() { // Hadronic Physics +#if RMG_HAS_GEANT4_11_2_OR_LATER + // Geant4 11.2 changed this to 1 year, which is rather short for our use case. + // Reset it to the old default of Geant4 11.0/11.1. + // note: this still might be too short for very rare decays, but it can be increased with + // a macro command. + G4HadronicParameters::Instance()->SetTimeThresholdForRadioactiveDecay(1.0e+27 * u::ns); +#endif + /* G4ParticleHPManager::GetInstance()->SetSkipMissingIsotopes( false ); G4ParticleHPManager::GetInstance()->SetDoNotAdjustFinalState( true );