Counting density of particles traveling in certain direction

Hello, I am a beginner trying to learn GEANT. So my question may be too basic and naive. Hope you can understand.

I would like to simulate a PET scan, and I would like to count the number of particles traveling at certain position x in certain direction θ with energy E. As far as I know, this particle density, also called radiance intensity, and is a component in radiative transport equation. It cannot be directly measured in PET scanning scenarios, so I wonder if it can be known in simulations. Is there any document/tool that I can refer to?

Presumably “certain position x” is really “through a small voxel or area pixel centered on x”? The information you would want to accumulate is momentum direction (px,py,pz) and kinetic energy. I don’t recall whether there’s a built-in scorer that will do this for you.

If I were doing it myself, I’d attach a SensitiveDetector to my volume, and use it to fill an N-tuple with the momentum, energy and position of each step. Then, in my analysis code, I can compute theta from (px,py,pz), and histogram it vs. position, with cuts, or in energy bins, or whatever.

Yes, exactly. For implementation it should be a small voxel/pixel. Will try your suggestion later.

I’m also curious about its efficiency - does attaching that SensitiveDetector slow down the simulation significantly?

Well, since SD’s are user code, that depends on how absurdly complex you want it to be :wink:

If you’re doing the usual simple thing of extracting data from G4Step and storing it to a hit, or an N-tuple, or something, even with if conditions, it’ll be perfectly fine compared to the rest of the tracking.

If you’re doing some sort of fit or complex interpolation as part of the SD, that could have an impact.

Many thanks for that :slightly_smiling_face:.