How to identify/Get Volume before first hit in SD volume

Is there a way to get previous volume(Non world) before first hit in SD volume.
I am trying to get hits energy deposits from scattered xray .

Not very well. Even if the hit is on the first step in the volume, the preStepPoint will still be at the entrance to the volume (with status fGeomBoundary). You could have a stepping action watch for tracks where the postStepPoint has fGeomBoundary at your SD volume.

If you built G4 with the “GEANT4_BUILD_STORE_TRAJECTORY” option, you could retrieve the trajectory for the track, and look back a couple of points to see where it was, and then pass that point into a G4Navigator instance (but not the main tracking Navigator!) to find the volume.

Got it , thank you very much