| 1 | <!-- ******************************************************** -->
|
|---|
| 2 | <!-- -->
|
|---|
| 3 | <!-- [History] -->
|
|---|
| 4 | <!-- 1st version created: Katsuya Amako, Dec-2006 -->
|
|---|
| 5 | <!-- -->
|
|---|
| 6 | <!-- ******************************************************** -->
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 | <!-- ********************* QandA Section ******************** -->
|
|---|
| 10 | <section id="qanda.Geometry">
|
|---|
| 11 | <title>
|
|---|
| 12 | Geometry
|
|---|
| 13 | </title>
|
|---|
| 14 |
|
|---|
| 15 | <qandaset defaultlabel="qanda">
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 | <!-- ******* QandA Entry ******** -->
|
|---|
| 19 | <qandaentry id="qanda.Geometry.GenPnt">
|
|---|
| 20 |
|
|---|
| 21 | <question><para>
|
|---|
| 22 | I have a generic point and I would like to know in which physical
|
|---|
| 23 | volume I'm located in my detector geometry.
|
|---|
| 24 | </para></question>
|
|---|
| 25 |
|
|---|
| 26 | <answer><para>
|
|---|
| 27 | The best way of doing this is by invoking the G4Navigator. First
|
|---|
| 28 | get a pointer of the navigator through the G4TransportationManager,
|
|---|
| 29 | and then locate the point. i.e.
|
|---|
| 30 | <informalexample><programlisting>
|
|---|
| 31 | #include "G4TransportationManager.hh"
|
|---|
| 32 | #include "G4Navigator.hh"
|
|---|
| 33 | G4ThreeVector myPoint = ....;
|
|---|
| 34 | G4Navigator* theNavigator = G4TransportationManager::GetTransportationManager()
|
|---|
| 35 | ->GetNavigatorForTracking();
|
|---|
| 36 | G4VPhysicalVolume* myVolume = theNavigator->LocateGlobalPointAndSetup(myPoint);
|
|---|
| 37 | </programlisting></informalexample>
|
|---|
| 38 |
|
|---|
| 39 | <note>
|
|---|
| 40 | <title>Note</title>
|
|---|
| 41 | <para>
|
|---|
| 42 | by using the navigator for tracking as shown above, the actual
|
|---|
| 43 | particle gets also -relocated- in the specified position. Therefore,
|
|---|
| 44 | if this information is needed during tracking time, in order to
|
|---|
| 45 | avoid affecting tracking, you should either use an alternative
|
|---|
| 46 | G4Navigator object (which you then assign to your world-volume),
|
|---|
| 47 | or you access the information through the track or touchable as
|
|---|
| 48 | specified in the FAQ for tracking and steps.
|
|---|
| 49 | </para>
|
|---|
| 50 | </note>
|
|---|
| 51 | </para></answer>
|
|---|
| 52 |
|
|---|
| 53 | </qandaentry>
|
|---|
| 54 |
|
|---|
| 55 | <!-- ******* QandA Entry ******** -->
|
|---|
| 56 | <qandaentry id="qanda.Geometry.DghtVol">
|
|---|
| 57 |
|
|---|
| 58 | <question><para>
|
|---|
| 59 | How can I access the daughter volumes of a specific physical volume?
|
|---|
| 60 | </para></question>
|
|---|
| 61 |
|
|---|
| 62 | <answer><para>
|
|---|
| 63 | Through the associated logical volume.
|
|---|
| 64 | <informalexample><programlisting>
|
|---|
| 65 | G4VPhysicalVolume* myPVolume = ....;
|
|---|
| 66 | G4LogicalVolume* myLVolume = myPVolume->GetLogicalVolume();
|
|---|
| 67 | for (G4int i=0; iGetNoDaughters(); i++)
|
|---|
| 68 | myPVolume = myLVolume->GetDaughter(i);
|
|---|
| 69 | </programlisting></informalexample>
|
|---|
| 70 | </para></answer>
|
|---|
| 71 |
|
|---|
| 72 | </qandaentry>
|
|---|
| 73 |
|
|---|
| 74 | <!-- ******* QandA Entry ******** -->
|
|---|
| 75 | <qandaentry id="qanda.Geometry.CpyNum">
|
|---|
| 76 |
|
|---|
| 77 | <question><para>
|
|---|
| 78 | How can I identify the exact copy-number of a specific physical volume
|
|---|
| 79 | in my mass geometry? I tried with GetCopyNo() from my physical volume
|
|---|
| 80 | pointer, but it doesn't seem to work!
|
|---|
| 81 | </para></question>
|
|---|
| 82 |
|
|---|
| 83 | <answer><para>
|
|---|
| 84 | The correct way to identify -uniquely- a physical volume in your mass
|
|---|
| 85 | geometry is by using the touchables (see also section 4.1.5 of the
|
|---|
| 86 | User's Guide for Application Developers), as follows:
|
|---|
| 87 | <informalexample><programlisting>
|
|---|
| 88 | G4Step* aStep = ..;
|
|---|
| 89 | G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
|
|---|
| 90 | G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle();
|
|---|
| 91 | G4int copyNo = theTouchable->GetCopyNumber();
|
|---|
| 92 | G4int motherCopyNo = theTouchable->GetCopyNumber(1);
|
|---|
| 93 | </programlisting></informalexample>
|
|---|
| 94 |
|
|---|
| 95 | where <literal>Copy</literal> here stays for any duplicated instance of
|
|---|
| 96 | a physical volume, either if it is a <literal>G4PVPlacement</literal>
|
|---|
| 97 | (multiple placements of the same logical volume) or a
|
|---|
| 98 | <literal>G4PVReplica/G4PVParameterised</literal>.
|
|---|
| 99 | The method <literal>GetCopyNo()</literal> is meant to return only the
|
|---|
| 100 | serial number of placements not duplicated in the geometry tree.
|
|---|
| 101 | </para></answer>
|
|---|
| 102 |
|
|---|
| 103 | </qandaentry>
|
|---|
| 104 |
|
|---|
| 105 | <!-- ******* QandA Entry ******** -->
|
|---|
| 106 | <qandaentry id="qanda.Geometry.ConvGtoL">
|
|---|
| 107 |
|
|---|
| 108 | <question><para>
|
|---|
| 109 | How can I determine the exact position in global coordinates in my mass
|
|---|
| 110 | geometry during tracking and how can I convert it to coordinates local
|
|---|
| 111 | to the current volume ?
|
|---|
| 112 | </para></question>
|
|---|
| 113 |
|
|---|
| 114 | <answer><para>
|
|---|
| 115 | You need again to do it through the touchables (see also section 4.1.5
|
|---|
| 116 | of the User's Guide for Application Developers), as follows:
|
|---|
| 117 | <informalexample><programlisting>
|
|---|
| 118 | G4Step* aStep = ..;
|
|---|
| 119 | G4StepPoint* preStepPoint = aStep->GetPreStepPoint();
|
|---|
| 120 | G4TouchableHandle theTouchable = preStepPoint->GetTouchableHandle();
|
|---|
| 121 | G4ThreeVector worldPosition = preStepPoint->GetPosition();
|
|---|
| 122 | G4ThreeVector localPosition = theTouchable->GetHistory()->
|
|---|
| 123 | GetTopTransform().TransformPoint(worldPosition);
|
|---|
| 124 | </programlisting></informalexample>
|
|---|
| 125 |
|
|---|
| 126 | where <literal>worldPosition</literal> here stays for the position related
|
|---|
| 127 | to the world volume, while <literal>localPosition</literal> refers to the
|
|---|
| 128 | coordinates local to the volume where the particle is currently placed.
|
|---|
| 129 | </para></answer>
|
|---|
| 130 |
|
|---|
| 131 | </qandaentry>
|
|---|
| 132 |
|
|---|
| 133 |
|
|---|
| 134 | </qandaset>
|
|---|
| 135 | </section>
|
|---|