Adding Secondary Particle Data Output and Root Histograms to Basic Example B2a

I wish to set up a Geant4 simulation that does the following. I want to have gamma rays, the number and energy of which I can specify and vary, strike a very thin layer of a high-Z material, such as a lead or a gold foil. For my output, I am interested in the following. First, I would like to have a visual display of the events. I want this visual display to feature a tracker-like detector that shows the tracks of the secondary particles produced by the gamma ray interactions with the thin layer of high-Z material. Second, I would like to have the energy and momentum (magnitude and azimuthal direction) of the secondary particles outputted into histograms that I can see in a .root file.

I am fairly new to Geant4. For the past several weeks I have been working with Geant4 examples. I have been making various edits to them, and asking for help on this forum when I need it. I think Basic Example B2a has the general setup that I need. However, B2a does not generate output on secondary particles produced from the initial interactions of the gamma rays from the lead layer, and display that output on Root histograms. I know that some other examples like Basic Example B4 have .root output files that include histograms. However, after studying the coding in the “src” and “include” files/macros, it is not evident to me how to make Basic Example B2a do this. Does anybody on this forum have any guidance on how to go about this, or if there is a better approach to what I discussed in the previous paragraph?


I suggest to take a look at the slides on the Analysis presented at the Orsay Geant4 tutorial:

and to the section on Analysis in the Application Developer Guide:

Best regards.

1 Like

Thank you. Is there a list of upcoming GEANT4 introductory courses that I might be able to take?

Down at the bottom of the G4 main page, it looks like they’re going to be running a virtual course via Indico in mid-May. Other than a session at a conference in June, that’s the only one listed.

1 Like

Thanks for this link. I will keep an eye on it.