Geant4 Cross Reference |
1 ---------------------------------------------- 1 ------------------------------------------------------------------- 2 2 3 ========================================= 3 ========================================================= 4 Geant4 - an Object-Oriented Toolkit for S 4 Geant4 - an Object-Oriented Toolkit for Simulation in HEP 5 ========================================= 5 ========================================================= 6 6 7 TestEm4 7 TestEm4 8 ------- 8 ------- 9 9 10 Plot energy deposited by 9 MeV photon beam in 10 Plot energy deposited by 9 MeV photon beam in an homogeneous medium. 11 11 12 1- GEOMETRY DEFINITION 12 1- GEOMETRY DEFINITION 13 13 14 It is a cylinder of 5 cm radius filled with 14 It is a cylinder of 5 cm radius filled with C6F6. 15 15 16 2- PHYSICS LIST 16 2- PHYSICS LIST 17 17 18 The particle list contains only gamma, elect 18 The particle list contains only gamma, electron,positron. 19 The physics list contains the 'standard' ele 19 The physics list contains the 'standard' electromagnetic processes. 20 20 21 3- AN EVENT : THE PRIMARY GENERATOR 21 3- AN EVENT : THE PRIMARY GENERATOR 22 22 23 The primary kinematic is a single 9 MeV gamm 23 The primary kinematic is a single 9 MeV gamma randomly shooted at the 24 middle of the cylinder. 24 middle of the cylinder. 25 25 26 4- VISUALIZATION 26 4- VISUALIZATION 27 27 28 The Visualization Manager is set in the main 28 The Visualization Manager is set in the main(). 29 The initialisation of the drawing is done vi 29 The initialisation of the drawing is done via the commands 30 /vis/.. in the macro vis.mac. This macro is 30 /vis/.. in the macro vis.mac. This macro is 31 automatically read from the main in case of 31 automatically read from the main in case of interactive running mode. 32 32 33 The detector has a default view which is a t 33 The detector has a default view which is a transversal view of the 34 cylinder. 34 cylinder. 35 35 36 The tracks are drawn at the end of event, an 36 The tracks are drawn at the end of event, and erased at the end of run. 37 Optionaly one can choose to draw all particl 37 Optionaly one can choose to draw all particles, only the charged one, 38 or none. This command is defined in EventAct 38 or none. This command is defined in EventActionMessenger class. 39 39 40 5- PHYSICS SURVEY 40 5- PHYSICS SURVEY 41 41 42 The energy deposited in C6F6 is histogramed 42 The energy deposited in C6F6 is histogramed. 43 43 44 6- HOW TO START ? 44 6- HOW TO START ? 45 45 46 - execute TestEm4 in 'batch' mode from macro 46 - execute TestEm4 in 'batch' mode from macro files 47 % TestEm4 TestEm4.in 47 % TestEm4 TestEm4.in 48 48 49 - execute TestEm4 in 'interactive mode' with 49 - execute TestEm4 in 'interactive mode' with visualization 50 % TestEm4 50 % TestEm4 51 .... 51 .... 52 Idle> type your commands 52 Idle> type your commands 53 .... 53 .... 54 Idle> exit 54 Idle> exit 55 << 55 56 macro verbose.mac illustrate capabili << 56 - visualize the histogram (paw) >> 57 paw> h/file 1 testem4.hbook >> 58 paw> option stat >> 59 paw> option logy >> 60 paw> h/pl 1 >> 61 57 62 58 7- USING HISTOGRAMS 63 7- USING HISTOGRAMS 59 64 60 The format of the histogram file can be : roo 65 The format of the histogram file can be : root (default), 61 xml, csv, by selecting g4nnn.hh in RunAction. << 66 hbook, xml, csv, by selecting g4nnn.hh in RunAction.hh 62 << 67 >> 68 Using hbook format >> 69 ------------------ >> 70 >> 71 Need a special treatement : the Cern Library must be installed and the >> 72 environment variable CERNLIB correctly set. Then, *before* compiling, >> 73 activate G4_USE_HBOOK in GNUmakefile and g4hbook.hh in RunAction.hh >> 74 63 8- RANDOM NUMBERS HANDLING 75 8- RANDOM NUMBERS HANDLING 64 76 65 CLHEP provides several random number engine 77 CLHEP provides several random number engines. In this example the Ranecu 66 engine is choosen at beginning of the main 78 engine is choosen at beginning of the main (TestEm4.cc). 67 79 68 By default, G4RunManager does not save the 80 By default, G4RunManager does not save the rndm seed. 69 To do so the user must set in BeginOfRunAct 81 To do so the user must set in BeginOfRunAction: 70 G4RunManager::GetRunManager()->SetRandomNum 82 G4RunManager::GetRunManager()->SetRandomNumberStore(true); 71 83 72 Then the rndm seed is systematically saved 84 Then the rndm seed is systematically saved at beginning of run 73 (currentRun.rndm) and beginning of event (c 85 (currentRun.rndm) and beginning of event (currentEvent.rndm) 74 Therefore, in case of abnormal end, the see 86 Therefore, in case of abnormal end, the seed of the last event processed 75 is available in currentEvent.rndm 87 is available in currentEvent.rndm 76 88 77 Even in case of normal run processing, the 89 Even in case of normal run processing, the user may wish to preserve the 78 rndm seed of selected events. At any time i 90 rndm seed of selected events. At any time in the event, put the 79 following statement: 91 following statement: 80 if (condition) G4RunManager::GetRunManager( 92 if (condition) G4RunManager::GetRunManager()->rndmSaveThisEvent(); 81 currentEvent.rndm will be copied to runXXev 93 currentEvent.rndm will be copied to runXXevntYY.rndm 82 (see SteppingAction::UserSteppingAction() ) 94 (see SteppingAction::UserSteppingAction() ) 83 95 84 To restart a run from a given rndm seed, us 96 To restart a run from a given rndm seed, use the UI command : 85 /random/resetEngineFrom fileName 97 /random/resetEngineFrom fileName 86 98 87 The macro rndmSeed.mac shows how to save an 99 The macro rndmSeed.mac shows how to save and reset the random number 88 seed between runs, from UI commands. 100 seed between runs, from UI commands.