source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/TrackingAndPhysics/tracking.xml @ 921

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

ajout de la doc

File size: 21.9 KB
Line 
1<!-- ******************************************************** -->
2<!--                                                          -->
3<!--  [History]                                               -->
4<!--    Changed by: Katsuya Amako, 30-Nov-1998                -->
5<!--    Changed by: Katsuya Amako, 10-Jul-1998                -->
6<!--    Proof read by: Joe Chuma,  30-Jun-1999                -->
7<!--    Changed by: Takashi SasakI,  15-Nov-2001              -->
8<!--    Changed by: Dennis Wright, 27-Nov-2001                -->
9<!--    Converted to DocBook: Katsuya Amako, Aug-2006         -->
10<!--    Changed by: Hisaya Kurashige, 01-Dec-2007             -->
11<!--                                                          -->
12<!-- ******************************************************** -->
13
14
15<!-- ******************* Section (Level#1) ****************** -->
16<sect1 id="sect.Track">
17<title>
18Tracking
19</title>
20
21<!-- ******************* Section (Level#2) ****************** -->
22<sect2 id="sect.Track.Basic">
23<title>
24Basic Concepts
25</title>
26
27<!-- ******* Bridgehead ******* -->
28<bridgehead renderas='sect4'>
29Philosophy of Tracking
30</bridgehead>
31
32<para>
33All Geant4 processes, including the transportation of particles,
34are treated generically. In spite of the name "<emphasis>tracking</emphasis>",
35particles are not <emphasis>transported</emphasis> in the tracking category.
36<emphasis>G4TrackingManager</emphasis> is an interface class which brokers
37transactions between the event, track and tracking categories. An
38instance of this class handles the message passing between the
39upper hierarchical object, which is the event manager, and lower
40hierarchical objects in the tracking category. The event manager is
41a singleton instance of the <emphasis>G4EventManager</emphasis> class.
42</para>
43
44<para>
45The tracking manager receives a track from the event manager and
46takes the actions required to finish tracking it.
47<emphasis>G4TrackingManager</emphasis> aggregates the pointers to
48<emphasis>G4SteppingManager,</emphasis> <emphasis>G4Trajectory</emphasis> and
49<emphasis>G4UserTrackingAction</emphasis>. Also there is a "use" relation to
50<emphasis>G4Track</emphasis> and <emphasis>G4Step</emphasis>.
51</para>
52
53<para>
54<emphasis>G4SteppingManager</emphasis> plays an essential role in tracking the
55particle. It takes care of all message passing between objects in
56the different categories relevant to transporting a particle (for
57example, geometry and interactions in matter). Its public method
58<literal>Stepping()</literal> steers the stepping of the particle. The
59algorithm to handle one step is given below.
60
61<orderedlist spacing="compact">
62  <listitem><para>
63    The particle's velocity at the beginning of the step is
64    calculated.
65  </para></listitem>
66  <listitem><para>
67    Each active discrete or continuous process must propose a step
68    length based on the interaction it describes. The smallest of these
69    step lengths is taken.
70  </para></listitem>
71  <listitem><para>
72    The geometry navigator calculates "Safety", the distance to the
73    next volume boundary. If the minimum physical-step-length from the
74    processes is shorter than "Safety", the physical-step-length is
75    selected as the next step length. In this case, no further
76    geometrical calculations will be performed.
77  </para></listitem>
78  <listitem><para>
79    If the minimum physical-step-length from the processes is
80    longer than "Safety", the distance to the next boundary is
81    re-calculated.
82  </para></listitem>
83  <listitem><para>
84    The smaller of the minimum physical-step-length and the
85    geometric step length is taken.
86  </para></listitem>
87  <listitem><para>
88    All active continuous processes are invoked. Note that the
89    particle's kinetic energy will be updated only after all invoked
90    processes have completed. The change in kinetic energy will be the
91    sum of the contributions from these processes.
92  </para></listitem>
93  <listitem><para>
94    The track is checked to see whether or not it has been
95    terminated by a continuous process.
96  </para></listitem>
97  <listitem><para>
98    The current track properties are updated before discrete
99    processes are invoked. This includes:
100
101    <itemizedlist spacing="compact">
102      <listitem><para>
103        updating the kinetic energy of the current track particle (note
104        that 'sumEnergyChange' is the sum of the new kinetic energy after
105        each continuos process was invoked, and NOT the sum of the energy
106        difference before and after the process invocation) and
107      </para></listitem>
108      <listitem><para>
109        updating position and time.
110      </para></listitem>
111    </itemizedlist>
112  </para></listitem>
113  <listitem><para>
114    The discrete process is invoked. After the invocation,
115
116    <itemizedlist spacing="compact">
117      <listitem><para>
118        the energy of the current track particle is updated, and
119      </para></listitem>
120      <listitem><para>
121        the secondaries from ParticleChange are stored in
122        SecondaryList. This includes constructing "G4Track" objects, and
123        setting their member data. Note that the stepping manager is
124        responsible for deleting secodaries from ParticleChange.
125      </para></listitem>
126    </itemizedlist>
127  </para></listitem>
128  <listitem><para>
129    The track is checked to see whether or not it has been
130    terminated by the discrete process.
131  </para></listitem>
132  <listitem><para>
133    "Safety" is updated.
134  </para></listitem>
135  <listitem><para>
136    If the step was limited by the volume boundary, push the
137    particle into the next volume.
138  </para></listitem>
139  <listitem><para>
140    Invoke the user intervention <emphasis>G4UserSteppingAction</emphasis>.
141  </para></listitem>
142  <listitem><para>
143    Handle hit information.
144  </para></listitem>
145  <listitem><para>
146    Save data to Trajectory.
147  </para></listitem>
148  <listitem><para>
149    Update the mean free paths of the discrete processes.
150  </para></listitem>
151  <listitem><para>
152    If the parent particle is still alive, reset the maximum
153    interaction length of the discrete process which has occurred.
154  </para></listitem>
155  <listitem><para>
156    One step completed.
157  </para></listitem>
158</orderedlist>
159</para>
160
161<!-- ******* Bridgehead ******* -->
162<bridgehead renderas='sect4'>
163What is a Step?
164</bridgehead>
165
166<para>
167<emphasis>G4Step</emphasis> stores the transient information of a step. This
168includes the two endpoints of the step, <literal>PreStepPoint</literal> and
169<literal>PostStepPoint</literal>, which contain the points' coordinates and
170the volumes containing the points. <emphasis>G4Step</emphasis> also stores the
171change in track properties between the two points. These
172properties, such as energy and momentum, are updated as the various
173active processes are invoked.
174</para>
175
176<!-- ******* Bridgehead ******* -->
177<bridgehead renderas='sect4'>
178What is a Track?
179</bridgehead>
180
181<para>
182<emphasis>G4Track</emphasis> keeps information on the final status of the
183particle after the completion of one step. This means that
184<emphasis>G4Track</emphasis> has information on the previous step while the
185<literal>AlongStepDoIt</literal>s are being invoked for the step in progress.
186Only after finishing all <literal>AlongStepDoIt</literal>s, will
187<emphasis>G4Track</emphasis> have the final information (e.g., the final
188position) for the step in progress. Also, <emphasis>G4Track</emphasis> will be
189updated after each invocation of a <literal>PostStepDoIt</literal>.
190</para>
191
192</sect2>
193
194
195<!-- ******************* Section (Level#2) ****************** -->
196<sect2 id="sect.Track.AccInfo">
197<title>
198Access to Track and Step Information
199</title>
200
201<!-- ******* Bridgehead ******* -->
202<bridgehead renderas='sect4'>
203How to Get Track Information
204</bridgehead>
205
206<para>
207Track information may be accessed by invoking various
208<literal>Get</literal> methods provided in the <emphasis>G4Track</emphasis> 
209class. For details, see the
210<emphasis role="bold">Software Reference Manual</emphasis>.
211Typical information available includes:
212
213<itemizedlist spacing="compact">
214  <listitem><para>
215    (x,y,z)
216  </para></listitem>
217  <listitem><para>
218   Global time (time since the event was created)
219  </para></listitem>
220  <listitem><para>
221    Local time (time since the track was created)
222  </para></listitem>
223  <listitem><para>
224    Proper time (time in its rest frame since the track was created )
225  </para></listitem>
226  <listitem><para>
227    Momentum direction ( unit vector )
228  </para></listitem>
229  <listitem><para>
230    Kinetic energy
231  </para></listitem>
232  <listitem><para>
233    Accumulated geometrical track length
234  </para></listitem>
235  <listitem><para>
236    Accumulated true track length
237  </para></listitem>
238  <listitem><para>
239    Pointer to dynamic particle
240  </para></listitem>
241  <listitem><para>
242    Pointer to physical volume
243  </para></listitem>
244  <listitem><para>
245    Track ID number
246  </para></listitem>
247  <listitem><para>
248    Track ID number of the parent
249  </para></listitem>
250  <listitem><para>
251    Current step number
252  </para></listitem>
253  <listitem><para>
254    Track status
255  </para></listitem>
256  <listitem><para>
257    (x,y,z) at the start point (vertex position) of the track
258  </para></listitem>
259  <listitem><para>
260    Momentum direction at the start point (vertex position) of the
261    track
262  </para></listitem>
263  <listitem><para>
264    Kinetic energy at the start point (vertex position) of the track
265  </para></listitem>
266  <listitem><para>
267    Pinter to the process which created the current track
268  </para></listitem>
269</itemizedlist>
270</para>
271
272<!-- ******* Bridgehead ******* -->
273<bridgehead renderas='sect4'>
274How to Get Step Information
275</bridgehead>
276
277<para>
278Step and step-point information can be retrieved by invoking
279various <literal>Get</literal> methods provided in the
280<emphasis>G4Step</emphasis>/<emphasis>G4StepPoint</emphasis> 
281classes. For details, see the
282<emphasis role="bold">Software Reference Manual</emphasis>.
283</para>
284
285<para>
286Information in <emphasis>G4Step</emphasis>
287includes:
288
289<itemizedlist spacing="compact">
290  <listitem><para>
291    Pointers to <literal>PreStep</literal> and
292    <literal>PostStepPoint</literal>
293  </para></listitem>
294  <listitem><para>
295    Geometrical step length (step length before the correction of
296    multiple scattering)
297  </para></listitem>
298  <listitem><para>
299    True step length (step length after the correction of multiple
300    scattering)
301  </para></listitem>
302  <listitem><para>
303    Increment of position and time between <literal>PreStepPoint</literal>
304    and <literal>PostStepPoint</literal>
305  </para></listitem>
306  <listitem><para>
307    Increment of momentum and energy between  <literal>PreStepPoint</literal>
308    and <literal>PostStepPoint</literal>. (Note: to get the energy deposited in
309    the step, you cannot use this 'Delta energy'. You have to use
310    'Total energy deposit' as below.)
311  </para></listitem>
312  <listitem><para>
313    Pointer to <literal>G4Track</literal>
314  </para></listitem>
315  <listitem><para>
316    Total energy deposited during the step - this is the sum of
317    <para>
318    <itemizedlist spacing="compact">
319      <listitem><para>
320        the energy deposited by the energy loss process, and
321      </para></listitem>
322      <listitem><para>
323        the energy lost by secondaries which have NOT been generated
324        because each of their energies was below the cut threshold
325      </para></listitem>
326    </itemizedlist>
327    </para>
328  </para></listitem>
329  <listitem><para>
330    Energy deposited not by ionization during the step
331  </para></listitem>
332</itemizedlist>
333</para>
334
335<para>
336Information in <emphasis>G4StepPoint</emphasis> 
337(<literal>PreStepPoint</literal> and <literal>PostStepPoint</literal>)
338includes:
339
340<itemizedlist spacing="compact">
341  <listitem><para>
342    (x, y, z, t)
343  </para></listitem>
344  <listitem><para>
345    (px, py, pz, Ek)
346  </para></listitem>
347  <listitem><para>
348    Momentum direction (unit vector)
349  </para></listitem>
350  <listitem><para>
351    Pointers to physical volumes
352  </para></listitem>
353  <listitem><para>
354    Safety
355  </para></listitem>
356  <listitem><para>
357    Beta, gamma
358  </para></listitem>
359  <listitem><para>
360    Polarization
361  </para></listitem>
362  <listitem><para>
363    Step status
364  </para></listitem>
365  <listitem><para>
366    Pointer to the physics process which defined the current step
367    and its <literal>DoIt</literal> type
368  </para></listitem>
369  <listitem><para>
370    Pointer to the physics process which defined the previous step
371    and its <literal>DoIt</literal> type
372  </para></listitem>
373  <listitem><para>
374    Total track length
375  </para></listitem>
376  <listitem><para>
377    Global time (time since the current event began)
378  </para></listitem>
379  <listitem><para>
380    Local time (time since the current track began)
381  </para></listitem>
382  <listitem><para>
383    Proper time
384  </para></listitem>
385</itemizedlist>
386</para>
387
388<!-- ******* Bridgehead ******* -->
389<bridgehead renderas='sect4'>
390How to Get "particle change"
391</bridgehead>
392
393<para>
394Particle change information can be accessed by invoking various
395<literal>Get</literal> methods provided in the
396<emphasis>G4ParticleChange</emphasis> class.
397Typical information available includes (for details, see the
398<emphasis role="bold">Software Reference Manual</emphasis>):
399
400<itemizedlist spacing="compact">
401  <listitem><para>
402    final momentum direction of the parent particle
403  </para></listitem>
404  <listitem><para>
405    final kinetic energy of the parent particle
406  </para></listitem>
407  <listitem><para>
408    final position of the parent particle
409  </para></listitem>
410  <listitem><para>
411    final global time of the parent particle
412  </para></listitem>
413  <listitem><para>
414    final proper time of the parent particle
415  </para></listitem>
416  <listitem><para>
417    final polarization of the parent particle
418  </para></listitem>
419  <listitem><para>
420    status of the parent particle (<emphasis>G4TrackStatus</emphasis>)
421  </para></listitem>
422  <listitem><para>
423    true step length (this is used by multiple scattering to store
424    the result of the transformation from the geometrical step length
425    to the true step length)
426  </para></listitem>
427  <listitem><para>
428    local energy deposited - this consists of either
429    <para>
430    <itemizedlist spacing="compact">
431      <listitem><para>
432        energy deposited by the energy loss process, or
433      </para></listitem>
434      <listitem><para>
435        the energy lost by secondaries which have NOT been generated
436        because each of their energies was below the cut threshold.
437      </para></listitem>
438    </itemizedlist>
439    </para>
440  </para></listitem>
441  <listitem><para>
442    number of secondaries particles
443  </para></listitem>
444  <listitem><para>
445    list of secondary particles (list of <emphasis>G4Track</emphasis>)
446  </para></listitem>
447</itemizedlist>
448</para>
449
450</sect2>
451
452
453<!-- ******************* Section (Level#2) ****************** -->
454<sect2 id="sect.Track.SecPar">
455<title>
456Handling of Secondary Particles
457</title>
458
459<para>
460Secondary particles are passed as <emphasis>G4Track</emphasis>s from a physics
461process to tracking. <emphasis>G4ParticleChange</emphasis> provides the following
462four methods for a physics process:
463
464<itemizedlist spacing="compact">
465  <listitem><para>
466    <literal>AddSecondary( G4Track* aSecondary )</literal>
467  </para></listitem>
468  <listitem><para>
469    <literal>AddSecondary( G4DynamicParticle* aSecondary )</literal>
470  </para></listitem>
471  <listitem><para>
472    <literal>AddSecondary( G4DynamicParticle* aSecondary, G4ThreeVector
473    position )</literal>
474  </para></listitem>
475  <listitem><para>
476    <literal>AddSecondary( G4DynamicParticle* aSecondary, G4double time)</literal>
477  </para></listitem>
478</itemizedlist>
479</para>
480
481<para>
482In all but the first, the construction of <emphasis>G4Track</emphasis> is done in
483the methods using informaton given by the arguments.
484</para>
485
486</sect2>
487
488
489<!-- ******************* Section (Level#2) ****************** -->
490<sect2 id="sect.Track.UserAct">
491<title>
492User Actions
493</title>
494
495<para>
496There are two classes which allow the user to intervene in the
497tracking. These are:
498
499<itemizedlist spacing="compact">
500  <listitem><para>
501    <emphasis>G4UserTrackingAction</emphasis>, and
502  </para></listitem>
503  <listitem><para>
504    <emphasis>G4UserSteppingAction</emphasis>.
505  </para></listitem>
506</itemizedlist>
507</para>
508
509<para>
510Each provides methods which allow the user access to the Geant4
511kernel at specific points in the tracking. For details, see the
512<emphasis role="bold">Software Reference Manual</emphasis>.
513</para>
514
515</sect2>
516
517
518<!-- ******************* Section (Level#2) ****************** -->
519<sect2 id="sect.Track.Verb">
520<title>
521Verbose Outputs
522</title>
523
524<para>
525The verbose information output flag can be turned on or off. The
526amount of information printed about the track/step, from brief to
527very detailed, can be controlled by the value of the verbose flag,
528for example,
529
530<informalexample>
531<programlisting>
532  G4UImanager* UI = G4UImanager::GetUIpointer();
533
534  UI-&gt;ApplyCommand("/tracking/verbose 1");
535</programlisting>
536</informalexample>
537</para>
538
539</sect2>
540
541
542<!-- ******************* Section (Level#2) ****************** -->
543<sect2 id="sect.Track.Traj">
544<title>
545Trajectory and Trajectory Point
546</title>
547
548<!-- ******* Bridgehead ******* -->
549<bridgehead renderas='sect4'>
550G4Trajectory and G4TrajectoryPoint
551</bridgehead>
552
553<para>
554<emphasis>G4Trajectory</emphasis> and <emphasis>G4TrajectoryPoint</emphasis> 
555are default concrete classes provided by Geant4, which are derived from the
556<emphasis>G4VTrajectory</emphasis> and <emphasis>G4VTrajectoryPoint</emphasis> 
557base classes, respectively.
558A <emphasis>G4Trajectory</emphasis> class object is created by
559<emphasis>G4TrackingManager</emphasis> when a <emphasis>G4Track</emphasis> 
560is passed from the <emphasis>G4EventManager</emphasis>.
561<emphasis>G4Trajectory</emphasis> has the following data
562members:
563
564<itemizedlist spacing="compact">
565  <listitem><para>
566    ID numbers of the track and the track's parent
567  </para></listitem>
568  <listitem><para>
569    particle name, charge, and PDG code
570  </para></listitem>
571  <listitem><para>
572    a collection of <emphasis>G4TrajectoryPoint</emphasis> pointers
573  </para></listitem>
574</itemizedlist>
575</para>
576
577<para>
578<emphasis>G4TrajectoryPoint</emphasis> corresponds to a step point along
579the path followed by the track. Its position is given by a
580<emphasis>G4ThreeVector</emphasis>. A <emphasis>G4TrajectoryPoint</emphasis> 
581class object is created in the <emphasis>AppendStep()</emphasis> method of
582<emphasis>G4Trajectory</emphasis> and this method is invoked by
583<emphasis>G4TrackingManager</emphasis> at the end of each step.
584The first point is created when the <emphasis>G4Trajectory</emphasis> 
585is created, thus the first point is the original vertex.
586</para>
587
588<para>
589The creation of a trajectory can be controlled by invoking
590<emphasis>G4TrackingManager::SetStoreTrajectory(G4bool)</emphasis>. The UI
591command <emphasis>/tracking/storeTrajectory _bool_</emphasis> does the same. The
592user can set this flag for each individual track from his/her
593<emphasis>G4UserTrackingAction::PreUserTrackingAction()</emphasis> method.
594</para>
595
596<note><title></title>
597<para>
598The user should not create trajectories for secondaries in a shower
599due to the large amount of memory consumed.
600</para>
601</note>
602
603<para>
604All the created trajectories in an event are stored in
605<emphasis>G4TrajectoryContainer</emphasis> class object and this object will be
606kept by <emphasis>G4Event</emphasis>. To draw or print trajectories generated in
607an event, the user may invoke the <emphasis>DrawTrajectory()</emphasis> or
608<emphasis>ShowTrajectory()</emphasis> methods of <emphasis>G4VTrajectory</emphasis>,
609respectively, from his/her
610<emphasis>G4UserEventAction::EndOfEventAction()</emphasis>. The geometry must be
611drawn before the trajectory drawing. The color of the drawn
612trajectory depends on the particle charge:
613
614<itemizedlist spacing="compact">
615  <listitem><para>
616    negative: red
617  </para></listitem>
618  <listitem><para>
619    neutral: green
620  </para></listitem>
621  <listitem><para>
622    positive: blue
623  </para></listitem>
624</itemizedlist>
625</para>
626
627<note><title></title>
628<para>
629Due to improvements in <emphasis>G4Navigator</emphasis>, a track
630can execute more than one turn of its spiral trajectory without
631being broken into smaller steps as long as the trajectory does not
632cross a geometrical boundary. Thus a drawn trajectory may not be
633circular.
634</para>
635</note>
636
637<!-- ******* Bridgehead ******* -->
638<bridgehead renderas='sect4'>
639Customizing trajectory and trajectory point
640</bridgehead>
641
642<para>
643<emphasis>G4Track</emphasis> and <emphasis>G4Step</emphasis> are
644transient classes; they are not available at the end of the event.
645Thus, the concrete classes <emphasis>G4VTrajectory</emphasis> and
646<emphasis>G4VTrajectoryPoint</emphasis> are the only
647ones a user may employ for end-of-event analysis or for
648persistency. As mentioned above, the default classes which Geant4
649provides, i.e. <emphasis>G4Trajectory</emphasis> and
650<emphasis>G4TrajectoryPoint</emphasis>,
651have only very primitive quantities. The user can customize his/her
652own trajectory and trajectory point classes by deriving directly
653from the respective base classes.
654</para>
655
656<para>
657To use the customized trajectory, the user must construct a
658concrete trajectory class object in the
659<emphasis>G4UserTrackingAction::PreUserTrackingAction()</emphasis> method and
660make its pointer available to <emphasis>G4TrackingManager</emphasis> by using the
661<emphasis>SetTrajectory()</emphasis> method. The customized trajectory point
662class object must be constructed in the <emphasis>AppendStep()</emphasis> method
663of the user's implementation of the trajectory class. This
664<emphasis>AppendStep()</emphasis> method will be invoked by
665<emphasis>G4TrackingManager</emphasis>.
666</para>
667
668<para>
669To customize trajectory drawing, the user can override the
670<emphasis>DrawTrajectory()</emphasis> method in his/her own trajectory class.
671</para>
672
673<para>
674When a customized version of G4Trajectory declares any new class
675variables, <emphasis>operator new</emphasis> and
676<emphasis>operator delete</emphasis> must be
677provided. It is also useful to check that the allocation size in
678<emphasis>operator new</emphasis> is equal to
679<emphasis>sizeof(G4Trajectory)</emphasis>. These two points do not
680apply to <emphasis>G4VTrajectory</emphasis> because it has no
681<emphasis>operator new</emphasis> or <emphasis>operator delete</emphasis>.
682</para>
683
684
685</sect2>
686</sect1>
Note: See TracBrowser for help on using the repository browser.