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 classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and dose are scored using class '''G4ScoringManager''' by defining scoring mesh. 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>
Line 77: Line 75:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
pico DoseFile.txt
+
[username@plus1 ProtonGB_build]$ pico DoseFile.txt
</pre>  
</pre>  
Line 208: 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 217: 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   
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:  
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">
<pre style="color: #800000; background-color: #dcdcdc">
-
root -l  
+
[username@plus1 ProtonGB_build]$ root -l  
-
.x PlotSimulation.C
+
root [1] .x PlotSimulation.C
</pre>
</pre>
Line 235: Line 233:
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/Simulation1.png   
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/Simulation1.png   
-
=== <span style="color:#000080"> Changes in proton.mac </span> ===
+
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
Line 243: Line 273:
<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 351: Line 381:
You can modify '''proton.mac''' as it is done in the tutorial '''Monoenergetic proton pencil beam'''.   
You can modify '''proton.mac''' as it is done in the tutorial '''Monoenergetic proton pencil beam'''.   
-
In addition to that you can modify
+
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> ==
Line 361: Line 410:
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).
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/ClatterbridgeSimulation.png   
+
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