Nead advice... use AnalysisManager with huge number of events in Run

Hello all!

I would like to simulate 10^10 events. Generally, due to a limitation related to the maximal parameter value in BeamOn(…), I could split one Run into a few sub-Runs:

for(int i = 0; i<1000; i++)
{
runManager->BeamOn(1E+7);
}

but I would like to use G4AnalysisManager in RunAction() and accumulate distributions at EndOfEventAction(…) in 1D histograms.

What is the best way to merge data between runs? Manually load saved histograms at BeginOfRunAction() and save updated at EndOfRunAction()… or there is something else?

The best solution is probably not to use Geant4 at all for the histogram merging, but, for example, run 1000 jobs of 1e7 events, each outputting one file with the histogram(s) for that job (you’ll need to seed them differently of course). Then merge the histograms in those 1000 files using the relevant tool for the output format (e.g. ROOT). This will also give you more opportunity for parallelism and to scale that across the resource you have.

keep in mind that adding floating point values on the order of single event contribution to an already significantly accumulated value could also cause problems. @bmorgan’s suggestion is probably the way to go anyways :slight_smile: