source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/TrackingAndPhysics/tracking.html @ 1358

Last change on this file since 1358 was 1208, checked in by garnier, 15 years ago

CVS update

File size: 16.0 KB
Line 
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>
54All Geant4 processes, including the transportation of particles, are treated
55generically.  In spite of the name "<i>tracking</i>", particles are not
56<i>transported</i> in the tracking category.  <i>G4TrackingManager</i> is an
57interface class which brokers transactions between the event, track and
58tracking categories.  An instance of this class handles the message passing
59between the upper hierarchical object, which is the event manager, and lower
60hierarchical objects in the tracking category.  The event manager is a
61singleton instance of the <i>G4EventManager</i> class.
62<P>
63The tracking manager receives a track from the event manager and takes the
64actions required to finish tracking it.  <i>G4TrackingManager</i> aggregates
65the pointers to <i>G4SteppingManager,</i> <i>G4Trajectory</i> and
66<i>G4UserTrackingAction</i>.  Also there is a "use" relation to <i>G4Track</i> 
67and <i>G4Step.</i>
68<p>
69<i>G4SteppingManager</i> plays an essential role in tracking the particle.  It
70takes care of all message passing between objects in the different categories
71relevant to transporting a particle (for example, geometry and interactions in
72matter).  Its public method <tt>Stepping()</tt> steers the stepping of the
73particle.  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
130two endpoints of the step, <tt>PreStepPoint</tt> and <tt>PostStepPoint</tt>,
131which contain the points' coordinates and the volumes containing the points.
132<i>G4Step</i> also stores the change in track properties between the two
133points.  These properties, such as energy and momentum, are updated as the
134various 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
139the completion of one step. This means that <i>G4Track</i> has information on
140the previous step while the <tt>AlongStepDoIt</tt>s are being invoked for the
141step 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
143step in progress. Also, <i>G4Track</i> will be updated after each invocation
144of a <tt>PostStepDoIt</tt>.
145<p>
146<hr><a NAME="5.1.2"></a>
147<h2>
1485.1.2 Access to Track and Step Information</h2>
149
150<B>How to Get Track Information</B>
151<P>
152Track information may be accessed by invoking various <tt>Get</tt> methods
153provided 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>
160Global time (time since the event was created)</li>
161
162<li>
163Local time (time since the track was created)</li>
164
165<li>
166Proper time</li>
167
168<li>
169Momentum direction (unit vector)</li>
170
171<li>
172Kinetic energy</li>
173
174<li>
175Accumulated geometrical track length</li>
176
177<li>
178Accumulated true track length</li>
179
180<li>
181Pointer to dynamic particle</li>
182
183<li>
184Pointer to physical volume</li>
185
186<li>
187Track ID number</li>
188
189<li>
190Track ID number of the parent</li>
191
192<li>
193Current step number</li>
194
195<li>
196Track status</li>
197
198<li>
199(x,y,z) at the start point (vertex position) of the track</li>
200
201<li>
202Momentum direction at the start point (vertex position) of the track</li>
203
204<li>
205Kinetic energy at the start point (vertex position) of the track</li>
206
207<li>
208Pointer to the process which created the current track</li>
209</ul>
210<P>
211<B>How to Get Step Information</B>
212<P>
213Step and step-point information can be retrieved by invoking various
214<tt>Get</tt> methods provided in the <i>G4Step</i>/<i>G4StepPoint</i> 
215classes.  For details, see the <b>Software Reference Manual</b>.
216Information in <i>G4Step</i> includes:
217<ul>
218<li>
219Pointers to <tt>PreStep</tt> and <tt>PostStepPoint</tt></li>
220
221<li>
222Geometrical step length (step length before the correction of multiple
223scattering)</li>
224
225<li>
226True step length (step length after the correction of multiple scattering)</li>
227
228<li>
229Increment of position and time between <tt>PreStepPoint</tt> and
230<tt>PostStepPoint</tt></li>
231
232<li>
233Increment of momentum and energy between <tt>PreStepPoint</tt> and
234<tt>PostStepPoint</tt>. (Note: to get the energy deposited in the step, you
235cannot use this 'Delta energy'. You have to use 'Total energy deposit' as
236below.)</li>
237
238<li>
239Pointer to <tt>G4Track</tt></li>
240
241<li>
242Total energy deposited during the step - this is the sum of</li>
243
244<ul>
245<li>
246the energy deposited by the energy loss process, and </li>
247
248<li>
249the energy lost by secondaries which have NOT been generated because each
250of their energies was below the cut threshold</li>
251</ul>
252</ul>
253Information 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>
263Momentum direction (init vector)</li>
264
265<li>
266Pointers to physical volumes</li>
267
268<li>
269Safety</li>
270
271<li>
272Beta, gamma</li>
273
274<li>
275Polarization</li>
276
277<li>
278Step status</li>
279
280<li>
281Pointer to the physics process which defined the current step and its
282<tt>DoIt</tt> type</li>
283
284<li>
285Pointer to the physics process which defined the previous step and its
286<tt>DoIt</tt> type</li>
287
288<li>
289Total track length</li>
290
291<li>
292Global time (time since the current event began)</li>
293
294<li>
295Local time (time since the current track began)</li>
296
297<li>
298Proper time</li>
299</ul>
300<P>
301<B>How to Get "particle change"</B>
302<P>
303Particle change information can be accessed by invoking various <tt>Get</tt>
304methods provided in the <i>G4ParticleChange</i> class. Typical information
305available includes (for details, see the <b>Software Reference Manual</b>):
306<ul>
307<li>
308final momentum direction of the parent particle</li>
309
310<li>
311final kinetic energy of the parent particle</li>
312
313<li>
314final position of the parent particle</li>
315
316<li>
317final global time of the parent particle</li>
318
319<li>
320final proper time of the parent particle</li>
321
322<li>
323final polarization of the parent particle</li>
324
325<li>
326status of the parent particle (<i>G4TrackStatus</i>)</li>
327
328<li>
329true step length (this is used by multiple scattering to store the result
330of the transformation from the geometrical step length to the true step
331length)</li>
332
333<li>
334local energy deposited - this consists of either</li>
335
336<ul>
337<li>
338energy deposited by the energy loss process, or</li>
339
340<li>
341the energy lost by secondaries which have NOT been generated because each
342of their energies was below the cut threshold.</li>
343</ul>
344
345<li>
346number of secondaries particles</li>
347
348<li>
349list 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>
354Secondary particles are passed as <i>G4Track</i>s from a physics process
355to tracking. <i>G4ParticleChange</i> provides the following four methods
356for 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>
371In all but the first, the construction of <i>G4Track</i> is done in the
372methods using informaton given by the arguments.
373<p>
374<hr><a NAME="5.1.4"></a>
375<h2>5.1.4 User Actions</h2>
376There are two classes which allow the user to intervene in the tracking. 
377These are:
378<ul>
379<li>
380<i>G4UserTrackingAction</i>, and</li>
381
382<li>
383<i>G4UserSteppingAction</i>.
384</ul>
385Each provides methods which allow the user access to the Geant4 kernel at
386specific 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>
392The verbose information output flag can be turned on or off.  The amount of
393information printed about the track/step, from brief to very detailed, can be
394controlled 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
404classes provided by Geant4, which are derived from the <i>G4VTrajectory</i>
405and <i>G4VTrajectoryPoint</i> base classes, respectively.  A
406<i>G4Trajectory</i> class object is created by <i>G4TrackingManager</i> 
407when 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
417followed by the track.  Its position is given by a <i>G4ThreeVector</i>.
418A <i>G4TrajectoryPoint</i> class object is created in the
419<i>AppendStep()</i> method of <i>G4Trajectory</i> and this method is
420invoked by <i>G4TrackingManager</i> at the end of each step.  The first
421point is created when the <i>G4Trajectory</i> is created, thus the first
422point is the original vertex.
423<p>
424The 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
427this 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
430a shower due to the large amount of memory consumed.</b></blockquote>
431All 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
434may invoke the <i>DrawTrajectory()</i> or <i>ShowTrajectory()</i> methods
435of <i>G4VTrajectory</i>, respectively, from his/her
436<i>G4UserEventAction::EndOfEventAction()</i>. The geometry must
437be drawn before the trajectory drawing.  The color of the drawn trajectory
438depends 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
448more than one turn of its spiral trajectory without being broken into smaller
449steps as long as the trajectory does not cross a geometrical boundary.
450Thus 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
455available at the end of the event.  Thus, the concrete classes
456<i>G4VTrajectory</i> and <i>G4VTrajectoryPoint</i> are the only ones a user
457may employ for end-of-event analysis or for persistency.  As mentioned above,
458the default classes which Geant4 provides, i.e. <i>G4Trajectory</i> and
459<i>G4TrajectoryPoint</i>, have only very primitive quantities.  The user can
460customize his/her own trajectory and trajectory point classes by deriving
461directly from the respective base classes.
462<p>
463To use the customized trajectory, the user must construct a concrete
464trajectory class object in the
465<i>G4UserTrackingAction::PreUserTrackingAction()</i> method and make its
466pointer available to <i>G4TrackingManager</i> by using the
467<i>SetTrajectory()</i> method.  The customized trajectory point class object
468must be constructed in the <i>AppendStep()</i> method of the user's
469implementation of the trajectory class.  This <i>AppendStep()</i> method will
470be invoked by <i>G4TrackingManager</i>.
471<p>
472To customize trajectory drawing, the user can override the
473<i>DrawTrajectory()</i> method in his/her own trajectory class.
474<p>
475When 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
477useful 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
483the authors</a></i>
484</body>
485</html>
Note: See TracBrowser for help on using the repository browser.