There is an inconsistency in the track reconstruction for gamma/lepton nuclear reactions.
Currently, two mechanism are used to recreate G4Steps / G4Tracks on the host:
ProcessGPUStep (used for all steps, e.g. SD code or first/last steps, uses GPUHit)
ReturnTrack (used for all leaked tracks, uses TrackData).
At the moment, gamma nuclear calls first ProcessGPUStep on the GPUHit for the returned step (which calls the SD code) and then later ReturnTrack on the TrackData for the returned track that invokes the nuclear reaction.
Problem:
only in ReturnTrack the nuclear processes are invoked, which create secondaries, but in ProcessGPUStep we loop over secondaries, here we create MC truth links. Currently, the order is wrong and then no MC truth link can be established, because we do the link with the secondaries before the secondaries are generated.
Solution:
Do not leak tracks for gamma nuclear or lepton nuclear - we already send back the step information (which is larger than the track information). We must invoke the nuclear processes in the ProcessGPUStep!
Caveat: need to stack the (hadronic) secondaries such that the reproducibility is preserved.
Larger implication:
In fact, we could get rid of all leaked tracks entirely: we could just send back the GPUHits which we currently sent (they are larger) and do all triage inside the ProcessGPUStep.
This would remove the leakQueues, and significantly simplify the whole state machine.
Note: steps (reconstructed from GPUHit) are larger than tracks (reconstructed from TrackData), so this would increase data traffic (at least for gammas leaving regions), and reduce it for others where the step is already being sent back (e.g., electrons already send the steps if there is energy deposition)
There is an inconsistency in the track reconstruction for gamma/lepton nuclear reactions.
Currently, two mechanism are used to recreate G4Steps / G4Tracks on the host:
ProcessGPUStep(used for all steps, e.g. SD code or first/last steps, usesGPUHit)ReturnTrack(used for all leaked tracks, usesTrackData).At the moment, gamma nuclear calls first ProcessGPUStep on the
GPUHitfor the returned step (which calls the SD code) and then laterReturnTrackon theTrackDatafor the returned track that invokes the nuclear reaction.Problem:
only in
ReturnTrackthe nuclear processes are invoked, which create secondaries, but inProcessGPUStepwe loop over secondaries, here we create MC truth links. Currently, the order is wrong and then no MC truth link can be established, because we do the link with the secondaries before the secondaries are generated.Solution:
Do not leak tracks for gamma nuclear or lepton nuclear - we already send back the step information (which is larger than the track information). We must invoke the nuclear processes in the
ProcessGPUStep!Caveat: need to stack the (hadronic) secondaries such that the reproducibility is preserved.
Larger implication:
In fact, we could get rid of all leaked tracks entirely: we could just send back the GPUHits which we currently sent (they are larger) and do all triage inside the ProcessGPUStep.
This would remove the leakQueues, and significantly simplify the whole state machine.
Note: steps (reconstructed from
GPUHit) are larger than tracks (reconstructed fromTrackData), so this would increase data traffic (at least for gammas leaving regions), and reduce it for others where the step is already being sent back (e.g., electrons already send the steps if there is energy deposition)