In my current simulation a positron beam interacts with a material producing photons, however this interaction only happens sometimes. After that, the positrons interact with a sensitive detector.
I would like to know if it is possible to only obtain the information of the positrons that interacted with the material.
With the information you provided, I can suggest you to focus on the primary position of photons.
Each primary position of photon will give you the interaction information of positrons with material.
This you can achieve in steppingAction class.
You can use two concrete classes G4Track and G4Step to call methods like GetPosition().