First apologies if this is answered somewhere else but I have spent some time going through the manuals, examples and forum posts and can not work out the answer to this. I have a model which applies just to inelastic collisions of pions in a limited energy range and is available for certain elements. I want to have a default physics list such as QGSP_BERT for everything else. The model was written by someone else but so far I can see it works but I can’t work out how to overlay it onto a reference physics list. I tried this:
G4PhysListFactory* factory=new G4PhysListFactory();
G4VModularPhysicsList* PhysicsList=factory->GetReferencePhysList(“QGSP_BERT”);
PhysicsList->RegisterPhysics(new MyPionPhysicsModel());
runManager->SetUserInitialization(PhysicsList);
but as soon as the generator produces a particle outside the energy range of the model it crashes saying
G4EnergyRangeManager:GetHadronicInteraction: counter=1, Ek=5861.95, Material = G4_C, Element = C
0 low=0, high=5995
In /t2k/Software/13.2/Geant4_10.1.03.01/geant4_source/source/processes/hadronic/management/src/G4EnergyRangeManager.cc, line 136:
===> GetHadronicInteraction: No Model found
-------- EEEE ------- G4Exception-START -------- EEEE -------
*** G4Exception : had005
issued by : G4HadronicProcess::PostStepDoIt
In /t2k/Software/13.2/Geant4_10.1.03.01/geant4_source/source/processes/hadronic/management/src/G4EnergyRangeManager.cc, line 136:
===> GetHadronicInteraction: No Model found
Target element C Z= 6 A= 12
Unrecoverable error in the method ChooseHadronicInteraction of MyPionPhysicsModel
TrackID= 1 ParentID= 0 pi+
Ekin(GeV)= 5.86195; direction= (2.46853e-05,-1.52839e-05,1)
Position(mm)= (1.18246e-05,-3.72635e-06,-0.582798); material G4_C
PhysicalVolume
No HadronicInteraction found out
*** Fatal Exception *** core dump ***
-------- EEEE -------- G4Exception-END --------- EEEE -------
*** G4Exception: Aborting execution ***
What is the correct way to do this?