Examples of exporting a histogram per voxel

Hi Folks,

I’m currently giving a collegue some advice on constructing a Geant4 simulation and their particular needs are a bit different from the software I’ve developed before. Specifically, they want to export a histogram (fluence) for each voxel in some parameterized volume. I can think of at least two ways to approach this:

1.) Using G4AnalysisManager, with some sort of looping statement, create an enormous number of histograms. Then implement a numbering system such that each volume and volume copy number can map to the appropriate histogram. The advantage of this is that G4AnalysisManager will take care of merging thread local information without any further work. However, I’m not sure that G4AnalysisManager was designed with a use case like this in mind, or how performance might be affected.

2.) Go the more conventional approach and develop a scorer as well as a G4THitsMap. Personally, I’m not sure I can wrap my head around what a HitsMap which contains a 1D histogram for 1000’s of voxels would look like or how this would be implemented. If anyone can direct me towards one of the Geant4 examples which possibly takes an approach like this I would be extremely grateful.

If anyone has any advice – or if I’m missing an easier/more obvious way of approaching the problem I would be glad to hear your input.

Thanks in advance for your help,

Joseph DeCunha

alternatively to the enormous amount of histograms you could also have a single enourmously large histogram where one dimension is the „3d“ index as a function of copyIds.

i have implemented exactly this, and additionally defined the primary vertex energy as a second dimension (thought it would be nice to run the simulation once and then be able to rescale results to different input spectra), and there was no obvious performance penalty.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.