Proton beam with realistic geometry

From UCL HEP PBT Wiki

Jump to: navigation, search
m
 
Line 1: Line 1:
== <span style="color:#000080"> Introduction </span> ==
== <span style="color:#000080"> Introduction </span> ==
-
This example shows the dose distribution in water along the incident proton beam. This example is very similar to the monoenergetic proton pencil beam example. The difference is that the beam is defined with realistic geometry. For the generation of the proton beam instead of particle gun, we use general particle source. For more details about '''G4GeneralParticleSource''' class look [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch02s07.html here].  
+
This example shows the dose distribution in water along the incident proton beam. This example is very similar to the monoenergetic proton pencil beam example. The difference is that the beam is defined with realistic geometry. For the generation of the proton beam, instead of particle gun, we use general particle source. For more details about '''G4GeneralParticleSource''' class look [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch02s07.html here].  
-
The volume of the water cube is divided into slices perpendicular to the incident beam. The slices are created using class '''G4PVReplica'''. The energy and dose are scored using user defined classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. There is an option to chose among several EM and '''QGSP_BIC_EMY''' physics lists.   
+
The volume of the water cube is divided into slices perpendicular to the incident beam. The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining a scoring mesh. 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/ProtonGB/g4_00_6000e.png
-
; Connect to HEP cluster and create folder ProtonGBFolder in your area
+
The image shows the water box divided into slices using class '''G4PVReplica'''. Protons are in blue, photons are in green. This tutorial is very similar to the [[Monoenergetic proton pencil beam]] tutorial. It is recommended to follow that tutorial first because some steps are similar. 
 +
 
 +
== <span style="color:#000080"> How to run the tutorial </span> ==
 +
 
 +
; Connect to the HEP cluster and create folder ProtonGBFolder 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/
+
[username@plus1 ~]$ mkdir ProtonGBFolder
-
mkdir ProtonGBFolder
+
[username@plus1 ~]$ cd ProtonGBFolder   
-
 
