00001 00002 /* 00003 * 00004 * Copyright: Mathieu Trocme, mathieu.trocme@gmail.com (21 september 2009) 00005 * 00006 * This software is a computer program whose purpose is to: provide a universal Hit/SD output method in Geant4 with a proper Root coupling 00007 * 00008 * This software is governed by the CeCILL license under French law and abiding by the rules of distribution of free software. 00009 * You can use, modify and/or redistribute the software under the terms of the CeCILL license as circulated by CEA, CNRS and INRIA at the following URL "http://www.cecill.info". 00010 * As a counterpart to the access to the source code and rights to copy, modify and redistribute granted by the license, users are provided only with a limited warranty and the software's author, the holder of the economic rights, and the successive licensors have only limited liability. 00011 * In this respect, the user's attention is drawn to the risks associated with loading, using, modifying and/or developing or reproducing the software by the user in light of its specific status of free software, that may mean that it is complicated to manipulate, and that also therefore means that it is reserved for developers and experienced professionals having in-depth computer knowledge. 00012 * Users are therefore encouraged to load and test the software's suitability as regards their requirements in conditions enabling the security of their systems and/or data to be ensured and, more generally, to use and operate it in the same conditions as regards security. 00013 * 00014 * The fact that you are presently reading this means that you have had knowledge of the CeCILL license and that you accept its terms. 00015 * 00016 */ 00017 00018 00019 00020 /* ****************************************************************************************************************************** 00021 00022 00023 00024 This example simulates the AlphaRad device (see http://eprints-scd-ulp.u-strasbg.fr:8080/933/) 00025 The term "macrofile" used below refers to the file alphaRad_new.mac. 00026 00027 00028 ################################################################################################################################# 00029 # GEOMETRY 00030 ################################################################################################################################# 00031 00032 ###################### 00033 # Scheme 00034 ###################### 00035 00036 00037 Si02 Si-SUB 00038 6um 300um 00039 00040 - -- -----//----- 00041 (AIR) / / / /| 00042 - -- -----//----- | 00043 t | | | | | 00044 <-> | | | Active | <----- (32*80 mum) * (32*80 mum) 00045 _ | | | matrix | | 00046 r | | | | | | | 00047 |*| - -- -----//----- /| 00048 |_| | | | | | 00049 | | | Inactive | | 00050 alpha | | | matrix | | 00051 cylindric | | | | | 00052 source - --- -----//---- / 00053 . . Si-EPI 00054 . . 14um 00055 .<-------->. 00056 sdd 00057 00058 00059 00060 y (up-down) 00061 00062 /\ 00063 | _ x (left-right) 00064 | /| 00065 | / 00066 | / 00067 ---------> z (beam direction) 00068 00069 00070 ###################### 00071 # Commands 00072 ###################### 00073 00074 Several built-in commands are provided through DetectorConstruction_Messenger. 00075 00076 Materials can be changed for test purposes: 00077 /setup/material/world 00078 /setup/material/source 00079 /setup/material/SiO2 00080 /setup/material/Siepi 00081 00082 The geometry can be adjusted: 00083 /setup/geometry/SourcetoDetectorDistance 00084 /setup/geometry/source/thickness 00085 /setup/geometry/source/radius 00086 00087 Any changes in the geometry should be followed by: 00088 /setup/update 00089 00090 See the macrofile. 00091 00092 00093 ###################### 00094 # Visualization 00095 ###################### 00096 00097 3 drivers are provided: 00098 - VRML (http://cic.nist.gov/vrml/vbdetect.html) 00099 - Wired 3 (http://www.slac.stanford.edu/~perl/HepRApp/) 00100 - Wired 4 (http://jas.freehep.org/jas3/) 00101 I recommend Wired 4 (see https://sbgtrac.in2p3.fr/projects/ramses/wiki/G4_MyTuto) 00102 Just uncomment the following part in the macrofile. 00103 00104 00105 ################################################################################################################################# 00106 # PHYSICS LIST 00107 ################################################################################################################################# 00108 00109 ###################### 00110 # Description 00111 ###################### 00112 00113 Standard EM physics for photons, e-, e+. 00114 Standard EM + LE physics for proton, alpha and GenericIon. 00115 Elastic and LE inelastic scattering for proton, alpha and GenericIon. 00116 00117 Although LowEnergy EM classes won't be supported anymore in a near future (https://twiki.cern.ch/twiki/bin/view/Geant4/LoweMigratedProcesses), 00118 they have been kept for backward testing. 00119 Make sure to select one and only one ionisation model in the macro file: either hLowEIoni OR {ion,h}Ioni 00120 00121 If you used to work with EM LowEnergy classes, an alternative may be found at http://hypernews.slac.stanford.edu/HyperNews/geant4/get/phys-list/253/1/1/1/1/1/3/2/1/1.html 00122 Actually, the issue is still on going off the forum. So please be patient... 00123 00124 00125 ###################### 00126 # Commands 00127 ###################### 00128 00129 Activation/Inactivation of physics processes 00130 /process/inactivate processName 00131 00132 Cuts (see PhysicsList_Messenger, which might disappear some day: http://hypernews.slac.stanford.edu/HyperNews/geant4/get/runmanage/259.html) 00133 /run/setCutForAGivenParticle particleName cutValue unit 00134 00135 Energy loss options (see $G4SOURCE/processes/electromagnetic/utils/src/G4EnergyLossMessenger.cc) 00136 /process/eLoss/ 00137 00138 See the macrofile for further tips and comments. 00139 00140 00141 ################################################################################################################################# 00142 # PRIMARY GENERATOR ACTION 00143 ################################################################################################################################# 00144 00145 Everything is done with the GPS commands (http://reat.space.qinetiq.com/gps/new_gps_sum_files/gps_sum.htm). 00146 The PrimaryGeneratorAction class is just an empty shell. 00147 Several examples are provided in the macrofile. 00148 00149 00150 ################################################################################################################################# 00151 # DETECTOR RESPONSE 00152 ################################################################################################################################# 00153 00154 The following files are just empty shells that do not need any changes: 00155 - RunAction* 00156 - EventAction* 00157 - SteppingAction* 00158 All the output implementation is done in Analysis. 00159 This technique has been borrowed to Aatos Heikkinen (aatos.heikkinen@cern.ch). 00160 00161 The SD/Hit technique is used in order not to loose any information (scoring uses histograms...). 00162 Four layers are declared as sensitive detectors: Si02, Siepi, Sisub and a dummy one behind Sisub 00163 to check if something exits the subtract (see DetectorConstruction::ConstructFilters()). 00164 00165 Each event can generate several particles (original alpha + ionisation electrons). 00166 For each particle, the following set of variables is stored in a Root tree: 00167 - particle info: name, Z, A, ID, parent ID, creator process name 00168 - position, direction, kinetic energy, time and weight at the entrance of all the sensitive layers 00169 - energy deposited, dose, and range (projected or not wrt to the +z direction and to the incident direction) in all the sensitive layers 00170 A proper coupling between Root and Geant4 is used (see http://root.cern.ch/phpBB2/viewtopic.php?t=6172). 00171 00172 00173 ################################################################################################################################# 00174 # ANALYSIS 00175 ################################################################################################################################# 00176 00177 Two ways of reading the output root file are provided: 00178 00179 1. z_analysis/readtree.max: A slow macro meant for fast debug (see comments inside) 00180 First compile TMyRootEvent 00181 [ROOT]>.L TMyRootEvent.hpp+ 00182 then execute the macro 00183 [ROOT]>.x readtree.max 00184 00185 2. z_analysis/reatree.c: A more complete plotting function that must be compiled (and is thus really faster than the above macro) 00186 First compile TMyRootEvent 00187 [ROOT]>.L TMyRootEvent.hpp+ 00188 then compile the function 00189 [ROOT]>.L readtree.c+ 00190 and excute it 00191 [ROOT]>readtree("data/test.root") 00192 00193 00194 ################################################################################################################################# 00195 # RUNS 00196 ################################################################################################################################# 00197 00198 For historical reasons, 3 scenari are provided in the macrofile (see z_analysis/results/Scenari.pdf). 00199 5.5 MeV alpha particles are generated without any angular distribution from: 00200 - a virtual surfacic source (infinitely thin) to study the device efficiency in air (non punctual geometry + entrance window filter) 00201 - a thin volumic Am source to take into account autoabsorption in the source. 00202 - a thicker volumic Am source for energy loss debug purposes (see http://hypernews.slac.stanford.edu/HyperNews/geant4/get/phys-list/253/1/1/1/1/1/3/2/1/1.html) 00203 00204 The corresponding Root (z_analysis/data/* & z_analysis/results/*) and Wired4 (z_heprep/*) resulting files are provided 00205 and prepended with a "_" to avoid awkward overwriting. 00206 00207 00208 ################################################################################################################################# 00209 # HOW TO START? 00210 ################################################################################################################################# 00211 00212 Make sure Root is installed on your machine and the $ROOTSYS environment variable is set. 00213 00214 Compile and link the example to create the executable 00215 > cd alphaRad_2009 00216 > make -j $(cat /proc/cpuinfo | grep "processor.*:" | wc -l) 00217 00218 Launch the simulation making sure the macrofile's here 00219 > cd $G4BINDIR 00220 > [ ! -a alphaRad_new.mac ] && ln -s $G4MYSIMU/alphaRad_new.mac 00221 > ./alphaRad_new alphaRad_new.mac 00222 00223 Open the 2 ouput files 00224 - alphaRad_new.heprep.zip with JAS3/Wired4 (see https://sbgtrac.in2p3.fr/projects/ramses/wiki/G4_MyTuto) 00225 - test.root with Root (see above) 00226 and check the results match the alphaRad_new.mac 00227 00228 00229 ################################################################################################################################# 00230 # CONTENT OF THE ARCHIVE 00231 ################################################################################################################################# 00232 00233 . 00234 |-- GNUmakefile 00235 |-- alphaRad_new.cc 00236 |-- alphaRad_new.mac 00237 |-- doc.html -> z_html/files.html 00238 |-- include 00239 | |-- TMyRootEvent.hpp 00240 | |-- TStandard_Analysis.hh 00241 | |-- TStandard_Analysis_Messenger.hh 00242 | |-- TAlphaRad_DetectorConstruction.hh 00243 | |-- TAlphaRad_DetectorConstruction_Messenger.hh 00244 | |-- TDummy_EventAction.hh 00245 | |-- TStandard_Hit.hh 00246 | |-- TAlphaRad_PhysicsList.hh 00247 | |-- TAlphaRad_PhysicsList_Messenger.hh 00248 | |-- TGPS_PrimaryGeneratorAction.hh 00249 | |-- TDummy_RunAction.hh 00250 | |-- TStandard_SD.hh 00251 | |-- TDummy_SteppingAction.hh 00252 | `-- linkdef.h 00253 |-- license 00254 |-- readme 00255 |-- src 00256 | |-- TStandard_Analysis.cc 00257 | |-- TStandard_Analysis_Messenger.cc 00258 | |-- TAlphaRad_DetectorConstruction.cc 00259 | |-- TAlphaRad_DetectorConstruction_Messenger.cc 00260 | |-- TDummy_EventAction.cc 00261 | |-- TStandard_Hit.cc 00262 | |-- TAlphaRad_PhysicsList.cc 00263 | |-- TAlphaRad_PhysicsList_Messenger.cc 00264 | |-- TGPS_PrimaryGeneratorAction.cc 00265 | |-- TDummy_RunAction.cc 00266 | |-- TStandard_SD.cc 00267 | `-- TDummy_SteppingAction.cc 00268 |-- z_analysis 00269 | |-- TMyRootEvent.hpp -> ../include/TMyRootEvent.hpp 00270 | |-- data 00271 | | |-- _test_scenario1.root 00272 | | |-- _test_scenario2.root 00273 | | `-- _test_scenario3.root 00274 | |-- readtree.c 00275 | |-- readtree.max 00276 | |-- results 00277 | | |-- Scenari.pdf 00278 | | |-- Scenari.ppt 00279 | | |-- _test_scenario1__geom.eps 00280 | | |-- _test_scenario1__geom.gif 00281 | | |-- _test_scenario1__kin.eps 00282 | | |-- _test_scenario1__kin.gif 00283 | | |-- _test_scenario2__geom.eps 00284 | | |-- _test_scenario2__geom.gif 00285 | | |-- _test_scenario2__kin.eps 00286 | | |-- _test_scenario2__kin.gif 00287 | | |-- _test_scenario3__geom.eps 00288 | | |-- _test_scenario3__geom.gif 00289 | | |-- _test_scenario3__kin.eps 00290 | | `-- _test_scenario3__kin.gif 00291 | `-- rootlogon.C 00292 `-- z_heprep 00293 | |-- _test_scenario1.heprep.zip 00294 | |-- _test_scenario1.heprep.zip.emz 00295 | |-- _test_scenario1.heprep.zip.png 00296 | |-- _test_scenario2.heprep.zip 00297 | |-- _test_scenario2.heprep.zip.emz 00298 | |-- _test_scenario2.heprep.zip.png 00299 | |-- _test_scenario3.heprep.zip 00300 | |-- _test_scenario3.heprep.zip.emz 00301 | |-- _test_scenario3.heprep.zip.png 00302 | |-- original_geometry_01.gif 00303 | |-- original_geometry_02.gif 00304 | `-- original_geometry_03.gif 00305 `-- z_html 00306 |-- ... 00307 00308 00309 00310 ****************************************************************************************************************************** */