Geant4 Cross Reference |
1 ------------------------------------------------------------------- 2 3 ========================================================= 4 Geant4 - an Object-Oriented Toolkit for Simulation in HEP 5 ========================================================= 6 7 Chem5 8 ------- 9 10 Jose Ramos-Mendez(a) and Bruce Faddegon 11 Department of Radiation Oncology, 12 University of California San Francisco. 13 14 (a) CORRESPONDING AUTHOR 15 joserm84 _ gmail _ com 16 17 This example is provided by the Geant4-DNA collaboration. 18 (http://geant4-dna.org) 19 20 Any report or published results obtained using the Geant4-DNA software shall 21 cite the following Geant4-DNA collaboration publications: 22 Phys. Med. 31 (2015) 861-874 23 Med. Phys. 37 (2010) 4692-4708 24 25 Any report or published results obtained using this example shall 26 cite the following publication: 27 Phys. Med. Biol. 63(10) (2018) 105014-12pp 28 29 The example is a variation of chem4, it shows how to activate 30 chemistry code and score the radiochemical yield G using the contructors 31 G4EmDNAPhysics_option8 and G4EmDNAChemistry_option1 32 33 1 - GEOMETRY DEFINITION 34 35 The world volume is a simple box which represents a 'pseudo infinite' 36 homogeneous medium. 37 38 Two parameters define the geometry : 39 - the material of the box -- for Geant4-DNA it has to be water. 40 - the full size of the box. 41 42 The default geometry is constructed in DetectorConstruction class. 43 44 2 - PHYSICS LIST 45 46 PhysicsList is Geant4 modular physics list using G4EmDNAPhysics_option8 & 47 G4EmDNAChemistry_option1 constructors. 48 49 3 - ACTION INITALIZATION 50 51 The class ActionInitialization instantiates and registers 52 to Geant4 kernel all user action classes. 53 54 While in sequential mode the action classes are instantiated just once, 55 via invoking the method: 56 ActionInitialization::Build() 57 in multi-threading mode the same method is invoked for each thread worker 58 and so all user action classes are defined thread-local. 59 60 A run action class is instantiated both thread-local 61 and global that's why its instance is created also in the method: 62 ActionInitialization::BuildForMaster() 63 which is invoked only in multi-threading mode. 64 65 4 - AN EVENT: THE PRIMARY GENERATOR 66 67 The primary kinematic consists of a single particle starting at the center 68 of the box. The type of the particle and its energy are set in the 69 PrimaryGeneratorAction class, and can be changed via the G4 build-in 70 commands of G4ParticleGun class. 71 The chemistry module is triggered in the StackingAction class when all 72 physical tracks have been processed. 73 74 5 - DETECTOR RESPONSE: Scorers 75 76 5.1 - Species scorer 77 78 Scorers are defined in DetectorConstruction::ConstructSDandField(). There is 79 one G4MultiFunctionalDetector object which computes the energy deposition and 80 the number of species along time in order to extract 81 the radiochemical yields: 82 (Number of species X) / (100 eV of deposited energy). 83 84 Run::RecordEvent(), called at end of event, collects informations 85 event per event from the hits collections, and accumulates statistic for 86 RunAction::EndOfRunAction(). 87 88 In multi-threading mode the statistics accumulated per workers is merged 89 to the master in Run::Merge(). 90 91 The information about G-value as a function of the time for each 92 molecular specie is scored in a ASCII format 93 94 95 5.2 - Primary killer 96 97 The G-values are computing for a range of deposited energy. 98 An infinite volume is assumed as geometric scenario. Therefore the energy lost by the 99 primary particle equals the deposited energy from all secondary particles. 100 101 The primary is killed once it has deposited more energy than a 102 minimum threshold. 103 104 **IMPORTANT**: However, when the primary particle looses more energy 105 in few interaction steps than the maximum allowed thresold, 106 the event is disregarded (=aborted). 107 108 These two macro commands can be used to control the energy loss by 109 the primary: 110 111 /primaryKiller/eLossMin 10 keV 112 # after 10 keV of energy loss by the primary particle, the primary is killed 113 114 /primaryKiller/eLossMax 10.1 keV 115 # if the primary particle losses more than 10.1 keV, the event is aborted 116 117 The G-values are then computed for a deposited energy in the range [10.0 keV;10.1 keV]. 118 119 Note that if the upper boundary of the energy lost by the primary is 120 not set, the chemistry may take a lot of time to compute. 121 This set of macros is embedded in the PrimaryKiller class. 122 The species scorer must check whether the event was aborted before taking it or not into 123 account for the computation of the results. 124 125 6 - STACKING ACTION 126 127 StackingAction::NewStage is called when a stack of tracks has been processed 128 (for more details, look at the Geant4 documentation). 129 A verification on whether physical tracks remain to be processed is done. 130 If no tracks remain to be processed, the chemical module is then triggered. 131 132 7 - VISUALISATION 133 134 The visualization manager is set via the G4VisExecutive class 135 in the main() function in chem5.cc. 136 The initialisation of the drawing is done via a set of /vis/ commands 137 in the macro vis.mac. To activate the visualization mode run: 138 ./chem5 -vis 139 140 8 - OUTPUT 141 142 Physics initialization and the defined reaction table are printed. 143 G4Scheduler processes the chemical stage time step after time step. 144 Chemical reactions are printed. 145 The molecular reaction as a function of the elapsed time can be displayed 146 setting the macro command /scheduler/verbose 1 147 148 9 - RELEVANT MACRO COMMANDS 149 /primaryKiller/eLossMin 10 keV # after 10 keV of energy loss by the primary particle, the primary is killed 150 /primaryKiller/eLossMax 10.1 keV # if the primary particle losses more than 10.1 keV, the event is aborted 151 /scheduler/verbose 1 # set the verbose level of the G4Scheduler class (time steps, reactions ...) 152 /scheduler/endTime 1 microsecond # set the time at which the simulation stops 153 /scheduler/whyDoYouStop # for advanced users: print information at the end of 154 #the chemical stage to know why the simulation has stopped 155 156 10 - PLOT 157 The information about all the molecular species is scored in a ASCII 158 tuple, each value corresponding to the G-value per time. This format is friendly 159 with a wide variety of plotting software. 160 Experimental data of G-values for solvated electron and hydroxil radical (as a function of the time) 161 from the literature is available in data subdirectory, the references are provided 162 in the header of each file. Further information is available in Phys. Med. Biol. 63(10) (2018) 105014-12pp. 163 164 A gnuplot script (plot.gp) file is provided to display the output data with the experimental data 165 166 11 - HOW TO START ? 167 168 To run the example in batch mode: 169 ./chem5 -mac beam.in 170 or 171 ./chem5 172 then the macro beam.in is processed by default 173 174 In interactive mode, run: 175 ./chem5 -gui 176 or 177 ./chem5 -gui gui.mac