Geant4 Cross Reference |
1 ---------------------------------------------- 2 3 ========================================= 4 Geant4 - an Object-Oriented Toolkit for S 5 ========================================= 6 7 Example B2 8 ---------- 9 10 This example simulates a simplified fixed tar 11 12 1- GEOMETRY DEFINITION 13 14 The setup consists of a target followed b 15 transverse size at defined instances from 16 located in a region called the Tracker re 17 Their shape are cylinders, constructed as 18 (in B2a::DetectorConstruction) and as par 19 (in B2b::DetectorConstruction), see also 20 21 In addition, a global, uniform, and trans 22 applied using G4GlobalMagFieldMessenger, 23 B2[a,b]::DetectorConstruction::ConstructS 24 or via interactive commands. 25 For example: 26 27 /globalField/setValue 0.2 0 0 tesla 28 29 An instance of the B2::TrackerSD class is 30 logical chamber volume (in B2a) and with 31 with G4PVParameterised (in B2b). 32 33 One can change the materials of the targe 34 interactively via the commands defined in 35 (or B2b::DetectorMessenger). For example: 36 37 /B2/det/setTargetMaterial G4_WATER 38 /B2/det/setChamberMaterial G4_Ar 39 40 2- PHYSICS LIST 41 42 The particle's type and the physic proces 43 in this example are set in the FTFP_BERT 44 requires data files for electromagnetic a 45 See more on installation of the datasets 46 Chapter 3.3: Note On Geant4 Datasets: 47 http://geant4.web.cern.ch/geant4/UserDocu 48 The following datasets: G4LEDATA, G4LEVEL 49 G4ENSDFSTATEDATA are mandatory for this e 50 51 In addition, the build-in interactive com 52 /process/(in)activate processName 53 allows the user to activate/inactivate th 54 55 3- ACTION INITALIZATION 56 57 A newly introduced class, B2::ActionInitial 58 instantiates and registers to Geant4 kernel 59 60 While in sequential mode the action classes 61 via invoking the method: 62 B2::ActionInitialization::Build() 63 in multi-threading mode the same method is 64 and so all user action classes are defined 65 66 A run action class is instantiated both thr 67 and global that's why its instance has is c 68 B2::ActionInitialization::BuildForMaster 69 which is invoked only in multi-threading mo 70 71 4- PRIMARY GENERATOR 72 73 The primary generator action class employ 74 The primary kinematics consists of a sing 75 to the world boundary and hits the target 76 face. The type of the particle and its en 77 Geant4 built-in commands of the G4Particl 78 79 5- RUNS and EVENTS 80 81 A run is a set of events. 82 83 The user has control: 84 - at Begin and End of each run (class 85 - at Begin and End of each event (clas 86 - at Begin and End of each track (clas 87 - at End of each step (class SteppingAction, 88 89 The event number is written to the log fi 90 of events in B2::EventAction::BeginOfEven 91 B2::EventAction::EndOfEventAction(). 92 Moreover, for the first 100 events and ev 93 information about the number of stored tr 94 is printed as well as the number of hits 95 96 The run number is printed at B2::RunActio 97 G4RunManager is also informed how to SetR 98 initial random number seeds per run or pe 99 100 6- USER LIMITS 101 102 This example also illustrates how to intro 103 like maximum step length, minimum kinetic 104 class and associated G4StepLimiter and G4U 105 See B2a::DetectorConstruction (or B2b::Det 106 107 The maximum step limit in the tracker regi 108 command (see B2a::DetectorMessenger, B2b:: 109 For example: 110 111 /B2/det/stepMax 1.0 mm 112 113 7- DETECTOR RESPONSE 114 115 A HIT is a step per step record of all th 116 simulate and analyse the detector respons 117 118 In this example the Tracker chambers are 119 Therefore, the chambers are declared 'sen 120 the B2a::DetectorConstruction (or B2b::De 121 They are associated with an instance of t 122 123 Then, a Hit is defined as a set of 4 info 124 the chambers, namely: 125 - the track identifier (an integer), 126 - the chamber number, 127 - the total energy deposit in this step, and 128 - the position of the energy deposit. 129 130 A given hit is an instance of the class B 131 during the tracking of a particle, step b 132 B2::TrackerSD::ProcessHits(). This hit is 133 134 The HitsCollection is printed at the end 135 B2::TrackerSD::EndOfEvent()), under the c 136 /hits/verbose 2 137 138 The following paragraphs are common to all ba 139 140 A- VISUALISATION 141 142 The visualization manager is set via the G4 143 in the main() function in exampleB2a.cc (or 144 The initialisation of the drawing is done v 145 in the macro vis.mac. This macro is automat 146 the main function when the example is used 147 148 By default, vis.mac opens an OpenGL viewer 149 The user can change the initial viewer by c 150 and instead uncommenting one of the other / 151 HepRepFile or DAWNFILE (which produce files 152 HepRApp and DAWN viewers, respectively). N 153 open new viewers at any time from the comma 154 you already have a view in, say, an OpenGL 155 "viewer-0", then 156 /vis/open DAWNFILE 157 then to get the same view 158 /vis/viewer/copyView viewer-0 159 or to get the same view *plus* scene-modifi 160 /vis/viewer/set/all viewer-0 161 then to see the result 162 /vis/viewer/flush 163 164 The DAWNFILE, HepRepFile drivers are always 165 (since they require no external libraries), 166 that the Geant4 libraries have been built w 167 168 Since 11.1, the TSG visualization driver ca 169 file output in png, jpeg, gl2ps formats wit 170 It can be controlled via UI commands provid 171 demonstrated in the tsg_offscreen.mac macro 172 173 For more information on visualization, incl 174 install and run DAWN, OpenGL and HepRApp, s 175 for example, 176 http://geant4.slac.stanford.edu/Presentatio 177 (where [VIS] can be replaced by DAWN, OpenG 178 179 The tracks are automatically drawn at the e 180 for all events and erased at the beginning 181 182 B- USER INTERFACES 183 184 The user command interface is set via the G 185 in the main() function in exampleB2a.cc 186 187 The selection of the user command interface 188 according to the Geant4 configuration or it 189 the third argument of the G4UIExecutive con 190 191 The gui.mac macros are provided in examples 192 is automatically executed if Geant4 is buil 193 It is also possible to customise the icons 194 demonstrated in the icons.mac macro in exam 195 196 C- HOW TO RUN 197 198 - Execute exampleB2a in the 'interactive m 199 % exampleB2a 200 and type in the commands from run1.mac l 201 Idle> /tracking/verbose 1 202 Idle> /run/beamOn 1 203 Idle> ... 204 Idle> exit 205 or 206 Idle> /control/execute run1.mac or ru 207 .... 208 Idle> exit 209 210 - Execute exampleB2a in the 'batch' mode f 211 (without visualization) 212 % exampleB2a run2.mac 213 % exampleB2a exampleB2.in > exampleB2. 214