Geant4 Cross Reference |
>> 1 $Id: README,v 1.1 2007/02/13 17:57:19 maire Exp $ 1 ---------------------------------------------- 2 ------------------------------------------------------------------- 2 3 3 ========================================= 4 ========================================================= 4 Geant4 - an Object-Oriented Toolkit for S 5 Geant4 - an Object-Oriented Toolkit for Simulation in HEP 5 ========================================= 6 ========================================================= 6 7 7 TestEm18 8 TestEm18 8 -------- 9 -------- 9 This example allows to study the various c << 10 This example allows to study the energy lost by a charged particle in a 10 by a charged particle in a single layer of << 11 single layer, due to ionization and bremsstrahlung. Results are compared to 11 See any textbook of interactions of charge << 12 'reference' values. 12 1- geant4.web.cern.ch --> UserSupport -- << 13 2- lappweb.in2p3.fr/~maire/tutorials/ind << 14 13 15 1- GEOMETRY DEFINITION 14 1- GEOMETRY DEFINITION 16 15 17 It is a simple cubic box of homogeneous ma << 16 It is a single box of homogeneous medium. 18 Two parameters define the geometry : 17 Two parameters define the geometry : 19 - the material of the box, 18 - the material of the box, 20 - the thickness of the box. << 19 - the (full) size of the box. 21 20 22 The default geometry (1 cm of water) is co 21 The default geometry (1 cm of water) is constructed in DetectorConstruction, 23 but the above parameters can be changed in 22 but the above parameters can be changed interactively via the commands 24 defined in DetectorMessenger. 23 defined in DetectorMessenger. 25 24 26 2- PHYSICS 25 2- PHYSICS 27 26 28 The physics list contains the 'standard' e 27 The physics list contains the 'standard' electromagnetic processes. 29 However the MultipleScattering is not regi 28 However the MultipleScattering is not registered, in order to focuse on 30 fluctuations of to energy loss alone. << 29 fluctuations due to energy loss alone. 31 30 32 3- BEAM 31 3- BEAM 33 32 34 The primary kinematic is a single particle 33 The primary kinematic is a single particle starting at the edge 35 of the box. The type of the particle and i 34 of the box. The type of the particle and its energy are set in 36 PrimaryGeneratorAction (e- 10 MeV), and ca 35 PrimaryGeneratorAction (e- 10 MeV), and can be changed via the G4 37 build-in commands of ParticleGun class. 36 build-in commands of ParticleGun class. 38 37 39 4- RUN 38 4- RUN 40 39 41 During the tracking of the incident partic << 40 During the tracking of the incident particle, the secondary particles 42 particles are immediately killed, after th << 41 are immediately killed, after that their energy has been registered 43 (see SteppingAction and StackingAction). << 42 (see StackingAction). 44 Therefore, we study here the various compo << 43 Therefore, we study here the total energy lost by the incident particle, 45 by the incident particle, not the energy d << 44 not the energy deposited in a layer of finite thickness. 46 thickness. << 47 With the option /testEm/trackSecondaries o << 48 deposited in the layer. See edep.mac << 49 45 50 At EndOfRun, the above results are compare 46 At EndOfRun, the above results are compared with 'reference' values, 51 i.e. the input data read from EnergyLoss a << 47 i.e. the values read from EnergyLoss tables. 52 See reference 2 : Energy-Range relation, s << 53 48 54 5- HISTOGRAMS 49 5- HISTOGRAMS 55 50 56 The test contains 13 built-in 1D histogram << 51 The test contains 6 built-in 1D histograms, which are managed by the 57 G4AnalysisManager and its Messenger. << 52 HistoManager class and its Messenger. 58 << 53 59 1 step size of primary track << 54 1 continuous energy loss along primary track 60 2 energy continuously deposited al << 55 2 energy from secondaries 61 3 energy transfered to secondaries << 56 3 total energy lost by primary track (1+2) 62 4 energy transfered to secondaries << 57 4 energy spectrum of e-+ 63 5 energy transfered to secondaries << 58 5 energy spectrum of gamma 64 6 total energy transfered to secon << 59 6 step size of primary track 65 7 total energy lost by primary tra << 60 66 8 total energy lost by primary tra << 67 9 energy continuously deposited al << 68 10 total energy deposited << 69 11 energy spectrum of gamma << 70 12 energy spectrum of e- << 71 13 energy spectrum of e+ << 72 << 73 The histograms are defined in HistoManager << 74 << 75 The histos can be activated individually w 61 The histos can be activated individually with the command : 76 /analysis/h1/set id nbBins valMin valMax u << 62 /testem/histo/setHisto id nbBins valMin valMax unit 77 where 'unit' is the desired unit for the h 63 where 'unit' is the desired unit for the histo (MeV or KeV, cm or mm, etc..) 78 64 79 One can control the name of the histograms << 65 One can control the name and the type of the histograms file with 80 /analysis/setFileName name (default test << 66 the commands: 81 << 67 /testem/histo/setFileName name (default testem18) 82 It is possible to choose the format of the << 68 /testem/histo/setFileType name (default hbook) 83 xml, csv, by using namespace in HistoManag << 69 84 For convenience, few simple Root macros ar << 70 Note that, by default, histograms are disabled. To activate them, uncomment 85 It is also possible to print selected hist << 71 the flag G4ANALYSIS_USE in GNUmakefile. 86 /analysis/h1/setAscii id << 87 All selected histos will be written on a f << 88 72 89 6- VISUALIZATION 73 6- VISUALIZATION 90 74 91 The Visualization Manager is set in the ma 75 The Visualization Manager is set in the main(). 92 The initialisation of the drawing is done 76 The initialisation of the drawing is done via the commands 93 /vis/... in the macro vis.mac. To get visu 77 /vis/... in the macro vis.mac. To get visualisation: 94 > /control/execute vis.mac 78 > /control/execute vis.mac 95 79 96 The detector has a default view which is a 80 The detector has a default view which is a longitudinal view of the box. 97 The tracks are drawn at the end of event, 81 The tracks are drawn at the end of event, and erased at the end of run. 98 82 99 7- HOW TO START ? 83 7- HOW TO START ? 100 84 >> 85 compile and link to generate an executable >> 86 % cd geant4/examples/extended/electromagnetic/TestEm18 >> 87 % gmake >> 88 101 execute TestEm18 in 'batch' mode from macr 89 execute TestEm18 in 'batch' mode from macro files : 102 % TestEm18 electron.mac << 90 % TestEm18 electron.mac.mac 103 91 104 execute TestEm18 in 'interactive mode' wit 92 execute TestEm18 in 'interactive mode' with visualization : 105 % TestEm18 93 % TestEm18 106 Idle> control/execute vis.mac 94 Idle> control/execute vis.mac 107 .... 95 .... 108 Idle> type your commands 96 Idle> type your commands 109 .... 97 .... 110 Idle> exit 98 Idle> exit 111 << 112 Macros provided in this example: << 113 - csda.mac: test independance of user step m << 114 - edep.mac: track secondary particles and pl << 115 - electron.mac: e- (10 MeV) on 1 cm of water << 116 - ion.mac: ion C12 (4 GeV) on 1 cm of water << 117 - muon.mac: mu+ (1 TeV) on 1 m of water << 118 - pixe.mac: proton (20 MeV) on 50 um of gold << 119 - proton.mac: proton (1 GeV) on 10 cm of wat << 120 - plotHisto.C, pixe.C: Root macros << 121 99 122 Macros to be run interactively: << 100 8- USING HISTOGRAMS 123 - vis.mac: To activate visualization << 101 >> 102 By default the histograms are not activated. To activate histograms >> 103 the environment variable G4ANALYSIS_USE should be defined. For instance >> 104 uncomment the flag G4ANALYSIS_USE in GNUmakefile. >> 105 >> 106 Before compilation of the example it is optimal to clean up old files: >> 107 gmake histclean >> 108 gmake >> 109 >> 110 To use histograms, at least one of the AIDA implementations should be >> 111 available (see http://aida.freehep.org). >> 112 >> 113 8a - PI >> 114 >> 115 A package including AIDA and extended interfaces also using Python is PI, >> 116 available from: http://cern.ch/pi >> 117 >> 118 Once installed PI or PI-Lite in a specified local area $MYPY, it is required >> 119 to add the installation path to $PATH, i.e. for example, for release 1.2.1 of >> 120 PI: >> 121 setenv PATH ${PATH}:$MYPI/1.2.1/app/releases/PI/PI_1_2_1/rh73_gcc32/bin >> 122 >> 123 CERN users can use the PATH to the LCG area on AFS. >> 124 Before running the example the command should be issued: >> 125 eval `aida-config --runtime csh` >> 126 >> 127 8b - OpenScientist >> 128 >> 129 OpenScientist is available at http://OpenScientist.lal.in2p3.fr. >> 130 >> 131 You have to "setup" the OpenScientist AIDA implementation before compiling >> 132 (then with G4ANALYSIS_USE set) and running your Geant4 application. >> 133 >> 134 On UNIX you setup, with a csh flavoured shell : >> 135 csh> source <<OpenScientist install path>/aida-setup.csh >> 136 or with a sh flavoured shell : >> 137 sh> . <<OpenScientist install path>/aida-setup.sh >> 138 On Windows : >> 139 DOS> call <<OpenScientist install path>/aida-setup.bat >> 140 >> 141 You can use various file formats for writing (AIDA-XML, hbook, root). >> 142 These formats are readable by the Lab onx interactive program >> 143 or the OpenPAW application. See the web pages. >> 144 >> 145 >> 146 With OpenPAW, on a run.hbook file, one can view the histograms >> 147 with something like : >> 148 OS> opaw >> 149 opaw> h/file 1 run.hbook ( or opaw> h/file 1 run.aida or run.root) >> 150 opaw> zone 2 2 >> 151 opaw> h/plot 1 >> 152 opaw> h/plot 2