Software/Geant4/Tutorials/Basic/Several Proton Beams With Spread Out Bragg Peaks

From PBTWiki
< Software‎ | Geant4‎ | Tutorials‎ | Basic
Jump to navigation Jump to search

Introduction

This tutorial is based on the Monoenergetic Proton Pencil Beam example. The code run with several beam energies to produce spread out Bragg peak.

The water cube is divided into slices using class G4PVReplica. At each slice the deposited dose and energy for every energy beam is computed. The energy and the dose are scored using classes G4UserSteppingAction and G4UserRunAction. The proton beams are simulated using G4ParticleGun class. There is an option to chose among several EM and the QGSP_BIC_EMY physics lists.

This image shows only one proton beam energy. The water box is divided into slices using class G4PVReplica. Photons are in green, protons are in blue, neutrons are in yellow.

Running the Tutorial

All the source files for the tutorial can be found in http://www.hep.ucl.ac.uk/pbt/wikiData/code/ProtonSB/.

The corresponding data files are available from http://www.hep.ucl.ac.uk/pbt/wikiData/data/ProtonSB/.

Create folder ProtonSBFolder

ssh -X username@plus1.hep.ucl.ac.uk 

username@plus1.hep.ucl.ac.uk's password: type your password here

[username@plus1 ~]$ mkdir ProtonSBFolder 

[username@plus1 ~]$ cd ProtonSBFolder  

Setup Your Environment

