1 | $Id: README.N03,v 1.1 2007/05/26 00:18:27 tkoi Exp $ |
---|
2 | ------------------------------------------------------------------- |
---|
3 | |
---|
4 | ========================================================= |
---|
5 | Geant4 - an Object-Oriented Toolkit for Simulation in HEP |
---|
6 | ========================================================= |
---|
7 | |
---|
8 | ExampleN03 |
---|
9 | ---------- |
---|
10 | |
---|
11 | This example simulates a simple Sampling Calorimeter setup. |
---|
12 | |
---|
13 | 1- GEOMETRY DEFINITION |
---|
14 | |
---|
15 | The calorimeter is a box made of a given number of layers. A layer |
---|
16 | consists of an absorber plate and of a detection gap. The layer is |
---|
17 | replicated. |
---|
18 | |
---|
19 | Six parameters define the calorimeter : |
---|
20 | - the material of the absorber, |
---|
21 | - the thickness of an absorber plate, |
---|
22 | - the material of the detection gap, |
---|
23 | - the thickness of a gap, |
---|
24 | - the number of layers, |
---|
25 | - the transverse size of the calorimeter (the input face is a square). |
---|
26 | |
---|
27 | In addition a transverse uniform magnetic field can be applied. |
---|
28 | |
---|
29 | The default geometry is constructed in DetectorConstruction class, |
---|
30 | but all of the above parameters can be modified interactively via |
---|
31 | the commands defined in the DetectorMessenger class. |
---|
32 | |
---|
33 | |
---|
34 | |<----layer 0---------->|<----layer 1---------->|<----layer 2---------->| |
---|
35 | | | | | |
---|
36 | ========================================================================== |
---|
37 | || | || | || | || |
---|
38 | || | || | || | || |
---|
39 | || absorber | gap || absorber | gap || absorber | gap || |
---|
40 | || | || | || | || |
---|
41 | || | || | || | || |
---|
42 | beam || | || | || | || |
---|
43 | ======> || | || | || | || |
---|
44 | || | || | || | || |
---|
45 | || | || | || | || |
---|
46 | || | || | || | || |
---|
47 | || | || | || | || |
---|
48 | || | || | || | || |
---|
49 | ========================================================================== |
---|
50 | |
---|
51 | NB. The thickness of the absorber or of the gap can be set to zero |
---|
52 | (but not together), and the number of layers to 1. In this case we |
---|
53 | have a unique homogeneous block of matter, which looks like |
---|
54 | a bubble chamber rather than a calorimeter ... |
---|
55 | (see the macro of commands: newgeom.mac) |
---|
56 | |
---|
57 | 2- AN EVENT : THE PRIMARY GENERATOR |
---|
58 | |
---|
59 | The primary kinematic consists of a single particle which hits the |
---|
60 | calorimeter perpendicular to the input face. The type of the particle |
---|
61 | and its energy are set in the PrimaryGeneratorAction class, and can |
---|
62 | be changed via the G4 build-in commands of ParticleGun class (see |
---|
63 | the macros provided with this example). |
---|
64 | |
---|
65 | In addition one can choose randomly the impact point of the incident |
---|
66 | particle. The corresponding interactive command is built in |
---|
67 | PrimaryGeneratorMessenger class (see run2.mac). |
---|
68 | |
---|
69 | A RUN is a set of events. |
---|
70 | |
---|
71 | |
---|
72 | 3- VISUALIZATION |
---|
73 | |
---|
74 | The Visualization Manager is set in the main(). |
---|
75 | The initialisation of the drawing is done via a set of /vis/ commands |
---|
76 | in the macro vis.mac. This macro is automatically read from |
---|
77 | the main in case of interactive running mode. |
---|
78 | |
---|
79 | By default, vis.mac opens a DAWNFILE, suitable for viewing in DAWN, |
---|
80 | and an OGLX for OpenGl. |
---|
81 | You can switch to other graphics systems by commenting out this line |
---|
82 | and instead uncommenting one of the other /vis/open statements, such as |
---|
83 | HepRepFile or HepRepXML. |
---|
84 | |
---|
85 | The DAWNFILE, HepRepFile and HepRepXML drivers are always available |
---|
86 | (since they require no external libraries), but the OGLIX driver |
---|
87 | requires: |
---|
88 | 1- the visualisation & interfaces categories have been compiled |
---|
89 | with the environment variable G4VIS_BUILD_OPENGLX_DRIVER. |
---|
90 | 2- exampleN03.cc has been compiled with G4VIS_USE_OPENGLX. |
---|
91 | |
---|
92 | The HepRepXML driver outputs a zip file that can be unzipped into |
---|
93 | several individual HepRep files, each viewable in WIRED. |
---|
94 | |
---|
95 | For more information on visualization, including information on how to |
---|
96 | install and run DAWN, OpenGL and WIRED, see the visualization tutorials |
---|
97 | on the Geant4 Workshop Tutorial CD available at: |
---|
98 | http://geant4.slac.stanford.edu/g4cd/Welcome.html |
---|
99 | |
---|
100 | The detector has a default view which is a longitudinal view of the |
---|
101 | calorimeter. |
---|
102 | |
---|
103 | The tracks are drawn at the end of event, and erased at the end of run. |
---|
104 | Optionaly one can choose to draw all particles, only the charged, |
---|
105 | or neutral or none. This command is build in EventActionMessenger class. |
---|
106 | |
---|
107 | Additional visualization tutorial macros are available in the visTutor |
---|
108 | subdirectory. They can be tried as: |
---|
109 | % $G4BINDIR/exampleN03 |
---|
110 | idle > /control/execute visTutor/exN03VisX.mac |
---|
111 | For details, see comment lines described in the macro files. |
---|
112 | These macros are designed to help your understanding the User's Guide. |
---|
113 | |
---|
114 | |
---|
115 | 4- PHYSICS DEMO |
---|
116 | |
---|
117 | The particle's type and the physic processes which will be available |
---|
118 | in this example are set in PhysicsList class. |
---|
119 | |
---|
120 | In addition the build-in interactive command: |
---|
121 | /process/(in)activate processName |
---|
122 | allows to activate/inactivate the processes one by one. |
---|
123 | Then one can well visualize the processes one by one, especially |
---|
124 | in the bubble chamber setup with a transverse magnetic field. |
---|
125 | (see run2.mac and newgeom.mac) |
---|
126 | |
---|
127 | As a homework try to visualize a gamma conversion alone, |
---|
128 | or the effect of the multiple scattering. |
---|
129 | |
---|
130 | 5- RANDOM NUMBERS HANDLING |
---|
131 | |
---|
132 | CLHEP provides several random number engines. In this example the Ranecu |
---|
133 | engine is choosen at beginning of the main (exampleN03.cc). |
---|
134 | |
---|
135 | By default, G4RunManager does not save the rndm seed. |
---|
136 | To do so the user must set in BeginOfRunAction: |
---|
137 | G4RunManager::GetRunManager()->SetRandomNumberStore(true); |
---|
138 | |
---|
139 | Then the rndm seed is systematically saved at beginning of run |
---|
140 | (currentRun.rndm) and beginning of event (currentEvent.rndm) |
---|
141 | Therefore, in case of abnormal end, the seed of the last event processed |
---|
142 | is available in currentEvent.rndm |
---|
143 | |
---|
144 | Even in case of normal run processing, the user may wish to preserve the |
---|
145 | rndm seed of selected events. At any time in the event, put the |
---|
146 | following statement: |
---|
147 | if (condition) G4RunManager::GetRunManager()->rndmSaveThisEvent(); |
---|
148 | currentEvent.rndm will be copied to runXXevntYY.rndm |
---|
149 | (see ExN03SteppingAction::UserSteppingAction() ) |
---|
150 | |
---|
151 | To restart a run from a given rndm seed, use the UI command : |
---|
152 | /random/resetEngineFrom fileName |
---|
153 | |
---|
154 | The macro rndmSeed.mac shows how to save and reset the random number |
---|
155 | seed between runs, from UI commands. |
---|
156 | |
---|
157 | 6- USER INTERFACES |
---|
158 | |
---|
159 | The default command interface, called G4UIterminal, is done via |
---|
160 | standart cin/G4cout. |
---|
161 | On Linux and Sun-cc on can use a smarter command interface G4UItcsh. |
---|
162 | It is enough to set the environment variable G4UI_USE_TCSH |
---|
163 | |
---|
164 | On can use a Motif driven command interface (called G4UIXm) if: |
---|
165 | 1- interfaces category has been compiled with G4UI_BUILD_XM_SESSION |
---|
166 | 2- exampleN03.cc has been compiled with G4UI_USE_XM. |
---|
167 | |
---|
168 | |
---|
169 | 7- HOW TO START ? |
---|
170 | |
---|
171 | - compile and link to generate an executable |
---|
172 | % cd N03 |
---|
173 | % gmake |
---|
174 | |
---|
175 | - execute N03 in 'batch' mode from macro files |
---|
176 | % exampleN03 run1.mac |
---|
177 | |
---|
178 | - execute N03 in 'interactive mode' with visualization |
---|
179 | % exampleN03 |
---|
180 | .... |
---|
181 | Idle> ---> type your commands. For instance: |
---|
182 | Idle> /run/beamOn |
---|
183 | .... |
---|
184 | Idle> /run/beamOn 10 |
---|
185 | .... |
---|
186 | Idle> /control/execute newgeom.mac |
---|
187 | .... |
---|
188 | Idle> exit |
---|
189 | |
---|
190 | |
---|
191 | |
---|