Running on single thread with multi-threading G4

Dear Geant4 gurus,

I am using a LCG-centrally-compiled version of G4 on lxplus, which is multi-threading.
I would like to force it to use one single thread, is there a way to do it?


In your main, instantiate G4RunManager instead of G4MTRunManager. Then it runs in sequential mode.

thank you very much!

Actually, I was unhappy at hardwiring this option. MT mode is annoying when debugging since the screen output will then mix info from different events running on different threads.

Indeed, G4MULTITHREADED is defined when compiling geant4 and there is nothing you can do about it. So G4MTRunManager will always be instantiated however if you put

/run/numberOfThreads 1

in your macro (before /run/initialize) the code will run single thread even if G4MTRunManager is used