[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/scripts/pbt.sh

Copy the Code to Your Working Directory and Rename It

[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .
  
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source

Create the Build Directory

[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  

Compile the Code with Make and Cmake

[username@plus1 PhotonSBFolder]$ cd ProtonSB_build 

[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source 

[username@plus1 ProtonSB_build]$ make  

Run Macro proton.mac

[username@plus1 ProtonSB_build]$ ./protonSB proton.mac

Analysing the Data

The code produces two text files DoseFile.txt and PlotDose.txt. The file DoseFile.txt contains energy and dose deposition for every layer and for every beam energy. The file PlotDose.txt contains only depth vs dose for each layer for every beam energy. These text files can be analyzed with MATLAB or ROOT.

Text files

This is the output from DoseFile.txt with proton beam energies 50, 52, 54 and 56 MeV. Use your favorite editor pico, vi, emacs etc to open text files. For example, open this text file with editor pico:

[username@plus1 ProtonPB_build]$ pico DoseFile.txt

DoseFile.txt

 Layers :	 x[mm]  	Edep 	Edep/Ebeam[%] 	Dose 	Dose/MaxDose[%]
 layer 1: 	0.8	6.14782 GeV	2.04927	7.69522e-07 Gy	17.9921	
 layer 2: 	1.6	6.3146 GeV	2.10487	7.90399e-07 Gy	18.4802	
 layer 3: 	2.4	6.408 GeV	2.136	8.02089e-07 Gy	18.7536	
 layer 4: 	3.2	6.57863 GeV	2.19288	8.23447e-07 Gy	19.2529	
 layer 5: 	4	6.67038 GeV	2.22346	8.34932e-07 Gy	19.5214	
 layer 6: 	4.8	6.83438 GeV	2.27813	8.55459e-07 Gy	20.0014	
 layer 7: 	5.6	7.01613 GeV	2.33871	8.78209e-07 Gy	20.5333	
 layer 8: 	6.4	7.13427 GeV	2.37809	8.92996e-07 Gy	20.879	
 layer 9: 	7.2	7.27016 GeV	2.42339	9.10006e-07 Gy	21.2768	
 layer 10: 	8	7.45719 GeV	2.48573	9.33417e-07 Gy	21.8241	
 layer 11: 	8.8	7.68621 GeV	2.56207	9.62083e-07 Gy	22.4943	
 layer 12: 	9.6	7.85903 GeV	2.61968	9.83715e-07 Gy	23.0001	
 layer 13: 	10.4	8.0806 GeV	2.69353	1.01145e-06 Gy	23.6486	
 layer 14: 	11.2	8.33342 GeV	2.77781	1.04309e-06 Gy	24.3885	
 layer 15: 	12	8.71141 GeV	2.9038	1.09041e-06 Gy	25.4947	
 layer 16: 	12.8	8.93703 GeV	2.97901	1.11865e-06 Gy	26.155	
 layer 17: 	13.6	9.3526 GeV	3.11753	1.17067e-06 Gy	27.3712	
 layer 18: 	14.4	9.6102 GeV	3.2034	1.20291e-06 Gy	28.1251	
 layer 19: 	15.2	10.1115 GeV	3.3705	1.26566e-06 Gy	29.5922	
 layer 20: 	16	10.7698 GeV	3.58995	1.34806e-06 Gy	31.5189	
 layer 21: 	16.8	11.4715 GeV	3.82383	1.43589e-06 Gy	33.5723	
 layer 22: 	17.6	12.3674 GeV	4.12247	1.54803e-06 Gy	36.1943	
 layer 23: 	18.4	13.507 GeV	4.50234	1.69067e-06 Gy	39.5295	
 layer 24: 	19.2	15.1418 GeV	5.04726	1.8953e-06 Gy	44.3137	
 layer 25: 	20	17.6389 GeV	5.87963	2.20786e-06 Gy	51.6218	
 layer 26: 	20.8	22.4892 GeV	7.4964	2.81497e-06 Gy	65.8166	
 layer 27: 	21.6	34.1695 GeV	11.3898	4.277e-06 Gy	100	
 layer 28: 	22.4	6.77518 GeV	2.25839	8.48049e-07 Gy	19.8281	
 layer 29: 	23.2	3.12365 MeV	0.00104122	3.90987e-10 Gy	0.00914163	
 layer 30: 	24	24.3735 keV	8.12451e-06	3.05083e-12 Gy	7.13312e-05	
 layer 31: 	24.8	93.0394 keV	3.10131e-05	1.16457e-11 Gy	0.000272288	
 layer 32: 	25.6	0 eV 	0	0 Gy	0	
 layer 33: 	26.4	185.76 keV	6.19199e-05	2.32515e-11 Gy	0.000543642	
 layer 34: 	27.2	157.02 keV	5.23402e-05	1.96543e-11 Gy	0.000459534	
 layer 35: 	28	22.6832 keV	7.56106e-06	2.83925e-12 Gy	6.63843e-05	
 layer 36: 	28.8	0 eV 	0	0 Gy	0	
 layer 37: 	29.6	0 eV 	0	0 Gy	0	
 layer 38: 	30.4	0 eV 	0	0 Gy	0	
 layer 39: 	31.2	0 eV 	0	0 Gy	0	
 layer 40: 	32	0 eV 	0	0 Gy	0	
 layer 41: 	32.8	0 eV 	0	0 Gy	0	
 layer 42: 	33.6	0 eV 	0	0 Gy	0	
 layer 43: 	34.4	0 eV 	0	0 Gy	0	
 layer 44: 	35.2	109.416 keV	3.64719e-05	1.36956e-11 Gy	0.000320215	
 layer 45: 	36	0 eV 	0	0 Gy	0	
 layer 46: 	36.8	0 eV 	0	0 Gy	0	
 layer 47: 	37.6	0 eV 	0	0 Gy	0	
 layer 48: 	38.4	9.96211 keV	3.3207e-06	1.24696e-12 Gy	2.9155e-05	
 layer 49: 	39.2	0 eV 	0	0 Gy	0	
 layer 50: 	40	0 eV 	0	0 Gy	0	


 The run consists of 6000 proton of 50 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided into 50 slices.

 Edep is the deposited energy in every slice.
 Total incident energy(Ebeam)= 300 GeV
 Total energy deposit= 296.909 GeV
 Dose is the deposited dose in every slice.
 MaxDose is the highest dose value from all slices.
 Layers :	 x[mm]  	Edep 	Edep/Ebeam[%] 	Dose 	Dose/MaxDose[%]
 layer 1: 	0.8	5.98064 GeV	1.91687	7.48597e-07 Gy	17.912	
 layer 2: 	1.6	6.04823 GeV	1.93854	7.57057e-07 Gy	18.1144	
 layer 3: 	2.4	6.16279 GeV	1.97525	7.71397e-07 Gy	18.4575	
 layer 4: 	3.2	6.30602 GeV	2.02116	7.89325e-07 Gy	18.8865	
 layer 5: 	4	6.40782 GeV	2.05379	8.02067e-07 Gy	19.1914	
 layer 6: 	4.8	6.55457 GeV	2.10082	8.20435e-07 Gy	19.6309	
 layer 7: 	5.6	6.74648 GeV	2.16233	8.44457e-07 Gy	20.2057	
 layer 8: 	6.4	6.84561 GeV	2.19411	8.56865e-07 Gy	20.5026	
 layer 9: 	7.2	7.03491 GeV	2.25478	8.8056e-07 Gy	21.0695	
 layer 10: 	8	7.16689 GeV	2.29708	8.9708e-07 Gy	21.4648	
 layer 11: 	8.8	7.27467 GeV	2.33163	9.10571e-07 Gy	21.7876	
 layer 12: 	9.6	7.44315 GeV	2.38562	9.31659e-07 Gy	22.2922	
 layer 13: 	10.4	7.68635 GeV	2.46357	9.62101e-07 Gy	23.0206	
 layer 14: 	11.2	7.90592 GeV	2.53395	9.89584e-07 Gy	23.6782	
 layer 15: 	12	8.08337 GeV	2.59082	1.0118e-06 Gy	24.2096	
 layer 16: 	12.8	8.40768 GeV	2.69477	1.05239e-06 Gy	25.1809	
 layer 17: 	13.6	8.60844 GeV	2.75912	1.07752e-06 Gy	25.7822	
 layer 18: 	14.4	8.87023 GeV	2.84302	1.11029e-06 Gy	26.5663	
 layer 19: 	15.2	9.25729 GeV	2.96708	1.15874e-06 Gy	27.7255	
 layer 20: 	16	9.66024 GeV	3.09623	1.20917e-06 Gy	28.9324	
 layer 21: 	16.8	10.137 GeV	3.24904	1.26885e-06 Gy	30.3603	
 layer 22: 	17.6	10.6283 GeV	3.4065	1.33034e-06 Gy	31.8316	
 layer 23: 	18.4	11.2959 GeV	3.62048	1.41391e-06 Gy	33.8311	
 layer 24: 	19.2	12.286 GeV	3.93782	1.53784e-06 Gy	36.7965	
 layer 25: 	20	13.4247 GeV	4.30278	1.68037e-06 Gy	40.2068	
 layer 26: 	20.8	15.05 GeV	4.82371	1.8838e-06 Gy	45.0745	
 layer 27: 	21.6	17.374 GeV	5.56859	2.1747e-06 Gy	52.035	
 layer 28: 	22.4	22.2033 GeV	7.11646	2.77919e-06 Gy	66.4989	
 layer 29: 	23.2	33.389 GeV	10.7016	4.17931e-06 Gy	100	
 layer 30: 	24	8.40699 GeV	2.69455	1.0523e-06 Gy	25.1789	
 layer 31: 	24.8	5.33026 MeV	0.00170842	6.67189e-10 Gy	0.0159641	
 layer 32: 	25.6	0 eV 	0	0 Gy	0	
 layer 33: 	26.4	0 eV 	0	0 Gy	0	
 layer 34: 	27.2	0 eV 	0	0 Gy	0	
 layer 35: 	28	2.07266 keV	6.64313e-07	2.59434e-13 Gy	6.20759e-06	
 layer 36: 	28.8	249.282 keV	7.98981e-05	3.12027e-11 Gy	0.000746599	
 layer 37: 	29.6	78.0821 keV	2.50263e-05	9.77353e-12 Gy	0.000233855	
 layer 38: 	30.4	0 eV 	0	0 Gy	0	
 layer 39: 	31.2	0 eV 	0	0 Gy	0	
 layer 40: 	32	0 eV 	0	0 Gy	0	
 layer 41: 	32.8	223.385 keV	7.15978e-05	2.79611e-11 Gy	0.000669037	
 layer 42: 	33.6	0 eV 	0	0 Gy	0	
 layer 43: 	34.4	0 eV 	0	0 Gy	0	
 layer 44: 	35.2	0 eV 	0	0 Gy	0	
 layer 45: 	36	0 eV 	0	0 Gy	0	
 layer 46: 	36.8	0 eV 	0	0 Gy	0	
 layer 47: 	37.6	0 eV 	0	0 Gy	0	
 layer 48: 	38.4	0 eV 	0	0 Gy	0	
 layer 49: 	39.2	0 eV 	0	0 Gy	0	
 layer 50: 	40	0 eV 	0	0 Gy	0	


 The run consists of 6000 proton of 52 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided into 50 slices.

 Edep is the deposited energy in every slice.
 Total incident energy(Ebeam)= 312 GeV
 Total energy deposit= 308.533 GeV
 Dose is the deposited dose in every slice.
 MaxDose is the highest dose value from all slices.
 Layers :	 x[mm]  	Edep 	Edep/Ebeam[%] 	Dose 	Dose/MaxDose[%]
 layer 1: 	0.8	5.87361 GeV	1.81284	7.352e-07 Gy	18.0985	
 layer 2: 	1.6	5.92284 GeV	1.82804	7.41362e-07 Gy	18.2501	
 layer 3: 	2.4	6.04424 GeV	1.86551	7.56558e-07 Gy	18.6242	
 layer 4: 	3.2	6.11372 GeV	1.88695	7.65254e-07 Gy	18.8383	
 layer 5: 	4	6.20213 GeV	1.91424	7.76321e-07 Gy	19.1107	
 layer 6: 	4.8	6.28211 GeV	1.93892	7.86332e-07 Gy	19.3572	
 layer 7: 	5.6	6.46409 GeV	1.99509	8.0911e-07 Gy	19.9179	
 layer 8: 	6.4	6.55832 GeV	2.02417	8.20906e-07 Gy	20.2083	
 layer 9: 	7.2	6.68291 GeV	2.06263	8.36501e-07 Gy	20.5922	
 layer 10: 	8	6.83398 GeV	2.10925	8.5541e-07 Gy	21.0577	
 layer 11: 	8.8	7.00147 GeV	2.16095	8.76374e-07 Gy	21.5738	
 layer 12: 	9.6	6.99665 GeV	2.15946	8.75771e-07 Gy	21.5589	
 layer 13: 	10.4	7.18837 GeV	2.21863	8.99769e-07 Gy	22.1497	
 layer 14: 	11.2	7.38262 GeV	2.27859	9.24082e-07 Gy	22.7482	
 layer 15: 	12	7.60591 GeV	2.3475	9.52032e-07 Gy	23.4362	
 layer 16: 	12.8	7.7884 GeV	2.40383	9.74874e-07 Gy	23.9985	
 layer 17: 	13.6	8.01411 GeV	2.47349	1.00313e-06 Gy	24.694	
 layer 18: 	14.4	8.27359 GeV	2.55358	1.03561e-06 Gy	25.4936	
 layer 19: 	15.2	8.4907 GeV	2.62059	1.06278e-06 Gy	26.1626	
 layer 20: 	16	8.73216 GeV	2.69511	1.093e-06 Gy	26.9066	
 layer 21: 	16.8	9.16414 GeV	2.82844	1.14708e-06 Gy	28.2376	
 layer 22: 	17.6	9.52408 GeV	2.93953	1.19213e-06 Gy	29.3467	
 layer 23: 	18.4	10.083 GeV	3.11203	1.26209e-06 Gy	31.0689	
 layer 24: 	19.2	10.4911 GeV	3.23799	1.31317e-06 Gy	32.3263	
 layer 25: 	20	11.2528 GeV	3.47307	1.40851e-06 Gy	34.6733	
 layer 26: 	20.8	12.0817 GeV	3.72891	1.51226e-06 Gy	37.2275	
 layer 27: 	21.6	13.2144 GeV	4.07852	1.65405e-06 Gy	40.7178	
 layer 28: 	22.4	14.7419 GeV	4.54996	1.84524e-06 Gy	45.4244	
 layer 29: 	23.2	17.0099 GeV	5.24998	2.12914e-06 Gy	52.4131	
 layer 30: 	24	21.4103 GeV	6.60812	2.67993e-06 Gy	65.972	
 layer 31: 	24.8	32.4536 GeV	10.0166	4.06222e-06 Gy	100	
 layer 32: 	25.6	12.4205 GeV	3.83349	1.55468e-06 Gy	38.2715	
 layer 33: 	26.4	23.8132 MeV	0.00734975	2.9807e-09 Gy	0.073376	
 layer 34: 	27.2	2.23159 MeV	0.000688763	2.79329e-10 Gy	0.00687625	
 layer 35: 	28	3.66756 MeV	0.00113196	4.59069e-10 Gy	0.0113009	
 layer 36: 	28.8	3.42644 MeV	0.00105754	4.28887e-10 Gy	0.0105579	
 layer 37: 	29.6	4.35785 MeV	0.00134502	5.45472e-10 Gy	0.0134279	
 layer 38: 	30.4	7.50143 MeV	0.00231526	9.38954e-10 Gy	0.0231143	
 layer 39: 	31.2	2.31629 MeV	0.000714905	2.8993e-10 Gy	0.00713724	
 layer 40: 	32	321.628 keV	9.9268e-05	4.02582e-11 Gy	0.00099104	
 layer 41: 	32.8	252.178 keV	7.78327e-05	3.15651e-11 Gy	0.000777041	
 layer 42: 	33.6	469.491 keV	0.000144905	5.87663e-11 Gy	0.00144665	
 layer 43: 	34.4	0 eV 	0	0 Gy	0	
 layer 44: 	35.2	0 eV 	0	0 Gy	0	
 layer 45: 	36	52.37 keV	1.61636e-05	6.55515e-12 Gy	0.000161369	
 layer 46: 	36.8	0 eV 	0	0 Gy	0	
 layer 47: 	37.6	2.81499 keV	8.68824e-07	3.52352e-13 Gy	8.67388e-06	
 layer 48: 	38.4	858.795 eV 	2.6506e-07	1.07495e-13 Gy	2.64622e-06	
 layer 49: 	39.2	597.285 keV	0.000184347	7.47622e-11 Gy	0.00184042	
 layer 50: 	40	0 eV 	0	0 Gy	0	


 The run consists of 6000 proton of 54 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided into 50 slices.

 Edep is the deposited energy in every slice.
 Total incident energy(Ebeam)= 324 GeV
 Total energy deposit= 320.045 GeV
 Dose is the deposited dose in every slice.
 MaxDose is the highest dose value from all slices.
 Layers :	 x[mm]  	Edep 	Edep/Ebeam[%] 	Dose 	Dose/MaxDose[%]
 layer 1: 	0.8	5.6427 GeV	1.67937	7.06297e-07 Gy	18.476	
 layer 2: 	1.6	5.72423 GeV	1.70364	7.16502e-07 Gy	18.743	
 layer 3: 	2.4	5.82339 GeV	1.73315	7.28915e-07 Gy	19.0676	
 layer 4: 	3.2	5.92663 GeV	1.76388	7.41837e-07 Gy	19.4057	
 layer 5: 	4	6.05828 GeV	1.80306	7.58315e-07 Gy	19.8367	
 layer 6: 	4.8	6.16405 GeV	1.83454	7.71554e-07 Gy	20.1831	
 layer 7: 	5.6	6.26561 GeV	1.86476	7.84267e-07 Gy	20.5156	
 layer 8: 	6.4	6.31228 GeV	1.87866	7.90109e-07 Gy	20.6684	
 layer 9: 	7.2	6.41373 GeV	1.90885	8.02807e-07 Gy	21.0006	
 layer 10: 	8	6.54286 GeV	1.94728	8.1897e-07 Gy	21.4234	
 layer 11: 	8.8	6.64689 GeV	1.97824	8.31991e-07 Gy	21.764	
 layer 12: 	9.6	6.8045 GeV	2.02515	8.5172e-07 Gy	22.2801	
 layer 13: 	10.4	6.84828 GeV	2.03818	8.572e-07 Gy	22.4235	
 layer 14: 	11.2	6.98713 GeV	2.0795	8.7458e-07 Gy	22.8781	
 layer 15: 	12	7.18446 GeV	2.13823	8.99279e-07 Gy	23.5242	
 layer 16: 	12.8	7.36162 GeV	2.19096	9.21455e-07 Gy	24.1043	
 layer 17: 	13.6	7.56269 GeV	2.2508	9.46622e-07 Gy	24.7626	
 layer 18: 	14.4	7.76989 GeV	2.31247	9.72557e-07 Gy	25.4411	
 layer 19: 	15.2	7.96003 GeV	2.36906	9.96357e-07 Gy	26.0637	
 layer 20: 	16	8.22125 GeV	2.4468	1.02905e-06 Gy	26.919	
 layer 21: 	16.8	8.51126 GeV	2.53311	1.06536e-06 Gy	27.8686	
 layer 22: 	17.6	8.84609 GeV	2.63277	1.10727e-06 Gy	28.9649	
 layer 23: 	18.4	9.05178 GeV	2.69398	1.13301e-06 Gy	29.6384	
 layer 24: 	19.2	9.44797 GeV	2.8119	1.1826e-06 Gy	30.9357	
 layer 25: 	20	9.85501 GeV	2.93304	1.23355e-06 Gy	32.2684	
 layer 26: 	20.8	10.4538 GeV	3.11126	1.30851e-06 Gy	34.2292	
 layer 27: 	21.6	11.0407 GeV	3.28594	1.38197e-06 Gy	36.1509	
 layer 28: 	22.4	11.917 GeV	3.54672	1.49165e-06 Gy	39.02	
 layer 29: 	23.2	13.059 GeV	3.8866	1.63459e-06 Gy	42.7592	
 layer 30: 	24	14.5231 GeV	4.32235	1.81786e-06 Gy	47.5532	
 layer 31: 	24.8	16.5962 GeV	4.93934	2.07734e-06 Gy	54.3412	
 layer 32: 	25.6	20.4144 GeV	6.07572	2.55528e-06 Gy	66.8433	
 layer 33: 	26.4	30.5407 GeV	9.0895	3.82278e-06 Gy	100	
 layer 34: 	27.2	17.7936 GeV	5.2957	2.22722e-06 Gy	58.2618	
 layer 35: 	28	279.605 MeV	0.0832157	3.49981e-08 Gy	0.915515	
 layer 36: 	28.8	3.4237 MeV	0.00101896	4.28545e-10 Gy	0.0112103	
 layer 37: 	29.6	7.30312 MeV	0.00217355	9.14132e-10 Gy	0.0239127	
 layer 38: 	30.4	945.375 keV	0.000281361	1.18333e-10 Gy	0.00309546	
 layer 39: 	31.2	100.804 keV	3.00012e-05	1.26176e-11 Gy	0.000330064	
 layer 40: 	32	8.90229 keV	2.64949e-06	1.1143e-12 Gy	2.91489e-05	
 layer 41: 	32.8	175.684 keV	5.2287e-05	2.19904e-11 Gy	0.000575246	
 layer 42: 	33.6	401.379 keV	0.000119458	5.02406e-11 Gy	0.00131424	
 layer 43: 	34.4	325.597 keV	9.69039e-05	4.0755e-11 Gy	0.00106611	
 layer 44: 	35.2	376.286 keV	0.00011199	4.70997e-11 Gy	0.00123208	
 layer 45: 	36	786.199 keV	0.000233988	9.84086e-11 Gy	0.00257427	
 layer 46: 	36.8	1.04863 MeV	0.000312093	1.31258e-10 Gy	0.00343356	
 layer 47: 	37.6	415.25 keV	0.000123586	5.19768e-11 Gy	0.00135966	
 layer 48: 	38.4	179.982 keV	5.35659e-05	2.25283e-11 Gy	0.000589317	
 layer 49: 	39.2	303.994 keV	9.04744e-05	3.8051e-11 Gy	0.000995374	
 layer 50: 	40	0 eV 	0	0 Gy	0	


 The run consists of 6000 proton of 56 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided into 50 slices.

 Edep is the deposited energy in every slice.
 Total incident energy(Ebeam)= 336 GeV
 Total energy deposit= 332.173 GeV
 Dose is the deposited dose in every slice.
 MaxDose is the highest dose value from all slices.

PlotDose.txt

The corresponding PlotDose.txt is:

0.8	17.9921	
1.6	18.4802	
2.4	18.7536	
3.2	19.2529	
4	19.5214	
4.8	20.0014	
5.6	20.5333	
6.4	20.879	
7.2	21.2768	
8	21.8241	
8.8	22.4943	
9.6	23.0001	
10.4	23.6486	
11.2	24.3885	
12	25.4947	
12.8	26.155	
13.6	27.3712	
14.4	28.1251	
15.2	29.5922	
16	31.5189	
16.8	33.5723	
17.6	36.1943	
18.4	39.5295	
19.2	44.3137	
20	51.6218	
20.8	65.8166	
21.6	100	
22.4	19.8281	
23.2	0.00914163	
24	7.13312e-05	
24.8	0.000272288	
25.6	0	
26.4	0.000543642	
27.2	0.000459534	
28	6.63843e-05	
28.8	0	
29.6	0	
30.4	0	
31.2	0	
32	0	
32.8	0	
33.6	0	
34.4	0	
35.2	0.000320215	
36	0	
36.8	0	
37.6	0	
38.4	2.9155e-05	
39.2	0	
40	0	
0.8	17.912	
1.6	18.1144	
2.4	18.4575	
3.2	18.8865	
4	19.1914	
4.8	19.6309	
5.6	20.2057	
6.4	20.5026	
7.2	21.0695	
8	21.4648	
8.8	21.7876	
9.6	22.2922	
10.4	23.0206	
11.2	23.6782	
12	24.2096	
12.8	25.1809	
13.6	25.7822	
14.4	26.5663	
15.2	27.7255	
16	28.9324	
16.8	30.3603	
17.6	31.8316	
18.4	33.8311	
19.2	36.7965	
20	40.2068	
20.8	45.0745	
21.6	52.035	
22.4	66.4989	
23.2	100	
24	25.1789	
24.8	0.0159641	
25.6	0	
26.4	0	
27.2	0	
28	6.20759e-06	
28.8	0.000746599	
29.6	0.000233855	
30.4	0	
31.2	0	
32	0	
32.8	0.000669037	
33.6	0	
34.4	0	
35.2	0	
36	0	
36.8	0	
37.6	0	
38.4	0	
39.2	0	
40	0	
0.8	18.0985	
1.6	18.2501	
2.4	18.6242	
3.2	18.8383	
4	19.1107	
4.8	19.3572	
5.6	19.9179	
6.4	20.2083	
7.2	20.5922	
8	21.0577	
8.8	21.5738	
9.6	21.5589	
10.4	22.1497	
11.2	22.7482	
12	23.4362	
12.8	23.9985	
13.6	24.694	
14.4	25.4936	
15.2	26.1626	
16	26.9066	
16.8	28.2376	
17.6	29.3467	
18.4	31.0689	
19.2	32.3263	
20	34.6733	
20.8	37.2275	
21.6	40.7178	
22.4	45.4244	
23.2	52.4131	
24	65.972	
24.8	100	
25.6	38.2715	
26.4	0.073376	
27.2	0.00687625	
28	0.0113009	
28.8	0.0105579	
29.6	0.0134279	
30.4	0.0231143	
31.2	0.00713724	
32	0.00099104	
32.8	0.000777041	
33.6	0.00144665	
34.4	0	
35.2	0	
36	0.000161369	
36.8	0	
37.6	8.67388e-06	
38.4	2.64622e-06	
39.2	0.00184042	
40	0	
0.8	18.476	
1.6	18.743	
2.4	19.0676	
3.2	19.4057	
4	19.8367	
4.8	20.1831	
5.6	20.5156	
6.4	20.6684	
7.2	21.0006	
8	21.4234	
8.8	21.764	
9.6	22.2801	
10.4	22.4235	
11.2	22.8781	
12	23.5242	
12.8	24.1043	
13.6	24.7626	
14.4	25.4411	
15.2	26.0637	
16	26.919	
16.8	27.8686	
17.6	28.9649	
18.4	29.6384	
19.2	30.9357	
20	32.2684	
20.8	34.2292	
21.6	36.1509	
22.4	39.02	
23.2	42.7592	
24	47.5532	
24.8	54.3412	
25.6	66.8433	
26.4	100	
27.2	58.2618	
28	0.915515	
28.8	0.0112103	
29.6	0.0239127	
30.4	0.00309546	
31.2	0.000330064	
32	2.91489e-05	
32.8	0.000575246	
33.6	0.00131424	
34.4	0.00106611	
35.2	0.00123208	
36	0.00257427	
36.8	0.00343356	
37.6	0.00135966	
38.4	0.000589317	
39.2	0.000995374	
40	0

Root file

You can use script PlotSimulation.C to plot the spread out Bragg peak. The script uses PlotDose.txt. Copy the script to your current ProtonSB_build directory:

cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .

Then, run the script:

[username@plus1 ProtonSB_build]$ root -l 

root [1] .x PlotSimulation.C

This will create SOBP.root file with the following plot:

Run with different settings

You can change the physics process, incident proton beam energies, number of slices etc. by modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:

# proton.mac
#
/control/verbose 2
/run/verbose 2
/tracking/verbose 0
/run/particle/verbose 1
/run/particle/dumpList
#
# set geometry
/protonSB/det/setSizeX  4 cm
/protonSB/det/setSizeYZ 4 cm
/protonSB/det/setSliceSizeYZ 4 cm
/protonSB/det/sliceNumber 50
#
# set physics process
/protonSB/phys/addPhysics QGSP_BIC_EMY
#/protonSB/phys/addPhysics emlivermore
#/protonSB/phys/addPhysics empenelope
#
# production tresholds (recommended range
#cut off not bigger than 10% of slice thickness)
/protonSB/phys/setCuts 0.2 mm
#/protonSB/phys/setGCut 1 um
#/protonSB/phys/setECut 1 um
#/protonSB/phys/setPCut 1 um
#
# initialize
/run/initialize
#
# visualisation
#/control/execute visualisation.mac
#
/control/loop protonLoop.mac ene 50 56 2

This is the content of protonLoop.mac:

# protonLoop.mac
#
/gun/particle proton
# particle energy
/gun/energy {ene} MeV
#
# beam size
#/photonSB/gun/rndm 3 mm
#
# step limit (recommended not bigger than 5% of
# slice thickness)
/protonSB/stepMax 0.1 mm
#
/protonSB/event/printModulo 50
#
# number of events
/run/beamOn 6000
#

Changing the Beam Energies

You can change the proton beam energies by modifying this line in proton.mac:

/control/loop protonLoop.mac ene 50 56 2

where "50" is the initial value, "56" is the final value and "2" is the step size in MeV.

Visualisation

If you want to use visualisation (with DAWN), in macro proton.mac uncomment line #/control/execute visualisation.mac. Then, run the code. You will have four images from the four proton beams.

Protons are in blue, neutrons are in yellow, photons are in green.

50 MeV Proton Energy

52 MeV Proton Energy

54 MeV Proton Energy

56 MeV Proton Energy

Files

List of files for Several Proton Beams With Spread Out Bragg Peaks simulation.