1 | $Id: README,v 1.2 2006/11/18 01:37:22 asaim Exp $ |
---|
2 | ------------------------------------------------------------------- |
---|
3 | |
---|
4 | ========================================================= |
---|
5 | Geant4 - an Object-Oriented Toolkit for Simulation in HEP |
---|
6 | ========================================================= |
---|
7 | |
---|
8 | ExampleRE02 |
---|
9 | ----------- |
---|
10 | |
---|
11 | |
---|
12 | This example simulates a simplified water phantom measurement |
---|
13 | in medical application with demonstration of primitive scorers. |
---|
14 | This example also demonstrates nested parameterised volume which |
---|
15 | realizes segmented boxes using a combination of replicated volumes |
---|
16 | and a parameterised volume. |
---|
17 | |
---|
18 | (Tips) |
---|
19 | This example creates 100 x 100 x 200 boxes using Nested Parameterised |
---|
20 | Volume for realistic situation of medical application. |
---|
21 | This is very memory consumption if normal Parameterised Volume is used, |
---|
22 | and needs roughly more than 1 GB memory for execution. However, |
---|
23 | NestedParameterised volume effectively works to reduce the memory consumption, |
---|
24 | and it only needs less than 100 MB memory for execution. |
---|
25 | |
---|
26 | 1- GEOMETRY DEFINITION |
---|
27 | |
---|
28 | The setup contains a water phantom as target by default. The world volume |
---|
29 | is 200 cm x 200 cm x 200 cm box filled with air. The water phantom is box shape |
---|
30 | and the size of 200 mm x 200 mm x 400 mm. The volume of water phantom is divided |
---|
31 | into 100 x 100 x 1 towers using replicated volume,(RE02DetectorConstruction), |
---|
32 | and then those towers are segmented into 200 boxes with respect to z axis |
---|
33 | using nested parameterized volume,(RE02NestedPhantomParameterisation). |
---|
34 | e.g. The volume of water phantom is divided into 100 x 100 x 200 boxes, |
---|
35 | and a voxel size is 2.0 mm x 2.0 mm x 2.0 mm. |
---|
36 | |
---|
37 | For demonstration purpose of the nested parameterised volume, |
---|
38 | (RE02NestedPhantomParameterisation), materials are assigned as water (lead) |
---|
39 | in even (odd) order segments, alternately. |
---|
40 | The simulation for homogeneous water phantom is also possible using an option. |
---|
41 | |
---|
42 | ---- Tips(1) |
---|
43 | *If you want to reduce number of segments of water phantom, |
---|
44 | please change following numbers which represent number of segments |
---|
45 | in x, y, z axis, respectively.The following code can be found in |
---|
46 | exampleRE02.cc. |
---|
47 | |
---|
48 | RE02DetectorConstruction* detector = new RE02DetectorConstruction; |
---|
49 | detector->SetNumberOfSegmentsInPhantom(100,100,200); |
---|
50 | Nx, Ny, Nz |
---|
51 | ---- Tips(2) |
---|
52 | *If you want to set all materials to water, |
---|
53 | please use the following method. The following code can be found in |
---|
54 | exampleRE02.cc. |
---|
55 | |
---|
56 | detector->SetLeadSegment(FALSE); // Homogeneous water phantom |
---|
57 | ---- |
---|
58 | |
---|
59 | The geometry and sensitive detector are constructed in |
---|
60 | RE02DetectorConstruction class. |
---|
61 | (See "4- SCORER " for detail descriptions about sensitive detector.) |
---|
62 | |
---|
63 | 2- PHYSICS LIST |
---|
64 | |
---|
65 | The particle's type and the physic processes which is available |
---|
66 | in this example are set in PhysicsList class. |
---|
67 | |
---|
68 | The PhysicsList is originally copied from extended example, |
---|
69 | (example/extended/analysis/A01). |
---|
70 | Full set of particles (baryons, bosons and mesons) are created, and |
---|
71 | Standard EM Physics and Low/High Energy parameterized models |
---|
72 | for hadrons are applied. The detail description will be found in |
---|
73 | example/extended/analysis/A01/README. |
---|
74 | Specially, the PhysicsList was modified in this example, |
---|
75 | to use Binary cascade model for hadron physics at low energy (<4GeV) |
---|
76 | and inelastic process for generic ions with BinaryLightIonReaction. |
---|
77 | The data files for physics processes have to be assigned using |
---|
78 | environment variables. |
---|
79 | |
---|
80 | RE02PhysicsList is optimized for robustness and is not optimized for |
---|
81 | any particular cases. If you will do precise calculation for your |
---|
82 | use-case, please consider utilizing hadronic_lists, and defines the |
---|
83 | production cut properly. |
---|
84 | The default CutValue defines the production threshold of secondary |
---|
85 | particles (mainly Ionisation and Bremsstrahlung processes are |
---|
86 | concerned by this CutValue). |
---|
87 | |
---|
88 | 3- RUNS and EVENTS |
---|
89 | |
---|
90 | - Primary particles. |
---|
91 | The primary kinematics consists of a single particle which hits the |
---|
92 | target perpendicular to the input face. The default type of the particle |
---|
93 | and its energy are set in the RE02PrimaryGeneratorAction class. |
---|
94 | However it can be changed via the G4 build-in commands of ParticleGun |
---|
95 | class. |
---|
96 | The RE02PrimaryGeneratorAction class introduces a beam spot size |
---|
97 | that makes initial particle position of x,y randomized using a Gaussian |
---|
98 | random function, where the center position is fixed to (0,0). |
---|
99 | The standard deviation of the beam spot size is given in |
---|
100 | RE02PrimaryGeneratorAction as 10 mm. |
---|
101 | |
---|
102 | An EVENT represents a simulation of one primary particle. |
---|
103 | A RUN is a set of events. |
---|
104 | |
---|
105 | The user has control: |
---|
106 | -at Begin and End of each run (class RunAction) |
---|
107 | -at Begin and End of each event (class EventAction) |
---|
108 | -at Begin and End of each track (class TrackingAction, not used here) |
---|
109 | -at End of each step (class SteppingAction, not used here) |
---|
110 | |
---|
111 | 4- SCORER |
---|
112 | |
---|
113 | - Concrete Scorer |
---|
114 | This example introduces concrete primitive scorer (PS) and filter |
---|
115 | classes for easy scoring. Those primitive scorers are registered to |
---|
116 | MultiFunctionalDetector which is a concrete class of sensitive |
---|
117 | detector(SD). Then the MultiFunctionalDetector is attached to |
---|
118 | the logical volume of sensitive geometry. |
---|
119 | A MultiFunctionalDetector, PrimitiveScorers, and SDFilters are |
---|
120 | created and assigned to the logical volume of water phantom in |
---|
121 | DetectorConstruction. |
---|
122 | |
---|
123 | A primitive scorer can score one kind of physical quantity, and |
---|
124 | creates one hits collection per event. The quantity is collected in |
---|
125 | G4THitsMap with the copy number of geometry. Here collection name is |
---|
126 | given as <MultiFunctionalDetector Name>/<PrimitiveScorer Name>. |
---|
127 | A primitive scorer can have one filter (SDFilter) for selecting hits |
---|
128 | to be used for the quantity. |
---|
129 | |
---|
130 | Since the geometry is constructed using nested parameterisation, |
---|
131 | the copy number of geometry is defined as follows, |
---|
132 | |
---|
133 | copy number of geometry = iy*Nx*Ny+ix*Nz+iz, |
---|
134 | |
---|
135 | where Nx,Ny,Nz is total number of segmentation in x, y, and z axis,respectively, |
---|
136 | and ix,iy,iz is a copy number of the mother volume, the grand mother volume, |
---|
137 | and this volume, respectively. |
---|
138 | This conversion is described in GetIndex() method in PrimitiveScorer. |
---|
139 | |
---|
140 | The physical quantities scored in this example are: |
---|
141 | ---------------------------------------------------- |
---|
142 | - Total energy deposit |
---|
143 | unit: Energy, collName: totalEDep |
---|
144 | - Energy deposit by protons |
---|
145 | unit: Energy, collName: protonEDep |
---|
146 | - Number of steps of protons |
---|
147 | unit: - , collName: protonNStep |
---|
148 | - Cell Flux of charged tracks which pass through the geometry |
---|
149 | unit: Length/Volume, collName: chargedPassCellFlux |
---|
150 | - Cell Flux of all charged tracks |
---|
151 | unit: Length/Volume, collName: chargedCellFlux |
---|
152 | - Flux of charged particle at -Z surface of the BOX geometry, |
---|
153 | where incident angle at the surface is taken into account. |
---|
154 | unit: Surface^(-1), collName: chargedSurfFlux |
---|
155 | - Surface current of gamma at -Z surface of the BOX geometry. |
---|
156 | The energy of gammas are from 1. keV to 10. keV. |
---|
157 | The incident angle is not taken into account. |
---|
158 | unit: Surface^(-1), collName: gammaSurfCurr000 |
---|
159 | - Same as previous one, but different energy bin. |
---|
160 | The energy of gammas are from 10. keV to 100. keV. |
---|
161 | unit: Surface^(-1), collName: gammaSurfCurr001 |
---|
162 | - Same as previous one, but different energy bin. |
---|
163 | The energy of gammas are from 100. keV to 1. MeV. |
---|
164 | unit: Surface^(-1), collName: gammaSurfCurr002 |
---|
165 | - Same as previous one, except for energy bin. |
---|
166 | The energy of gammas are from 1. MeV to 10. MeV. |
---|
167 | unit: Surface^(-1), collName: gammaSurfCurr003 |
---|
168 | ------------------------------------------------- |
---|
169 | |
---|
170 | - Accumulating quantities during a RUN |
---|
171 | A PrimitiveScorer creates one hits collection per event. |
---|
172 | The physical quantity in the hits collection need to be accumulated |
---|
173 | into another G4THitsMap object during a RUN, in order to obtain |
---|
174 | integrated flux or dose in a RUN. The accumulation of quantities |
---|
175 | are done at RE02Run class. |
---|
176 | |
---|
177 | RE02Run class can automatically generate G4THitsMap objects for a RUN, |
---|
178 | and accumulate physical quantities of an event into it. The accumulation |
---|
179 | is done at RE02Run::RecordEvent(G4Event* aEvent). |
---|
180 | |
---|
181 | - Generate a Run object, and print results |
---|
182 | The RE02Run object is generated at RE02RunAction::GenerateRun(). |
---|
183 | The accumulated physical quantities are printed at the end of RUN |
---|
184 | ( RE02RunAction::EndOfEvent() ). This example prints only selected |
---|
185 | physical quantities. |
---|
186 | |
---|
187 | |
---|
188 | 5- VISUALIZATION |
---|
189 | |
---|
190 | The Visualization Manager is set in the main(). |
---|
191 | The initialization of the drawing is done via a set of /vis/ commands |
---|
192 | in the macro vis.mac. This macro is automatically read from |
---|
193 | the main when running in interactive mode. |
---|
194 | |
---|
195 | The tracks are automatically drawn at the end of event and erased at |
---|
196 | the beginning of the next run. |
---|
197 | |
---|
198 | The visualization (with OpenGL driver) assumes two things: |
---|
199 | 1- the visualization & interfaces categories have been compiled |
---|
200 | with the environment variable G4VIS_BUILD_OPENGLX_DRIVER. |
---|
201 | 2- exampleRE02.cc has been compiled with G4VIS_USE_OPENGLX. |
---|
202 | |
---|
203 | (The same with DAWNFILE instead of OPENGLX) |
---|
204 | |
---|
205 | |
---|
206 | 6- USER INTERFACES |
---|
207 | |
---|
208 | The default command interface, called G4UIterminal, is done via |
---|
209 | standard G4cin/G4cout. |
---|
210 | On Linux and Sun-cc on can use a smarter command interface G4UItcsh. |
---|
211 | It is enough to set the environment variable G4UI_USE_TCSH before |
---|
212 | compiling exampleRE02.cc |
---|
213 | |
---|
214 | |
---|
215 | 7- HOW TO START ? |
---|
216 | |
---|
217 | - compile and link to generate an executable |
---|
218 | % cd RE02 |
---|
219 | % gmake |
---|
220 | |
---|
221 | - execute RE02 in 'batch' mode from macro files (without visualization) |
---|
222 | % exampleRE02 run1.mac |
---|
223 | |
---|
224 | - execute RE02 in 'interactive mode' with visualization |
---|
225 | % exampleRE02 |
---|
226 | .... |
---|
227 | Idle> type your commands. For instance: |
---|
228 | Idle> /run/beamOn 10 |
---|
229 | .... |
---|
230 | Idle> /control/execute run2.mac |
---|
231 | .... |
---|
232 | Idle> exit |
---|
233 | |
---|
234 | - macros are for different primary particles. |
---|
235 | vis.mac : 200 MeV proton with visualization |
---|
236 | run1.mac : 150 MeV proton |
---|
237 | run2.mac : 195 MeV/u Carbon ion |
---|
238 | run3.mac : 30 MeV electron |
---|
239 | run4.mac : 60 keV gamma |
---|
240 | |
---|
241 | |
---|
242 | |
---|
243 | |
---|