Monoenergetic proton pencil beam

From UCL HEP PBT Wiki

Jump to: navigation, search
 
Line 3: Line 3:
This example shows the dose distribution in water along the incident proton 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. At each slice the deposited dose and energy is computed.  
This example shows the dose distribution in water along the incident proton 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. At each slice the deposited dose and energy is computed.  
-
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and dose are scored using class '''G4ScoringManager''' by defining two scoring meshes in logitudinal and lateral direction of the beam. More information about scoring meshes can be found [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s08.html here]. Protons are generated using '''G4ParticleGun''' class. There is an option to chose among several '''EM''' and '''QGSP_BIC_EMY''' physics lists.
+
The slices are created using class '''G4PVReplica'''. The energy and the dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining two scoring meshes in longitudinal and lateral direction of the beam. More information about the scoring meshes can be found [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s08.html here]. The protons are generated using '''G4ParticleGun''' class. There is an option to chose among several '''EM''' and the '''QGSP_BIC_EMY''' physics lists.
-
== <span style="color:#000080"> Setting up the environment </span> ==
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.png
-
; Connect to HEP cluster and create folder ProtonPBFolder in your area
+
The image shows the water box divided into slices using class '''G4PVReplica'''. Protons are in blue, photons are in green.
 +
 
 +
== <span style="color:#000080"> How to run the tutorial </span> ==
 +
 
 +
; Connect to the HEP cluster and create folder ProtonPBFolder in your area
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
ssh -X username@plus1.hep.ucl.ac.uk  
ssh -X username@plus1.hep.ucl.ac.uk  
-
password: type your password here
+
username@plus1.hep.ucl.ac.uk's password: type your password here
-
 
