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