Merging output files (.csv) when operating in MULTITHREAD mode

Please fill out the following information to help in answering your question, and also see tips for posting code snippets. If you don’t provide this information it will take more time to help with your problem!

_Geant4 Version:_11.1
_Operating System:_Linux
CMake Version:


is there a way to merge directly in GEANT4 the .csv output files each thread produces?
(e.g if I work with 20 threads I’d like only 1 .csv output file and not 20).



Hi @tommasorizzi,

I’m assuming you’re working with G4AnalysisManager for your data output, is that correct? You might already be aware, but from what I can see in the documentation here only merging of .root files is currently supported (Analysis Manager Classes — Book For Application Developers 11.2 documentation).

There may be a way to implement this kind of merging in a Geant4 user-code, but if not the Geant4 source code could be modified to make it possible. But the approach I would take is to output a merged .root file from Geant and then implement a script to write that .root to a .csv. If you’d like any help with this I’d be happy to discuss.