source: trunk/Documentation/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch05.html@ 901

Last change on this file since 901 was 901, checked in by garnier, 17 years ago

Add Geant4 Documentation at 8.12.2008

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