Monoenergetic photon pencil beam

From UCL HEP PBT Wiki

Jump to: navigation, search
m
 
Line 3: Line 3:
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. At each slice the deposited dose and energy is computed.  
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. 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'''. Photons are generated using '''G4ParticleGun''' class. There is an option to chose among several EM physics lists.
+
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Photons are generated using '''G4ParticleGun''' class. There is an option to chose among several '''EM''' physics lists.
-
== <span style="color:#000080"> Setting up the environment </span> ==
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png
-
; Connect to HEP cluster and create folder PhotonPBFolder in your area
+
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, electrons are in red.
 +
 
 +
== <span style="color:#000080"> How to run the tutorial </span> ==
 +
 
 +
; Connect to the HEP cluster and create folder PhotonPBFolder 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 PhotonPBFolder  
-
 
+
-
mkdir PhotonPBFolder  
+
-
cd PhotonPBFolder   
+
[username@plus1 ~]$ cd PhotonPBFolder   
</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 PhotonPBFolder]$ 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/PhotonPB .
+
[username@plus1 PhotonPBFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPB .
    
    
-
mv PhotonPB PhotonPB_source
+
[username@plus1 PhotonPBFolder]$ mv PhotonPB PhotonPB_source
</pre>
</pre>
-
 
-
== <span style="color:#000080"> How to run the code </span> ==
 
; Inside /home/username/PhotonPBFolder/ create a directory
; Inside /home/username/PhotonPBFolder/ create a directory
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
mkdir PhotonPB_build   
+
[username@plus1 PhotonPBFolder]$ mkdir PhotonPB_build   
</pre>
</pre>
Line 48: Line 46:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
cd PhotonPB_build  
+
[username@plus1 PhotonPBFolder]$ cd PhotonPB_build  
-
cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source  
+
[username@plus1 PhotonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source  
-
make   
+
[username@plus1 PhotonPB_build]$ make   
</pre>
</pre>
-
; Run macro gamma.mac. The macro generates 6000 events.
+
; Run macro gamma.mac  
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
./photonPB gamma.mac
+
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac
</pre>
</pre>
   
   
Line 72: Line 70:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
pico DoseFile.txt
+
[username@plus1 PhotonPB_build]$ pico DoseFile.txt
</pre>
</pre>
Line 179: Line 177:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
root -l Gamma.root
+
[username@plus1 PhotonPB_build]$ root -l Gamma.root
-
new TBrowser
+
root [1] new TBrowser
Select ROOT files and Gamma.root
Select ROOT files and Gamma.root
Line 199: Line 197:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
cp /home/username/PhotonPBFolder/PhotonPB_source/PlotSimulation.C .
+
[username@plus1 PhotonPB_build]$ cp /home/username/PhotonPBFolder/PhotonPB_source/PlotSimulation.C .
</pre>   
</pre>   
Line 205: Line 203:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
root -l  
+
[username@plus1 PhotonPB_build]$ root -l  
-
.x PlotSimulation.C
+
root [1] .x PlotSimulation.C
</pre>
</pre>
Line 214: Line 212:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
root -l Simulation.root
+
[username@plus1 PhotonPB_build]$ root -l Simulation.root
-
new TBrowser
+
root [1] new TBrowser
Select ROOT files and Gamma.root
Select ROOT files and Gamma.root
Line 225: Line 223:
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/DoseDeposition1.png   
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/DoseDeposition1.png   
-
=== <span style="color:#000080"> Changes in macro gamma.mac </span> ===
+
You can also plot the file '''PlotDose.txt''' using MATLAB. This software is installed on the plus1 cluster but using it via ssh is not recommended because it is slow. If you have MATLAB installed on your computer you can import the '''PlotDose.txt''' file and plot it. You can also use the MATLAB installed on the computers at the Science Library.
 +
Before proceeding with MATLAB you need to copy the text files from the cluster 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/PhotonPBFolder/PhotonPB_build/PlotDose.txt .
 +
</pre>
 +
 
 +
The file '''PlotDose.txt''' will be copied in your current directory. 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/PhotonPB/matlab0photon.png
 +
 
 +
=== <span style="color:#000080"> Run with different settings </span> ===
You can change the physics process, incident photon energy, phantom material, number of slices etc. by
You can change the physics process, incident photon energy, phantom material, number of slices etc. by
Line 231: Line 247:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
pico gamma.mac
+
[username@plus1 PhotonPB_build]$ pico gamma.mac
</pre>   
</pre>   
Line 414: Line 430:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
./photonPB gamma.mac
+
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac
</pre>
</pre>
Line 426: Line 442:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
./photonPB gamma.mac
+
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac
</pre>
</pre>
Line 436: Line 452:
<pre style="color: #800000; background-color: #dcdcdc">
<pre style="color: #800000; background-color: #dcdcdc">
-
dawn g4_01.prim
+
[username@plus1 PhotonPB_build]$ dawn g4_01.prim
</pre>
</pre>
In the DAWN display change the polar and azimuthal angles to 0 and 90 degrees, then press OK.  This will create the image:
In the DAWN display change the polar and azimuthal angles to 0 and 90 degrees, then press OK.  This will create the image:
-
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_02_6000e.eps
+
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_01_6000e.eps
The color in the images indicates the type of the particle. Photons are in green, electrons are in red and positrons are in cyan.  
The color in the images indicates the type of the particle. Photons are in green, electrons are in red and positrons are in cyan.  

Latest revision as of 13:31, 10 September 2014

Personal tools