| 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">
|
|---|
| 2 | function 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.
|
|---|
| 9 | How 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.
|
|---|
| 11 | Getting 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.
|
|---|
| 13 | How 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.
|
|---|
| 15 | Physics Processes
|
|---|
| 16 | </h3></div></div></div><p>
|
|---|
| 17 | Physics processes describe how particles interact with materials.
|
|---|
| 18 | Geant4 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>
|
|---|
| 35 | All physics processes are derived from the <span class="emphasis"><em>G4VProcess</em></span>
|
|---|
| 36 | base 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 |
|
|---|
| 46 | and 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 |
|
|---|
| 56 | describe the behavior of a physics process when they are
|
|---|
| 57 | implemented in a derived class. The details of these methods are
|
|---|
| 58 | described in
|
|---|
| 59 | <a href="ch05s02.html" title="5.2.
|
|---|
| 60 | Physics Processes
|
|---|
| 61 | ">Section 5.2</a>.
|
|---|
| 62 | </p><p>
|
|---|
| 63 | The following are specialized base classes to be used for simple
|
|---|
| 64 | processes:
|
|---|
| 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>
|
|---|
| 71 | Another 4 virtual classes, such as
|
|---|
| 72 | <span class="emphasis"><em>G4VContinuousDiscreteProcess</em></span>, are provided for complex
|
|---|
| 73 | processes.
|
|---|
| 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.
|
|---|
| 75 | Managing Processes
|
|---|
| 76 | </h3></div></div></div><p>
|
|---|
| 77 | The <span class="emphasis"><em>G4ProcessManager</em></span> class contains a list of processes that
|
|---|
| 78 | a particle can undertake. It has information on the order of
|
|---|
| 79 | invocation of the processes, as well as which kind of <code class="literal">DoIt</code>
|
|---|
| 80 | method is valid for each process in the list. A
|
|---|
| 81 | <span class="emphasis"><em>G4ProcessManager</em></span> object corresponds to each particle and is
|
|---|
| 82 | attached to the <span class="emphasis"><em>G4ParticleDefiniton</em></span> class.
|
|---|
| 83 | </p><p>
|
|---|
| 84 | In order to validate processes, they should be registered with
|
|---|
| 85 | the particle's <span class="emphasis"><em>G4ProcessManager</em></span>. Process ordering
|
|---|
| 86 | information is included by using the <code class="literal">AddProcess()</code> and
|
|---|
| 87 | <code class="literal">SetProcessOrdering()</code> methods. For registration of simple
|
|---|
| 88 | processes, the <code class="literal">AddAtRestProcess()</code>,
|
|---|
| 89 | <code class="literal">AddContinuousProcess()</code> and <code class="literal">AddDiscreteProcess()</code>
|
|---|
| 90 | methods may be used.
|
|---|
| 91 | </p><p>
|
|---|
| 92 | <span class="emphasis"><em>G4ProcessManager</em></span> is able to turn some processes on or off
|
|---|
| 93 | during a run by using the <code class="literal">ActivateProcess()</code> and
|
|---|
| 94 | <code class="literal">InActivateProcess()</code> methods. These methods are valid only
|
|---|
| 95 | after process registration is complete, so they must not be used in
|
|---|
| 96 | the <span class="emphasis"><em>PreInit</em></span> phase.
|
|---|
| 97 | </p><p>
|
|---|
| 98 | The <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
|
|---|
| 100 | the <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.
|
|---|
| 102 | Specifying Physics Processes
|
|---|
| 103 | </h3></div></div></div><p>
|
|---|
| 104 | <span class="emphasis"><em>G4VUserPhysicsList</em></span> is the base class for a "mandatory user
|
|---|
| 105 | class" (see <a href="ch02.html#sect.HowToDefMain" title="2.1.
|
|---|
| 106 | How to Define the main() Program
|
|---|
| 107 | ">Section 2.1</a>), in which all physics
|
|---|
| 108 | processes and all particles required in a simulation must be registered.
|
|---|
| 109 | The 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>
|
|---|
| 113 | For example, if just the <span class="emphasis"><em>G4Geantino</em></span> particle class is
|
|---|
| 114 | required, only the transportation process need be registered. The
|
|---|
| 115 | <code class="literal">ConstructProcess()</code> method would then be implemented as
|
|---|
| 116 | follows:
|
|---|
| 117 |
|
|---|
| 118 | </p><div class="example"><a name="programlist_HowToSpecPhysProc_1"></a><p class="title"><b>Example 2.17.
|
|---|
| 119 | Register 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 |
|
|---|
| 128 | Here, 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
|
|---|
| 132 | the particle motion in space and time. It is the mandatory process
|
|---|
| 133 | for tracking particles.
|
|---|
| 134 | </p><p>
|
|---|
| 135 | In the <code class="literal">ConstructProcess()</code> method, physics processes
|
|---|
| 136 | should be created and registered with each particle's instance of
|
|---|
| 137 | <span class="emphasis"><em>G4ProcessManager</em></span>.
|
|---|
| 138 | </p><p>
|
|---|
| 139 | An example of process registration is given in the
|
|---|
| 140 | <span class="emphasis"><em>G4VUserPhysicsList</em></span>::<code class="literal">AddTransportation()</code>
|
|---|
| 141 | method.
|
|---|
| 142 | </p><p>
|
|---|
| 143 | Registration in <span class="emphasis"><em>G4ProcessManager</em></span> is a complex procedure
|
|---|
| 144 | for other processes and particles because the relations between
|
|---|
| 145 | processes are crucial for some processes. Please see
|
|---|
| 146 | <a href="ch05s02.html" title="5.2.
|
|---|
| 147 | Physics Processes
|
|---|
| 148 | ">Section 5.2</a> and the example codes.
|
|---|
| 149 | </p><p>
|
|---|
| 150 | An example of electromagnetic process registration for photons
|
|---|
| 151 | is shown below:
|
|---|
| 152 |
|
|---|
| 153 | </p><div class="example"><a name="programlist_HowToSpecPhysProc_2"></a><p class="title"><b>Example 2.18.
|
|---|
| 154 | Register processes for a gamma.
|
|---|
| 155 | </b></p><div class="example-contents"><pre class="programlisting">
|
|---|
| 156 | void MyPhysicsList::ConstructProcess()
|
|---|
| 157 | {
|
|---|
| 158 | // Define transportation process
|
|---|
| 159 | AddTransportation();
|
|---|
| 160 | // electromagnetic processes
|
|---|
| 161 | ConstructEM();
|
|---|
| 162 | }
|
|---|
| 163 | void MyPhysicsList::ConstructEM()
|
|---|
| 164 | {
|
|---|
| 165 | // Get the process manager for gamma
|
|---|
| 166 | G4ParticleDefinition* particle = G4Gamma::GammaDefinition();
|
|---|
| 167 | G4ProcessManager* pmanager = particle->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->AddDiscreteProcess(thePhotoElectricEffect);
|
|---|
| 176 | pmanager->AddDiscreteProcess(theComptonScattering);
|
|---|
| 177 | pmanager->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.
|
|---|
| 181 | How 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.
|
|---|
| 183 | How to Generate a Primary Event
|
|---|
| 184 | </td></tr></table></div></body></html>
|
|---|