Get location of a volume

Is there a method to get a global position for a physical volume or path?

The closest thing I could find is this comment in the docs for TGeoMatrix:
The second use case is the computation
of the global transformation of a given object in the geometry. Since the
geometry is built as ‘volumes-inside-volumes’, this global transformation
represent the pile-up of all local transformations in the corresponding
branch.

But that’s merely suggestive, and not very practical. Isn’t there a class method somewhere to perform this operation? If not, is there a best-practices recipe for how to go about it?

I see that the inverse function (translating a location to a physical volume) seems to be fairly well supported in TGeoManager.

… Morgan Burke

Hi Morgan,

A physical volume is represented in TGeo by a path. Suppose the interesting one is:
/TOP_1/A_5/B_2/MyVol_1, what you can do is:

gGeoManager->cd("/TOP_1/A_5/B_2/MyVol_1");
TGeoMatrix *global = gGeoManager->GetCurrentMatrix();

Having now the global matrix pointer you can perform directly master-to-local or local-to-master operations (or retreive translation/rotation components) by using TGeoMatrix functionality.

Regards,