Hi all,
In my simulation, I want to focus on the energy deposition of secondaries whose parent track was created by a specific process: for example, energy loss of Compton electrons from scattering of higher energy bremsstrahlung gammas. However, I’ve been struggling to think of an efficient way to go about this.
What I currently do in my code is the following:
- In PreUserTrackingAction, if a particle is a gamma and the track creator process is brems, then the track ID is appended to a vector in UserEventAction
- In UserSteppingAction, the parent ID of the current track is compared to the vector of brems track IDs, and if there is a match, the energy deposition is recorded
This works, but slows down when a large number of brems gammas are produced. Has anyone encountered a similar situation before? Any feedback on how to go about this more efficiently would be greatly appreciated!