Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!
I use Geant4 as a generator for simulating inelastic hadron-nuclear interactions based on the example Had09 (ie without run-manager). Is there a simpler way to register the physics than the one used in the constructor HadronicGenerator::HadronicGenerator, eg using production physics lists and G4PhysListFactory.
Welcome to the Geant4 forum, and thanks for your question!
I actually wondered the same thing when trying something similar myself [1]. I tried replacing the physics list in the Hadr09 example with one of the built-in physics lists, but I ran into a segmentation fault.
From what I’ve seen, it looks like the ConstructProcess() method in the physics list depends on a Run Manager, so trying to use it without one may cause the crash.
I’m also curious if there’s a way to use a physics list in this case, or, if not, whether there’s a specific reason why it cannot work.
Maybe @ribon, as the original author of the example could help clarify this.
Hi, @atolosad, the physicsList->Construct() function is called from G4RunManagerKernel::InitializePhysics(). The base class G4VUserPhysicsList::Construct() (in the .hh file) is where both ConstructParticle() and ConstructProcess() get called.
Having said all that, Hadr09 doesn’t use a physics list at all. It just uses a bunch of names which “correspond to” the physics lists. In HadronicGenerator, it seems to do all of the same setup work and configuration that physics lists are supposed to do.
Hello,
the idea behind Hadr09 is to use a hadronic physics model (such as FTFP, QGSP, BERT, etc.) as a Monte Carlo event-generator, without all the extra features and complications of a transportation code, and therefore without any physics list and run-manager. So, the question of using Hadr09 inside a physics list goes again the motivation for using Hadr09 - something that, in my view, does not make much sense.
Alberto