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