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.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]
1 -------------------------------------------------------------------
2
3 =========================================================
4 Geant4 - an Object-Oriented Toolkit for Simulation in HEP
5 =========================================================
6
7 field01
8 -------
9
10 Example that enables investigation of the accuracy and performance of the
11 tracking in a magnetic field.
12
13 The key Geant4 capabilities demonstrated in this example are:
14 - creating a uniform magnetic field interactively using the field
15 messenger,
16 - choosing the type of Runge Kutta stepper used for integration of the
17 motion of charged particles in the magnetic field,
18 - controlling the thresholds that determine which looping particles are
19 killed by G4Transportation.
20
21 Some of these capabilities are available via interactive commands,
22 implemented in F01FieldMessenger.
23
24 A. The magnetic field is defined in the ConstructSDandField() method
25 in the F01DetectorConstruction class using the G4FieldBuilder class.
26
27 The interactive commands, under the /field directory, are created with
28 the instantiation of G4FieldBuilder in the F03DetectorConstruction constructor,
29
30 B. Choosing the type of stepper -
31
32 The basic capabilities of choosing the stepper type are demonstrated in the
33 field.in macro file:
34
35 /field/stepperType TsitourasRK45 ## Choose a stepper type ( Tsitouras )
36
37 /field/stepperType RK547FEq1 ## Choose an FSAL stepper ( FEqRK1 )
38
39 /field/setMinimumStep 0.1 mm ## Smaller steps always succeed
40
41 /field/update ## Initialise using parameters above
42 ## if they were changed after initialization
43
44 In addition it is possible to choose to use a new type of stepper, known
45 as 'First Same as Last' or FSAL, which in each step obtains the field value
46 at the step endpoint and evaluates the 'right hand size' of the equation
47 for the next integration step. This reduces the number of calls to the field
48 evaluation, which can be one the most computationally expensive methods,
49 while providing similar accuracy.
50
51 There are several potential choices of the stepper type. Here are some
52 suggestions:
53 ===========================================================================
54 Number Name of Stepper Comments
55 ===========================================================================
56 Recommended - default since Geant4 10.4:
57
58 DormandPrince745 : Uses a pair 4th & 5th order formulae (like other 4/5
59 well-known and very efficient embedded method
60 methods); their difference is the error estimate.
61 Highly recommended in literature, including
62 Hairer & Wanner, & Numerical Recipes
63 Used in several established RK code (e.g. DOPRI5)
64 ===========================================================================
65 Good choices for reasonably smooth fields:
66
67 BogackiShampine45 : more efficient embedded 4/5 pair
68 Used in many applications, including
69 RKSUITE suite.
70
71 TsitourasRK45 : potentially the most efficient embedded 4/5
72 pair - found in expanded search of parameter
73 space.
74
75 DormandPrinceRK56 : higher order embedded method from authors of DoPri5.
76 Uses a pair 5th & 6th order formulae.
77
78 DormandPrinceRK78 : higher order embedded method from authors of DoPri5.
79 Uses a pair 7th & 8th order formulae.
80
81 NystromRK4 : a specialised Nystrom method for magnetic fields.
82 Reuses the field value at the mid-point of the step,
83 and also provides an analytical estimation of the
84 integration error based on numerical evaluation of
85 fourth order variation in the equation for
86 magnetic field.
87 ===========================================================================
88 The new 'First Same as Last' (FSAL) steppers can be chosen in addition:
89 RKFEq1 : FSAL stepper with improved equilibrium properties.
90 When kinks or other anomalies are encountered,
91 and at the start of integration when the best
92 step size is not known, this type of stepper
93 converges faster and more smoothly to good
94 step sizes.
95 ===========================================================================
96 The old default and old first alternative -
97
98 ClassicalRK4 : original Runge-Kutta method, very robust but slower )
99 ( obtains error estimate by doing 2 half steps )
100 Good baseline for comparison - long experience of use.
101 May be good alternative for less smooth fields.
102
103 CashKarpRKF45 : The oldest 'embedded' RK method in Geant4 -
104 also fairly robust.
105 Faster than ClassicalRK4 for smoother fields,
106 as it does not need two half steps to estimate error.
107 Available since Geant4 1.0
108
109 ===========================================================================
110 Other potential choices for non-smooth fields (with kinks, abrupt changes):
111
112 SimpleHeum : low order, with error obtained from half-steps
113 BogackiShampine23 : lower order embedded method (new in 10.3-beta)
114 ===========================================================================
115
116
117
118 C. Controlling the killing of looping particles
119
120
121 Occasionally tracks 'looping' in a strong magnetic field, making little
122 progress even over hundreds of integration steps. This is due to a
123 combination of a strong magnetic field and a thin material (gas or vacuum)
124 in which the size of a physics step is substantially larger than the radius
125 of curvature of the track.
126
127 Since the amount of CPU time which can be consumed by one or few such tracks
128 is very large, it is important to limit the number of integration steps
129 spent on these tracks. The module for propagation in field in Geant4
130 flags tracks which take more than a certain number (default 1,000) integration
131 steps without reaching the requested end of the step size, which was
132 determined by the physics and geometry.
133
134 The Geant4 G4Transportation and G4CoupledTransportation processes are tasked
135 to select which of the looping tracks are killed and which survive. To
136 balance the potential significant cost of integrating looping particles,
137 three thresholds exist
138
139 The 'Warning' Energy: a track with energy below this value that is found to
140 loop is killed silently (no warning.)
141
142 Above the 'Warning Energy', if a track is selected for killing a warning is
143 generated.
144
145 The 'Important' Energy: the threshold energy above which a track will survive
146 for multiple steps if found looping.
147
148 number of 'tracking' steps. They will be only be killed only if they still
149 loop after than
150 The number of 'trials': the number of steps that 'important' tracks survive.
151
152 Note that currently only stable particles are killed. ( Refinements to enable
153 toggling whether unstable particles can be killed are in development. )
154
155 This example demonstrate choosing different values for these parametes
156 in the main() method of field01.cc using one of two techniques.
157
158 The first method is new in Geant4 release 10.5, and uses the G4PhysicsListHelper
159 which has methods to choose a pre-selected set of parameter values. The choices
160 are between a set each of low and high thresholds. Either one can be enabled
161 by calling correspondingly
162 - G4PhysicsListHelper::GetPhysicsListHelper()->UseLowLooperThresholds();
163 or
164 - G4PhysicsListHelper::GetPhysicsListHelper()->UseHighLooperThresholds();
165 These methods must be called before the physics is constructed - i.e. typically
166 before RunManager's Initialise() method is called.
167 This works only if either
168 - a modular physics lists is used, or if
169 - the G4ModularPhysicsList and its AddTransporation method are used
170 to create and register a common transportation process for all particles
171 (one for each thread).
172
173 ii) Fine grained control (available in Geant4 versions since 7.0)
174
175 Fine grained control of the Transportation's parameters for looping particles
176 is also possible.
177
178 This is demonstrated in the F01RunAction's ChangeLooperParameters method,
179 which is called by the BeginOfRunAction. There the appropriate
180 Transportation object for the electron is obtained, and its parameters
181 (if valid) are used to overwrite the thresholds in the G4Transportation class.
182
183 For example, to ensure that only looping particles with energy 10 keV are
184 killed silently we change the value of the 'Warning' Energy:
185
186 runAction->SetWarningEnergy( 10.0 * CLHEP::keV );
187
188 [ This is passed along to the registered G4Transportation or
189 G4CoupledTransportation object by the F01RunAction's ChangeLooperParameters.]
190
191 As a result the killing of any (stable) looping track with energy over 10 keV
192 will generate a warning.
193
194 A second configurable energy threshold enables tracks above it to survive a
195 chosen number of 'tracking' steps. They will be only be killed only if they
196 still loop after than number of tracking steps. F01RunAction's methods are
197 used to configure these parameters:
198
199 runAction->SetImportantEnergy( 0.1 * CLHEP::MeV );
200 runAction->SetNumberOfTrials( 30 );
201
202 which the run action passes to the G4Transportation or
203 G4CoupledTransportation object registered for the electron.
204
205 Note that for all pre-configured and modular physics lists share a single
206 Transportation process for all types of particles. So the parameters for
207 killing loopers will be shared by all particle types in this case.
208
209
210 Background Information
211
212 1- GEOMETRY DEFINITION
213
214 The "Absorber" is a solid made of a given material.
215
216 Three parameters define the absorber :
217 - the material of the absorber,
218 - the thickness of an absorber,
219 - the transverse size of the absorber (the input face is a square).
220
221 The volume "World" contains the "Absorber".
222 In this test the parameters of the "World" can be changed , too.
223
224 In addition a transverse uniform magnetic field can be applied.
225
226 The default geometry is constructed in F01DetectorConstruction class,
227 but all the parameters can be changed via
228 the commands defined in the F01DetectorMessenger class.
229
230 2- AN EVENT : THE PRIMARY GENERATOR
231
232 The primary kinematic consists of a single particle (electron, Ekin = 0.5 GeV)
233 which hits the
234 absorber perpendicular to the input face. The type of the particle
235 and its energy are set in the F01PrimaryGeneratorAction class, and can
236 be changed via the G4 build-in commands of G4ParticleGun class (see
237 the macros provided with this example).
238
239 It is also possible to change the position of the primary particle vertex
240 or activate its randomization via the commands defined in the
241 F01PrimaryGeneratorMessenger class.
242
243 A RUN is a set of events.
244
245 3- DETECTOR RESPONSE
246
247 The spatial distribution of charged particles transported in magnetic
248 field is envistigated.
249 A HIT is a record, event per event , of all the
250 informations needed to simulate and analyse the detector response.
251
252 In this example a F01CalorHit is defined as a set of 2 informations:
253 - the total energy deposit in the absorber,
254 - the total tracklength of all charged particles in the absorber,
255
256 Therefore the absorber is declared
257 'sensitive detector' (SD), see F01CalorimeterSD, which means they can contribute to the hit.
258
259 4- PHYSICS LIST
260
261 The particle's type and the physic processes which will be available
262 in this example are set in the FTFP_BERT physics list. This physics list
263 requires data files for electromagnetic and hadronic processes.
264 See more on installation of the datasets in Geant4 Installation Guide,
265
266 5- HOW TO START ?
267
268 - Execute field01 in 'batch' mode from macro file e.g.
269 % ./field01 field01.in
270
271 - Execute field01 in 'interactive' mode with visualization e.g.
272 % ./field01
273 ....
274 Idle> /run/beamOn 1
275 ....
276
277
278