source: trunk/documents/UserDoc/UsersGuides/ForApplicationDeveloper/html/GettingStarted/physicsDef.html @ 1358

Last change on this file since 1358 was 1208, checked in by garnier, 15 years ago

CVS update

File size: 6.5 KB
Line 
1<HTML>
2<TITLE>
3</TITLE>
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
9<BODY>
10<TABLE WIDTH="100%"><TR>
11<TD>
12
13
14<A HREF="index.html">
15<IMG SRC="../../../../resources/html/IconsGIF/Contents.gif" ALT="Contents"></A>
16<A HREF="particleDef.html">
17<IMG SRC="../../../../resources/html/IconsGIF/Previous.gif" ALT="Previous"></A>
18<A HREF="eventDef.html">
19<IMG SRC="../../../../resources/html/IconsGIF/Next.gif" ALT="Next"></A>
20</TD>
21<TD ALIGN="Right">
22<FONT SIZE="-1" COLOR="#238E23">
23<B>Geant4 User's Guide</B>
24<BR>
25<B>For Application Developers</B>
26<BR>
27<B>Getting Started with Geant4</B>
28</FONT>
29</TD>
30</TR></TABLE>
31<BR>
32
33<P ALIGN="Center">
34<FONT SIZE="+3" COLOR="#238E23">
35<B>2.5 How to Specify Physics Processes</B>
36</FONT>
37<P><BR>
38
39<HR ALIGN="Center" SIZE="7%">
40<p>
41
42<a name="2.5.1">
43<H2>2.5.1 Physics Processes</H2></a>
44
45 Physics processes describe how particles interact with materials.  Geant4
46 provides seven major categories of processes:
47<ul>
48 <li>electromagnetic,
49 <li>hadronic,
50 <li>transportation,
51 <li>decay,
52 <li>optical,
53 <li>photolepton_hadron, and
54 <li>parameterisation.
55</ul>
56<P>
57 All physics processes are derived from the <I>G4VProcess</I> base class.
58 Its virtual methods
59<ul>
60 <li><TT>AtRestDoIt</TT>,
61 <li><TT>AlongStepDoIt</TT>, and
62 <li><TT>PostStepDoIt</TT>
63</ul>
64 and the corresponding methods
65<ul>
66 <li><TT>AtRestGetPhysicalInteractionLength</TT>,
67 <li><TT>AlongStepGetPhysicalInteractionLength</TT>, and
68 <li><TT>PostStepGetPhysicalInteractionLength</TT>
69</ul>
70 describe the behavior of a physics process when they are implemented in a
71 derived class.  The details of these methods are described in
72 <a href="../TrackingAndPhysics/physicsProcess.html"> Section 5.2</a>.
73<P>
74 The following are specialized base classes to be used for simple processes:
75<table>
76<tr>
77<td><i>G4VAtRestProcess</i>
78<td>- processes with only <tt>AtRestDoIt</tt>
79<tr>
80<td><i>G4VContinuousProcess</i>
81<td>- processes with only <tt>AlongStepDoIt</tt>
82<tr>
83<td><i>G4VDiscreteProcess</i>
84<td>- processes with only <tt>PostStepDoIt</tt>
85</table>
86
87 Another 4 virtual classes, such as <I>G4VContinuousDiscreteProcess</I>,
88 are provided for complex processes.
89<P>
90
91<hr>
92<a name="2.5.2">
93<H2>2.5.2 Managing Processes</H2></a>
94
95The <I>G4ProcessManager</I> class contains a list of processes that a particle
96can undertake.  It has information on the order of invocation of the
97processes, as well as which kind of <tt>DoIt</tt> method is valid for each
98process in the list.  A <I>G4ProcessManager</I> object corresponds to each
99particle and is attached to the <I>G4ParticleDefiniton</I> class.
100<P>
101In order to validate processes, they should be registered with the particle's
102<I>G4ProcessManager</I>.  Process ordering information is included by using
103the <TT>AddProcess()</TT> and <TT>SetProcessOrdering()</TT> methods.  For
104registration of simple processes, the <TT>AddAtRestProcess()</TT>,
105<TT>AddContinuousProcess()</TT> and <TT>AddDiscreteProcess()</TT> methods may
106be used.
107<P>
108<I>G4ProcessManager</I> is able to turn some processes on or off during a run
109by using the <TT>ActivateProcess()</TT> and <TT>InActivateProcess()</TT> 
110methods.  These methods are valid only after process registration is complete,
111so they must not be used in the <i>PreInit</i> phase.
112<P>
113The <I>G4VUserPhysicsList</I> class creates and attaches
114<I>G4ProcessManager</I> objects to all particle classes defined in the
115<TT>ConstructParticle()</TT> method.
116<P>
117<hr>
118<a name="2.5.3">
119<H2>2.5.3 Specifying Physics Processes</H2></a>
120
121<I>G4VUserPhysicsList</I> is the base class for a "mandatory user class" (see
122 <a href="mainProgram.html">Section 2.1</a>), in which all physics processes
123and all particles required in a simulation must be registered.  The user must
124create a class derived from <I>G4VUserPhysicsList</I> and implement the pure
125virtual method <TT>ConstructProcess()</TT>.
126<P>
127For example, if just the <i>G4Geantino</i> particle class is required, only
128the transportation process need be registered.  The
129<TT>ConstructProcess()</TT> method would then be implemented as follows:
130<P>
131<center>
132<table border=2 cellpadding=10>
133<tr>
134<td>
135<PRE>
136  void ExN01PhysicsList::ConstructProcess()
137  {
138    // Define transportation process
139    AddTransportation();
140  }
141</PRE>
142</td>
143</tr>
144<tr>
145<td align=center>
146 Source listing 2.5.1<BR>
147 Register processes for a geantino.
148</td>
149</tr>
150</table></center>
151<P>
152Here, the <TT>AddTransportation()</TT> method is provided in the
153<I>G4VUserPhysicsList</I> class to register the <I>G4Transportation</I> class
154with all particle classes.  The <I>G4Transportation</I> class (and/or related
155classes) describes the particle motion in space and time.  It is the
156mandatory process for tracking particles.
157<P>
158In the <TT>ConstructProcess()</TT> method, physics processes should be
159created and registered with each particle's instance of
160<I>G4ProcessManager</I>.
161<P>
162An example of process registration is given in the
163<I>G4VUserPhysicsList</I>::<TT>AddTransportation()</TT> method.
164<P>
165 Registration in <I>G4ProcessManager</I> is a complex procedure for
166 other processes and particles because the relations between processes are
167 crucial for some processes.  Please see
168<a href="../TrackingAndPhysics/physicsProcess.html"> Section 5.2</a> and the
169example codes.
170<P>
171An example of electromagnetic process registration for photons is shown below:
172<p>
173<center>
174<table border=2 cellpadding=10>
175<tr>
176<td>
177<PRE>
178void MyPhysicsList::ConstructProcess()
179{
180  // Define transportation process
181  AddTransportation();
182  // electromagnetic processes
183  ConstructEM();
184}
185void MyPhysicsList::ConstructEM()
186{
187   //  Get the process manager for gamma
188  G4ParticleDefinition* particle = G4Gamma::GammaDefinition();
189  G4ProcessManager* pmanager = particle->GetProcessManager();
190
191  // Construct processes for gamma
192  G4PhotoElectricEffect * thePhotoElectricEffect = new G4PhotoElectricEffect();     
193  G4ComptonScattering * theComptonScattering = new G4ComptonScattering();
194  G4GammaConversion* theGammaConversion = new G4GammaConversion();
195
196  // Register processes to gamma's process manager
197  pmanager->AddDiscreteProcess(thePhotoElectricEffect);
198  pmanager->AddDiscreteProcess(theComptonScattering);
199  pmanager->AddDiscreteProcess(theGammaConversion);
200}
201</PRE>
202</td>
203</tr>
204<tr>
205<td align=center>
206 Source listing 2.5.2<BR>
207 Register processes for a gamma.
208</td>
209</tr>
210</table></center>
211<p>
212<HR>
213<A HREF="../../../../Authors/html/subjectsToAuthors.html">
214<I>About the authors</I></A>
215
216</BODY>
217</HTML>
Note: See TracBrowser for help on using the repository browser.