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> |
---|
12 | Tracks 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->GetPreStepPoint(); |
---|
30 | G4StepPoint* point2 = step->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->GetPosition(); |
---|
38 | G4ThreeVector pos2 = point2->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->GetTouchableHandle(); |
---|
51 | </programlisting></informalexample> |
---|
52 | </para> |
---|
53 | |
---|
54 | <para> |
---|
55 | To get the current volume: |
---|
56 | <informalexample><programlisting> |
---|
57 | G4VPhysicalVolume* volume = touch1->GetVolume(); |
---|
58 | </programlisting></informalexample> |
---|
59 | </para> |
---|
60 | |
---|
61 | <para> |
---|
62 | To get its name: |
---|
63 | <informalexample><programlisting> |
---|
64 | G4String name = volume->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->GetCopyNumber(); |
---|
73 | </programlisting></informalexample> |
---|
74 | </para> |
---|
75 | |
---|
76 | <para> |
---|
77 | To get logical volume: |
---|
78 | <informalexample><programlisting> |
---|
79 | G4LogicalVolume* lVolume = volume->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 ->GetMaterial(); |
---|
88 | G4Material* material = lVolume ->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->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->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->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->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->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->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->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->GetTotalEnergyDeposit(); |
---|
166 | G4double sLength = step->GetStepLength(); |
---|
167 | G4ThreeVector displace = step->GetDeltaPosition(); |
---|
168 | G4double tof = step->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->GetTrack(); |
---|
178 | G4ThreeVector momentum = track->GetMomentum(); |
---|
179 | G4double kinEnergy = track->GetKineticEnergy(); |
---|
180 | G4double globalTime = track->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> |
---|