+
-
cd ProtonGBFolder   
+
</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 PhotonGBFolder]$ 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/ProtonGB .
+
[username@plus1 PhotonGBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonGB .
    
    
-
mv ProtonGB ProtonGB_source
+
[username@plus1 PhotonGBFolder]$ mv ProtonGB ProtonGB_source
</pre>
</pre>
-
 
-
== <span style="color:#000080"> How to run the code </span> ==
 
; Inside /home/username/ProtonGBFolder/ create a directory
; Inside /home/username/ProtonGBFolder/ create a directory
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
mkdir ProtonGB_build   
+
[username@plus1 PhotonGBFolder]$ mkdir ProtonGB_build   
</pre>
</pre>
Line 48: Line 46:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
cd ProtonGB_build  
+
[username@plus1 PhotonGBFolder]$ cd ProtonGB_build  
-
cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonGBFolder/ProtonGB_source  
+
[username@plus1 ProtonGB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonGBFolder/ProtonGB_source  
-
make   
+
[username@plus1 ProtonGB_build]$ make   
</pre>
</pre>
-
; Run macro proton.mac.
+
; Run macro proton.mac
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
./protonGB proton.mac
+
[username@plus1 ProtonGB_build]$ ./protonGB proton.mac
</pre>
</pre>
== <span style="color:#000080"> How to analyze data </span> ==
== <span style="color:#000080"> How to analyze data </span> ==
-
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 two text files '''DoseFile.txt''' and '''PlotDose.txt'''. 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.
+
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 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 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 an example output for '''DoseFile.txt''' with physics process '''QGSP_BIC_EMY''' and incident proton energy of '''62 MeV'''.
This is an example output for '''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. Now, open the text file '''DoseFile.txt''':
 +
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonGB_build]$ pico DoseFile.txt
 +
</pre>
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
  Layers x[mm] Edep   Edep/Ebeam[%]   Dose       Dose/MaxDose[%]
+
  Layers x[mm]   Edep     Edep/Ebeam[%] Dose Dose/MaxDose[%]
-
  layer 1: 1.33333 8.83908 GeV 2.376 1.062e-05 Gy 21.88
+
  layer 1: 0.8 5.20624 GeV 1.399 6.517e-07 Gy 18.49
-
  layer 2: 2.667 8.928 GeV 2.4 1.073e-05 Gy 22.11
+
layer 2: 1.6 5.255 GeV 1.413 6.578e-07 Gy 18.67
-
  layer 3: 4 9.214 GeV 2.477 1.107e-05 Gy 22.81
+
  layer 3: 2.4 5.349 GeV 1.438 6.696e-07 Gy 19
-
  layer 4: 5.333 9.468 GeV 2.545 1.138e-05 Gy 23.44
+
layer 4: 3.2 5.464 GeV 1.469 6.839e-07 Gy 19.41
-
  layer 5: 6.667 9.577 GeV 2.575 1.151e-05 Gy 23.71
+
layer 5: 4 5.533 GeV 1.487 6.926e-07 Gy 19.66
-
  layer 6: 8 9.767 GeV 2.626 1.174e-05 Gy 24.18
+
  layer 6: 4.8 5.546 GeV 1.491 6.942e-07 Gy 19.7
-
  layer 7: 9.333 10 GeV         2.689 1.202e-05 Gy 24.77
+
layer 7: 5.6 5.592 GeV 1.503 7e-07 Gy 19.87
-
  layer 8: 10.67 10.27 GeV 2.761 1.234e-05 Gy 25.43
+
  layer 8: 6.4 5.586 GeV 1.502 6.993e-07 Gy 19.84
-
  layer 9: 12 10.48 GeV 2.817 1.259e-05 Gy 25.94
+
layer 9: 7.2 5.748 GeV 1.545 7.194e-07 Gy 20.42
-
  layer 10: 13.33 10.79 GeV 2.901 1.297e-05 Gy 26.72
+
layer 10: 8 5.827 GeV 1.566 7.293e-07 Gy 20.7
-
  layer 11: 14.67 11.11 GeV 2.986 1.335e-05 Gy 27.5
+
  layer 11: 8.8 5.922 GeV 1.592 7.412e-07 Gy 21.04
-
  layer 12: 16 11.58 GeV 3.114 1.392e-05 Gy 28.68
+
layer 12: 9.6 5.949 GeV 1.599 7.446e-07 Gy 21.13
-
  layer 13: 17.33 12.04 GeV 3.236 1.447e-05 Gy 29.81
+
layer 13: 10.4 6.05 GeV 1.626 7.573e-07 Gy 21.49
-
  layer 14: 18.67 12.4 GeV 3.334 1.49e-05 Gy 30.7
+
layer 14: 11.2 6.195 GeV 1.665 7.755e-07 Gy 22.01
-
  layer 15: 20 12.98 GeV 3.489 1.56e-05 Gy 32.14
+
  layer 15: 12 6.306 GeV 1.695 7.894e-07 Gy 22.4
-
  layer 16: 21.33 13.67 GeV 3.675 1.643e-05 Gy 33.84
+
layer 16: 12.8 6.365 GeV 1.711 7.967e-07 Gy 22.61
-
  layer 17: 22.67 14.39 GeV 3.868 1.729e-05 Gy 35.63
+
layer 17: 13.6 6.499 GeV 1.747 8.135e-07 Gy 23.09
-
  layer 18: 24 15.4 GeV 4.139 1.85e-05 Gy 38.12
+
  layer 18: 14.4 6.634 GeV 1.783 8.303e-07 Gy 23.56
-
  layer 19: 25.33 16.57 GeV 4.454 1.991e-05 Gy 41.02
+
layer 19: 15.2 6.731 GeV 1.809 8.425e-07 Gy 23.91
-
  layer 20: 26.67 18.19 GeV 4.89 2.186e-05 Gy 45.04
+
  layer 20: 16 6.915 GeV 1.859 8.655e-07 Gy 24.56
-
  layer 21: 28 20.69 GeV 5.562 2.486e-05 Gy 51.22
+
layer 21: 16.8 7.099 GeV 1.908 8.886e-07 Gy 25.22
-
  layer 22: 29.33 24.52 GeV 6.592 2.946e-05 Gy 60.71
+
  layer 22: 17.6 7.168 GeV 1.927 8.972e-07 Gy 25.46
-
  layer 23: 30.67 33.19 GeV 8.922 3.988e-05 Gy 82.17
+
layer 23: 18.4 7.301 GeV 1.963 9.138e-07 Gy 25.93
-
  layer 24: 32 40.39 GeV 10.86 4.853e-05 Gy 100
+
  layer 24: 19.2 7.593 GeV 2.041 9.505e-07 Gy 26.97
-
  layer 25: 33.33 3.536 GeV 0.9507 4.249e-06 Gy 8.756
+
  layer 25: 20 7.718 GeV 2.075 9.66e-07 Gy 27.42
-
  layer 26: 34.67 1.466 MeV 0.0003942 1.762e-09 Gy 0.00363
+
  layer 26: 20.8 7.952 GeV 2.138 9.954e-07 Gy 28.25
-
  layer 27: 36 10.16 MeV 0.002731 1.221e-08 Gy 0.02515
+
  layer 27: 21.6 8.149 GeV 2.191 1.02e-06 Gy 28.95
-
  layer 28: 37.33 126 keV         3.387e-05 1.514e-10 Gy 0.0003119
+
  layer 28: 22.4 8.446 GeV 2.27 1.057e-06 Gy 30
-
  layer 29: 38.67 18.63 keV 5.009e-06 2.239e-11 Gy 4.613e-05
+
layer 29: 23.2 8.784 GeV 2.361 1.1e-06 Gy 31.2
-
  layer 30: 40 0 eV         0           0 Gy 0
+
  layer 30: 24 9.082 GeV 2.441 1.137e-06 Gy 32.26
 +
  layer 31: 24.8 9.47 GeV 2.546 1.185e-06 Gy 33.64
 +
  layer 32: 25.6 9.929 GeV 2.669 1.243e-06 Gy 35.27
 +
  layer 33: 26.4 10.54 GeV 2.833 1.319e-06 Gy 37.44
 +
  layer 34: 27.2 11.25 GeV 3.023 1.408e-06 Gy 39.95
 +
  layer 35: 28 12.11 GeV 3.256 1.516e-06 Gy 43.03
 +
  layer 36: 28.8 13.21 GeV 3.55 1.653e-06 Gy 46.91
 +
  layer 37: 29.6 14.65 GeV 3.938 1.834e-06 Gy 52.05
 +
layer 38: 30.4 16.98 GeV 4.564 2.125e-06 Gy 60.31
 +
  layer 39: 31.2 21.42 GeV 5.759 2.682e-06 Gy 76.1
 +
  layer 40: 32 28.15 GeV 7.567 3.524e-06 Gy 100
 +
  layer 41: 32.8 15.14 GeV 4.07 1.895e-06 Gy 53.78
 +
layer 42: 33.6 1.256 GeV 0.3376 1.572e-07 Gy 4.462
 +
  layer 43: 34.4 18.93 MeV 0.005087  2.369e-09 Gy 0.06723
 +
  layer 44: 35.2 597.5 keV 0.0001606 7.479e-11 Gy 0.002122
 +
  layer 45: 36 665.8 keV 0.000179  8.334e-11 Gy 0.002365
 +
layer 46: 36.8 130.1 keV 3.498e-05 1.629e-11 Gy 0.0004623
 +
  layer 47: 37.6 457.2 keV 0.0001229  5.722e-11 Gy 0.001624
 +
layer 48: 38.4 247.8 keV 6.661e-05  3.102e-11 Gy 0.0008802
 +
layer 49: 39.2 236.6 keV 6.361e-05 2.962e-11 Gy 0.0008406
 +
  layer 50: 40 0 eV 0 0 Gy 0
-
  The run consists of 6000  protons of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided into 30 slices.
+
  The run consists of 6000  protons 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= 366.6 GeV
+
  Total energy deposit= 367.3 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 115: Line 145:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
1.33333 21.8846
+
0.8 18.4941
-
2.66667 22.106
+
1.6 18.668
-
4 22.8118
+
2.4 19.0022
-
5.33333 23.4411
+
3.2 19.4096
-
6.66667 23.7111
+
4 19.6559
-
8 24.1827
+
4.8 19.7012
-
9.33333 24.7673
+
5.6 19.8661
-
10.6667 25.4289
+
6.4 19.8446
-
12 25.9402
+
7.2 20.4168
-
13.3333 26.7199
+
8 20.6987
-
14.6667 27.4969
+
8.8 21.0351
-
16 28.681
+
9.6 21.1327
-
17.3333 29.8068
+
10.4 21.493
-
18.6667 30.704
+
11.2 22.0079
-
20 32.136
+
12 22.4025
-
21.3333 33.8436
+
12.8 22.6104
-
22.6667 35.6258
+
13.6 23.0872
-
24 38.1195
+
14.4 23.5642
-
25.3333 41.0227
+
15.2 23.9102
-
26.6667 45.0388
+
16 24.564
-
28 51.2228
+
16.8 25.2168
-
29.3333 60.709
+
17.6 25.4611
-
30.6667 82.172
+
18.4 25.9348
 +
19.2 26.9738
 +
20 27.4152
 +
20.8 28.2496
 +
21.6 28.9492
 +
22.4 30.0033
 +
23.2 31.2049
 +
24 32.2636
 +
24.8 33.6414
 +
25.6 35.2707
 +
26.4 37.4412
 +
27.2 39.9539
 +
28 43.0264
 +
28.8 46.9139
 +
29.6 52.0461
 +
30.4 60.3067
 +
31.2 76.1028
32 100
32 100
-
33.3333 8.75568
+
32.8 53.7805
-
34.6667 0.00363025
+
33.6 4.46152
-
36 0.0251539
+
34.4 0.0672278
-
37.3333 0.000311934
+
35.2 0.00212242
-
38.6667 4.61342e-05
+
36 0.00236509
 +
36.8 0.000462313
 +
37.6 0.00162397
 +
38.4 0.00088024
 +
39.2 0.000840567
40 0
40 0
</pre>  
</pre>  
 +
 +
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/DoseLongitudinalMesh.txt '''DoseLongitudinalMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/EnergyLongitudinalMesh.txt '''EnergyLongitudinalMesh.txt'''] contain information about the dose and energy deposition in 50 voxels along the beam. 
 +
 +
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/DoseLateralMesh.txt '''DoseLateralMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/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 152: Line 206:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
root -l Proton.root
+
[username@plus1 ProtonGB_build]$ root -l Proton.root
-
new TBrowser
+
root [1] new TBrowser
Select ROOT Files and Proton.root
Select ROOT Files and Proton.root
Line 161: Line 215:
<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/ProtonGB/BraggPeak_GB.png  
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/BraggPeak_GB1.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/ProtonGB/BraggPeak_GBzoom.png   
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/BraggPeak_GBzoom1.png   
-
=== <span style="color:#000080"> Changes in proton.mac </span> ===
+
You can use script '''PlotSimulation.C''' from folder '''RootScripts''' to plot the dose deposition along the absorber. This script uses '''PlotDose.txt'''. Copy the script from '''/ProtonGB_source/RootScripts/''' to your build directory as it was done in the '''Monoenergetic proton pencil beam''' tutorial and run it:
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonGB_build]$ root -l
 +
 
 +
root [1] .x PlotSimulation.C
 +
</pre>
 +
 
 +
This will create root file with the following plot:
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/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/ProtonGBFolder/ProtonGB_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/ProtonGB/matlab2protonreal.png
 +
 
 +
Similarly to the previous tutorial you can 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.
 +
 
 +
<pre style="color: #800000; background-color: #dcdcdc">
 +
[username@plus1 ProtonGB_build]$ cp /home/username/ProtonGBFolder/ProtonGB_source/RootScripts/PlotLateralDoseMesh.C .
 +
 
 +
[username@plus1 ProtonGB_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/ProtonGB/SimulationLateralMesh.png
 +
 
 +
=== <span style="color:#000080"> Run with different settings </span> ===
You can change the physics process, incident proton energy and number of slices by
You can change the physics process, incident proton energy and number of slices by
-
modifying the macro proton.mac. In addition, you can configure the particle source by using '''/gps/''' commands. The beam characteristics used in this macro are similar to the ones used at the Laboratori Nazionali del Sud (INFN) in Catania, Italy. The proton beam has Guassian energy distribution. Have a look [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch02s07.html here] to learn more about the /gps/ commands.  
+
modifying the macro proton.mac. In addition, you can configure the particle source by using '''/gps/''' commands. The beam characteristics used in this macro are similar to the ones used at the Laboratori Nazionali del Sud (INFN) in Catania, Italy and the Clatterbridge Cancer Center(energy distribution is similar). The proton beam has Guassian energy distribution. [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch02s07.html Here] you can learn more about the different /gps/ commands.  
-
Now, use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open the macro proton.mac:
+
Open the macro proton.mac:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
pico proton.mac
+
[username@plus1 ProtonGB_build]$ pico proton.mac
</pre>   
</pre>   
Line 192: Line 290:
/protonGB/det/setSizeX  4 cm
/protonGB/det/setSizeX  4 cm
/protonGB/det/setSizeYZ 4 cm
/protonGB/det/setSizeYZ 4 cm
-
/protonGB/det/setSliceSizeYZ 1 cm
+
/protonGB/det/setSliceSizeYZ 4 cm
-
/protonGB/det/sliceNumber 30
+
/protonGB/det/sliceNumber 50
 +
#
 +
# define longitudinal scoring mesh
 +
# along the beam
 +
/score/create/boxMesh waterMeshlongitudinal
 +
/score/mesh/boxSize 2. 2. 2. cm
 +
/score/mesh/nBin 50 1 1
 +
/score/mesh/translate/xyz 0. 0. 0. cm
 +
/score/quantity/energyDeposit energyDeposit
 +
/score/quantity/doseDeposit doseDeposit
 +
/score/close
 +
#
 +
# define lateral scoring mesh
 +
# centered at the Bragg peak
 +
/score/create/boxMesh waterMeshlateral
 +
/score/mesh/boxSize 0.1 2. 2. cm
 +
/score/mesh/nBin 1 1 50
 +
/score/mesh/translate/xyz 1.2 0. 0. cm
 +
/score/quantity/energyDeposit energyDeposit
 +
/score/quantity/doseDeposit doseDeposit
 +
/score/close
#
#
# set physics process
# set physics process
Line 209: Line 327:
# initialize
# initialize
/run/initialize
/run/initialize
 +
#
 +
# visualisation
 +
#/control/execute visualisation.mac
#
#
# General particle source
# General particle source
# proton circle source   
# proton circle source   
/gps/pos/shape Circle
/gps/pos/shape Circle
-
/gps/pos/centre -4. 0. 0. cm
+
/gps/pos/centre -2. 0. 0. cm
/gps/pos/radius 0. mm
/gps/pos/radius 0. mm
/gps/pos/sigma_r 2. mm
/gps/pos/sigma_r 2. mm
Line 248: Line 369:
/run/beamOn 6000
/run/beamOn 6000
#
#
 +
# drawing projections
 +
#/score/drawProjection waterMeshlongitudinal doseDeposit
 +
#/score/drawProjection waterMeshlateral doseDeposit
 +
 +
# dump scores to a file
 +
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt
 +
/score/dumpQuantityToFile waterMeshlongitudinal energyDeposit EnergyLongitudinalMesh.txt
 +
/score/dumpQuantityToFile waterMeshlateral doseDeposit DoseLateralMesh.txt
 +
/score/dumpQuantityToFile waterMeshlateral energyDeposit EnergyLateralMesh.txt
</pre>
</pre>
 +
 +
You can modify '''proton.mac''' as it is done in the tutorial '''Monoenergetic proton pencil beam'''. 
 +
In addition to that you can modify the beam characteristics via commands '''/score/''' and visualise their effect. How to run visualisation is explained in the next section.
=== <span style="color:#000080"> Visualisation </span> ===
=== <span style="color:#000080"> Visualisation </span> ===
 +
 +
In macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup.
 +
The lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections in longitudinal and lateral directions.
 +
 +
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 ProtonGB_build]$ ./protonGB 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, '''g4_00.prim''', contains detector geometry and particle interactions:
 +
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_00_6000e.eps
 +
 +
The second file, '''g4_01.prim''' contains dose projections in longitudinal direction:
 +
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_01_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/ProtonGB/g4_02_6000e.eps 
== <span style="color:#000080"> Comparison with data from The Clatterbridge Cancer Centre </span> ==
== <span style="color:#000080"> Comparison with data from The Clatterbridge Cancer Centre </span> ==
-
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/ClatterbridgeBraggPeak.txt Data file]
+
Compare simulation with data using ROOT macros in folder '''RootScripts'''. These scripts are similar to the ones used in the tutorial '''Monoenergetic proton pencil beam'''. For example, by using '''PlotDataAndSim.C''' you can compare proton data from Clatterbridge with simulation (PlotDose.txt).
 +
 
 +
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/ClatterbridgeSimulation1.png 
== <span style="color:#000080"> Files </span> ==
== <span style="color:#000080"> Files </span> ==
[[List of proton beam with realistic geometry files with brief description]]
[[List of proton beam with realistic geometry files with brief description]]

Latest revision as of 13:35, 10 September 2014

Personal tools