1 | <!-- ******************************************************** --> |
---|
2 | <!-- --> |
---|
3 | <!-- [History] --> |
---|
4 | <!-- Changed by: Katsuya Amako, 4-Aug-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 | <!-- Changed by: Hisaya Kurashige, 18-Jan-2007 --> |
---|
10 | <!-- Changed by: Hisaya Kurashige, 1-Dec-2007 --> |
---|
11 | <!-- --> |
---|
12 | <!-- ******************************************************** --> |
---|
13 | |
---|
14 | |
---|
15 | <!-- ******************* Section (Level#1) ****************** --> |
---|
16 | <sect1 id="sect.HowToSpecParti"> |
---|
17 | <title> |
---|
18 | How to Specify Particles |
---|
19 | </title> |
---|
20 | |
---|
21 | <para> |
---|
22 | <literal>G4VuserPhysicsList</literal> is one of the mandatory user base |
---|
23 | classes described in |
---|
24 | <xref linkend="sect.HowToDefMain" />. |
---|
25 | Within this class all particles and physics processes to be used in |
---|
26 | your simulation must be defined. The range cut-off parameter should |
---|
27 | also be defined in this class. |
---|
28 | </para> |
---|
29 | |
---|
30 | <para> |
---|
31 | The user must create a class derived from |
---|
32 | <literal>G4VuserPhysicsList</literal> and implement the following pure |
---|
33 | virtual methods: |
---|
34 | |
---|
35 | <informalexample> |
---|
36 | <programlisting> |
---|
37 | ConstructParticle(); // construction of particles |
---|
38 | ConstructProcess(); // construct processes and register them to particles |
---|
39 | SetCuts(); // setting a range cut value for all particles |
---|
40 | </programlisting> |
---|
41 | </informalexample> |
---|
42 | </para> |
---|
43 | |
---|
44 | <para> |
---|
45 | This section provides some simple examples of the |
---|
46 | <literal>ConstructParticle()</literal> and <literal>SetCuts()</literal> |
---|
47 | methods. |
---|
48 | For information on <literal>ConstructProcess()</literal> methods, please see |
---|
49 | <xref linkend="sect.HowToSpecPhysProc" />. |
---|
50 | |
---|
51 | </para> |
---|
52 | |
---|
53 | |
---|
54 | <!-- ******************* Section (Level#2) ****************** --> |
---|
55 | <sect2 id="sect.HowToSpecParti.PartiDef"> |
---|
56 | <title> |
---|
57 | Particle Definition |
---|
58 | </title> |
---|
59 | |
---|
60 | <para> |
---|
61 | Geant4 provides various types of particles for use in simulations: |
---|
62 | |
---|
63 | <itemizedlist spacing="compact"> |
---|
64 | <listitem><para> |
---|
65 | ordinary particles, such as electrons, protons, and gammas |
---|
66 | </para></listitem> |
---|
67 | <listitem><para> |
---|
68 | resonant particles with very short lifetimes, such as vector |
---|
69 | mesons and delta baryons |
---|
70 | </para></listitem> |
---|
71 | <listitem><para> |
---|
72 | nuclei, such as deuteron, alpha, and heavy ions (including hyper-nuclei) |
---|
73 | </para></listitem> |
---|
74 | <listitem><para> |
---|
75 | quarks, di-quarks, and gluon |
---|
76 | </para></listitem> |
---|
77 | </itemizedlist> |
---|
78 | </para> |
---|
79 | |
---|
80 | <para> |
---|
81 | Each particle is represented by its own class, which is derived |
---|
82 | from <literal>G4ParticleDefinition</literal>. |
---|
83 | (Exception: G4Ions represents all heavy nuclei. Please see |
---|
84 | <xref linkend="sect.Parti" />.) |
---|
85 | Particles are organized into six major categories: |
---|
86 | |
---|
87 | <itemizedlist spacing="compact"> |
---|
88 | <listitem><para> |
---|
89 | lepton, |
---|
90 | </para></listitem> |
---|
91 | <listitem><para> |
---|
92 | meson, |
---|
93 | </para></listitem> |
---|
94 | <listitem><para> |
---|
95 | baryon, |
---|
96 | </para></listitem> |
---|
97 | <listitem><para> |
---|
98 | boson, |
---|
99 | </para></listitem> |
---|
100 | <listitem><para> |
---|
101 | shortlived and |
---|
102 | </para></listitem> |
---|
103 | <listitem><para> |
---|
104 | ion, |
---|
105 | </para></listitem> |
---|
106 | </itemizedlist> |
---|
107 | |
---|
108 | each of which is defined in a corresponding sub-directory under |
---|
109 | <literal>geant4/source/particles</literal>. There is also a corresponding |
---|
110 | granular library for each particle category. |
---|
111 | </para> |
---|
112 | |
---|
113 | |
---|
114 | <!-- ******************* Section (Level#3) ****************** --> |
---|
115 | <sect3 id="sect.HowToSpecParti.PartiDef.G4ParticleDefinition"> |
---|
116 | <title> |
---|
117 | The <literal>G4ParticleDefinition</literal> Class |
---|
118 | </title> |
---|
119 | |
---|
120 | <para> |
---|
121 | <literal>G4ParticleDefinition</literal> has properties which characterize |
---|
122 | individual particles, such as, name, mass, charge, spin, and so on. |
---|
123 | Most of these properties are "read-only" and can not be changed directly. |
---|
124 | <literal>G4ParticlePropertyTable</literal> is used to retrieve (load) |
---|
125 | particle property of <literal>G4ParticleDefinition</literal> |
---|
126 | into (from) <literal>G4ParticlePropertyData</literal>. |
---|
127 | </para> |
---|
128 | |
---|
129 | </sect3> |
---|
130 | |
---|
131 | <!-- ******************* Section (Level#3) ****************** --> |
---|
132 | <sect3 id="sect.HowToSpecParti.PartiDef.HowToAccessParti"> |
---|
133 | <title> |
---|
134 | How to Access a Particle |
---|
135 | </title> |
---|
136 | |
---|
137 | <para> |
---|
138 | Each particle class type represents an individual particle type, |
---|
139 | and each class has a single object. This object can be accessed by |
---|
140 | using the static method of each class. |
---|
141 | There are some exceptions to this rule; please see |
---|
142 | <xref linkend="sect.Parti" /> for details. |
---|
143 | </para> |
---|
144 | |
---|
145 | <para> |
---|
146 | For example, the class <literal>G4Electron</literal> represents the |
---|
147 | electron and the member <literal>G4Electron::theInstance</literal> |
---|
148 | points its only object. |
---|
149 | The pointer to this object is available |
---|
150 | through the static methods |
---|
151 | <literal>G4Electron::ElectronDefinition()</literal>. |
---|
152 | <literal>G4Electron::Definition()</literal>. |
---|
153 | </para> |
---|
154 | |
---|
155 | <para> |
---|
156 | More than 100 types of particles are provided by default, to be |
---|
157 | used in various physics processes. In normal applications, users |
---|
158 | will not need to define their own particles. |
---|
159 | </para> |
---|
160 | |
---|
161 | <para> |
---|
162 | The unique object for each particle class is created when its static |
---|
163 | method to get the pointer is called iat the first time. |
---|
164 | Because particles are dynamic objects and should be instantiated before |
---|
165 | initialization of physics processes, |
---|
166 | you must explicitly invoke static methods of all particle classes |
---|
167 | required by your program at the initialization step. |
---|
168 | (NOTE: The particle object was static and created automatically before 8.0 release) |
---|
169 | </para> |
---|
170 | |
---|
171 | </sect3> |
---|
172 | |
---|
173 | <!-- ******************* Section (Level#3) ****************** --> |
---|
174 | <sect3 id="sect.HowToSpecParti.PartiDef.DictOfParti"> |
---|
175 | <title>Dictionary of Particles |
---|
176 | </title> |
---|
177 | |
---|
178 | <para> |
---|
179 | The <literal>G4ParticleTable</literal> class is provided as a dictionary of |
---|
180 | particles. Various utility methods are provided, such as: |
---|
181 | |
---|
182 | <informalexample> |
---|
183 | <programlisting> |
---|
184 | FindParticle(G4String name); // find the particle by name |
---|
185 | FindParticle(G4int PDGencoding) // find the particle by PDG encoding . |
---|
186 | </programlisting> |
---|
187 | </informalexample> |
---|
188 | </para> |
---|
189 | |
---|
190 | <para> |
---|
191 | <literal>G4ParticleTable</literal> is defined as a singleton object, |
---|
192 | and the static method <literal>G4ParticleTable::GetParticleTable()</literal> |
---|
193 | provides its pointer. |
---|
194 | </para> |
---|
195 | |
---|
196 | <para> |
---|
197 | As for heavy ions (including hyper-nuclei), objects are created |
---|
198 | dynamically by requests from users and processes. |
---|
199 | The <literal>G4ParticleTable</literal> class provides |
---|
200 | methods to create ions, such as: |
---|
201 | <informalexample> |
---|
202 | <programlisting> |
---|
203 | G4ParticleDefinition* GetIon( G4int atomicNumber, |
---|
204 | G4int atomicMass, |
---|
205 | G4double excitationEnergy); |
---|
206 | </programlisting> |
---|
207 | </informalexample> |
---|
208 | </para> |
---|
209 | |
---|
210 | <para> |
---|
211 | Particles are registered automatically during construction. The |
---|
212 | user has no control over particle registration. |
---|
213 | </para> |
---|
214 | |
---|
215 | |
---|
216 | </sect3> |
---|
217 | |
---|
218 | <!-- ******************* Section (Level#3) ****************** --> |
---|
219 | <sect3 id="sect.HowToSpecParti.PartiDef.ConstruParti"> |
---|
220 | <title> |
---|
221 | Constructing Particles |
---|
222 | </title> |
---|
223 | |
---|
224 | <para> |
---|
225 | <literal>ConstructParticle()</literal> is a pure virtual method, in which |
---|
226 | the static member functions for all the particles you require should be called. |
---|
227 | This ensures that objects of these particles are created. |
---|
228 | </para> |
---|
229 | |
---|
230 | <para> |
---|
231 | WARNING: You must define "All PARTICLE TYPES" which are used in your |
---|
232 | application, except for heavy ions. |
---|
233 | "All PARTICLE TYPES" means not only primary |
---|
234 | particles, but also all other particles which may appear as secondaries |
---|
235 | generated by physics processes you use. Beginning with Geant4 version 8.0, |
---|
236 | you should keep this rule strictly because all particle definitions are |
---|
237 | revised to "non-static" objects. |
---|
238 | </para> |
---|
239 | |
---|
240 | <para> |
---|
241 | For example, suppose you need a proton and a geantino, which is |
---|
242 | a virtual particle used for simulation and which does not interact |
---|
243 | with materials. The <literal>ConstructParticle()</literal> method is |
---|
244 | implemented as below: |
---|
245 | |
---|
246 | <example id="programlist_HowToSpecParti_1"> |
---|
247 | <title> |
---|
248 | Construct a proton and a geantino. |
---|
249 | </title> |
---|
250 | <programlisting> |
---|
251 | void ExN01PhysicsList::ConstructParticle() |
---|
252 | { |
---|
253 | G4Proton::ProtonDefinition(); |
---|
254 | G4Geantino::GeantinoDefinition(); |
---|
255 | } |
---|
256 | </programlisting> |
---|
257 | </example> |
---|
258 | </para> |
---|
259 | |
---|
260 | <para> |
---|
261 | Due to the large number of pre-defined particles in Geant4, it |
---|
262 | is cumbersome to list all the particles by this method. If you want |
---|
263 | all the particles in a Geant4 particle category, there are six |
---|
264 | utility classes, corresponding to each of the particle categories, |
---|
265 | which perform this function: |
---|
266 | |
---|
267 | <itemizedlist spacing="compact"> |
---|
268 | <listitem><para> |
---|
269 | <literal>G4BosonConstructor</literal> |
---|
270 | </para></listitem> |
---|
271 | <listitem><para> |
---|
272 | <literal>G4LeptonConstructor</literal> |
---|
273 | </para></listitem> |
---|
274 | <listitem><para> |
---|
275 | <literal>G4MesonConstructor</literal> |
---|
276 | </para></listitem> |
---|
277 | <listitem><para> |
---|
278 | <literal>G4BarionConstructor</literal> |
---|
279 | </para></listitem> |
---|
280 | <listitem><para> |
---|
281 | <literal>G4IonConstructor</literal> |
---|
282 | </para></listitem> |
---|
283 | <listitem><para> |
---|
284 | <literal>G4ShortlivedConstructor</literal>. |
---|
285 | </para></listitem> |
---|
286 | </itemizedlist> |
---|
287 | </para> |
---|
288 | |
---|
289 | <para> |
---|
290 | An example of this is shown in <literal>ExN05PhysicsList</literal>, |
---|
291 | listed below. |
---|
292 | |
---|
293 | <example id="programlist_HowToSpecParti_2"> |
---|
294 | <title> |
---|
295 | Construct all leptons. |
---|
296 | </title> |
---|
297 | <programlisting> |
---|
298 | void ExN05PhysicsList::ConstructLeptons() |
---|
299 | { |
---|
300 | // Construct all leptons |
---|
301 | G4LeptonConstructor pConstructor; |
---|
302 | pConstructor.ConstructParticle(); |
---|
303 | } |
---|
304 | </programlisting> |
---|
305 | </example> |
---|
306 | </para> |
---|
307 | |
---|
308 | </sect3> |
---|
309 | </sect2> |
---|
310 | |
---|
311 | <!-- ******************* Section (Level#2) ****************** --> |
---|
312 | <sect2 id="sect.HowToSpecParti.RangeCuts"> |
---|
313 | <title> |
---|
314 | Range Cuts |
---|
315 | </title> |
---|
316 | |
---|
317 | <para> |
---|
318 | To avoid infrared divergence, some electromagnetic processes |
---|
319 | require a threshold below which no secondary will be generated. |
---|
320 | Because of this requirement, gammas, electrons and positrons |
---|
321 | require production thresholds which the user should define. This |
---|
322 | threshold should be defined as a distance, or range cut-off, which |
---|
323 | is internally converted to an energy for individual materials. The |
---|
324 | range threshold should be defined in the initialization phase using |
---|
325 | the <literal>SetCuts()</literal> method of <literal>G4VUserPhysicsList</literal>. |
---|
326 | <xref linkend="sect.CutReg" /> discusses threshold and tracking |
---|
327 | cuts in detail. |
---|
328 | </para> |
---|
329 | |
---|
330 | |
---|
331 | |
---|
332 | <!-- ******************* Section (Level#3) ****************** --> |
---|
333 | <sect3 id="sect.HowToSpecParti.RangeCuts.SetCuts"> |
---|
334 | <title> |
---|
335 | Setting the cuts |
---|
336 | </title> |
---|
337 | |
---|
338 | <para> |
---|
339 | Production threshold values should be defined in <literal>SetCuts()</literal> |
---|
340 | which is a pure virtual method of the <literal>G4VUserPhysicsList</literal> |
---|
341 | class. Construction of particles, materials, and processes should |
---|
342 | precede the invocation of <literal>SetCuts()</literal>. <literal>G4RunManager</literal> |
---|
343 | takes care of this sequence in usual applications. |
---|
344 | </para> |
---|
345 | |
---|
346 | <para> |
---|
347 | The idea of a "unique cut value in range" is one of the |
---|
348 | important features of Geant4 and is used to handle cut values in a |
---|
349 | coherent manner. For most applications, users need to determine |
---|
350 | only one cut value in range, and apply this value to gammas, |
---|
351 | electrons and positrons alike. |
---|
352 | </para> |
---|
353 | |
---|
354 | <para> |
---|
355 | In such a case, the <literal>SetCutsWithDefault()</literal> method may be |
---|
356 | used. It is provided by the <literal>G4VuserPhysicsList</literal> base class, |
---|
357 | which has a <literal>defaultCutValue</literal> member as the default range |
---|
358 | cut-off value. <literal>SetCutsWithDefault()</literal> uses this value. |
---|
359 | </para> |
---|
360 | |
---|
361 | <para> |
---|
362 | It is possible to set different range cut values for gammas, |
---|
363 | electrons and positrons, and also to set different range cut values |
---|
364 | for each geometrical region. In such cases however, one must be |
---|
365 | careful with physics outputs because Geant4 processes (especially |
---|
366 | energy loss) are designed to conform to the "unique cut value in |
---|
367 | range" scheme. |
---|
368 | |
---|
369 | <example id="programlist_HowToSpecParti_3"> |
---|
370 | <title> |
---|
371 | Set cut values by using the default cut value. |
---|
372 | </title> |
---|
373 | <programlisting> |
---|
374 | void ExN04PhysicsList::SetCuts() |
---|
375 | { |
---|
376 | // the G4VUserPhysicsList::SetCutsWithDefault() method sets |
---|
377 | // the default cut value for all particle types |
---|
378 | SetCutsWithDefault(); |
---|
379 | } |
---|
380 | </programlisting> |
---|
381 | </example> |
---|
382 | </para> |
---|
383 | |
---|
384 | <para> |
---|
385 | The <literal>defaultCutValue</literal> is set to 1.0 mm by default. Of |
---|
386 | course, you can set the new default cut value in the constructor of |
---|
387 | your physics list class as shown below. |
---|
388 | |
---|
389 | <example id="programlist_HowToSpecParti_4"> |
---|
390 | <title> |
---|
391 | Set the default cut value. |
---|
392 | </title> |
---|
393 | <programlisting> |
---|
394 | ExN04PhysicsList::ExN04PhysicsList(): G4VUserPhysicsList() |
---|
395 | { |
---|
396 | // default cut value (1.0mm) |
---|
397 | defaultCutValue = 1.0*mm; |
---|
398 | } |
---|
399 | </programlisting> |
---|
400 | </example> |
---|
401 | </para> |
---|
402 | |
---|
403 | <para> |
---|
404 | The <literal>SetDefaultCutValue()</literal> method in |
---|
405 | <literal>G4VUserPhysicsList</literal> may also be used, and the "/run/setCut" |
---|
406 | command may be used to change the default cut value |
---|
407 | interactively. |
---|
408 | </para> |
---|
409 | |
---|
410 | <para> |
---|
411 | WARNING: DO NOT change cut values inside the event loop. Cut |
---|
412 | values may however be changed between runs. |
---|
413 | </para> |
---|
414 | |
---|
415 | <para> |
---|
416 | An example implementation of <literal>SetCuts()</literal> is shown |
---|
417 | below: |
---|
418 | |
---|
419 | <example id="programlist_HowToSpecParti_5"> |
---|
420 | <title> |
---|
421 | Example implementation of the <literal>SetCuts()</literal> method. |
---|
422 | </title> |
---|
423 | <programlisting> |
---|
424 | void ExN03PhysicsList::SetCuts() |
---|
425 | { |
---|
426 | // set cut values for gamma at first and for e- second and next for e+, |
---|
427 | // because some processes for e+/e- need cut values for gamma |
---|
428 | SetCutValue(cutForGamma, "gamma"); |
---|
429 | SetCutValue(cutForElectron, "e-"); |
---|
430 | SetCutValue(cutForElectron, "e+"); |
---|
431 | } |
---|
432 | </programlisting> |
---|
433 | </example> |
---|
434 | </para> |
---|
435 | |
---|
436 | <para> |
---|
437 | Beginning with Geant4 version 5.1, it is now possible to set |
---|
438 | production thresholds for each geometrical region. This new |
---|
439 | functionality is described in <xref linkend="sect.CutReg" />. |
---|
440 | </para> |
---|
441 | |
---|
442 | |
---|
443 | </sect3> |
---|
444 | </sect2> |
---|
445 | </sect1> |
---|