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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 Geant4 - an Object-Oriented Toolkit for Simulation in HEP
4 =========================================================
5
6 electronScattering2
7 ------------------
8
9 Electron scattering benchmark variant 2 (Joseph Perl)
10
11 The two examples, electronScattering and electronScattering2 demonstrate how two alternate
12 approaches can be taken to simulating the same electron scattering benchmark experiment.
13
14 ElectronScattering2 simulates the experiment with a minimum of user code, whereas the other
15 version of this example shows how to do more of the work directly as the user.
16 In ElectronScattering2:
17 Primary generation relies on the G4GeneralParticleSource.
18 Material definitions are taken from the NIST database.
19 Visualization uses the standard G4VisExective.
20 Scoring is handled by the ready-made Geant4 scorer, G4PSCellFlux.
21
22 Both electronScattering and electronScattering2 simulate a precision electron scattering benchmark
23 experiment performed at NRCC Canada and published as:
24 "Measurement of multiple scattering of 13 and 20 MeV electrons by thin foils,"
25 by C. K. Ross, M. R. McEwen, A. F. McDonald, C. D. Cojocaru and B. A. Faddegon,
26 Med. Phys. Volume 35, Issue 9, pp. 4121-4131 (September 2008), DOI: 10.1118/1.2968095
27
28 The experiment represents the most accurate benchmark of its type.
29
30 A schematic of the experimental setup is shown in NRCC_electron_scat.pdf
31
32 The experimental data was itself published, as document number E-MPHYA6-35-034809 at http://www.aip.org/pubservs/epaps.html
33
34 The testing of three Monte Carlo simulation codes against this experimental benchmark has been
35 published as:
36 "The accuracy of EGSnrc, Geant4 and PENELOPE Monte Carlo systems for the simulation of electron
37 scatter in external beam radiotherapy,"
38 by Bruce A Faddegon, Iwan Kawrakow, Yuri Kubyshin, Joseph Perl, Josep Sempau and Laszlo Urban,
39 Phys. Med. Biol. 54 (2009) 6151-6163, DOI:10.1088/0031-9155/54/20/008
40
41 This present example, electronScattering2, was the Geant4 code used for this publication.
42
43
44 1- GEOMETRY DEFINITION
45
46 The geometry is described in the enclosed documument: NRCC_electron_scat.pdf
47 - A "World" volume contains an Exit Window, Primary Foil, Monitor Chamber and Helium Bag.
48 - The Helium Bag contains a Gas volume, which in turn contains 2 aluminium Rings
49 - A scoring cylinder is defined near the end of the World.
50
51 The default geometry is constructed in the DetectorConstruction class.
52 The parameters of the Primary Foil (material and thickness) are defined from macro commands.
53
54
55 2- PHYSICS LIST
56
57 Physics lists are based on modular design. Several modules are instantiated:
58 1. Transportation
59 2. EM physics
60 3. Decays
61 4. StepMax - for step limitation
62
63 EM physics builders are from the G4 kernel physics_lists subdirectory.
64 - "emstandard_opt0" recommended standard EM physics for LHC
65 - "emstandard_opt1" best CPU performance standard physics for LHC
66 - "emstandard_opt2" similar fast simulation
67 - "emstandard_opt3" best standard EM options - analog to "local" above
68 - "emstandard_opt4" best current advanced EM options standard + lowenergy
69 - "emstandardSS" standard EM physics and single scattering model
70 - "emstandardWVI" standard EM physics and WentzelVI multiple scattering
71 - "emstandardGS" standard EM physics and Goudsmit-Saunderson multiple scatt.
72 - "emlivermore" low-energy EM physics using Livermore data
73 - "empenelope" low-energy EM physics implementing Penelope models
74 - "emlowenergy" low-energy EM physics implementing experimental
75 low-energy models
76
77 Physics lists and options can be (re)set with UI commands.
78
79 3- PRIMARY GENERATOR
80
81 All of the work of the primary event generation is deferred to the G4GeneralParticleSource.
82 The specific characteristics of the source are configured from the macro file, using
83 /gps commands.
84 Energy is set to either 13 or 20 MeV.
85 Particle type is set to electron.
86 Direction is set exactly orthogonal to the scattering foil.
87 Source type is set to beam.
88 Spatial distribution of the beam is set as a circle gassian sigma_r of 0.042 cm
89
90
91 4- VISUALIZATION
92
93 Visualization is controlled by the standard G4VisExecutive.
94 The standard set of visualization options is supported.
95 Example macros use HepRepFile.
96
97
98 5- SCORING
99
100 All of the work of the scoring is done by the standard Geant4 scorers, G4PSCellFlux and G4PSPopulation.
101 Flux and population are scored in concentric rings at the scoring surface.
102 Flux is corrected for ring area just before output (as PSCellFlux assumes the area is the complete
103 area of the face of the cylinder, not the area of the one ring).
104
105 Because the geometry may need to be updated after various /primfoil commands,
106 ElectronBenchmarkDetector is written in such a way that the sensitive detector can have its scorer ring
107 logical volume updated after geometry changes. After any geometry change, ConstructSDandField is again
108 called, setting the sensitive detector to use the logical volume of the updated scorer ring.
109 The same sensitive detector is reused, but the manner in which the sensitive detector pointer
110 is stored for this reuse is complicated by the fact that this example may be run in multi-threaded mode
111 (in which each worker thread has its own sensitive detector).
112 We therefore store the sensitive detector pointer in a G4Cache rather than in a direct pointer.
113
114
115 6- MACROS
116
117 Macros are provided for all of the 37 different combinations of scattering foils and beam energies
118 that were used in the actual experiment.
119 Separate directories of these macros are provided for the different EM Physics options, Opt0, 1, 2 and 3.
120
121
122 7- HOW TO START
123
124 - execute electornScattering2 in 'batch' mode from macro files:
125 % electronScattering2 <macro_file> <starting_seed> <output_file>
126
127 - for example, to run the Al1_13MeV case with physics option 2 and a starting random seed of 1:
128 % electronScattering2 macros/Opt2/Al1_13MeV.mac 1 output/Opt2/Al1_13MeV_1
129
130 - if macro_file is not specfied, the job starts and then just waits for interactive commands
131
132 - if starting_seed is not specified, it defaults to 1.
133 Precision benchmark studies often involve running multiple long batch jobs and then combining the results.
134 If you plan to combine more than one job with the same primary foil and energy, be sure to use different
135 random seeds for each of the jobs.
136
137 - if output_file is not specified, it defaults to output.csv in the current directory
138
139 - to simplify batch submission of large numbers of jobs, a shell script is given called run.csh.
140 The above submission could be done, for example, by:
141 run.csh Opt2/Al1_13MeV 1
142
143 - to run a basic visualization job, producing output to a HepRep file, use vis.mac, as in:
144 % electronScattering2
145 then:
146 PreInit> /control/execute macros/vis.mac
147
148
149 8- OUTPUT
150
151 Results are given as comma-separated values (csv) files.
152 The first column gives the CellFlux for all particles.
153 The second column gives the CellFlux counting only electrons.
154 The third column gives the population for all particles.
155 The fourth column gives the population counting only electrons.
156
157
158 9 - MULTITHREADING
159
160 This example supports multi-threading.
161 To run in multi-threaded mode, build your Geant4 with the cmake option:
162 -DGEANT4_BUILD_MULTITHREADED=ON
163 and then set the desired number of threads by inserting the /run/numberOfThreads command
164 into your macro file just before /run/initialize, as in:
165 /run/numberOfThreads 8
166 You may also find the output more readable if you use the following command to make output from
167 each thread be collected together:
168 /control/cout/useBuffer
169 The visualization macro, /macros/vis.mac demonstrates use of the above two commands.
170 Output from the multiple worker threads is merged by the Merge method at the end of ElectronRun.cc