source: trunk/documents/UserDoc/DocBookUsersGuides/ForApplicationDeveloper/xml/GettingStarted/particleDef.xml @ 1013

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

ajout de la doc

File size: 13.2 KB
Line 
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>
18How to Specify Particles
19</title>
20
21<para>
22<literal>G4VuserPhysicsList</literal> is one of the mandatory user base
23classes described in
24<xref linkend="sect.HowToDefMain" />.
25Within this class all particles and physics processes to be used in
26your simulation must be defined. The range cut-off parameter should
27also be defined in this class.
28</para>
29
30<para>
31The user must create a class derived from
32<literal>G4VuserPhysicsList</literal> and implement the following pure
33virtual methods:
34
35<informalexample>
36<programlisting>
37ConstructParticle();      // construction of particles
38ConstructProcess();       // construct processes and register them to particles
39SetCuts();                // setting a range cut value for all particles
40</programlisting>
41</informalexample>
42</para>
43
44<para>
45This section provides some simple examples of the
46<literal>ConstructParticle()</literal> and <literal>SetCuts()</literal>
47methods.
48For 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>
57Particle Definition
58</title>
59
60<para>
61Geant4 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>
81Each particle is represented by its own class, which is derived
82from <literal>G4ParticleDefinition</literal>.
83(Exception: G4Ions represents all heavy nuclei. Please see
84<xref linkend="sect.Parti" />.)
85Particles 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
108each of which is defined in a corresponding sub-directory under
109<literal>geant4/source/particles</literal>. There is also a corresponding
110granular library for each particle category.
111</para>
112
113
114<!-- ******************* Section (Level#3) ****************** -->
115<sect3 id="sect.HowToSpecParti.PartiDef.G4ParticleDefinition">
116<title>
117The <literal>G4ParticleDefinition</literal> Class
118</title>
119
120<para>
121<literal>G4ParticleDefinition</literal> has properties which characterize
122individual particles, such as, name, mass, charge, spin, and so on.
123Most of these properties are "read-only" and can not be changed directly.
124<literal>G4ParticlePropertyTable</literal> is used to retrieve (load)
125particle property of <literal>G4ParticleDefinition</literal> 
126into (from) <literal>G4ParticlePropertyData</literal>.
127</para>
128
129</sect3>
130
131<!-- ******************* Section (Level#3) ****************** -->
132<sect3 id="sect.HowToSpecParti.PartiDef.HowToAccessParti">
133<title>
134How to Access a Particle
135</title>
136
137<para>
138Each particle class type represents an individual particle type,
139and each class has a single object. This object can be accessed by
140using the static method of each class.
141There are some exceptions to this rule; please see
142<xref linkend="sect.Parti" /> for details.
143</para>
144
145<para>
146For example, the class <literal>G4Electron</literal> represents the
147electron and the member <literal>G4Electron::theInstance</literal> 
148points its only object.
149The pointer to this object is available
150through the static methods
151<literal>G4Electron::ElectronDefinition()</literal>.
152<literal>G4Electron::Definition()</literal>.
153</para>
154
155<para>
156More than 100 types of particles are provided by default, to be
157used in various physics processes. In normal applications, users
158will not need to define their own particles.
159</para>
160
161<para>
162The unique object for each particle class is created when its static
163method to get the pointer is called iat the first time.
164Because particles are dynamic objects and should be instantiated before
165initialization of physics processes,
166you must explicitly invoke static methods of all particle classes
167required 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>
179The <literal>G4ParticleTable</literal> class is provided as a dictionary of
180particles. Various utility methods are provided, such as:
181
182<informalexample>
183<programlisting>
184FindParticle(G4String name);         // find the particle by name
185FindParticle(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,
192and the static method <literal>G4ParticleTable::GetParticleTable()</literal>
193provides its pointer.
194</para>
195
196<para>
197As for heavy ions (including hyper-nuclei), objects are created
198dynamically by requests from users and processes. 
199The <literal>G4ParticleTable</literal> class provides
200methods to create ions, such as:
201<informalexample>
202<programlisting>
203G4ParticleDefinition* GetIon(  G4int    atomicNumber, 
204                               G4int    atomicMass,
205                               G4double   excitationEnergy);
206</programlisting>
207</informalexample>
208</para>
209
210<para>
211Particles are registered automatically during construction. The
212user 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>
221Constructing Particles
222</title>
223
224<para>
225<literal>ConstructParticle()</literal> is a pure virtual method, in which
226the static member functions for all the particles you require should be called.
227This ensures that objects of these particles are created.
228</para>
229
230<para>
231WARNING: You must define "All PARTICLE TYPES" which are used in your
232application, except for heavy ions.
233"All PARTICLE TYPES" means not only primary
234particles, but also all other particles which may appear as secondaries
235generated by physics processes you use. Beginning with Geant4 version 8.0,
236you should keep this rule strictly because all particle definitions are
237revised to "non-static" objects.
238</para>
239
240<para>
241For example, suppose you need a proton and a geantino, which is
242a virtual particle used for simulation and which does not interact
243with materials. The <literal>ConstructParticle()</literal> method is
244implemented as below:
245
246<example id="programlist_HowToSpecParti_1">
247<title>
248Construct 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>
261Due to the large number of pre-defined particles in Geant4, it
262is cumbersome to list all the particles by this method. If you want
263all the particles in a Geant4 particle category, there are six
264utility classes, corresponding to each of the particle categories,
265which 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>
290An example of this is shown in <literal>ExN05PhysicsList</literal>,
291listed below.
292
293<example id="programlist_HowToSpecParti_2">
294<title>
295Construct all leptons.
296</title>
297<programlisting>
298void 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>
314Range Cuts
315</title>
316
317<para>
318To avoid infrared divergence, some electromagnetic processes
319require a threshold below which no secondary will be generated.
320Because of this requirement, gammas, electrons and positrons
321require production thresholds which the user should define. This
322threshold should be defined as a distance, or range cut-off, which
323is internally converted to an energy for individual materials. The
324range threshold should be defined in the initialization phase using
325the <literal>SetCuts()</literal> method of <literal>G4VUserPhysicsList</literal>.
326<xref linkend="sect.CutReg" /> discusses threshold and tracking
327cuts in detail.
328</para>
329
330
331
332<!-- ******************* Section (Level#3) ****************** -->
333<sect3 id="sect.HowToSpecParti.RangeCuts.SetCuts">
334<title>
335Setting the cuts
336</title>
337
338<para>
339Production threshold values should be defined in <literal>SetCuts()</literal>
340which is a pure virtual method of the <literal>G4VUserPhysicsList</literal>
341class. Construction of particles, materials, and processes should
342precede the invocation of <literal>SetCuts()</literal>. <literal>G4RunManager</literal>
343takes care of this sequence in usual applications.
344</para>
345
346<para>
347The idea of a "unique cut value in range" is one of the
348important features of Geant4 and is used to handle cut values in a
349coherent manner. For most applications, users need to determine
350only one cut value in range, and apply this value to gammas,
351electrons and positrons alike.
352</para>
353
354<para>
355In such a case, the <literal>SetCutsWithDefault()</literal> method may be
356used. It is provided by the <literal>G4VuserPhysicsList</literal> base class,
357which has a <literal>defaultCutValue</literal> member as the default range
358cut-off value. <literal>SetCutsWithDefault()</literal> uses this value.
359</para>
360
361<para>
362It is possible to set different range cut values for gammas,
363electrons and positrons, and also to set different range cut values
364for each geometrical region. In such cases however, one must be
365careful with physics outputs because Geant4 processes (especially
366energy loss) are designed to conform to the "unique cut value in
367range" scheme.
368
369<example id="programlist_HowToSpecParti_3">
370<title>
371Set cut values by using the default cut value.
372</title>
373<programlisting>
374void 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>
385The <literal>defaultCutValue</literal> is set to 1.0 mm by default. Of
386course, you can set the new default cut value in the constructor of
387your physics list class as shown below.
388
389<example id="programlist_HowToSpecParti_4">
390<title>
391Set the default cut value.
392</title>
393<programlisting>
394ExN04PhysicsList::ExN04PhysicsList():  G4VUserPhysicsList()
395{
396  // default cut value  (1.0mm)
397  defaultCutValue = 1.0*mm;
398}
399</programlisting>
400</example>
401</para>
402
403<para>
404The <literal>SetDefaultCutValue()</literal> method in
405<literal>G4VUserPhysicsList</literal> may also be used, and the "/run/setCut"
406command may be used to change the default cut value
407interactively.
408</para>
409
410<para>
411WARNING: DO NOT change cut values inside the event loop. Cut
412values may however be changed between runs.
413</para>
414
415<para>
416An example implementation of <literal>SetCuts()</literal> is shown
417below:
418
419<example id="programlist_HowToSpecParti_5">
420<title>
421Example implementation of the <literal>SetCuts()</literal> method.
422</title>
423<programlisting>
424void 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>
437Beginning with Geant4 version 5.1, it is now possible to set
438production thresholds for each geometrical region. This new
439functionality is described in <xref linkend="sect.CutReg" />.
440</para>
441
442
443</sect3>
444</sect2>
445</sect1>
Note: See TracBrowser for help on using the repository browser.