Spectral, Temporal and Spatial Distribution of Scattered Gamma Rays Near a Gamma Source

Hello, I’ve been getting comfortable with G4 for a couple of months now but have been unable to come up with an elegant solution to my problem. I would like to gather information about photons that have been scattered and pass through various regions of my simulated world. Specifically, I’d like to know how long it took a photon to get from the gamma source to a particular region of space and how much energy it had when it passed through. Ideally, I’d use a mesh to gather maximum spatial data as well and not have to create multiple detectors.

Imagine an X-ray pointed toward the sky. Some of those photons will scatter and eventually return to earth (skyshine). I want to simulate where and when they will arrive and with how much energy.

To recap, I’m trying to figure out the best way the capture spectral, temporal and spatial distributions for scattered gamma rays near a source. I imagine I need to use GetGlobalTime and GetKineticEnergy to obtain these quantities. I have looked at extended/runAndEvent/RE03 for mesh scoring and extend/electromagnetic/TestEM14 for visualization of distributions using ROOT.

I think I’m having the must trouble capturing the correct quantities for particles passing through a particular plane. Has anyone written a similar simulation? Are there other examples that might help me understand better how to structure this?

Thank you everyone!

I assume your source is at the surface or slightly above of a volume called “Earth”. Then when your X-ray starts, it does not go through Earth, as it goes towards the sky. The idea is that you will check if this X-ray then enters into Earth, and record its energy & time when this happens. For that you can make Earth a sensitive volume. This sensitive volume code will be called for each particle making a step inside, at the end of the step.
In the case of your X-ray you can:

  1. check if the step you see if the first step in the Earth volume:
  • take pre step point, check if it was limited by the geometry, and if so
  1. check if this X-ray is a primary
  • check the track ParentID, if 0, then this is a primary X-ray, from your source, if so
  1. record -from the PreStepPoint- (the state of the track while entering the volume) whatever information you need.

Hope this helps.