Penelope/Livermore Physics in main file

Hi!

Until now, I’ve been using FTFP_BERT as my physics list but I want to investigate other lists too. I’ve been using the physics list factory as follows (in my main.cc file):

G4PhysListFactory factory; G4VModularPhysicsList* physList=factory.GetReferencePhysList("G4EmPenelopePhysics");

which works when the brackets contain “FTFP_BERT”, or “G4StandardPhysics_EMZ” for example, but this structure does not work for Penelope as it is there, or Livermore. I have also tried as below which hasn’t worked:

    auto* physicsList = new G4EmPenelopePhysics();

Is there a way to declare Penelope or Livermore in the main.cc file, or does it have to be in a dedicated PhysicsList.cc/.hh file structure to work? Why?

Also to note I have included the relevant G4EmPenelopePhysics.hh header in the main file!

Thank you!
Lauryn

Right. Penelope (and Livermore) are not top-level physics lists. They are physics “constructors” that create the necessary EM processes and register the specific models you want to use with them.

Since you’re using G4PhysListFactory (good decision!), you can replace the EM physics as you desire:

#include "G4EmPenelopePhysics.hh"
[...]
G4PhysListFactory factory;
G4VModularPhysicsList* physList=factory.GetReferencePhysList("FTFP_BERT");
physList->ReplacePhysics(new G4EmPenelopePhysics);

Note that I used ReplacePhysics() here because I know that FTFP_BERT already contains some EM physics constructor. If you’re adding something new that isn’t already included in the physics list, you would use RegisterPhysics() instead.

Ahh amazing thank you, I suspected I was missing something but wasn’t sure what. Thank you for the explanation, that makes a lot more sense :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.