Root output file in multithreaded mode

Dear experts,
I would like to ask related to root output file using multithread mode.
I am modifiying radioprotection example in Geant4 version 10-06-patch-02 by inserting SOI detector inside water phantom.
The root output file will dividing depends on number of thread.
When I run it in single thread it got no problem but when changes to multithread mode some of root output file was empty and error.

I’d appreciate any help on this.


Are you writing the ROOT output yourself, or are you using G4Analysis?

Dear Sir,

Thank you so much for your respond.
I am using G4Analysis.
The issue occurs when large number of histories (more than 10,000) were used.



I tried to run the radioprotection example with 100K primaries (with the run.mac macro) with Geant4 11.1 and do not see anything suspect in the ROOT output files.

The problem can be in your updates to the example. Also you are using quite old version of Geant4, but we did not had a similar problem report that would be fixed since 10.6.

To investigate more, we would need more details on your additions to the example.

Best regards,

Dear Madam,

Thank you so much for your reply and help.
I simulate 131 MeV proton beams with a (19.0 KB) (11.3 KB)
silicon bridge detector inside water in Geant4 version 10-06-patch-02
The details of my simulation as attached files.
I use 8 threads and founds the problem occurs when more than 1000 events recorded in detector, it is weird that some root output file are fine and some are corrupt.

I am appreciate your kind help.

Best regards,

Thank you for providing your code.

I was able to run 10000 events with the current version of Geant4 and I see no problems in the outputs.

Could you, please, let us know if you have any special reason for staying with the Geant4 version 10-06-patch-02?

Thank you.

Dear Madam,

Thank you so much for your answer.
May I ask if the issue on multithreading may occur on different versions of Geant4?

Thank you,