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

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

Add Geant4 Documentation at 8.12.2008

File size: 10.2 KB
Line 
1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>2.5.  How to Specify Physics Processes</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="ch02.html" title="Chapter 2.  Getting Started with Geant4 - Running a Simple Example"><link rel="prev" href="ch02s04.html" title="2.4.  How to Specify Particles"><link rel="next" href="ch02s06.html" title="2.6.  How to Generate a Primary Event"><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">2.5. 
9How to Specify Physics Processes
10</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch02s04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><th width="60%" align="center">Chapter 2. 
11Getting Started with Geant4 - Running a Simple Example
12</th><td width="20%" align="right"> <a accesskey="n" href="ch02s06.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sect.HowToSpecPhysProc"></a>2.5. 
13How to Specify Physics Processes
14</h2></div></div></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.HowToSpecPhysProc.PhysProc"></a>2.5.1. 
15Physics Processes
16</h3></div></div></div><p>
17Physics processes describe how particles interact with materials.
18Geant4 provides seven major categories of processes:
19
20</p><div class="itemizedlist"><ul type="disc" compact><li><p>
21  electromagnetic,
22  </p></li><li><p>
23  hadronic,
24  </p></li><li><p>
25  transportation,
26  </p></li><li><p>
27  decay,
28  </p></li><li><p>
29  optical,
30  </p></li><li><p>
31  photolepton_hadron, and
32  </p></li><li><p>parameterisation.
33  </p></li></ul></div><p>
34</p><p>
35All physics processes are derived from the <span class="emphasis"><em>G4VProcess</em></span>
36base class. Its virtual methods
37
38</p><div class="itemizedlist"><ul type="disc" compact><li><p>
39  <code class="literal">AtRestDoIt</code>,
40  </p></li><li><p>
41  <code class="literal">AlongStepDoIt</code>, and
42  </p></li><li><p>
43  <code class="literal">PostStepDoIt</code>
44  </p></li></ul></div><p>
45
46and the corresponding methods
47
48</p><div class="itemizedlist"><ul type="disc" compact><li><p>
49  <code class="literal">AtRestGetPhysicalInteractionLength</code>,
50  </p></li><li><p>
51  <code class="literal">AlongStepGetPhysicalInteractionLength</code>, and
52  </p></li><li><p>
53  <code class="literal">PostStepGetPhysicalInteractionLength</code>
54  </p></li></ul></div><p>
55
56describe the behavior of a physics process when they are
57implemented in a derived class. The details of these methods are
58described in
59<a href="ch05s02.html" title="5.2. 
60Physics Processes
61">Section 5.2</a>.
62</p><p>
63The following are specialized base classes to be used for simple
64processes:
65
66</p><div class="variablelist"><dl><dt><span class="term"><span class="emphasis"><em>G4VAtRestProcess</em></span></span></dt><dd>
67    Processes with only <code class="literal">AtRestDoIt</code></dd><dt><span class="term"><span class="emphasis"><em>G4VContinuousProcess</em></span></span></dt><dd>
68    Processes with only <code class="literal">AlongStepDoIt</code></dd><dt><span class="term"><span class="emphasis"><em>G4VDiscreteProcess</em></span></span></dt><dd>
69    processes with only <code class="literal">PostStepDoIt</code></dd></dl></div><p>
70</p><p>
71Another 4 virtual classes, such as
72<span class="emphasis"><em>G4VContinuousDiscreteProcess</em></span>, are provided for complex
73processes.
74</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.HowToSpecPhysProc.ManagingProc"></a>2.5.2. 
75Managing Processes
76</h3></div></div></div><p>
77The <span class="emphasis"><em>G4ProcessManager</em></span> class contains a list of processes that
78a particle can undertake. It has information on the order of
79invocation of the processes, as well as which kind of <code class="literal">DoIt</code>
80method is valid for each process in the list. A
81<span class="emphasis"><em>G4ProcessManager</em></span> object corresponds to each particle and is
82attached to the <span class="emphasis"><em>G4ParticleDefiniton</em></span> class.
83</p><p>
84In order to validate processes, they should be registered with
85the particle's <span class="emphasis"><em>G4ProcessManager</em></span>. Process ordering
86information is included by using the <code class="literal">AddProcess()</code> and
87<code class="literal">SetProcessOrdering()</code> methods. For registration of simple
88processes, the <code class="literal">AddAtRestProcess()</code>,
89<code class="literal">AddContinuousProcess()</code> and <code class="literal">AddDiscreteProcess()</code>
90methods may be used.
91</p><p>
92<span class="emphasis"><em>G4ProcessManager</em></span> is able to turn some processes on or off
93during a run by using the <code class="literal">ActivateProcess()</code> and
94<code class="literal">InActivateProcess()</code> methods. These methods are valid only
95after process registration is complete, so they must not be used in
96the <span class="emphasis"><em>PreInit</em></span> phase.
97</p><p>
98The <span class="emphasis"><em>G4VUserPhysicsList</em></span> class creates and attaches
99<span class="emphasis"><em>G4ProcessManager</em></span> objects to all particle classes defined in
100the <code class="literal">ConstructParticle()</code> method.
101</p></div><div class="sect2" lang="en"><div class="titlepage"><div><div><h3 class="title"><a name="sect.HowToSpecPhysProc.SpecPhysProc"></a>2.5.3. 
102Specifying Physics Processes
103</h3></div></div></div><p>
104<span class="emphasis"><em>G4VUserPhysicsList</em></span> is the base class for a "mandatory user
105class" (see <a href="ch02.html#sect.HowToDefMain" title="2.1. 
106How to Define the main() Program
107">Section 2.1</a>), in which all physics
108processes and all particles required in a simulation must be registered.
109The user must create a class derived from
110<span class="emphasis"><em>G4VUserPhysicsList</em></span> and implement the pure virtual method
111<code class="literal">ConstructProcess()</code>.
112</p><p>
113For example, if just the <span class="emphasis"><em>G4Geantino</em></span> particle class is
114required, only the transportation process need be registered. The
115<code class="literal">ConstructProcess()</code> method would then be implemented as
116follows:
117
118</p><div class="example"><a name="programlist_HowToSpecPhysProc_1"></a><p class="title"><b>Example 2.17. 
119Register processes for a geantino.
120</b></p><div class="example-contents"><pre class="programlisting">
121  void ExN01PhysicsList::ConstructProcess()
122  {
123    // Define transportation process
124    AddTransportation();
125  }
126</pre></div></div><p><br class="example-break">
127
128Here, the <code class="literal">AddTransportation()</code> method is provided in the
129<span class="emphasis"><em>G4VUserPhysicsList</em></span> class to register the
130<span class="emphasis"><em>G4Transportation</em></span> class with all particle classes. The
131<span class="emphasis"><em>G4Transportation</em></span> class (and/or related classes) describes
132the particle motion in space and time. It is the mandatory process
133for tracking particles.
134</p><p>
135In the <code class="literal">ConstructProcess()</code> method, physics processes
136should be created and registered with each particle's instance of
137<span class="emphasis"><em>G4ProcessManager</em></span>.
138</p><p>
139An example of process registration is given in the
140<span class="emphasis"><em>G4VUserPhysicsList</em></span>::<code class="literal">AddTransportation()</code> 
141method.
142</p><p>
143Registration in <span class="emphasis"><em>G4ProcessManager</em></span> is a complex procedure
144for other processes and particles because the relations between
145processes are crucial for some processes. Please see
146<a href="ch05s02.html" title="5.2. 
147Physics Processes
148">Section 5.2</a> and the example codes.
149</p><p>
150An example of electromagnetic process registration for photons
151is shown below:
152
153</p><div class="example"><a name="programlist_HowToSpecPhysProc_2"></a><p class="title"><b>Example 2.18. 
154Register processes for a gamma.
155</b></p><div class="example-contents"><pre class="programlisting">
156void MyPhysicsList::ConstructProcess()
157{
158  // Define transportation process
159  AddTransportation();
160  // electromagnetic processes
161  ConstructEM();
162}
163void MyPhysicsList::ConstructEM()
164{
165   //  Get the process manager for gamma
166  G4ParticleDefinition* particle = G4Gamma::GammaDefinition();
167  G4ProcessManager* pmanager = particle-&gt;GetProcessManager();
168
169  // Construct processes for gamma
170  G4PhotoElectricEffect * thePhotoElectricEffect = new G4PhotoElectricEffect();     
171  G4ComptonScattering * theComptonScattering = new G4ComptonScattering();
172  G4GammaConversion* theGammaConversion = new G4GammaConversion();
173
174  // Register processes to gamma's process manager
175  pmanager-&gt;AddDiscreteProcess(thePhotoElectricEffect);
176  pmanager-&gt;AddDiscreteProcess(theComptonScattering);
177  pmanager-&gt;AddDiscreteProcess(theGammaConversion);
178}
179</pre></div></div><p><br class="example-break">
180</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch02s04.html"><img src="AllResources/IconsGIF/prev.gif" alt="Prev"></a> </td><td width="20%" align="center"><a accesskey="u" href="ch02.html"><img src="AllResources/IconsGIF/up.gif" alt="Up"></a></td><td width="40%" align="right"> <a accesskey="n" href="ch02s06.html"><img src="AllResources/IconsGIF/next.gif" alt="Next"></a></td></tr><tr><td width="40%" align="left" valign="top">2.4. 
181How to Specify Particles
182 </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"> 2.6. 
183How to Generate a Primary Event
184</td></tr></table></div></body></html>
Note: See TracBrowser for help on using the repository browser.