Adding and Removing Processes

Dear All,

I am trying to create a modular physics list because I want to modify one of the physics processes for a particle. In order to do so, I define a process manager:

auto processManager = particle->GetProcessManager();

and I remove the process I would like to modify:
this works fine.

Afterwards I try adding the new process (I call the new process “newprocess”):

The problem I encounter here is that I do not manage to add the process at the right index. In the sense that this process is added as the end the vector list and I would like instead to add it at the same index of the process I removed.

I tried already using, SetProcessOrdering but this this is not working for me.
Do you have an idea how to do this?

Thank you in advance.
Gian Luigi

You can’t do that directly from the G4ProcessManager interface, basically because there are seven different vectors (lists) that a given process could belong to. The RemoveProcess(index) function takes the index for the global list, but it also takes care of finding and removing the process from the other specialized lists as well.

The SetProcessOrdering() functions are the appropriate ones for what you want, but note that it’s possible for multiple processes to have been assigned the same “priority”, so when you put yours in, it’ll come after all the others with the same priority.

Thank you very much for your answer Michael.

So, if I understood correctly, when I add the process, this is automatically assigned by Geant to the right index, according to its priority. And in case it needs changing I can do so with SetProcessOrdering().

Perhaps to refine the question - is it possible to switch one process out… e.g. replace a process?

If this interface doesn’t exist, I can add it (in a fork / pull request), if you can point me to the seven containers the process is in. (I guess I could follow RemoveProcess() ).

Our intention is to use a reference physics list (such as FTFP_BERT) then modify it afterwards by wrapping certain processes for muon splitting. By doing it afterwards we retain flexibility because we’re not copying and hard-coding a specific physics list. From our understanding, we need to maintain the process ordering to ensure the same results (if our wrapping had no effect).

So as it stands if we put a process back in with a certain priority (perhaps using the physics list helper) then it’ll be put alongside processes with the same priority but maybe in a slightly different order. Would this affect the physics outcome? (different specific event outcome for a seed ok, but obviously we’d want the rates to be right).