Multiple runs one ROOT output file

Hi all,

During my simulation I’m saving the information (energy, position, etc ) of a particle that hits my SD detector, using the G4AnalysisManager::Instance() and the g4tools option with the root header. It works as expected when doing one run, but when there’s more than one the output file gets rewritten and saves only the last run information. There is a way to pass an option to the analysis manager instance so it just reopens and update the file if it exist?

I know there’s a workaround using directly the root API in G4 and passing the option "UPDATE" when opening the file, but would be simpler and perhaps more generic with the analysis manager?

Thank you :smiley:
Juan

Geant4 Version: v10.6 with Multithread
OS: Ubuntu 18.04

1 Like

Hi,

We do not provide the “UPDATE” mode; this is in planned development for the next Geant4 version.
At present, to avoid overwrite the output file with each run, you have to define a different file name in OpenFile() call at the BeginOfRun() action. Then you can use Root TChain to chain the produced files and process the written ntuple.

Best regards,

1 Like

Hi all,

Does anybody know whether its possible now with Geant4 Version 11.0.2 ?

Cheers,
Jennifer

Does anyone have any updates on this post?

Hello,

This feature is now implemented and will be available in Geant4 version 11.1, that will be released in December.

Best regards,

2 Likes