source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/GettingStarted/physicsDef.xml@ 905

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

ajout de la doc

File size: 7.9 KB
Line 
1<!-- ******************************************************** -->
2<!-- -->
3<!-- [History] -->
4<!-- Changed by: Katsuya Amako, 15-Jul-1998 -->
5<!-- Proof read by: Joe Chuma, 15-Jun-1999 -->
6<!-- Changed by: Hisaya Kurashige, 28-Oct-2001 -->
7<!-- Changed by: Dennis Wright, 29-Nov-2001 -->
8<!-- Converted to DocBook: Katsuya Amako, Aug-2006 -->
9<!-- -->
10<!-- ******************************************************** -->
11
12
13<!-- ******************* Section (Level#1) ****************** -->
14<sect1 id="sect.HowToSpecPhysProc">
15<title>
16How to Specify Physics Processes
17</title>
18
19<!-- ******************* Section (Level#2) ****************** -->
20<sect2 id="sect.HowToSpecPhysProc.PhysProc">
21<title>
22Physics Processes
23</title>
24
25<para>
26Physics processes describe how particles interact with materials.
27Geant4 provides seven major categories of processes:
28
29<itemizedlist spacing="compact">
30 <listitem><para>
31 electromagnetic,
32 </para></listitem>
33 <listitem><para>
34 hadronic,
35 </para></listitem>
36 <listitem><para>
37 transportation,
38 </para></listitem>
39 <listitem><para>
40 decay,
41 </para></listitem>
42 <listitem><para>
43 optical,
44 </para></listitem>
45 <listitem><para>
46 photolepton_hadron, and
47 </para></listitem>
48 <listitem><para>parameterisation.
49 </para></listitem>
50</itemizedlist>
51</para>
52
53<para>
54All physics processes are derived from the <emphasis>G4VProcess</emphasis>
55base class. Its virtual methods
56
57<itemizedlist spacing="compact">
58 <listitem><para>
59 <literal>AtRestDoIt</literal>,
60 </para></listitem>
61 <listitem><para>
62 <literal>AlongStepDoIt</literal>, and
63 </para></listitem>
64 <listitem><para>
65 <literal>PostStepDoIt</literal>
66 </para></listitem>
67</itemizedlist>
68
69and the corresponding methods
70
71<itemizedlist spacing="compact">
72 <listitem><para>
73 <literal>AtRestGetPhysicalInteractionLength</literal>,
74 </para></listitem>
75 <listitem><para>
76 <literal>AlongStepGetPhysicalInteractionLength</literal>, and
77 </para></listitem>
78 <listitem><para>
79 <literal>PostStepGetPhysicalInteractionLength</literal>
80 </para></listitem>
81</itemizedlist>
82
83describe the behavior of a physics process when they are
84implemented in a derived class. The details of these methods are
85described in
86<xref linkend="sect.PhysProc" />.
87</para>
88
89<para>
90The following are specialized base classes to be used for simple
91processes:
92
93<variablelist>
94 <varlistentry>
95 <term><emphasis>G4VAtRestProcess</emphasis></term>
96 <listitem>
97 Processes with only <literal>AtRestDoIt</literal>
98 </listitem>
99 </varlistentry>
100 <varlistentry>
101 <term><emphasis>G4VContinuousProcess</emphasis></term>
102 <listitem>
103 Processes with only <literal>AlongStepDoIt</literal>
104 </listitem>
105 </varlistentry>
106 <varlistentry>
107 <term><emphasis>G4VDiscreteProcess</emphasis></term>
108 <listitem>
109 processes with only <literal>PostStepDoIt</literal>
110 </listitem>
111 </varlistentry>
112</variablelist>
113</para>
114
115<para>
116Another 4 virtual classes, such as
117<emphasis>G4VContinuousDiscreteProcess</emphasis>, are provided for complex
118processes.
119</para>
120
121</sect2>
122
123<!-- ******************* Section (Level#2) ****************** -->
124<sect2 id="sect.HowToSpecPhysProc.ManagingProc">
125<title>
126Managing Processes
127</title>
128
129<para>
130The <emphasis>G4ProcessManager</emphasis> class contains a list of processes that
131a particle can undertake. It has information on the order of
132invocation of the processes, as well as which kind of <literal>DoIt</literal>
133method is valid for each process in the list. A
134<emphasis>G4ProcessManager</emphasis> object corresponds to each particle and is
135attached to the <emphasis>G4ParticleDefiniton</emphasis> class.
136</para>
137
138<para>
139In order to validate processes, they should be registered with
140the particle's <emphasis>G4ProcessManager</emphasis>. Process ordering
141information is included by using the <literal>AddProcess()</literal> and
142<literal>SetProcessOrdering()</literal> methods. For registration of simple
143processes, the <literal>AddAtRestProcess()</literal>,
144<literal>AddContinuousProcess()</literal> and <literal>AddDiscreteProcess()</literal>
145methods may be used.
146</para>
147
148<para>
149<emphasis>G4ProcessManager</emphasis> is able to turn some processes on or off
150during a run by using the <literal>ActivateProcess()</literal> and
151<literal>InActivateProcess()</literal> methods. These methods are valid only
152after process registration is complete, so they must not be used in
153the <emphasis>PreInit</emphasis> phase.
154</para>
155
156<para>
157The <emphasis>G4VUserPhysicsList</emphasis> class creates and attaches
158<emphasis>G4ProcessManager</emphasis> objects to all particle classes defined in
159the <literal>ConstructParticle()</literal> method.
160</para>
161
162</sect2>
163
164
165<!-- ******************* Section (Level#2) ****************** -->
166<sect2 id="sect.HowToSpecPhysProc.SpecPhysProc">
167<title>
168Specifying Physics Processes
169</title>
170
171<para>
172<emphasis>G4VUserPhysicsList</emphasis> is the base class for a "mandatory user
173class" (see <xref linkend="sect.HowToDefMain" />), in which all physics
174processes and all particles required in a simulation must be registered.
175The user must create a class derived from
176<emphasis>G4VUserPhysicsList</emphasis> and implement the pure virtual method
177<literal>ConstructProcess()</literal>.
178</para>
179
180<para>
181For example, if just the <emphasis>G4Geantino</emphasis> particle class is
182required, only the transportation process need be registered. The
183<literal>ConstructProcess()</literal> method would then be implemented as
184follows:
185
186<example id="programlist_HowToSpecPhysProc_1">
187<title>
188Register processes for a geantino.
189</title>
190<programlisting>
191 void ExN01PhysicsList::ConstructProcess()
192 {
193 // Define transportation process
194 AddTransportation();
195 }
196</programlisting>
197</example>
198
199Here, the <literal>AddTransportation()</literal> method is provided in the
200<emphasis>G4VUserPhysicsList</emphasis> class to register the
201<emphasis>G4Transportation</emphasis> class with all particle classes. The
202<emphasis>G4Transportation</emphasis> class (and/or related classes) describes
203the particle motion in space and time. It is the mandatory process
204for tracking particles.
205</para>
206
207<para>
208In the <literal>ConstructProcess()</literal> method, physics processes
209should be created and registered with each particle's instance of
210<emphasis>G4ProcessManager</emphasis>.
211</para>
212
213<para>
214An example of process registration is given in the
215<emphasis>G4VUserPhysicsList</emphasis>::<literal>AddTransportation()</literal>
216method.
217</para>
218
219<para>
220Registration in <emphasis>G4ProcessManager</emphasis> is a complex procedure
221for other processes and particles because the relations between
222processes are crucial for some processes. Please see
223<xref linkend="sect.PhysProc" /> and the example codes.
224</para>
225
226<para>
227An example of electromagnetic process registration for photons
228is shown below:
229
230<example id="programlist_HowToSpecPhysProc_2">
231<title>
232Register processes for a gamma.
233</title>
234<programlisting>
235void MyPhysicsList::ConstructProcess()
236{
237 // Define transportation process
238 AddTransportation();
239 // electromagnetic processes
240 ConstructEM();
241}
242void MyPhysicsList::ConstructEM()
243{
244 // Get the process manager for gamma
245 G4ParticleDefinition* particle = G4Gamma::GammaDefinition();
246 G4ProcessManager* pmanager = particle-&gt;GetProcessManager();
247
248 // Construct processes for gamma
249 G4PhotoElectricEffect * thePhotoElectricEffect = new G4PhotoElectricEffect();
250 G4ComptonScattering * theComptonScattering = new G4ComptonScattering();
251 G4GammaConversion* theGammaConversion = new G4GammaConversion();
252
253 // Register processes to gamma's process manager
254 pmanager-&gt;AddDiscreteProcess(thePhotoElectricEffect);
255 pmanager-&gt;AddDiscreteProcess(theComptonScattering);
256 pmanager-&gt;AddDiscreteProcess(theGammaConversion);
257}
258</programlisting>
259</example>
260</para>
261
262
263</sect2>
264</sect1>
Note: See TracBrowser for help on using the repository browser.