Message: Re: Solid position - finding the global-to-local transformation for a physical volume Not Logged In (login)
 Next-in-Thread Next-in-Thread
 Next-in-Forum Next-in-Forum

None Re: Solid position - finding the global-to-local transformation for a physical volume  

Forum: Geometry
Re: Question Solid position (Kirill)
Date: 27 Feb, 2014
From: John Apostolakis <John Apostolakis>

Dear Kirill,

A Solid can exist in many copies, at many locations inside many different volumes.

I will interpret your question in terms of obtaining the transformation for a G4Placement physical volume, which is an instance of a logical volume that uses this solid.
Even a G4Placement can represent many volumes in a detector: the logical volume in which it is placed can be used.

|        |
P1   P2  placement physical volumes (different)
L1    L1   logical volume (same one)
|        |
P3   P3  <== this placement appears twice   ( it is the same instance, the same object in memory, but represents two distinct volumes in the physical setup. )
L2   L2   

This means that the 'back' pointer from a physical (or logical) volume to its parent logical volume is not unique in some geometries.

This one of the reasons that Geant4 does not offer the capability to do this in a simple way "out of the box".

1) If when you created a geometry in which each logical volume is used to create only one placement volume, and you have initialized the information of the back pointers, then it should be possible to go from a physical volume to its parent volume, all the way up the geometry tree - and thus 

2) A more robust way is to calculate the composition of transformations, e.g. in the ConstructDetector method you use to build the geometry

3) Else, if you can make an approximate calculation of the transformation, you can use an inverse procedure:
     - locate a point which should be in the physical volume of interest using the Navigator's LocateGlobalPointAndSetup method
     - If you get the 'correct' answer, ie the physical volume you are interested in, then create a 'Touchable' and ask for its transformation.
    You will need to be sure that either you have only one copy of this volume, or 

4) You could also randomly sample points within a box (or sphere) around the approximate location in order to find a 'hit', as in 3).

You can also try to use the 'GPS' module - the General Particle Source, in particular if you want your source to have other complex properties which it can provide.

Good success,
John Apostolakis,  PH Department, CERN

On Feb 26, 2014, at 9:17 PM, Kirill wrote:

> *** Discussion title: Geometry
> Hello!
> I want to know how can i get position (in the global coordinate system,
> not local) some solid in the complex geometry (with rotations,
> replications, assamblies) at initialization level. So to place a
> particle generetor at the same position.
> Thanks!
> -------------------------------------------------------------
> Visit this GEANT4 at message (to reply or unsubscribe) at: 

 Add Message Add Message
to: "Re: Solid position - finding the global-to-local transformation for a physical volume "

 Subscribe Subscribe

This site runs SLAC HyperNews version 1.11-slac-98, derived from the original HyperNews

[ Geant 4 Home | Geant 4 HyperNews | Search | Request New Forum | Feedback ]