Hello!
Let us assume that I have built my detector in the class derived from G4VUserDetectorConstruction.
So far so good.
Then I would like to get which material is present at random point X,Y,Z. Does Geant4 provide a method to easily get this piece of information?
Notice that I want to know the material before any particle is generated.
It’s not built into G4Navigator. You write code; you write exactly the code which was already spelled out in the linked post. Use the navigator to get the volume (placement) at the specified coordinates, and then you query the volume (exactly the same way you created the volume in your geometry, but in reverse order) to determine the material.
@mkelsey Thank you for the clarification. If I understand that snippet correctly, it seems pretty straightforward. I hope it is so for @cdreisbach too.