+
-
cd /home/username/
+
   
   
-
mkdir ProtonPBFolder  
+
[username@plus1 ~]$ mkdir ProtonPBFolder  
-
cd ProtonPBFolder   
+
[username@plus1 ~]$ cd ProtonPBFolder   
</pre>
</pre>
Line 24: Line 26:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
source /unix/pbt/software/dev/bin/pbt-dev.sh   
+
[username@plus1 ProtonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh   
</pre>
</pre>
-
 
-
== <span style="color:#000080"> How to get the code </span> ==
 
; Copy the code to your working directory and rename it
; Copy the code to your working directory and rename it
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
cp -r /unix/pbt/tutorials/basic/ProtonPB .
+
[username@plus1 ProtonPBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonPB .
    
    
-
mv ProtonPB ProtonPB_source
+
[username@plus1 ProtonPBFolder]$ mv ProtonPB ProtonPB_source
</pre>
</pre>
-
 
-
== <span style="color:#000080"> How to run the code </span> ==
 
; Inside /home/username/ProtonPBFolder/ create a directory
; Inside /home/username/ProtonPBFolder/ create a directory
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
mkdir ProtonPB_build   
+
[username@plus1 ProtonPBFolder]$ mkdir ProtonPB_build   
</pre>
</pre>
Line 48: Line 46:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
cd ProtonPB_build  
+
[username@plus1 ProtonPBFolder]$ cd ProtonPB_build  
-
cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonPBFolder/ProtonPB_source  
+
[username@plus1 ProtonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonPBFolder/ProtonPB_source  
-
make   
+
[username@plus1 ProtonPB_build]$ make   
</pre>
</pre>
-
; Run macro proton.mac. The macro generates 6000 events.
+
; Run macro proton.mac
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
./protonPB proton.mac
+
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac
</pre>
</pre>
Line 65: Line 63:
The macro produces a root file '''Proton.root''' with two histograms. The first histogram shows the energy deposition in water box along the beam line, the second histogram shows zoomed energy deposition around the peak. The macro also produces several text files.  
The macro produces a root file '''Proton.root''' with two histograms. The first histogram shows the energy deposition in water box along the beam line, the second histogram shows zoomed energy deposition around the peak. The macro also produces several text files.  
-
* The data in files '''DoseFile.txt''' and '''PlotDose.txt''' was created using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The file '''DoseFile.txt''' contains energy and dose deposition for every layer. The file '''PlotDose.txt''' contains only depth vs dose values for each layer. These values can be imported in MATLAB or analyzed with ROOT macro.
+
* The data in files '''DoseFile.txt''' and '''PlotDose.txt''' was created using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The file '''DoseFile.txt''' contains energy and dose deposition for every layer. The file '''PlotDose.txt''' contains only depth vs dose for each layer. These text files can be analyzed with MATLAB or ROOT.
-
* The files '''DoseLongitudinalMesh.txt''', '''EnergyLongitudinalMesh.txt''', '''DoseLateralMesh.txt''' and '''EnergyLateralMesh.txt''' contain information about the dose and energy deposition in voxels in longitudinal and lateral direction of the beam.    
+
* The files '''DoseLongitudinalMesh.txt''', '''EnergyLongitudinalMesh.txt''', '''DoseLateralMesh.txt''' and '''EnergyLateralMesh.txt''' contain information about the dose and energy deposition in voxels in longitudinal and lateral direction of the beam. The data was created using class '''G4ScoringManager''' and commands '''/score/''' in proton.mac. These text files can be analyzed with MATLAB or ROOT.
 +
 
 +
* The two ways to record data should give similar result. 
=== <span style="color:#000080"> Text files </span> ===
=== <span style="color:#000080"> Text files </span> ===
-
This is output from '''DoseFile.txt''' with physics process '''QGSP_BIC_EMY''' and incident proton energy of '''62 MeV'''.
+
This is output from '''DoseFile.txt''' with physics process '''QGSP_BIC_EMY''' and incident proton energy of '''62 MeV'''. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc to open text files. For example, open this text file with editor '''pico''':
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
  Layers : x[mm]   Edep     Edep/Ebeam[%]  Dose Dose/MaxDose[%]
+
[username@plus1 ProtonPB_build]$ pico DoseFile.txt
-
  layer 1: 1.33333 8.84429 GeV 2.3775 1.06276e-05 Gy 20.6613
+
</pre>
-
  layer 2: 2.66667 8.91694 GeV 2.39703 1.07149e-05 Gy 20.831
+
   
-
  layer 3: 4 9.17299 GeV 2.46586 1.10226e-05 Gy 21.4291
+
<pre style="color: #800000; background-color: #dcdcdc">
-
  layer 4: 5.33333 9.38711 GeV 2.52342 1.12799e-05 Gy 21.9294
+
  Layers : x[mm] Edep     Edep/Ebeam[%]  Dose       Dose/MaxDose[%]
-
  layer 5: 6.66667 9.62373 GeV 2.58702 1.15642e-05 Gy 22.4821
+
  layer 1: 0.8 5.17382 GeV 1.39081 6.47608e-07 Gy 17.3315
-
  layer 6: 8 9.75588 GeV 2.62255 1.1723e-05 Gy 22.7908
+
layer 2: 1.6 5.24175 GeV 1.40907 6.5611e-07 Gy 17.5591
-
  layer 7: 9.33333 9.98464 GeV 2.68404 1.19979e-05 Gy 23.3252
+
  layer 3: 2.4 5.29862 GeV 1.42436 6.63229e-07 Gy 17.7496
-
  layer 8: 10.6667 10.3128 GeV 2.77225 1.23922e-05 Gy 24.0918
+
layer 4: 3.2 5.41481 GeV 1.45559 6.77772e-07 Gy 18.1388
-
  layer 9: 12 10.5176 GeV 2.82732 1.26383e-05 Gy 24.5704
+
  layer 5: 4 5.43787 GeV 1.46179 6.80658e-07 Gy 18.216
-
  layer 10: 13.3333 10.8275 GeV 2.91061 1.30107e-05 Gy 25.2942
+
  layer 6: 4.8 5.52101 GeV 1.48414 6.91065e-07 Gy 18.4946
-
  layer 11: 14.6667 11.164 GeV 3.00107 1.3415e-05 Gy 26.0803
+
layer 7: 5.6 5.64633 GeV 1.51783 7.06751e-07 Gy 18.9144
-
  layer 12: 16 11.6363 GeV 3.12804 1.39825e-05 Gy 27.1837
+
layer 8: 6.4 5.63969 GeV 1.51605 7.0592e-07 Gy 18.8921
-
  layer 13: 17.3333 12.0232 GeV 3.23203 1.44474e-05 Gy 28.0874
+
layer 9: 7.2 5.71744 GeV 1.53695 7.15652e-07 Gy 19.1526
-
  layer 14: 18.6667 12.6138 GeV 3.3908 1.51571e-05 Gy 29.4672
+
  layer 10: 8 5.78086 GeV 1.55399 7.2359e-07 Gy 19.365
-
  layer 15: 20 12.9498 GeV 3.48112 1.55609e-05 Gy 30.2521
+
layer 11: 8.8 5.94371 GeV 1.59777 7.43975e-07 Gy 19.9106
-
  layer 16: 21.3333 13.6288 GeV 3.66365 1.63768e-05 Gy 31.8383
+
layer 12: 9.6 6.02518 GeV 1.61967 7.54172e-07 Gy 20.1835
-
  layer 17: 22.6667 14.5047 GeV 3.89912 1.74294e-05 Gy 33.8847
+
layer 13: 10.4 6.10292 GeV 1.64057 7.63903e-07 Gy 20.4439
-
  layer 18: 24 15.4695 GeV 4.15847 1.85887e-05 Gy 36.1385
+
layer 14: 11.2 6.18071 GeV 1.66148 7.7364e-07 Gy 20.7045
-
  layer 19: 25.3333 16.5838 GeV 4.45801 1.99276e-05 Gy 38.7416
+
  layer 15: 12 6.2621 GeV 1.68336 7.83827e-07 Gy 20.9771
-
  layer 20: 26.6667 18.3271 GeV 4.92663 2.20224e-05 Gy 42.8141
+
layer 16: 12.8 6.37762 GeV 1.71441 7.98286e-07 Gy 21.3641
-
  layer 21: 28 20.6828 GeV 5.5599 2.48532e-05 Gy 48.3174
+
layer 17: 13.6 6.52458 GeV 1.75392 8.16682e-07 Gy 21.8564
-
  layer 22: 29.3333 24.4737 GeV 6.57896 2.94084e-05 Gy 57.1734
+
  layer 18: 14.4 6.67805 GeV 1.79517 8.35892e-07 Gy 22.3705
-
  layer 23: 30.6667 32.4582 GeV 8.72532 3.90028e-05 Gy 75.826
+
layer 19: 15.2 6.86252 GeV 1.84476 8.58982e-07 Gy 22.9884
-
  layer 24: 32 42.8062 GeV 11.507 5.14373e-05 Gy 100
+
  layer 20: 16 6.95226 GeV 1.86889 8.70215e-07 Gy 23.289
-
  layer 25: 33.3333 1.99409 GeV 0.536046     2.39617e-06 Gy 4.65842
+
layer 21: 16.8 7.11679 GeV 1.91312 8.90809e-07 Gy 23.8402
-
  layer 26: 34.6667 1.01076 MeV 0.000271708 1.21456e-09 Gy 0.00236124
+
  layer 22: 17.6 7.15125 GeV 1.92238 8.95122e-07 Gy 23.9556
-
  layer 27: 36 503.954 keV 0.000135472 6.05568e-10 Gy 0.00117729
+
layer 23: 18.4 7.43274 GeV 1.99805 9.30356e-07 Gy 24.8986
-
  layer 28: 37.3333 33.8047 keV 9.08729e-06 4.06209e-11 Gy 7.89716e-05
+
  layer 24: 19.2 7.58811 GeV 2.03981 9.49804e-07 Gy 25.419
-
  layer 29: 38.6667 2.03563 MeV 0.000547213 2.44608e-09 Gy 0.00475547
+
  layer 25: 20 7.8156 GeV 2.10097 9.78279e-07 Gy 26.1811
-
  layer 30: 40 0 eV         0     0 Gy         0
+
layer 26: 20.8 7.94754 GeV 2.13643 9.94794e-07 Gy 26.6231
 +
  layer 27: 21.6 8.35363 GeV 2.2456 1.04562e-06 Gy 27.9834
 +
  layer 28: 22.4 8.44564 GeV 2.27033 1.05714e-06 Gy 28.2917
 +
  layer 29: 23.2 8.74817 GeV 2.35166 1.09501e-06 Gy 29.3051
 +
  layer 30: 24 9.08194 GeV 2.44138 1.13679e-06 Gy 30.4232
 +
  layer 31: 24.8 9.50886 GeV 2.55615 1.19022e-06 Gy 31.8533
 +
  layer 32: 25.6 9.93302 GeV 2.67017 1.24332e-06 Gy 33.2741
 +
  layer 33: 26.4 10.5627 GeV 2.83943 1.32213e-06 Gy 35.3834
 +
  layer 34: 27.2 11.1563 GeV 2.99902 1.39644e-06 Gy 37.3721
 +
  layer 35: 28 12.0025 GeV 3.22647 1.50235e-06 Gy 40.2065
 +
  layer 36: 28.8 13.1124 GeV 3.52485 1.64128e-06 Gy 43.9247
 +
  layer 37: 29.6 14.5158 GeV 3.90209 1.81694e-06 Gy 48.6257
 +
  layer 38: 30.4 16.8932 GeV 4.54119 2.11452e-06 Gy 56.5898
 +
layer 39: 31.2 20.9827 GeV 5.64051 2.62641e-06 Gy 70.289
 +
layer 40: 32 29.8521 GeV 8.02475 3.73658e-06 Gy 100
 +
  layer 41: 32.8 14.922 GeV 4.0113 1.86779e-06 Gy 49.9866
 +
  layer 42: 33.6 330.005 MeV 0.088711     4.13067e-08 Gy 1.10547
 +
  layer 43: 34.4 2.92265 MeV 0.000785658  3.65828e-10 Gy  0.00979044
 +
layer 44: 35.2 864.413 keV 0.000232369 1.08199e-10 Gy 0.00289566
 +
  layer 45: 36 673.958 keV 0.000181172 8.43594e-11 Gy 0.00225766
 +
  layer 46: 36.8 1.18851 MeV 0.000319491  1.48765e-10 Gy 0.00398132
 +
layer 47: 37.6 3.81319 MeV 0.00102505  4.77297e-10 Gy 0.0127736
 +
  layer 48: 38.4 4.58219 MeV 0.00123177  5.73552e-10 Gy 0.0153496
 +
layer 49: 39.2 7.29449 MeV 0.00196088  9.13052e-10 Gy 0.0244355
 +
  layer 50: 40 0 eV 0 0 Gy 0
-
  The run consists of 6000 proton of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided into 30 slices.
+
  The run consists of 6000 proton of 62 MeV through 4 cm  of Water (density: 1 g/cm3 )  
 +
divided into 50 slices.
  Edep is the deposited energy in every slice.
  Edep is the deposited energy in every slice.
  Total incident energy(Ebeam)= 372 GeV
  Total incident energy(Ebeam)= 372 GeV
-
  Total energy deposit= 367.244 GeV
+
  Total energy deposit= 367.368 GeV
  Dose is the deposited dose in every slice.
  Dose is the deposited dose in every slice.
  MaxDose is the highest dose value from all slices.
  MaxDose is the highest dose value from all slices.
Line 119: Line 144:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
x[mm]  Dose/MaxDose[%]
+
0.8 17.3315
-
1.33333 20.6613
+
1.6 17.5591
-
2.66667 20.831
+
2.4 17.7496
-
4 21.4291
+
3.2 18.1388
-
5.33333 21.9294
+
4 18.216
-
6.66667 22.4821
+
4.8 18.4946
-
8 22.7908
+
5.6 18.9144
-
9.33333 23.3252
+
6.4 18.8921
-
10.6667 24.0918
+
7.2 19.1526
-
12 24.5704
+
8 19.365
-
13.3333 25.2942
+
8.8 19.9106
-
14.6667 26.0803
+
9.6 20.1835
-
16 27.1837
+
10.4 20.4439
-
17.3333 28.0874
+
11.2 20.7045
-
18.6667 29.4672
+
12 20.9771
-
20 30.2521
+
12.8 21.3641
-
21.3333 31.8383
+
13.6 21.8564
-
22.6667 33.8847
+
14.4 22.3705
-
24 36.1385
+
15.2 22.9884
-
25.3333 38.7416
+
16 23.289
-
26.6667 42.8141
+
16.8 23.8402
-
28 48.3174
+
17.6 23.9556
-
29.3333 57.1734
+
18.4 24.8986
-
30.6667 75.826
+
19.2 25.419
 +
20 26.1811
 +
20.8 26.6231
 +
21.6 27.9834
 +
22.4 28.2917
 +
23.2 29.3051
 +
24 30.4232
 +
24.8 31.8533
 +
25.6 33.2741
 +
26.4 35.3834
 +
27.2 37.3721
 +
28 40.2065
 +
28.8 43.9247
 +
29.6 48.6257
 +
30.4 56.5898
 +
31.2 70.289
32 100
32 100
-
33.3333 4.65842
+
32.8 49.9866
-
34.6667 0.00236124
+
33.6 1.10547
-
36 0.00117729
+
34.4 0.00979044
-
37.3333 7.89716e-05
+
35.2 0.00289566
-
38.6667 0.00475547
+
36 0.00225766
-
40 0
+
36.8 0.00398132
 +
37.6 0.0127736
 +
38.4 0.0153496
 +
39.2 0.0244355
 +
40 0
</pre>  
</pre>  
-
'''DoseLongitudinalMesh.txt''' and '''EnergyLongitudinalMesh.txt''' contain information about the dose and energy deposition in 30 voxels along the beam.   
+
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLongitudinalMesh.txt '''DoseLongitudinalMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/EnergyLongitudinalMesh.txt '''EnergyLongitudinalMesh.txt'''] contain information about the dose and energy deposition in 50 voxels along the beam.   
-
'''DoseLateralMesh.txt''' and '''EnergyLateralMesh.txt''' contain information about the dose and energy deposition in 30 voxels in direction perpendicular to the beam at its peak location along the beam.  
+
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLateralMesh.txt '''DoseLateralMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/EnergyLateralMesh.txt '''EnergyLateralMesh.txt'''] contain information about the dose and energy deposition in 50 voxels in direction perpendicular to the beam at its peak location along the beam.  
=== <span style="color:#000080"> Root file </span> ===
=== <span style="color:#000080"> Root file </span> ===
Line 161: Line 205:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
root -l Proton.root
+
[username@plus1 ProtonPB_build]$ root -l Proton.root
-
new TBrowser
+
root [1] new TBrowser
Select ROOT Files and Proton.root
Select ROOT Files and Proton.root
Line 170: Line 214:
<span style="color:#000080"> '''This is the energy deposition along the beam in the absorber:''' </span>
<span style="color:#000080"> '''This is the energy deposition along the beam in the absorber:''' </span>
   
   
-
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PB.png  
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PB1.png  
   
   
<span style="color:#000080"> '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' </span>
<span style="color:#000080"> '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' </span>
-
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PBzoom.png   
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PBzoom1.png   
-
=== <span style="color:#000080"> Changes in proton.mac </span> ===
+
You can close your ROOT session by typing
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
.q
 +
</pre>
 +
 
 +
Folder '''RootScripts''' contains several ROOT scripts which plot dose deposition in data and simulation.
 +
You can use script '''PlotSimulation.C''' to plot the dose deposition along the absorber. This script uses '''PlotDose.txt'''. Copy the script to your current ProtonPB_build directory:
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotSimulation.C .
 +
</pre>
 +
 
 +
Then run the script in the following way:
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonPB_build]$ root -l
 +
 
 +
root [1] .x PlotSimulation.C
 +
</pre>
 +
 
 +
This will create '''Simulation.root''' file with the following plot:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/Simulation1.png 
 +
 
 +
You can also plot the file '''PlotDose.txt''' using MATLAB. Similarly to the previous example first copy the text file to your computer. In the terminal at your computer write:
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
scp username@plus1.hep.ucl.ac.uk:/home/username/ProtonPBFolder/ProtonPB_build/PlotDose.txt .
 +
</pre>
 +
 
 +
Then, open MATLAB and follow the procedure:
 +
 
 +
* Import the file: Chose 'HOME' tab and 'Import Data'.
 +
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path.
 +
* In the opened window select the data points in the 'IMPORT' tab. If you like, you can change the name of the variables. For example, 'x' instead of 'VarName1' and 'Dose' instead of 'VarName2'. Then, press 'Import Selection'/'Import Data'. 
 +
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.
 +
 
 +
This plot will be created with added axis labels and a legend:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/matlab1proton.png
 +
 
 +
You can also plot the data in '''DoseLongitudinalMesh.txt''' and '''DoseLateralMesh.txt''' which were created using commands '''/score/''' in the macro '''proton.mac'''. The file '''DoseLongitudinalMesh.txt''' will be used later to compare with data from the Clatterbridge Cancer Center. Now, use script '''PlotLateralDoseMesh.C''' to plot the lateral dose distribution.
 +
Before running the script substitude the commas in '''DoseLateralMesh.txt''' with spaces. Remove also the header in the text file. Then, save the text file as '''DoseLateralMesh_Mod.txt'''.
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotLateralDoseMesh.C .
 +
 
 +
[username@plus1 ProtonPB_build]$ root -l
 +
 
 +
root [1] .x PlotLateralDoseMesh.C
 +
</pre> 
 +
 
 +
This will create '''LateralDose_Mesh.root''' file with the following plot:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/SimulationLateralMesh.png
 +
 
 +
=== <span style="color:#000080"> Run with different settings </span> ===
You can change the physics process, incident proton energy and number of slices etc. by
You can change the physics process, incident proton energy and number of slices etc. by
-
modifying the macro proton.mac. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. For example open the macro with editor '''pico''':
+
modifying the macro proton.mac. Open the macro with editor '''pico''':
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
pico proton.mac
+
[username@plus1 ProtonPB_build]$ pico proton.mac
</pre>   
</pre>   
-
This is what you will see:
+
This is the content of the macro:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
Line 199: Line 300:
/protonPB/det/setSizeX  4 cm
/protonPB/det/setSizeX  4 cm
/protonPB/det/setSizeYZ 4 cm
/protonPB/det/setSizeYZ 4 cm
-
/protonPB/det/setSliceSizeYZ 1 cm
+
/protonPB/det/setSliceSizeYZ 4 cm
-
/protonPB/det/sliceNumber 30
+
/protonPB/det/sliceNumber 50
#
#
# define longitudinal scoring mesh
# define longitudinal scoring mesh
Line 206: Line 307:
/score/create/boxMesh waterMeshlongitudinal
/score/create/boxMesh waterMeshlongitudinal
/score/mesh/boxSize 2. 2. 2. cm
/score/mesh/boxSize 2. 2. 2. cm
-
/score/mesh/nBin 30 1 1
+
/score/mesh/nBin 50 1 1
 +
/score/mesh/translate/xyz 0. 0. 0. cm
/score/quantity/energyDeposit energyDeposit  
/score/quantity/energyDeposit energyDeposit  
/score/quantity/doseDeposit doseDeposit
/score/quantity/doseDeposit doseDeposit
Line 214: Line 316:
# centered at the Bragg peak
# centered at the Bragg peak
/score/create/boxMesh waterMeshlateral
/score/create/boxMesh waterMeshlateral
-
/score/mesh/boxSize 1. 2. 2. cm
+
/score/mesh/boxSize 0.1 2. 2. cm
-
/score/mesh/nBin 1 30 1
+
/score/mesh/nBin 1 1 50
/score/mesh/translate/xyz 1.2 0. 0. cm
/score/mesh/translate/xyz 1.2 0. 0. cm
/score/quantity/energyDeposit energyDeposit  
/score/quantity/energyDeposit energyDeposit  
Line 235: Line 337:
# initialize
# initialize
/run/initialize
/run/initialize
 +
#
 +
# visualisation
 +
#/control/execute visualisation.mac
#
#
/gun/particle proton
/gun/particle proton
Line 256: Line 361:
# number of events
# number of events
/run/beamOn 6000
/run/beamOn 6000
 +
#
 +
# drawing projections
 +
#/score/drawProjection waterMeshlongitudinal doseDeposit
 +
#/score/drawProjection waterMeshlateral doseDeposit
 +
#
# dump scores to a file
# dump scores to a file
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt
Line 310: Line 420:
'''Change the number of slices'''
'''Change the number of slices'''
-
You can change the number of slices. The default number is 30. Keep in mind that  
+
You can change the number of slices. The default number is 50. Keep in mind that  
if you want to increase the number of slices you need to modify the file DetectorConstruction.hh in
if you want to increase the number of slices you need to modify the file DetectorConstruction.hh in
/ProtonPB_source/include/.
/ProtonPB_source/include/.
-
In DetectorConstruction.hh set MaxLayer to value bigger than the number of your slices. The default value is MaxLayer=40. For example, if you want to have 35 slices you do not need to modify MaxLayer. Then, only in proton.mac change the number of slices  
+
In DetectorConstruction.hh set MaxLayer to value bigger than the number of your slices. The default value is MaxLayer=60. For example, if you want to have 55 slices you do not need to modify MaxLayer. Then, only in proton.mac change the number of slices  
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
/protonPB/det/sliceNumber 35
+
/protonPB/det/sliceNumber 55
</pre>
</pre>
'''Modify the mesh'''
'''Modify the mesh'''
-
You can change the size of the mesh and the number of voxels by modifying  
+
You can change the size of the mesh (longitudinal and lateral) and the number of voxels by modifying their corresponding lines
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
Line 334: Line 444:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
./protonPB proton.mac
+
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac
</pre>
</pre>
   
   
-
If you modify files in directory ProtonPB_source (for example change the value of MaxLayer) you need to comppile the code. In directory PhotonPB_build do
+
If you modify files in directory ProtonPB_source (for example you change the value of MaxLayer) you need to comppile the code. In directory PhotonPB_build do
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
make  
+
[username@plus1 ProtonPB_build]$ make  
</pre>
</pre>
Line 347: Line 457:
=== <span style="color:#000080"> Visualisation </span> ===
=== <span style="color:#000080"> Visualisation </span> ===
-
== <span style="color:#000080"> Comparison with data from The Clatterbridge Cancer Centre </span> ==
+
If you want to use visualisation, in macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup.
 +
If you uncomment the lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections. In this example, we use '''DAWN''' event display. Before running the visualisation look at this [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].
 +
 
 +
To run the visualisation, first uncomment lines '''/control/execute visualisation.mac''' and '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Then, run the proton.mac
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac
 +
</pre>
 +
 
 +
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. The first file contains detector geometry and particle interactions. The second file contains dose projections. While running the proton.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.eps
 +
 
 +
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonPB_build]$ dawn g4_01.prim
 +
