source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/FAQ/tracksAndSteps.xml @ 1179

Last change on this file since 1179 was 904, checked in by garnier, 16 years ago

ajout de la doc

File size: 6.1 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    1st version created:  Katsuya Amako, Dec-2006         -->
5<!--                                                          -->
6<!-- ******************************************************** -->
7
8
9<!-- ********************* QandA Section ******************** -->
10<section id="qanda.TrackSteps">
11<title>
12Tracks and steps
13</title>
14
15<qandaset defaultlabel="qanda">
16
17<!-- ******* QandA Entry ******** -->
18<qandaentry id="qanda.TrackSteps.AccssTrkInfo">
19
20<question><para>
21  How can I access the track information through the step object and
22  what information am I allowed to access ?
23</para></question>
24
25<answer><para>
26  <para>
27  A <literal>G4Step</literal> object consists of two points:
28  <informalexample><programlisting>
29      G4StepPoint* point1 = step-&gt;GetPreStepPoint();
30      G4StepPoint* point2 = step-&gt;GetPostStepPoint();
31  </programlisting></informalexample>
32  </para>
33
34  <para>
35  To get their positions in the global coordinate system:
36  <informalexample><programlisting>
37      G4ThreeVector pos1 = point1-&gt;GetPosition();
38      G4ThreeVector pos2 = point2-&gt;GetPosition();
39  </programlisting></informalexample>
40  </para>
41
42  <para>
43  Hereafter we call current volume the volume where the step has just
44  gone through. Geometrical informations are available from
45  <literal>preStepPoint</literal>.
46  <literal>G4VTouchable</literal> and its derivates keep these geometrical
47  informations. We retrieve a touchable by creating a handle for it:
48
49  <informalexample><programlisting>
50      G4TouchableHandle touch1 = point1-&gt;GetTouchableHandle();
51  </programlisting></informalexample> 
52  </para>
53
54  <para>
55  To get the current volume:
56  <informalexample><programlisting>
57       G4VPhysicalVolume* volume = touch1-&gt;GetVolume();
58  </programlisting></informalexample> 
59  </para>
60
61  <para>
62  To get its name:
63  <informalexample><programlisting>
64      G4String name = volume-&gt;GetName();
65  </programlisting></informalexample> 
66  </para>
67
68<?soft-pagebreak ?>
69  <para>
70  To get the physical volume copy number:
71  <informalexample><programlisting>
72      G4int copyNumber = touch1-&gt;GetCopyNumber();
73  </programlisting></informalexample> 
74  </para>
75
76  <para>
77  To get logical volume:
78  <informalexample><programlisting>
79      G4LogicalVolume* lVolume = volume-&gt;GetLogicalVolume();
80  </programlisting></informalexample> 
81  </para>
82
83<?soft-pagebreak ?>
84  <para>
85  To get the associated material: the following statements are equivalent:
86  <informalexample><programlisting>
87      G4Material* material = point1  -&gt;GetMaterial();
88      G4Material* material = lVolume -&gt;GetMaterial();
89  </programlisting></informalexample> 
90  </para>
91
92<?soft-pagebreak ?>
93  <para>
94  To get the geometrical region:
95  <informalexample><programlisting>
96      G4Region* region = lVolume-&gt;GetRegion();
97  </programlisting></informalexample> 
98  </para>
99
100<?soft-pagebreak ?>
101  <para>
102  To get its mother volume:
103  <informalexample><programlisting>
104      G4VPhysicalVolume* mother = touch1-&gt;GetVolume(depth=1);
105      grandMother: depth=2 ...etc...
106  </programlisting></informalexample> 
107  </para>
108
109<?soft-pagebreak ?>
110  <para>
111  To get the copy number of the mother volume:
112  <informalexample><programlisting>
113      G4int copyNumber = touch1-&gt;GetCopyNumber(depth=1);
114      grandMother: depth=2 ...etc...
115  </programlisting></informalexample> 
116  </para>
117
118  <para>
119  To get the process which has limited the current step:
120  <informalexample><programlisting>
121      G4VProcess* aProcess = point2-&gt;GetProcessDefinedStep();
122  </programlisting></informalexample> 
123  </para>
124
125  <para>
126  To check that the particle has just entered in the current volume
127  (i.e. it is at the first step in the volume; the
128  <literal>preStepPoint</literal> is at the boundary):
129
130  <informalexample><programlisting>
131      if (point1-&gt;GetStepStatus() == fGeomBoundary)
132  </programlisting></informalexample> 
133  </para>
134
135  <para>
136  To check that the particle is leaving the current volume
137  (i.e. it is at the last step in the volume; the
138  <literal>postStepPoint</literal> is at the boundary):
139
140  <informalexample><programlisting>
141      if (point2-&gt;GetStepStatus() == fGeomBoundary)
142  </programlisting></informalexample> 
143  </para>
144
145  <para>
146  In the above situation, to get touchable of the next volume:
147
148  <informalexample><programlisting>
149      G4TouchableHandle touch2 = point2-&gt;GetTouchableHandle();
150  </programlisting></informalexample> 
151
152  From <literal>touch2</literal>, all informations on the next
153  volume can be retrieved as above.
154  </para>
155
156  <para>
157  Physics quantities are available from the step
158  (<literal>G4Step</literal>) or from the track (<literal>G4Track</literal>).
159  </para>
160
161  <para>
162  To get the energy deposition, step length, displacement and time
163  of flight spent by the current step:
164  <informalexample><programlisting>
165      G4double eDeposit      = step-&gt;GetTotalEnergyDeposit();
166      G4double sLength       = step-&gt;GetStepLength();
167      G4ThreeVector displace = step-&gt;GetDeltaPosition();
168      G4double tof           = step-&gt;GetDeltaTime();
169  </programlisting></informalexample> 
170  </para>
171
172  <para>
173  To get momentum, kinetic energy and global time (time since the
174  beginning of the event) of the track after the completion of the
175  current step:
176  <informalexample><programlisting>
177      G4Track* track         = step-&gt;GetTrack();
178      G4ThreeVector momentum = track-&gt;GetMomentum();
179      G4double kinEnergy     = track-&gt;GetKineticEnergy();
180      G4double globalTime    = track-&gt;GetGlobalTime();
181      ...etc...
182  </programlisting></informalexample> 
183
184    <note>
185    <title>Remark</title>
186    <para>
187      To transform a position from the global coordinate system to the
188      local system of the current volume, use the
189      <literal>preStepPoint</literal> transformation, as described in the
190      <link linkend="qanda.Geometry.ConvGtoL">geometry section</link> above.
191    </para>
192    </note>
193  </para>
194</para></answer>
195
196</qandaentry>
197
198
199</qandaset>
200</section>
Note: See TracBrowser for help on using the repository browser.