ConstructSDandField in multi-threaded mode

Dear all,

In the geant4 documentation is said that “the new ConstructSDandField() method is thread-local and is invoked for each thread”. I did some tests for the basic examples B2a and B5 with a geant4 multi-threading installation. This method is called after constructing the geometry so in the “no multi-thread part”.
Could you please help me to understand this?

Thank you!

It’s true that ConstructSDandField() is invoked in G4RunManager::InitializeGeometry() alongside Construct() (in what you call “no multi-thread part”), no matter if it’s run in MT or not.
But, if run with MT mode, it is invoked for each thread additionaly from G4WorkerRunManager::InitializeGeometry().
You can check it with a debugger gdb setting the breakpoint to ConstructSDandField().