</pre>
 +
 
 +
In the opened window press OK and this will create the image:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_02_6000e.eps
 +
 
 +
You can modify the .prim files in DAWN. For example, in the DAWN display change the polar and azimuthal angles. 1) (polar angle, azimuthal angle) = (0,90) will create this image
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_01_6000e.eps
 +
 
 +
2) (polar angle, azimuthal angle) = (90,0) will create this image
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_04_6000e.eps
 +
 
 +
Now, in proton.mac macro uncomment '''/score/drawProjection waterMeshlateral doseDeposit''' and comment '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Run '''proton.mac''' with the new settings. The image with the lateral dose projections will look like that:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_03_6000e.eps   
 +
 
 +
== <span style="color:#000080"> Data from The Clatterbridge Cancer Centre </span> ==
 +
 
 +
This is [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/ClatterbridgeBraggPeak.txt data] from the Clatterbridge Cancer Center. The first column represents the values in mm in depth, the second column represents the normalized values of deposited dose and normalized at the peak. You can use script '''PlotData.C''' from folder'''RootScripts''' to plot the data. Copy files '''ClatterbridgeData.txt''' and '''PlotData.C''' to your current ProtonPB_build directory and run the script:
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotData.C .
 +
 
 +
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/ClatterbridgeData.txt .
 +
 
 +
[username@plus1 ProtonPB_build]$ root -l
 +
 
 +
root [1] .x PlotData.C
 +
</pre> 
 +
 
 +
This will create '''ClatterbridgeData.root''' file with the following plot:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/Clatterbridge.png
 +
 
 +
== <span style="color:#000080"> Comparison between data and simulation </span> ==
 +
 
 +
The scripts '''PlotDataAndSim.C''' and '''PlotDataAndSimMesh.C''' in folder '''RootScripts''' compare data with simulation.
 +
You can use script '''PlotDataAndSim.C''' to compare data (ClatterbridgeData.txt) and simulation ('''PlotDose.txt'''). Both text files must be in the folder where you run the script.
 +
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSim.C .
 +
 
 +
[username@plus1 ProtonPB_build]$ root -l
 +
 
 +
root [1] .x PlotDataAndSim.C
 +
</pre> 
 +
 
 +
This will create '''BraggPeakComparison.root''' file with the following plot:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulation.png
 +
 
 +
You can also compare data (ClatterbridgeData.txt) with simulation done with scoring mesh ('''DoseLongitudinalMesh.txt''').
 +
This can be done with script '''PlotDataAndSimMesh.C'''. This script works only if before running it you substitude the commas
 +
in '''DoseLongitudinalMesh.txt''' with spaces. Remove also the header in the text file. Save the new text file as '''DoseLongitudinalMesh_Mod.txt'''.
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSimMesh.C .
 +
 
 +
[username@plus1 ProtonPB_build]$ root -l
 +
 
 +
root [1] .x PlotDataAndSimMesh.C
 +
</pre> 
 +
 
 +
This creates '''BraggPeakComparison_Mesh.root''' file with the following plot:
-
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/ClatterbridgeBraggPeak.txt Data file]
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulationMesh.png
== <span style="color:#000080"> Files </span> ==
== <span style="color:#000080"> Files </span> ==
[[List of monoenergetic proton pencil beam files with brief description]]
[[List of monoenergetic proton pencil beam files with brief description]]

Latest revision as of 13:36, 10 September 2014

Personal tools