Monoenergetic photon pencil beam
From UCL HEP PBT Wiki
for
Monoenergetic photon pencil beam
Jump to:
navigation
,
search
== <span style="color:#000080"> Introduction </span> == This example shows the dose distribution in water along the incident photon beam. The beam hits the water cube surface and deposits a dose under the surface of the water. The volume of the water cube is divided into slices perpendicular to the incident beam. The dose and energy deposited from the pencil beams at each slice is computed. == <span style="color:#000080"> Setting up the environment </span> == ; Connect to HEP cluster and create folder PhotonPBFolder in your area <pre style="color: #800000; background-color: #dcdcdc"> ssh username@plus1.hep.ucl.ac.uk password: type your password here cd /home/username/ mkdir PhotonPBFolder cd PhotonPBFolder </pre> ; Setup GEANT4 environment <pre style="color: #800000; background-color: #dcdcdc"> source /unix/pbt/software/dev/bin/pbt-dev.sh </pre> == <span style="color:#000080"> How to get the code </span> == ; Copy the code to your working directory and rename it <pre style="color: #800000; background-color: #dcdcdc"> cp -r /unix/pbt/tutorials/basic/PhotonPB . mv PhotonPB PhotonPB_source </pre> == <span style="color:#000080"> How to run the code </span> == ; Inside /home/username/PhotonPBFolder/ create a directory <pre style="color: #800000; background-color: #dcdcdc"> mkdir PhotonPB_build </pre> ; To compile the code enter this directory and run cmake and make <pre style="color: #800000; background-color: #dcdcdc"> cd PhotonPB_build cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source make </pre> ; Run macro gamma.mac. The macro generates 10000 events. <pre style="color: #800000; background-color: #dcdcdc"> ./photonPB gamma.mac </pre> == <span style="color:#000080"> How to analyze data </span> == The macro produces a root file '''Gamma.root''' with 1D histogram showing the energy deposition in water box along the beam line. It also produces a text file '''DoseFile.txt''' with energy and dose deposited at each slice of the water box. This is an example output with the default settings: physics process emstandard_opt0 and incident gamma energy of 20 MeV. <pre style="color: #800000; background-color: #dcdcdc"> Cumulated Doses : X[mm] Edep Edep/Ebeam Dose layer 1: 10 695.299 MeV 0.347649 % 6.96245e-09 Gy layer 2: 20 1.17329 GeV 0.586646 % 1.17489e-08 Gy layer 3: 30 1.60782 GeV 0.80391 % 1.61001e-08 Gy layer 4: 40 1.89698 GeV 0.94849 % 1.89956e-08 Gy layer 5: 50 2.23625 GeV 1.11812 % 2.23929e-08 Gy layer 6: 60 2.41072 GeV 1.20536 % 2.414e-08 Gy layer 7: 70 2.5396 GeV 1.2698 % 2.54306e-08 Gy layer 8: 80 2.66291 GeV 1.33145 % 2.66653e-08 Gy layer 9: 90 2.5538 GeV 1.2769 % 2.55727e-08 Gy layer 10: 100 2.47482 GeV 1.23741 % 2.47819e-08 Gy layer 11: 110 2.45013 GeV 1.22507 % 2.45346e-08 Gy layer 12: 120 2.34969 GeV 1.17484 % 2.35288e-08 Gy layer 13: 130 2.3329 GeV 1.16645 % 2.33608e-08 Gy layer 14: 140 2.37302 GeV 1.18651 % 2.37625e-08 Gy layer 15: 150 2.4226 GeV 1.2113 % 2.4259e-08 Gy layer 16: 160 2.4147 GeV 1.20735 % 2.41799e-08 Gy layer 17: 170 2.38873 GeV 1.19437 % 2.39198e-08 Gy layer 18: 180 2.36667 GeV 1.18333 % 2.36989e-08 Gy layer 19: 190 2.28832 GeV 1.14416 % 2.29143e-08 Gy layer 20: 200 8.08046e+167 J 2.52171e+177 % 5.05029e+169 Gy The run consists of 10000 gamma of 20 MeV through 20 cm of Water (density: 1 g/cm3 ) </pre> You can open Gamma.root file in the following way: <pre style="color: #800000; background-color: #dcdcdc"> root -l Gamma.root new TBrowser Select ROOT files and Gamma.root </pre> Inside is 1D histogram showing the energy deposition in water box: [[File:/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/Edep.png|Energy deposit per event along the beam]] You can change the physics process, incident photon energy, phantom material, number of slices etc. by modifying the macro gamma.mac. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. For example open the macro with editor pico: <pre style="color: #800000; background-color: #dcdcdc"> pico gamma.mac </pre> This is what you will see: <pre style="color: #800000; background-color: #dcdcdc"> # gamma.mac # /control/verbose 2 /run/verbose 2 /tracking/verbose 0 /run/particle/verbose 1 /run/particle/dumpList # # set geometry and material /photonPB/det/setMat Water #/photonPB/det/setMat Lead /photonPB/det/setSizeX 20 cm /photonPB/det/setSizeYZ 20 cm /photonPB/det/setSliceSizeYZ 4 cm /photonPB/det/sliceNumber 20 # # set physics process /photonPB/phys/addPhysics emstandard_opt0 #photonPB/phys/addPhysics emlivermore #/photonPB/phys/addPhysics empenelope # # production tresholds (range cut off- # not bigger than 10% of slice thickness) /photonPB/phys/setCuts 1 mm #/photonPB/phys/setGCut 1 um #/photonPB/phys/setECut 1 um #/photonPB/phys/setPCut 1 um # # initialize /run/initialize # # particle gun properties (type of #particle and energy:10keV-25MeV) /gun/particle gamma /gun/energy 20 MeV # # beam size #/photonPB/gun/rndm 3 mm # # step limit (not bigger than 5% of # slice thickness) /photonPB/stepMax 0.5 mm # /photonPB/event/printModulo 50 # # output root file /analysis/setFileName Gamma # # number of events /run/beamOn 10000 </pre> === Change the physics process === The default physics process is '''emstandard_opt0'''. This package is used in high energy experiments. In gamma.mac change <pre style="color: #800000; background-color: #dcdcdc"> /photonPB/phys/addPhysics emstandard_opt0 </pre> to <pre style="color: #800000; background-color: #dcdcdc"> /photonPB/phys/addPhysics emlivermore </pre> The process '''emlivermore''' is used in low energy physics experiments. Now run the code: <pre style="color: #800000; background-color: #dcdcdc"> ./photonPB gamma.mac </pre> === Change the incident particle energy === The default energy is 20 MeV. This is one of the energies used in radiotherapy. In gamma.mac you can change the value of 20 MeV <pre style="color: #800000; background-color: #dcdcdc"> /gun/energy 20 MeV </pre> to, for example, 10 MeV <pre style="color: #800000; background-color: #dcdcdc"> /gun/energy 10 MeV </pre> and run the macro <pre style="color: #800000; background-color: #dcdcdc"> ./photonPB gamma.mac </pre> Keep in mind that the primary particle generation is done at /PhotonPB_source/src/PrimaryGeneratorAction.cc. This is part of the PrimaryGeneratorAction.cc: <pre style="color: #800000; background-color: #dcdcdc"> fParticleGun = new G4ParticleGun(1); G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()->FindParticle("proton"); fParticleGun->SetParticleDefinition(particle); fParticleGun->SetParticleEnergy(160*MeV); fParticleGun->SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.)); ... G4double x0 = -0.5*(fDetector->GetAbsorSizeX()); G4double y0 = 0.*cm, z0 = 0.*cm; ... fParticleGun->SetParticlePosition(G4ThreeVector(x0,y0,z0)); </pre> The line <pre style="color: #800000; background-color: #dcdcdc"> fParticleGun = new G4ParticleGun(1); </pre> means that only one particle is generated, incident from (x0,y0,z0). The default number of events is set to 10000. Therefore, 10000 particles are incident to the water box. === Change the material of the phantom === This example is to compute the energy deposition of photons in a water box. However, there is an option to change the box material from water to lead. In gamma.mac change <pre style="color: #800000; background-color: #dcdcdc"> /photonPB/det/setMat Water </pre> to <pre style="color: #800000; background-color: #dcdcdc"> /photonPB/det/setMat Lead </pre> and run the macro <pre style="color: #800000; background-color: #dcdcdc"> ./photonPB gamma.mac </pre> === Change the number of slices === You can change the number of water box slices. The default number is 20. Keep in mind that if you want to have more slices you need to modify the file DetectorConstruction.hh in /PhotonPB_source/include/. In DetectorConstruction.hh change the MaxLayer to a value which is bigger or equal to the number of your slices. <pre style="color: #800000; background-color: #dcdcdc"> const G4int MaxLayer = 30; </pre> Then in gamma.mac you need to change the number of slices <pre style="color: #800000; background-color: #dcdcdc"> /photonPB/det/sliceNumber 30 </pre> You modified the code therefore you need to comppile it again. In directory PhotonPB_build do <pre style="color: #800000; background-color: #dcdcdc"> make </pre> then run the macro <pre style="color: #800000; background-color: #dcdcdc"> ./photonPB gamma.mac </pre>
Return to
Monoenergetic photon pencil beam
.
Views
Page
Discussion
View source
History
Personal tools
Log in
Navigation
Main page
Community portal
Current events
Recent changes
Random page
Help
Search
Toolbox
What links here
Related changes
Special pages