Monoenergetic photon 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 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.
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png
-
== <span style="color:#000080"> Setting up the environment </span> ==
+
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, electrons are in red.
-
; Connect to HEP cluster and create folder PhotonPBFolder in your area
+
== <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
 +
 +
[username@plus1 ~]$ mkdir PhotonPBFolder
-
cd /home/username/
+
[username@plus1 ~]$ cd PhotonPBFolder   
-
 
+
-
mkdir PhotonPBFolder
+
-
 
+
-
cd PhotonPBFolder   
+
</pre>
</pre>
Line 26: 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 50: 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 74: 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 181: 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 201: 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 207: 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 216: 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 227: 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 233: 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 416: 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 428: 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 438: 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>

Latest revision as of 13:31, 10 September 2014

Personal tools