Retrieving dimensional info of solids within SteppingAction possible?

Dear expert(s),

I have a geometry made of large number of G4Tubs and G4Box of various lengths and radii as well as various orientations in the world volume. I need to get the distance of a stepPoint (that is located somewhere in the world geometry) to a specific surface of each of the solids placed in the geometry. By “specific surface of a solid”, I mean the left face of G4Box or the left circle of G4Tubs solids. And by “left face or circle”, I mean from their local-coordinates point of view.

So, I thought that I should first retrieve the local position of the stepPoint and then find its distance to the left face of the solid (I can clearly calculate the latter provided that I know the position of the left face of the solid wrt its center). Hence, this way, I would need to retrieve the dimensions of the Solids within SteppingAction.

Is this the right approach and if so, how can I get the dimensional info of these solids inside SteppingAction?
If not, what would be the right approach?

Thanks for any help

You can drill down to the solid via G4StepPoint::GetTouchable()->GetVolume()->GetLogicalVolume()->GetSolid() (but check the intermediate pointers for null!). Then you can use G4VSolid::GetDistanceToOut(). See G4VSolid.hh for details.

Thank you so much, that solved my problem.