[904] | 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> |
---|
| 16 | How to Specify Physics Processes |
---|
| 17 | </title> |
---|
| 18 | |
---|
| 19 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 20 | <sect2 id="sect.HowToSpecPhysProc.PhysProc"> |
---|
| 21 | <title> |
---|
| 22 | Physics Processes |
---|
| 23 | </title> |
---|
| 24 | |
---|
| 25 | <para> |
---|
| 26 | Physics processes describe how particles interact with materials. |
---|
| 27 | Geant4 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> |
---|
| 54 | All physics processes are derived from the <emphasis>G4VProcess</emphasis> |
---|
| 55 | base 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 | |
---|
| 69 | and 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 | |
---|
| 83 | describe the behavior of a physics process when they are |
---|
| 84 | implemented in a derived class. The details of these methods are |
---|
| 85 | described in |
---|
| 86 | <xref linkend="sect.PhysProc" />. |
---|
| 87 | </para> |
---|
| 88 | |
---|
| 89 | <para> |
---|
| 90 | The following are specialized base classes to be used for simple |
---|
| 91 | processes: |
---|
| 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> |
---|
| 116 | Another 4 virtual classes, such as |
---|
| 117 | <emphasis>G4VContinuousDiscreteProcess</emphasis>, are provided for complex |
---|
| 118 | processes. |
---|
| 119 | </para> |
---|
| 120 | |
---|
| 121 | </sect2> |
---|
| 122 | |
---|
| 123 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 124 | <sect2 id="sect.HowToSpecPhysProc.ManagingProc"> |
---|
| 125 | <title> |
---|
| 126 | Managing Processes |
---|
| 127 | </title> |
---|
| 128 | |
---|
| 129 | <para> |
---|
| 130 | The <emphasis>G4ProcessManager</emphasis> class contains a list of processes that |
---|
| 131 | a particle can undertake. It has information on the order of |
---|
| 132 | invocation of the processes, as well as which kind of <literal>DoIt</literal> |
---|
| 133 | method is valid for each process in the list. A |
---|
| 134 | <emphasis>G4ProcessManager</emphasis> object corresponds to each particle and is |
---|
| 135 | attached to the <emphasis>G4ParticleDefiniton</emphasis> class. |
---|
| 136 | </para> |
---|
| 137 | |
---|
| 138 | <para> |
---|
| 139 | In order to validate processes, they should be registered with |
---|
| 140 | the particle's <emphasis>G4ProcessManager</emphasis>. Process ordering |
---|
| 141 | information is included by using the <literal>AddProcess()</literal> and |
---|
| 142 | <literal>SetProcessOrdering()</literal> methods. For registration of simple |
---|
| 143 | processes, the <literal>AddAtRestProcess()</literal>, |
---|
| 144 | <literal>AddContinuousProcess()</literal> and <literal>AddDiscreteProcess()</literal> |
---|
| 145 | methods may be used. |
---|
| 146 | </para> |
---|
| 147 | |
---|
| 148 | <para> |
---|
| 149 | <emphasis>G4ProcessManager</emphasis> is able to turn some processes on or off |
---|
| 150 | during a run by using the <literal>ActivateProcess()</literal> and |
---|
| 151 | <literal>InActivateProcess()</literal> methods. These methods are valid only |
---|
| 152 | after process registration is complete, so they must not be used in |
---|
| 153 | the <emphasis>PreInit</emphasis> phase. |
---|
| 154 | </para> |
---|
| 155 | |
---|
| 156 | <para> |
---|
| 157 | The <emphasis>G4VUserPhysicsList</emphasis> class creates and attaches |
---|
| 158 | <emphasis>G4ProcessManager</emphasis> objects to all particle classes defined in |
---|
| 159 | the <literal>ConstructParticle()</literal> method. |
---|
| 160 | </para> |
---|
| 161 | |
---|
| 162 | </sect2> |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | <!-- ******************* Section (Level#2) ****************** --> |
---|
| 166 | <sect2 id="sect.HowToSpecPhysProc.SpecPhysProc"> |
---|
| 167 | <title> |
---|
| 168 | Specifying Physics Processes |
---|
| 169 | </title> |
---|
| 170 | |
---|
| 171 | <para> |
---|
| 172 | <emphasis>G4VUserPhysicsList</emphasis> is the base class for a "mandatory user |
---|
| 173 | class" (see <xref linkend="sect.HowToDefMain" />), in which all physics |
---|
| 174 | processes and all particles required in a simulation must be registered. |
---|
| 175 | The 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> |
---|
| 181 | For example, if just the <emphasis>G4Geantino</emphasis> particle class is |
---|
| 182 | required, only the transportation process need be registered. The |
---|
| 183 | <literal>ConstructProcess()</literal> method would then be implemented as |
---|
| 184 | follows: |
---|
| 185 | |
---|
| 186 | <example id="programlist_HowToSpecPhysProc_1"> |
---|
| 187 | <title> |
---|
| 188 | Register 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 | |
---|
| 199 | Here, 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 |
---|
| 203 | the particle motion in space and time. It is the mandatory process |
---|
| 204 | for tracking particles. |
---|
| 205 | </para> |
---|
| 206 | |
---|
| 207 | <para> |
---|
| 208 | In the <literal>ConstructProcess()</literal> method, physics processes |
---|
| 209 | should be created and registered with each particle's instance of |
---|
| 210 | <emphasis>G4ProcessManager</emphasis>. |
---|
| 211 | </para> |
---|
| 212 | |
---|
| 213 | <para> |
---|
| 214 | An example of process registration is given in the |
---|
| 215 | <emphasis>G4VUserPhysicsList</emphasis>::<literal>AddTransportation()</literal> |
---|
| 216 | method. |
---|
| 217 | </para> |
---|
| 218 | |
---|
| 219 | <para> |
---|
| 220 | Registration in <emphasis>G4ProcessManager</emphasis> is a complex procedure |
---|
| 221 | for other processes and particles because the relations between |
---|
| 222 | processes are crucial for some processes. Please see |
---|
| 223 | <xref linkend="sect.PhysProc" /> and the example codes. |
---|
| 224 | </para> |
---|
| 225 | |
---|
| 226 | <para> |
---|
| 227 | An example of electromagnetic process registration for photons |
---|
| 228 | is shown below: |
---|
| 229 | |
---|
| 230 | <example id="programlist_HowToSpecPhysProc_2"> |
---|
| 231 | <title> |
---|
| 232 | Register processes for a gamma. |
---|
| 233 | </title> |
---|
| 234 | <programlisting> |
---|
| 235 | void MyPhysicsList::ConstructProcess() |
---|
| 236 | { |
---|
| 237 | // Define transportation process |
---|
| 238 | AddTransportation(); |
---|
| 239 | // electromagnetic processes |
---|
| 240 | ConstructEM(); |
---|
| 241 | } |
---|
| 242 | void MyPhysicsList::ConstructEM() |
---|
| 243 | { |
---|
| 244 | // Get the process manager for gamma |
---|
| 245 | G4ParticleDefinition* particle = G4Gamma::GammaDefinition(); |
---|
| 246 | G4ProcessManager* pmanager = particle->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->AddDiscreteProcess(thePhotoElectricEffect); |
---|
| 255 | pmanager->AddDiscreteProcess(theComptonScattering); |
---|
| 256 | pmanager->AddDiscreteProcess(theGammaConversion); |
---|
| 257 | } |
---|
| 258 | </programlisting> |
---|
| 259 | </example> |
---|
| 260 | </para> |
---|
| 261 | |
---|
| 262 | |
---|
| 263 | </sect2> |
---|
| 264 | </sect1> |
---|