We are working on migrating our simulation framework to Geant4 11.3.2 (11.4.0 after December). I’ve run into one problem that I’m not sure how to solve. We have a Messenger class to configure a customized physics list, which includes adding or removing various pieces of hadronic physics. After /run/initialize, the processes defined by those physics builders are added to G4HadronicProcessStore.
In order to support reconfiguring the physics list between runs of a single job, our Messenger class has an “updatePhysics” command which tries to reset everything to the “PreInit” state:
- Removes all processes from the particles (via G4ProcessVector::clear() in the usual pdIter loop)
- Removes all the hadronic processes from the store, via
G4HadronicProcessStore::Clean() - Calls
physicsList->Construct()to redo all the process building and registration - Calls
RM->PhysicsHasBeenModified()to trigger all the table building at the next/run/initializeorbeamOn
@civanch removed the G4HadronicProcessStore::Clean() function in October 2023, to solve a “constant crashes” problem (I think!). Should I just remove the call to Clean(), and assume everything will magically get deleted? Is it no longer possible to change the physics list at this low level between runs within a job? Is there an example which shows how a user application is supposed to do this properly?
Geant4 Version: Moving to 11.3.2
Operating System: Ubuntu 24
Compiler/Version: GCC 13.3.0