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 OpNovice 7 OpNovice 8 -------- 8 -------- 9 9 10 This example presently illustrates the followi 10 This example presently illustrates the following basic concepts, and in 11 particular (indicated with ***), how to use G4 11 particular (indicated with ***), how to use G4 for optical photon 12 generation and transport. Other extended examp 12 generation and transport. Other extended example of what is possible 13 in Geant4 with optical photons can be found at 13 in Geant4 with optical photons can be found at 14 examples/extended/optical/LXe and wls. 14 examples/extended/optical/LXe and wls. 15 15 16 main() 16 main() 17 ------ 17 ------ 18 18 19 ==> define Random Number generator initial se << 19 ==> define Random Number Engine and initial seed 20 20 21 G4Optical Physics << 21 G4VUserPhysicsList 22 ----------------- << 22 ------------------ 23 << 24 The G4OpticalPhysics physics class is used. T << 25 G4OpticalParametersMessenger class. << 26 23 27 ==> define particles; including *** G4Optical 24 ==> define particles; including *** G4OpticalPhoton *** 28 define processes; including *** G4Cerenko 25 define processes; including *** G4Cerenkov *** 29 *** G4Scintil 26 *** G4Scintillation *** 30 *** G4OpAbsor 27 *** G4OpAbsorption *** 31 *** G4OpRayle 28 *** G4OpRayleigh *** 32 *** G4OpBound 29 *** G4OpBoundaryProcess *** 33 30 34 ==> A messenger command allows to define inte << 31 ==> A messenger command allows to define interactivly the 35 verbose level and the maximum number of C 32 verbose level and the maximum number of Cerenkov photons per step 36 (see for instance OpNovice.in) 33 (see for instance OpNovice.in) 37 34 38 G4VUserDetectorConstruction 35 G4VUserDetectorConstruction 39 --------------------------- 36 --------------------------- 40 37 41 ==> define material: Air and Water 38 ==> define material: Air and Water 42 define simple G4box geometry 39 define simple G4box geometry 43 *** add G4MaterialPropertiesTable to G4Ma 40 *** add G4MaterialPropertiesTable to G4Material *** 44 *** define G4LogicalSurface(s) 41 *** define G4LogicalSurface(s) *** 45 *** define G4OpticalSurface 42 *** define G4OpticalSurface *** 46 *** add G4MaterialPropertiesTable to G4Op 43 *** add G4MaterialPropertiesTable to G4OpticalSurface *** 47 44 48 alternatively the Configuration can be read fr << 49 The provided gdml file NoviceExample.gdml corr << 50 defined in OpNoviceDetectorConstruction. << 51 << 52 G4VUserPrimaryGeneratorAction 45 G4VUserPrimaryGeneratorAction 53 ----------------------------- 46 ----------------------------- 54 47 55 ==> Use G4ParticleGun to shoot a charge parti 48 ==> Use G4ParticleGun to shoot a charge particle into a Cerenkov radiator 56 49 57 ==> A messenger command allows to define inte 50 ==> A messenger command allows to define interactively the polarization of an 58 primary optical photon (see for instance 51 primary optical photon (see for instance optPhoton.mac) 59 52 60 G4UserRunAction and G4Run << 53 G4UserRunAction 61 ------------------------- << 54 --------------- 62 55 63 Used to accumulate statistics. << 56 ==> define G4Timer (start/stop) >> 57 set verbose levels 64 58 65 G4UserStackingAction and G4UserEventAction << 59 G4UserStackingAction 66 ------------------------------------------ << 60 -------------------- 67 61 68 ==> show how to count the number of secondary 62 ==> show how to count the number of secondary particles in an event 69 63 70 Visualisation 64 Visualisation 71 ------------- 65 ------------- 72 66 73 The Visualization Manager is set in the main( 67 The Visualization Manager is set in the main(). 74 The initialisation of the drawing is done via 68 The initialisation of the drawing is done via a set of /vis/ commands 75 in the macro vis.mac. This macro is automatic 69 in the macro vis.mac. This macro is automatically read from 76 the main in case of interactive running mode. 70 the main in case of interactive running mode. 77 71 78 The detector has a default view which is a lo 72 The detector has a default view which is a longitudinal view of the tank. 79 The tracks are drawn at the end of event, and 73 The tracks are drawn at the end of event, and erased at the end of run. 80 74 81 HOW TO START 75 HOW TO START 82 ------------ 76 ------------ 83 77 84 - compile and link to generate an executable 78 - compile and link to generate an executable >> 79 % cd OpNovice >> 80 % gmake 85 81 86 This example handles the program arguments 82 This example handles the program arguments in a new way. 87 It can be run with the following optional o << 83 It can be run with the following optional arguments: 88 $ OpNovice [-g gdmlfile] [-m macro ] [-u UI << 84 % OpNovice [-m macro ] [-u UIsession] [-t nThreads] 89 85 90 The -t option is available only in multi-th 86 The -t option is available only in multi-threading mode 91 and it allows the user to override the Gean 87 and it allows the user to override the Geant4 default number of 92 threads. The number of threads can be also 88 threads. The number of threads can be also set via G4FORCENUMBEROFTHREADS 93 environment variable which has the top prio 89 environment variable which has the top priority. 94 90 95 - execute OpNovice in 'batch' mode from macro 91 - execute OpNovice in 'batch' mode from macro files 96 $ OpNovice -m OpNovice.in << 92 % OpNovice -m OpNovice.in 97 << 93 98 - execute OpNovice in 'batch' mode from macro << 99 to define the geometry << 100 $ OpNovice -g NoviceExample.gdml -m OpNovice << 101 << 102 - execute OpNovice in 'interactive mode' with 94 - execute OpNovice in 'interactive mode' with visualization 103 $ OpNovice << 95 % OpNovice 104 .... 96 .... 105 Idle> type your commands. For instance: 97 Idle> type your commands. For instance: 106 Idle> /control/execute optPhoton.mac 98 Idle> /control/execute optPhoton.mac 107 .... 99 .... 108 Idle> exit 100 Idle> exit 109 << 101 110 Macros << 111 ------ << 112 << 113 The following macros are provided: << 114 << 115 - optPhoton.mac: Shoot optical photons with e << 116 - OpNovice.in: Shoot positrons with energy 50 << 117 - gui.mac: Configure the graphical user inter << 118 - vis.mac: Configure visualization. << 119 << 120 << 121 gdml files << 122 ---------- << 123 NoviceExample.gdml: example gdml file correspo << 124 OpNoviceDetectorConstruction <<