Warning, /geant4/examples/extended/medical/dna/chem4/README.md is written in an unsupported language. File is not indexed.
0001 \page ExampleChem4 Example chem4
0002
0003 \author P. Piersimoni (a), M. Karamitros (b) \n
0004 (a) pierluigi.piersimoni _ gmail _ com \n
0005 (b) matkara _ gmail _ com \n
0006
0007 This example is provided by the Geant4-DNA collaboration.
0008 (http://geant4-dna.org)
0009
0010 Any report or published results obtained using the Geant4-DNA software shall
0011 cite the following Geant4-DNA collaboration publications: \n
0012 Phys. Med. 31 (2015) 861-874 \n
0013 Med. Phys. 37 (2010) 4692-4708 \n
0014
0015 The example shows how to activate the chemistry code and score the radiochemical yield G
0016 defined as \n
0017 ```
0018 (Number of species X) / (100 eV of deposited energy).
0019 ```
0020 in a range of deposited energy [X;Y] chosen by the user.\n
0021
0022 ## GEOMETRY DEFINITION
0023 The world volume is a simple box which represents a 'pseudo infinite'
0024 homogeneous medium.
0025
0026 Two parameters define the geometry :
0027 - the material of the box -- for Geant4-DNA it has to be water.
0028 - the full size of the box.
0029
0030 The default geometry is constructed in DetectorConstruction class.
0031
0032 ## PHYSICS LIST
0033
0034 PhysicsList is Geant4 modular physics list using G4EmDNAPhysics &
0035 G4EmDNAChemistry constructors.
0036 It will later be updated to use the G4EmDNAModelActivator constructor
0037
0038 ## CHEMISTRY MODEL AND CHEMICAL REACTION LIST
0039
0040 UI species are defined by format :
0041 username [ molecule | charge | D(m2/s) | Radius(nm) ]
0042 where : *username* is decided by users, *molecule* is used by Geant4,
0043 *D* is diffusion constant, *Radius* is reaction radius.
0044 Spaces between characters are needed.
0045
0046 UI reactions are defined by format :
0047 ```
0048 /chem/reaction/add H + H -> H2 | Fix | 1.2e10 | 0
0049 where : *H* is username, *1.2e10* is reaction rate, *0* is reaction type.
0050 ```
0051 Spaces between characters are needed.
0052
0053 (parameters can be found in Prog. Nucl. Sci. Tec. 2 (2011))
0054
0055 ## ACTION INITALIZATION
0056
0057 The class ActionInitialization instantiates and registers
0058 to Geant4 kernel all user action classes.
0059
0060 While in sequential mode the action classes are instantiated just once,
0061 via invoking the method
0062 ActionInitialization::Build()
0063 in multi-threading mode the same method is invoked for each thread worker
0064 and so all user action classes are defined thread-local.
0065
0066 A run action class is instantiated both thread-local
0067 and global that's why its instance is created also in the method
0068 ActionInitialization::BuildForMaster()
0069 which is invoked only in multi-threading mode.
0070
0071 ## AN EVENT: PRIMARY GENERATOR
0072
0073 The primary kinematic consists of a single particle starting at the center
0074 of the box. The type of the particle and its energy are set in the
0075 PrimaryGeneratorAction class, and can be changed via the G4 build-in
0076 commands of G4ParticleGun class.
0077 The chemistry module is triggered in the StackingAction class when all
0078 physical tracks have been processed.
0079
0080 ## DETECTOR RESPONSE : Scorers
0081
0082 ### Species scorer
0083
0084 Scorers are defined in DetectorConstruction::ConstructSDandField(). There is
0085 one G4MultiFunctionalDetector object which computes the energy deposition and
0086 the number of species along time in order to extract
0087 the radiochemical yields:
0088 ```
0089 (Number of species X) / (100 eV of deposited energy).
0090 ```
0091
0092 Run::RecordEvent(), called at end of event, collects informations
0093 event per event from the hits collections, and accumulates statistic for
0094 RunAction::EndOfRunAction().
0095
0096 In multi-threading mode the statistics accumulated per workers is merged
0097 to the master in Run::Merge().
0098
0099 The information about all the molecular species is scored in a ROOT
0100 ntuple file Species.root. The root macro program PlotNtuple.C can be used to
0101 plot the G values vs time, for each species.
0102
0103 ### Primary Killer
0104 The G-values are computing for a range of deposited energy.
0105 We are in an infinite volume. Therefore the energy lost by the
0106 primary equals the deposited energy since all secondary particles
0107 will finally slow down to the thermal energy.
0108 The primary is killed once it has deposited more energy than a
0109 minimum threshold.
0110 IMPORTANT: However, when the primary particle looses more energy in
0111 few interaction steps than the maximum allowed thresold, the event is
0112 disregarded (=aborted). \n
0113
0114 These two macro commands can be used to control the energy loss by the primary:
0115
0116 ```
0117 /primaryKiller/eLossMin 1 keV
0118 # after 1 keV of energy loss by the primary particle, the primary is killed
0119
0120 /primaryKiller/eLossMax 2 keV
0121 # if the primary particle losses more than 2 keV, the event is aborted
0122 ```
0123
0124 The G-values are then computed for a deposited energy in the range [1 keV;2 keV].
0125
0126 Note that if the upper boundary of the energy lost by the primary is not set, the chemistry may
0127 take a lot of time to compute as the number of secondaries may be huge.
0128 This set of macros is embedded in the PrimaryKiller class.
0129 The species scorer must check whether the event was aborted before taking it or not into
0130 account for the computation of the results.
0131
0132 ## STACKING ACTION
0133
0134 StackingAction::NewStage is called when a stack of tracks has been processed
0135 (for more details, look at the Geant4 documentation).
0136 A verification on whether physical tracks remain to be processed is done.
0137 If no tracks remain to be processed, the chemical module is then triggered.
0138
0139 ## VISUALISATION
0140
0141 The visualization manager is set via the G4VisExecutive class
0142 in the main() function in chem4.cc.
0143 The initialisation of the drawing is done via a set of /vis/ commands
0144 in the macro vis.mac. To activate the visualization mode run:
0145 ```
0146 ./chem4 -vis
0147 ```
0148
0149 ## OUTPUT
0150
0151 Physics initialization and the defined reaction table are printed.
0152 G4Scheduler processes the chemical stage time step after time step.
0153 Chemical reactions are printed.
0154 The molecular reaction as a function of the elapsed time can be displayed
0155 setting the macro command /scheduler/verbose 1
0156
0157 ## RELEVANT MACRO COMMANDS
0158 ```
0159 /primaryKiller/eLossMax 1 keV # after 1 keV of energy loss by the primary particle, the primary is killed
0160 /scheduler/verbose 1 # set the verbose level of the G4Scheduler class (time steps, reactions ...)
0161 /scheduler/endTime 1 microsecond # set the time at which the simulation stops
0162 /scheduler/whyDoYouStop # for advanced users: print information at the end of the chemical stage
0163 # to know why the simulation has stopped
0164 ```
0165
0166 ## PLOT
0167 The information about all the molecular species is scored in a ROOT
0168 ntuple file Species.root during the run of chem4.
0169 The ROOT program plotG can be used to plot the G values vs time,
0170 for each species. It must be launched after
0171 chem4 has run. When "plotG" is executed, select the root file output by the
0172 chem4 application.
0173 You can also execute plotG as:
0174 ```
0175 ./plot/plotG Species.root
0176 ```
0177 where Species.root is the file output by the chem4 application.
0178
0179 ## OTHER INFORMATION
0180 I have access to a track. How do I access to its molecular information?
0181 ```cpp
0182 #include "G4Molecule.hh"
0183 G4Track* thisIsMytrack = ...
0184 G4Molecule* thisIsMyMolecule = GetMolecule(thisIsMyTrack);
0185 ```
0186 If the pointer thisIsMyMolecule is null, then this is NOT a chemical species
0187
0188 How do I get the molecule's name?
0189 ```cpp
0190 G4Molecule* thisIsMyMolecule = ...
0191 const G4String& moleculeName = thisIsMyMolecule->GetName();
0192 ```
0193
0194 How can I display the reaction information?
0195 - Use this macro command:
0196 ```
0197 /scheduler/verbose 1
0198 ```
0199
0200 How can I display the step by step information?
0201 1. Add ITTrackingInteraction to the G4Scheduler singleton (cf. chem3)
0202 2. Use
0203 ```
0204 /chem/tracking/verbose 1
0205 ```
0206
0207 ## HOW TO START
0208
0209 To run the example in batch mode
0210
0211 ./chem4 -mac beam.in
0212
0213 or
0214
0215 ./chem4
0216
0217 then the macro beam.in is processed by default
0218
0219 In interactive mode, run:
0220
0221 ./chem4 -gui
0222
0223 or
0224
0225 ./chem4 -gui gui.mac