Geant4 Version: 10.07.p04, 11.4.1
Operating System: Any
Compiler/Version: Any
CMake Version: Any
A long time ago, we (CDMS) wrote a physics “unbuilder” to remove the G4NuclearStopping process from all the nuclei. This is because we have our own hooks to compute ionization yield from Lindhard theory, and don’t want to have to “undo” the Geant4 default for that. Anyway, the code I wrote makes use of G4ProcessManager::RemoveProcess(G4VProcess*) inside a loop over particles.
I’ve just discovered (five years later) that this causes a segfault when /process/setVerbose is invoked. First, I get an error message from the top-level G4ProcessTable:
G4ProcessTable::Find() - The Process[nuclearStopping] is not found
followed by a segmentation fault from G4ProcessTableMessenger. The segfault is because theProcessTable->FindProcesses(<name>); returns an empty vector, so that the subsequent (*tmpVector)(0) dereference is invalid. I understand that y’all don’t test for (*tmpVector).empty(), because the normal physics-list procedure should make that impossible.
My question for y’all is this. Besides doing the particle-by-particle RemoveProcess(), is there a way to properly remove the “nuclearStopping” name from procNameVector entirely? Note that we do avoid memory leaks by collecting the unique process pointers and deleting them ourselves after removing them.