<!-- ******************************************************** -->
<!--                                                          -->
<!--  [History]                                               -->
<!--    1st version created:  Katsuya Amako, Dec-2006         -->
<!--                                                          -->
<!-- ******************************************************** -->


<!-- ********************* QandA Section ******************** -->
<section id="qanda.Geometry">
<title>
Geometry
</title>

<qandaset defaultlabel="qanda">


<!-- ******* QandA Entry ******** -->
<qandaentry  id="qanda.Geometry.GenPnt">

<question><para>
  I have a generic point and I would like to know in which physical 
  volume I'm located in my detector geometry. 
</para></question>

<answer><para>
  The best way of doing this is by invoking the G4Navigator. First 
  get a pointer of the navigator through the G4TransportationManager, 
  and then locate the point. i.e.
  <informalexample><programlisting>
     #include "G4TransportationManager.hh" 
     #include "G4Navigator.hh" 
     G4ThreeVector myPoint = ....;
     G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()
                                 -&gt;GetNavigatorForTracking();
     G4VPhysicalVolume* myVolume = theNavigator-&gt;LocateGlobalPointAndSetup(myPoint); 
  </programlisting></informalexample>

  <note>
  <title>Note</title>
  <para>
    by using the navigator for tracking as shown above, the actual 
    particle gets also -relocated- in the specified position. Therefore, 
    if this information is needed during tracking time, in order to 
    avoid affecting tracking, you should either use an alternative 
    G4Navigator object (which you then assign to your world-volume), 
    or you access the information through the track or touchable as 
    specified in the FAQ for tracking and steps.
  </para>
  </note> 
</para></answer>

</qandaentry>

<!-- ******* QandA Entry ******** -->
<qandaentry id="qanda.Geometry.DghtVol">

<question><para>
  How can I access the daughter volumes of a specific physical volume? 
</para></question>

<answer><para>
  Through the associated logical volume.
  <informalexample><programlisting>
      G4VPhysicalVolume* myPVolume = ....; 
      G4LogicalVolume* myLVolume = myPVolume-&gt;GetLogicalVolume(); 
      for (G4int i=0; iGetNoDaughters(); i++)  
        myPVolume = myLVolume-&gt;GetDaughter(i); 
  </programlisting></informalexample>
</para></answer>

</qandaentry>

<!-- ******* QandA Entry ******** -->
<qandaentry id="qanda.Geometry.CpyNum">

<question><para>
  How can I identify the exact copy-number of a specific physical volume 
  in my mass geometry? I tried with GetCopyNo()  from my physical volume 
  pointer, but it doesn't seem to work! 
</para></question>

<answer><para>
  The correct way to identify -uniquely- a physical volume in your mass 
  geometry is by using the touchables (see also section 4.1.5 of the 
  User's Guide for Application Developers), as follows:
  <informalexample><programlisting>
      G4Step* aStep = ..;
      G4StepPoint* preStepPoint = aStep-&gt;GetPreStepPoint();
      G4TouchableHandle theTouchable = preStepPoint-&gt;GetTouchableHandle();
      G4int copyNo = theTouchable-&gt;GetCopyNumber();
      G4int motherCopyNo = theTouchable-&gt;GetCopyNumber(1);
  </programlisting></informalexample>

  where <literal>Copy</literal> here stays for any duplicated instance of 
  a physical volume, either if it is a <literal>G4PVPlacement</literal> 
  (multiple placements of the same logical volume) or a 
  <literal>G4PVReplica/G4PVParameterised</literal>.
  The method <literal>GetCopyNo()</literal> is meant to return only the 
  serial number of placements not duplicated in the geometry tree.
</para></answer>

</qandaentry>

<!-- ******* QandA Entry ******** -->
<qandaentry id="qanda.Geometry.ConvGtoL">

<question><para>
  How can I determine the exact position in global coordinates in my mass 
  geometry during tracking and how can I convert it to coordinates local 
  to the current volume ? 
</para></question>

<answer><para>
  You need again to do it through the touchables (see also section 4.1.5 
  of the User's Guide for Application Developers), as follows:
  <informalexample><programlisting>
      G4Step* aStep = ..;
      G4StepPoint* preStepPoint = aStep-&gt;GetPreStepPoint();
      G4TouchableHandle theTouchable = preStepPoint-&gt;GetTouchableHandle();
      G4ThreeVector worldPosition = preStepPoint-&gt;GetPosition();
      G4ThreeVector localPosition = theTouchable-&gt;GetHistory()-&gt;
                                    GetTopTransform().TransformPoint(worldPosition);
  </programlisting></informalexample>

  where <literal>worldPosition</literal> here stays for the position related 
  to the world volume, while <literal>localPosition</literal> refers to the 
  coordinates local to the volume where the particle is currently placed.
</para></answer>

</qandaentry>


</qandaset>
</section>
