1 | <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
5 | <meta name="GENERATOR" content="Mozilla/4.77 [en] (X11; U; SunOS 5.8 sun4u) [Netscape]"> |
---|
6 | <! $Id: tracking.html,v 1.6 2005/08/02 20:28:19 dennis Exp $ > |
---|
7 | <!-- Changed by: Katsuya Amako, 30-Nov-1998 --> |
---|
8 | <!-- Proof read by: Joe Chuma, 30-Jun-1999 --> |
---|
9 | <!-- Changed by: Takashi SasakI, 15-Nov-2001 --> |
---|
10 | <!-- Changed by: Dennis Wright, 27-Nov-2001 --> |
---|
11 | </head> |
---|
12 | <body> |
---|
13 | <!-- Changed by: Katsuya Amako, 10-Jul-1998 --> |
---|
14 | <table WIDTH="100%" > |
---|
15 | <tr> |
---|
16 | <td> |
---|
17 | <a href="../../../../Overview/html/index.html"> |
---|
18 | <IMG SRC="../../../../resources/html/IconsGIF/Overview.gif" ALT="Overview" height=16 width=59></a> |
---|
19 | <a href="index.html"> |
---|
20 | <img SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents" height=16 width=59></a> |
---|
21 | <a> |
---|
22 | <img SRC="../../../../resources/html/IconsGIF/PreviousGR.gif" ALT="Previous" height=16 width=59></a> |
---|
23 | <a href="physicsProcess.html"> |
---|
24 | <img SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next" height=16 width=59></a> |
---|
25 | </td> |
---|
26 | |
---|
27 | <td ALIGN=RIGHT> |
---|
28 | <FONT SIZE=-1 color="#238E23"> |
---|
29 | <B>Geant4 User's Guide</B> |
---|
30 | <br> |
---|
31 | <B>For Application Developers</B> |
---|
32 | <br> |
---|
33 | <B>Tracking and Physics</B> |
---|
34 | </FONT> |
---|
35 | </TD> |
---|
36 | </tr></table> |
---|
37 | <br><BR> |
---|
38 | |
---|
39 | <P ALIGN=center> |
---|
40 | <FONT SIZE=+3 color="#238E23"> |
---|
41 | <B>5.1 Tracking</B> |
---|
42 | </FONT> |
---|
43 | |
---|
44 | <br><br> |
---|
45 | |
---|
46 | <hr ALIGN="Center" SIZE="7%"> |
---|
47 | <p> |
---|
48 | |
---|
49 | <a NAME="5.1.1"></a> |
---|
50 | <h2>5.1.1 Basic Concepts</h2> |
---|
51 | |
---|
52 | <B>Philosophy of Tracking</B> |
---|
53 | <P> |
---|
54 | All Geant4 processes, including the transportation of particles, are treated |
---|
55 | generically. In spite of the name "<i>tracking</i>", particles are not |
---|
56 | <i>transported</i> in the tracking category. <i>G4TrackingManager</i> is an |
---|
57 | interface class which brokers transactions between the event, track and |
---|
58 | tracking categories. An instance of this class handles the message passing |
---|
59 | between the upper hierarchical object, which is the event manager, and lower |
---|
60 | hierarchical objects in the tracking category. The event manager is a |
---|
61 | singleton instance of the <i>G4EventManager</i> class. |
---|
62 | <P> |
---|
63 | The tracking manager receives a track from the event manager and takes the |
---|
64 | actions required to finish tracking it. <i>G4TrackingManager</i> aggregates |
---|
65 | the pointers to <i>G4SteppingManager,</i> <i>G4Trajectory</i> and |
---|
66 | <i>G4UserTrackingAction</i>. Also there is a "use" relation to <i>G4Track</i> |
---|
67 | and <i>G4Step.</i> |
---|
68 | <p> |
---|
69 | <i>G4SteppingManager</i> plays an essential role in tracking the particle. It |
---|
70 | takes care of all message passing between objects in the different categories |
---|
71 | relevant to transporting a particle (for example, geometry and interactions in |
---|
72 | matter). Its public method <tt>Stepping()</tt> steers the stepping of the |
---|
73 | particle. The algorithm to handle one step is given below. |
---|
74 | <p> |
---|
75 | <OL> |
---|
76 | <LI>The particle's velocity at the beginning of the step is calculated. |
---|
77 | <LI>Each active discrete or continuous process must propose a step length |
---|
78 | based on the interaction it describes. The smallest of these step |
---|
79 | lengths is taken. |
---|
80 | <LI>The geometry navigator calculates "Safety", the distance to the next |
---|
81 | volume boundary. If the minimum physical-step-length from the processes |
---|
82 | is shorter than "Safety", the physical-step-length is selected as the |
---|
83 | next step length. In this case, no further geometrical calculations will |
---|
84 | be performed. |
---|
85 | <LI>If the minimum physical-step-length from the processes is longer than |
---|
86 | "Safety", the distance to the next boundary is re-calculated. |
---|
87 | <LI>The smaller of the minimum physical-step-length and the geometric |
---|
88 | step length is taken. |
---|
89 | <LI>All active continuous processes are invoked. Note that the particle's |
---|
90 | kinetic energy will be updated only after all invoked processes have |
---|
91 | completed. The change in kinetic energy will be the sum of the |
---|
92 | contributions from these processes. |
---|
93 | <LI>The track is checked to see whether or not it has been terminated by a |
---|
94 | continuous process. |
---|
95 | <LI>The current track properties are updated before discrete processes |
---|
96 | are invoked. This includes: |
---|
97 | <UL> |
---|
98 | <LI>updating the kinetic energy of the current track particle |
---|
99 | (note that 'sumEnergyChange' is the sum of the new kinetic |
---|
100 | energy after each continuos process was invoked, and NOT the sum |
---|
101 | of the energy difference before and after the process |
---|
102 | invocation) and |
---|
103 | <LI>updating position and time. |
---|
104 | </UL> |
---|
105 | <LI>The discrete process is invoked. After the invocation, |
---|
106 | <UL> |
---|
107 | <LI>the energy of the current track particle is updated, and |
---|
108 | <LI>the secondaries from ParticleChange are stored in SecondaryList. |
---|
109 | This includes constructing "G4Track" objects, and setting their |
---|
110 | member data. Note that the stepping manager is responsible for |
---|
111 | deleting secodaries from ParticleChange. |
---|
112 | </UL> |
---|
113 | <LI>The track is checked to see whether or not it has been terminated by |
---|
114 | the discrete process. |
---|
115 | <LI>"Safety" is updated. |
---|
116 | <LI>If the step was limited by the volume boundary, push the particle into |
---|
117 | the next volume. |
---|
118 | <LI>Invoke the user intervention <i>G4UserSteppingAction</i>. |
---|
119 | <LI>Handle hit information. |
---|
120 | <LI>Save data to Trajectory. |
---|
121 | <LI>Update the mean free paths of the discrete processes. |
---|
122 | <LI>If the parent particle is still alive, reset the maximum interaction |
---|
123 | length of the discrete process which has occurred. |
---|
124 | <LI>One step completed. |
---|
125 | </OL> |
---|
126 | <P> |
---|
127 | <B>What is a Step?</B> |
---|
128 | <P> |
---|
129 | <i>G4Step</i> stores the transient information of a step. This includes the |
---|
130 | two endpoints of the step, <tt>PreStepPoint</tt> and <tt>PostStepPoint</tt>, |
---|
131 | which contain the points' coordinates and the volumes containing the points. |
---|
132 | <i>G4Step</i> also stores the change in track properties between the two |
---|
133 | points. These properties, such as energy and momentum, are updated as the |
---|
134 | various active processes are invoked.</P> |
---|
135 | |
---|
136 | <B>What is a Track?</B> |
---|
137 | <P> |
---|
138 | <i>G4Track</i> keeps information on the final status of the particle after |
---|
139 | the completion of one step. This means that <i>G4Track</i> has information on |
---|
140 | the previous step while the <tt>AlongStepDoIt</tt>s are being invoked for the |
---|
141 | step in progress. Only after finishing all <tt>AlongStepDoIt</tt>s, will |
---|
142 | <i>G4Track</i> have the final information (e.g., the final position) for the |
---|
143 | step in progress. Also, <i>G4Track</i> will be updated after each invocation |
---|
144 | of a <tt>PostStepDoIt</tt>. |
---|
145 | <p> |
---|
146 | <hr><a NAME="5.1.2"></a> |
---|
147 | <h2> |
---|
148 | 5.1.2 Access to Track and Step Information</h2> |
---|
149 | |
---|
150 | <B>How to Get Track Information</B> |
---|
151 | <P> |
---|
152 | Track information may be accessed by invoking various <tt>Get</tt> methods |
---|
153 | provided in the <i>G4Track</i> class. For details, see the |
---|
154 | <b>Software Reference Manual</b>. Typical information available includes: |
---|
155 | <ul> |
---|
156 | <li> |
---|
157 | (x,y,z)</li> |
---|
158 | |
---|
159 | <li> |
---|
160 | Global time (time since the event was created)</li> |
---|
161 | |
---|
162 | <li> |
---|
163 | Local time (time since the track was created)</li> |
---|
164 | |
---|
165 | <li> |
---|
166 | Proper time</li> |
---|
167 | |
---|
168 | <li> |
---|
169 | Momentum direction (unit vector)</li> |
---|
170 | |
---|
171 | <li> |
---|
172 | Kinetic energy</li> |
---|
173 | |
---|
174 | <li> |
---|
175 | Accumulated geometrical track length</li> |
---|
176 | |
---|
177 | <li> |
---|
178 | Accumulated true track length</li> |
---|
179 | |
---|
180 | <li> |
---|
181 | Pointer to dynamic particle</li> |
---|
182 | |
---|
183 | <li> |
---|
184 | Pointer to physical volume</li> |
---|
185 | |
---|
186 | <li> |
---|
187 | Track ID number</li> |
---|
188 | |
---|
189 | <li> |
---|
190 | Track ID number of the parent</li> |
---|
191 | |
---|
192 | <li> |
---|
193 | Current step number</li> |
---|
194 | |
---|
195 | <li> |
---|
196 | Track status</li> |
---|
197 | |
---|
198 | <li> |
---|
199 | (x,y,z) at the start point (vertex position) of the track</li> |
---|
200 | |
---|
201 | <li> |
---|
202 | Momentum direction at the start point (vertex position) of the track</li> |
---|
203 | |
---|
204 | <li> |
---|
205 | Kinetic energy at the start point (vertex position) of the track</li> |
---|
206 | |
---|
207 | <li> |
---|
208 | Pointer to the process which created the current track</li> |
---|
209 | </ul> |
---|
210 | <P> |
---|
211 | <B>How to Get Step Information</B> |
---|
212 | <P> |
---|
213 | Step and step-point information can be retrieved by invoking various |
---|
214 | <tt>Get</tt> methods provided in the <i>G4Step</i>/<i>G4StepPoint</i> |
---|
215 | classes. For details, see the <b>Software Reference Manual</b>. |
---|
216 | Information in <i>G4Step</i> includes: |
---|
217 | <ul> |
---|
218 | <li> |
---|
219 | Pointers to <tt>PreStep</tt> and <tt>PostStepPoint</tt></li> |
---|
220 | |
---|
221 | <li> |
---|
222 | Geometrical step length (step length before the correction of multiple |
---|
223 | scattering)</li> |
---|
224 | |
---|
225 | <li> |
---|
226 | True step length (step length after the correction of multiple scattering)</li> |
---|
227 | |
---|
228 | <li> |
---|
229 | Increment of position and time between <tt>PreStepPoint</tt> and |
---|
230 | <tt>PostStepPoint</tt></li> |
---|
231 | |
---|
232 | <li> |
---|
233 | Increment of momentum and energy between <tt>PreStepPoint</tt> and |
---|
234 | <tt>PostStepPoint</tt>. (Note: to get the energy deposited in the step, you |
---|
235 | cannot use this 'Delta energy'. You have to use 'Total energy deposit' as |
---|
236 | below.)</li> |
---|
237 | |
---|
238 | <li> |
---|
239 | Pointer to <tt>G4Track</tt></li> |
---|
240 | |
---|
241 | <li> |
---|
242 | Total energy deposited during the step - this is the sum of</li> |
---|
243 | |
---|
244 | <ul> |
---|
245 | <li> |
---|
246 | the energy deposited by the energy loss process, and </li> |
---|
247 | |
---|
248 | <li> |
---|
249 | the energy lost by secondaries which have NOT been generated because each |
---|
250 | of their energies was below the cut threshold</li> |
---|
251 | </ul> |
---|
252 | </ul> |
---|
253 | Information in <i>G4StepPoint</i> (<tt>PreStepPoint</tt> and |
---|
254 | <tt>PostStepPoint</tt>) includes: |
---|
255 | <ul> |
---|
256 | <li> |
---|
257 | (x, y, z, t)</li> |
---|
258 | |
---|
259 | <li> |
---|
260 | (px, py, pz, Ek)</li> |
---|
261 | |
---|
262 | <li> |
---|
263 | Momentum direction (init vector)</li> |
---|
264 | |
---|
265 | <li> |
---|
266 | Pointers to physical volumes</li> |
---|
267 | |
---|
268 | <li> |
---|
269 | Safety</li> |
---|
270 | |
---|
271 | <li> |
---|
272 | Beta, gamma</li> |
---|
273 | |
---|
274 | <li> |
---|
275 | Polarization</li> |
---|
276 | |
---|
277 | <li> |
---|
278 | Step status</li> |
---|
279 | |
---|
280 | <li> |
---|
281 | Pointer to the physics process which defined the current step and its |
---|
282 | <tt>DoIt</tt> type</li> |
---|
283 | |
---|
284 | <li> |
---|
285 | Pointer to the physics process which defined the previous step and its |
---|
286 | <tt>DoIt</tt> type</li> |
---|
287 | |
---|
288 | <li> |
---|
289 | Total track length</li> |
---|
290 | |
---|
291 | <li> |
---|
292 | Global time (time since the current event began)</li> |
---|
293 | |
---|
294 | <li> |
---|
295 | Local time (time since the current track began)</li> |
---|
296 | |
---|
297 | <li> |
---|
298 | Proper time</li> |
---|
299 | </ul> |
---|
300 | <P> |
---|
301 | <B>How to Get "particle change"</B> |
---|
302 | <P> |
---|
303 | Particle change information can be accessed by invoking various <tt>Get</tt> |
---|
304 | methods provided in the <i>G4ParticleChange</i> class. Typical information |
---|
305 | available includes (for details, see the <b>Software Reference Manual</b>): |
---|
306 | <ul> |
---|
307 | <li> |
---|
308 | final momentum direction of the parent particle</li> |
---|
309 | |
---|
310 | <li> |
---|
311 | final kinetic energy of the parent particle</li> |
---|
312 | |
---|
313 | <li> |
---|
314 | final position of the parent particle</li> |
---|
315 | |
---|
316 | <li> |
---|
317 | final global time of the parent particle</li> |
---|
318 | |
---|
319 | <li> |
---|
320 | final proper time of the parent particle</li> |
---|
321 | |
---|
322 | <li> |
---|
323 | final polarization of the parent particle</li> |
---|
324 | |
---|
325 | <li> |
---|
326 | status of the parent particle (<i>G4TrackStatus</i>)</li> |
---|
327 | |
---|
328 | <li> |
---|
329 | true step length (this is used by multiple scattering to store the result |
---|
330 | of the transformation from the geometrical step length to the true step |
---|
331 | length)</li> |
---|
332 | |
---|
333 | <li> |
---|
334 | local energy deposited - this consists of either</li> |
---|
335 | |
---|
336 | <ul> |
---|
337 | <li> |
---|
338 | energy deposited by the energy loss process, or</li> |
---|
339 | |
---|
340 | <li> |
---|
341 | the energy lost by secondaries which have NOT been generated because each |
---|
342 | of their energies was below the cut threshold.</li> |
---|
343 | </ul> |
---|
344 | |
---|
345 | <li> |
---|
346 | number of secondaries particles</li> |
---|
347 | |
---|
348 | <li> |
---|
349 | list of secondary particles (list of <i>G4Track</i>)</li> |
---|
350 | </ul> |
---|
351 | |
---|
352 | <hr><a NAME="5.1.3"></a> |
---|
353 | <h2>5.1.3 Handling of Secondary Particles</h2> |
---|
354 | Secondary particles are passed as <i>G4Track</i>s from a physics process |
---|
355 | to tracking. <i>G4ParticleChange</i> provides the following four methods |
---|
356 | for a physics process: |
---|
357 | <ul> |
---|
358 | <li> |
---|
359 | <tt>AddSecondary( G4Track* aSecondary )</tt></li> |
---|
360 | |
---|
361 | <li> |
---|
362 | <tt>AddSecondary( G4DynamicParticle* aSecondary )</tt></li> |
---|
363 | |
---|
364 | <li> |
---|
365 | <tt>AddSecondary( G4DynamicParticle* aSecondary, G4ThreeVector position |
---|
366 | )</tt></li> |
---|
367 | |
---|
368 | <li> |
---|
369 | <tt>AddSecondary( G4DynamicParticle* aSecondary, G4double time )</tt></li> |
---|
370 | </ul> |
---|
371 | In all but the first, the construction of <i>G4Track</i> is done in the |
---|
372 | methods using informaton given by the arguments. |
---|
373 | <p> |
---|
374 | <hr><a NAME="5.1.4"></a> |
---|
375 | <h2>5.1.4 User Actions</h2> |
---|
376 | There are two classes which allow the user to intervene in the tracking. |
---|
377 | These are: |
---|
378 | <ul> |
---|
379 | <li> |
---|
380 | <i>G4UserTrackingAction</i>, and</li> |
---|
381 | |
---|
382 | <li> |
---|
383 | <i>G4UserSteppingAction</i>. |
---|
384 | </ul> |
---|
385 | Each provides methods which allow the user access to the Geant4 kernel at |
---|
386 | specific points in the tracking. For details, see the |
---|
387 | <b>Software Reference Manual</b>.</li> |
---|
388 | </ul> |
---|
389 | |
---|
390 | <hr><a NAME="5.1.5"></a> |
---|
391 | <h2>5.1.5 Verbose Outputs</h2> |
---|
392 | The verbose information output flag can be turned on or off. The amount of |
---|
393 | information printed about the track/step, from brief to very detailed, can be |
---|
394 | controlled by the value of the verbose flag, for example, |
---|
395 | <p>G4UImanager* UI = G4UImanager::GetUIpointer(); |
---|
396 | <br>UI->ApplyCommand("/tracking/verbose 1"); |
---|
397 | <p> |
---|
398 | <hr><a NAME="5.1.6"></a> |
---|
399 | <h2>5.1.6 Trajectory and Trajectory Point</h2> |
---|
400 | |
---|
401 | <B>G4Trajectory and G4TrajectoryPoint</B> |
---|
402 | <P> |
---|
403 | <i>G4Trajectory</i> and <i>G4TrajectoryPoint</i> are default concrete |
---|
404 | classes provided by Geant4, which are derived from the <i>G4VTrajectory</i> |
---|
405 | and <i>G4VTrajectoryPoint</i> base classes, respectively. A |
---|
406 | <i>G4Trajectory</i> class object is created by <i>G4TrackingManager</i> |
---|
407 | when a <i>G4Track</i> is passed from the <i>G4EventManager</i>. |
---|
408 | <i>G4Trajectory</i> has the following data members: |
---|
409 | <ul> |
---|
410 | <li>ID numbers of the track and the track's parent</li> |
---|
411 | |
---|
412 | <li>particle name, charge, and PDG code</li> |
---|
413 | |
---|
414 | <li>a collection of <i>G4TrajectoryPoint</i> pointers</li> |
---|
415 | </ul> |
---|
416 | <i>G4TrajectoryPoint</i> corresponds to a step point along the path |
---|
417 | followed by the track. Its position is given by a <i>G4ThreeVector</i>. |
---|
418 | A <i>G4TrajectoryPoint</i> class object is created in the |
---|
419 | <i>AppendStep()</i> method of <i>G4Trajectory</i> and this method is |
---|
420 | invoked by <i>G4TrackingManager</i> at the end of each step. The first |
---|
421 | point is created when the <i>G4Trajectory</i> is created, thus the first |
---|
422 | point is the original vertex. |
---|
423 | <p> |
---|
424 | The creation of a trajectory can be controlled by invoking |
---|
425 | <i>G4TrackingManager::SetStoreTrajectory(G4bool)</i>. The UI command |
---|
426 | <i>/tracking/storeTrajectory _bool_</i> does the same. The user can set |
---|
427 | this flag for each individual track from his/her |
---|
428 | <i>G4UserTrackingAction::PreUserTrackingAction()</i> method. |
---|
429 | <blockquote><b>The user should not create trajectories for secondaries in |
---|
430 | a shower due to the large amount of memory consumed.</b></blockquote> |
---|
431 | All the created trajectories in an event are stored in |
---|
432 | <i>G4TrajectoryContainer</i> class object and this object will be kept by |
---|
433 | <i>G4Event</i>. To draw or print trajectories generated in an event, the user |
---|
434 | may invoke the <i>DrawTrajectory()</i> or <i>ShowTrajectory()</i> methods |
---|
435 | of <i>G4VTrajectory</i>, respectively, from his/her |
---|
436 | <i>G4UserEventAction::EndOfEventAction()</i>. The geometry must |
---|
437 | be drawn before the trajectory drawing. The color of the drawn trajectory |
---|
438 | depends on the particle charge: |
---|
439 | <ul> |
---|
440 | <li>negative: red</li> |
---|
441 | |
---|
442 | <li>neutral: green</li> |
---|
443 | |
---|
444 | <li>positive: blue</li> |
---|
445 | </ul> |
---|
446 | |
---|
447 | <blockquote><b>Due to improvements in <i>G4Navigator</i>, a track can execute |
---|
448 | more than one turn of its spiral trajectory without being broken into smaller |
---|
449 | steps as long as the trajectory does not cross a geometrical boundary. |
---|
450 | Thus a drawn trajectory may not be circular.</b></blockquote> |
---|
451 | <P> |
---|
452 | <B>Customizing trajectory and trajectory point</B> |
---|
453 | <P> |
---|
454 | <i>G4Track</i> and <i>G4Step</i> are transient classes; they are not |
---|
455 | available at the end of the event. Thus, the concrete classes |
---|
456 | <i>G4VTrajectory</i> and <i>G4VTrajectoryPoint</i> are the only ones a user |
---|
457 | may employ for end-of-event analysis or for persistency. As mentioned above, |
---|
458 | the default classes which Geant4 provides, i.e. <i>G4Trajectory</i> and |
---|
459 | <i>G4TrajectoryPoint</i>, have only very primitive quantities. The user can |
---|
460 | customize his/her own trajectory and trajectory point classes by deriving |
---|
461 | directly from the respective base classes. |
---|
462 | <p> |
---|
463 | To use the customized trajectory, the user must construct a concrete |
---|
464 | trajectory class object in the |
---|
465 | <i>G4UserTrackingAction::PreUserTrackingAction()</i> method and make its |
---|
466 | pointer available to <i>G4TrackingManager</i> by using the |
---|
467 | <i>SetTrajectory()</i> method. The customized trajectory point class object |
---|
468 | must be constructed in the <i>AppendStep()</i> method of the user's |
---|
469 | implementation of the trajectory class. This <i>AppendStep()</i> method will |
---|
470 | be invoked by <i>G4TrackingManager</i>. |
---|
471 | <p> |
---|
472 | To customize trajectory drawing, the user can override the |
---|
473 | <i>DrawTrajectory()</i> method in his/her own trajectory class. |
---|
474 | <p> |
---|
475 | When a customized version of G4Trajectory declares any new class variables, |
---|
476 | <i>operator new</i> and <i>operator delete</i> must be provided. It is also |
---|
477 | useful to check that the allocation size in <i>operator new</i> is equal to |
---|
478 | <i>sizeof(G4Trajectory)</i>. These two points do not apply to |
---|
479 | <i>G4VTrajectory</i> because it has no <i>operator new</i> or |
---|
480 | <i>operator delete</i>. |
---|
481 | <p> |
---|
482 | <hr><i><a href="../../../../Authors/html/subjectsToAuthors.html">About |
---|
483 | the authors</a></i> |
---|
484 | </body> |
---|
485 | </html> |
---|