Loop cycle for multiple scattering parameter


I would like to use the command

/process/msc/ThetaLimit 0.1 radian

in a MACRO file to implement a loop cycle, for istance reducing the limit angle for single/multiple scattering from 3 rad to 1 rad, with step of 0.5 rad.

So I write in the macro:

/process/msc/ThetaLimit {ThetaLim} radian

and then I launch from the main:

UImanager->ApplyCommand("/control/loop test.mac ThetaLim 1 3 0.5 ");

However, the program returns this error:

***** Illegal application state </process/msc/ThetaLimit {ThetaLim} radian> *****

***** Batch is interrupted!! *****

I think the problem is in the fact the the modification to the physics list must be done before initializing the run, but once it is initialized for the first step of the cycle, then for the remaining ones it crashes.

How can I fix that?

Thank you!


some parameters may be modified only before initialisation. For this purpose a check on Geant4_State is performed and you get this error.
You need to issue this command after PhysicsList is instantiated but before /run/BeamOn