Execute same code with different GPS in same executable

Dear all,

I am simulating the detector response to different kind of radioactive isotopes. I have a list of isotopes that I want to simulate for each physical volume of a system. (I have found a way to place the particle gun homogeneously inside a given physical volume with GPS.)

The way I would solve this problem to start a Run for each type of radioactive nuclei. How is it possible to start several Runs within the same executable the fastest way? Just initialize the UserInterface and call SessionStart each time with the changes required between different Runs?

The brute force solution would be to run my executable and change the type of particle inside the GPS macro each time. Although I do not want to do this as the initialization of a G4 simulation would happen each time creating a huge overhead.

All the best,
Gábor

ps. My analysis is in the EndOfRunaction so it would be a big + to run each isotope GPS in a different Run with different RunId

Just make one macro file that has all of the ions you want to have a run for e.g. to do a run with Co-60 for 1,000,000 histories, then a run with Cs-137 for 1,000,000 histories:

/gps/ion 27 60
/run/beamOn 1000000

/gps/ion 55 137
/run/beamOn 1000000

Each time the user calls /run/beamOn, that’s a new run with a different runId.

1 Like