Local -> Global position inside DetectorConstruction

Hi,

I have constructed inside my DectorConstruction a Capsule located at “position” inside a mother volume “Union1b”.
G4VPhysicalVolume*PhyCapsule = new G4PVPlacement(0,position,“LogCapsule”,Capsule,Union1b,false,0,fCheckOverlaps);
I would like to get the global position of this Capsule, i.e the position w.r.t the world.
How can I do ? by advance thank you…
Olivier

Look in Frequently Asked Questions under Geometry -> Conversion Global to Local Co-ordinates.

Thank you Allison, but this only “during tracking” I need it inside my DetectorConstruction …

Hi Olivier

Ah. OK. Well, you have to work your way up or down the geometry hierarchy accumulating transformations. Bear in mind that a given physical volume may be placed multiple times and similarly its mother and grandmother, etc. So you need to be precise about which physical volume - this is known as a “touchable”.

So, we have a similar problem in visualisation. On the back of that we have developed some commands. For example, in exampleB2a, the following commands give you loads of information (probably too much):

/vis/drawTree

(This reminds you of the names of volumes in your geometry hierarchy.)

/vis/set/touchable World 0 Tracker 0 Chamber_PV 3

(This defines the touchable associated with one of the placements.)

/vis/touchable/dump

Let us know if this is of any use to you.

John

I also think HepRepFile will get you some information by clicking the shape when you view it offline with HepRApp.

Thank you Allison. I think I will retrieve the position of my volume using the tracking of a
geantino particle.
But I am disappointed that there no method to retrieve this position inside my Detector Construction …

Hi Olivier,
this topic is described and explained in the Guide, see:
http://cern.ch/geant4-userdoc/UsersGuides/ForApplicationDeveloper/html/Detector/Geometry/geomNav.html#using-the-navigator-to-locate-points
in section “Using an alternative navigator to locate points”.
As explained by John, the difficulty is to determine that the given (local) point is located in the right -copy- of a physical volume.
Cheers, Gabriele