Got some gamma which kinetic energy is ZERO

As we all know, gamma (photon) could not have a zero energy (also kinetic energy because it has no rest mass). But I got some zero energy gamma. It is strange.

I got the energy by the code in steppingAction:

G4double ParticleEnergy = aStep->GetPreStepPoint()->GetKineticEnergy();

So I wonder why it could happen.

Look at the step status. If the track is “fStopAndKill”, it may be that a process set the kinetic energy to zero as part of the stopping (e.g., if the photon transferred all of its energy to a secondary).