<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?feed=atom&amp;target=IlinaMediaWiki&amp;title=Special%3AContributions%2FIlinaMediaWiki</id>
		<title>UCL HEP PBT Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?feed=atom&amp;target=IlinaMediaWiki&amp;title=Special%3AContributions%2FIlinaMediaWiki"/>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Special:Contributions/IlinaMediaWiki"/>
		<updated>2026-05-13T00:17:19Z</updated>
		<subtitle>From UCL HEP PBT Wiki</subtitle>
		<generator>MediaWiki 1.16.5</generator>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2016-02-16T19:56:26Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. &lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water from several incident monoenergetic proton beams.  &lt;br /&gt;
* [[Electron beam using phase-space files]] is a simple code which shows the dose deposition in water along the incident electron beam using phase-space data files.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2016-02-16T19:56:12Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. 888888&lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water from several incident monoenergetic proton beams.  &lt;br /&gt;
* [[Electron beam using phase-space files]] is a simple code which shows the dose deposition in water along the incident electron beam using phase-space data files.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files</id>
		<title>Electron beam using phase-space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files"/>
				<updated>2014-09-12T12:31:35Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident electron beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The electron beam is generated using '''Varian Clinac 2100 C/D''' [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ElectronPHSP/phase-spacedata.txt phase-space data] files. You can find more information about phase-space data at the [https://www-nds.iaea.org/phsp/phsp.htmlx IAEA website]. [https://www-nds.iaea.org/phsp/electron1/VarianClinac_2100CD-readme.pdf Here] you can read more about the '''Varian Clinac 2100 C/D''' electron beam. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ElectronPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ElectronPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ElectronPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/ElectronPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mv ElectronPHS ElectronPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ElectronPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mkdir ElectronPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cd ElectronPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ElectronPHSPFolder &lt;br /&gt;
/ElectronPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro electron.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ ./electronPHSP electron.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files</id>
		<title>Electron beam using phase-space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files"/>
				<updated>2014-09-11T14:34:17Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident electron beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The electron beam is generated using '''Varian Clinac 2100 C/D''' [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ElectronPHSP/phase-spacedata.txt phase-space data] files. You can find more information about phase-space data at the [https://www-nds.iaea.org/phsp/phsp.htmlx IAEA website]. [https://www-nds.iaea.org/phsp/electron1/VarianClinac_2100CD-readme.pdf Here] you can read more about the '''Varian Clinac 2100 C/D''' electron beam. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ElectronPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ElectronPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ElectronPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/ElectronPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mv ElectronPHS ElectronPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ElectronPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mkdir ElectronPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cd ElectronPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ElectronPHSPFolder &lt;br /&gt;
/ElectronPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ ./electronPHSP electron.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files</id>
		<title>Electron beam using phase-space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files"/>
				<updated>2014-09-11T14:33:50Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident electron beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The electron beam is generated using '''Varian Clinac 2100 C/D''' [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ElectronPHSP/phase-spacedata.txt phase-space data] files. You can find more information about phase-space data at the [https://www-nds.iaea.org/phsp/phsp.htmlx IAEA website]. [https://www-nds.iaea.org/phsp/electron1/VarianClinac_2100CD-readme.pdf Here] you can read more about the '''Varian Clinac 2100 C/D''' electron beam. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ElectronPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ElectronPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ElectronPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/ElectronPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mv ElectronPHS ElectronPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ElectronPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mkdir ElectronPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cd ElectronPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ElectronPHSPFolde &lt;br /&gt;
/ElectronPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ ./electronPHSP electron.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files</id>
		<title>Electron beam using phase-space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files"/>
				<updated>2014-09-11T14:30:33Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident electron beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The electron beam is generated using '''Varian Clinac 2100 C/D''' [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ElectronPHSP/phase-spacedata.txt phase-space data] files. You can find more information about phase-space data at the [https://www-nds.iaea.org/phsp/phsp.htmlx IAEA website]. [https://www-nds.iaea.org/phsp/electron1/VarianClinac_2100CD-readme.pdf Here] you can read more about the '''Varian Clinac 2100 C/D''' electron beam. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ElectronPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ElectronPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ElectronPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/ElectronPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mv ElectronPHS ElectronPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ElectronPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mkdir ElectronPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cd ElectronPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ElectronPHSPFolder/ElectronPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ ./electronPHSP electron.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files</id>
		<title>Electron beam using phase-space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files"/>
				<updated>2014-09-11T14:29:12Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident electron beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The electron beam is generated using '''Varian Clinac 2100 C/D''' [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ElectronPHSP/phase-spacedata.txt phase-space data] files. The phase-space data files contain detailed description of the particles generated via a Monte-Carlo simulation of the treatment source. You can find more information about phase-space data at the [https://www-nds.iaea.org/phsp/phsp.htmlx IAEA website]. [https://www-nds.iaea.org/phsp/electron1/VarianClinac_2100CD-readme.pdf Here] you can read more about the '''Varian Clinac 2100 C/D''' electron beam. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ElectronPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ElectronPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ElectronPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/ElectronPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mv ElectronPHS ElectronPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ElectronPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mkdir ElectronPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cd ElectronPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ElectronPHSPFolder/ElectronPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ ./electronPHSP electron.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files</id>
		<title>Electron beam using phase-space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files"/>
				<updated>2014-09-11T14:11:51Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident electron beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The electron beam is generated using '''Varian Clinac 2100 C/D''' phase-space data files. You can find more information about phase-space data at the [https://www-nds.iaea.org/phsp/phsp.htmlx IAEA website]. [https://www-nds.iaea.org/phsp/electron1/VarianClinac_2100CD-readme.pdf Here] you can read more about the '''Varian Clinac 2100 C/D''' electron beam. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ElectronPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ElectronPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ElectronPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/ElectronPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mv ElectronPHS ElectronPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ElectronPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mkdir ElectronPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cd ElectronPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ElectronPHSPFolder/ElectronPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ ./electronPHSP electron.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files</id>
		<title>Electron beam using phase-space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Electron_beam_using_phase-space_files"/>
				<updated>2014-09-11T14:11:13Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: Created page with &amp;quot;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==  This example shows the dose distribution in water along the incident electron beam. The volume of the water cube is divid...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident electron beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. The electron beam is generated using Varian Clinac 2100 C/D phase-space data files. You can find more information about phase-space data at the [https://www-nds.iaea.org/phsp/phsp.htmlx IAEA website]. [https://www-nds.iaea.org/phsp/electron1/VarianClinac_2100CD-readme.pdf Here] you can read more about the Varian Clinac 2100 C/D electron beam. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ElectronPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ElectronPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ElectronPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/ElectronPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mv ElectronPHS ElectronPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ElectronPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ mkdir ElectronPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSPFolder]$ cd ElectronPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ElectronPHSPFolder/ElectronPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ElectronPHSP_build]$ ./electronPHSP electron.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2014-09-11T13:47:22Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. &lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water from several incident monoenergetic proton beams.  &lt;br /&gt;
* [[Electron beam using phase-space files]] is a simple code which shows the dose deposition in water along the incident electron beam using phase-space data files.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2014-09-11T13:46:51Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. &lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water from several incident monoenergetic proton beams.  &lt;br /&gt;
* [[Electron beam using phase space files]] is a simple code which shows the dose deposition in water along the incident electron beam using phase space data files.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Photon_beam_using_phase_space_files</id>
		<title>Photon beam using phase space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Photon_beam_using_phase_space_files"/>
				<updated>2014-09-11T13:10:58Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident photon beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Photons are generated using phase-space data files. You can find more information about phase-space data [https://www-nds.iaea.org/phsp/phsp.htmlx here]. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder PhotonPHSPFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir PhotonPHSPFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd PhotonPHSPFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSPFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSPFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPHSP .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonPHSPFolder]$ mv PhotonPHS PhotonPHSP_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/PhotonPHSPFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSPFolder]$ mkdir PhotonPHSP_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSPFolder]$ cd PhotonPHSP_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPHSP_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPHSPFolder/PhotonPHSP_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPHSP_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSP_build]$ ./photonPHSP gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2014-09-11T12:27:54Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. &lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water from several incident monoenergetic proton beams.  &lt;br /&gt;
* [[Photon beam using phase space files]] is a simple code which shows the dose deposition in water along the incident photon beam created using phase space data files.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Photon_beam_using_phase_space_files</id>
		<title>Photon beam using phase space files</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Photon_beam_using_phase_space_files"/>
				<updated>2014-09-11T12:25:15Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: Created page with &amp;quot;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==  This example shows the dose distribution in water along the incident photon beam. The volume of the water cube is divided...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident photon beam. 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Photons are generated using phase-space data files. You can find more information about phase-space data [https://www-nds.iaea.org/phsp/phsp.htmlx here]. There is an option to chose among several '''EM''' physics lists.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder PhotonPHSFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir PhotonPHSFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd PhotonPHSFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPHS .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonPHSFolder]$ mv PhotonPHS PhotonPHS_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/PhotonPHSFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSFolder]$ mkdir PhotonPHS_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHSFolder]$ cd PhotonPHS_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPHS_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPHSFolder/PhotonPHS_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPHS_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPHS_build]$ ./photonPHS gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2014-09-11T12:15:37Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. &lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water from several incident monoenergetic proton beams.  &lt;br /&gt;
* [[Photon beam using phase space files]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam</id>
		<title>Monoenergetic proton pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam"/>
				<updated>2014-09-10T13:36:46Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident proton 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and the dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining two scoring meshes in longitudinal and lateral direction of the beam. More information about the scoring meshes can be found [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s08.html here]. The protons are generated using '''G4ParticleGun''' class. There is an option to chose among several '''EM''' and the '''QGSP_BIC_EMY''' physics lists.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Protons are in blue, photons are in green. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mv ProtonPB ProtonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mkdir ProtonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cd ProtonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonPBFolder/ProtonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* The two ways to record data should give similar result.   &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''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. For example, open this text file with editor '''pico''': &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	x[mm]  	Edep 	    Edep/Ebeam[%]  Dose        Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	0.8	5.17382 GeV	1.39081	6.47608e-07 Gy	17.3315	&lt;br /&gt;
 layer 2: 	1.6	5.24175 GeV	1.40907	6.5611e-07 Gy	17.5591	&lt;br /&gt;
 layer 3: 	2.4	5.29862 GeV	1.42436	6.63229e-07 Gy	17.7496	&lt;br /&gt;
 layer 4: 	3.2	5.41481 GeV	1.45559	6.77772e-07 Gy	18.1388	&lt;br /&gt;
 layer 5: 	4	5.43787 GeV	1.46179	6.80658e-07 Gy	18.216	&lt;br /&gt;
 layer 6: 	4.8	5.52101 GeV	1.48414	6.91065e-07 Gy	18.4946	&lt;br /&gt;
 layer 7: 	5.6	5.64633 GeV	1.51783	7.06751e-07 Gy	18.9144	&lt;br /&gt;
 layer 8: 	6.4	5.63969 GeV	1.51605	7.0592e-07 Gy	18.8921	&lt;br /&gt;
 layer 9: 	7.2	5.71744 GeV	1.53695	7.15652e-07 Gy	19.1526	&lt;br /&gt;
 layer 10: 	8	5.78086 GeV	1.55399	7.2359e-07 Gy	19.365	&lt;br /&gt;
 layer 11: 	8.8	5.94371 GeV	1.59777	7.43975e-07 Gy	19.9106	&lt;br /&gt;
 layer 12: 	9.6	6.02518 GeV	1.61967	7.54172e-07 Gy	20.1835	&lt;br /&gt;
 layer 13: 	10.4	6.10292 GeV	1.64057	7.63903e-07 Gy	20.4439	&lt;br /&gt;
 layer 14: 	11.2	6.18071 GeV	1.66148	7.7364e-07 Gy	20.7045	&lt;br /&gt;
 layer 15: 	12	6.2621 GeV	1.68336	7.83827e-07 Gy	20.9771	&lt;br /&gt;
 layer 16: 	12.8	6.37762 GeV	1.71441	7.98286e-07 Gy	21.3641	&lt;br /&gt;
 layer 17: 	13.6	6.52458 GeV	1.75392	8.16682e-07 Gy	21.8564	&lt;br /&gt;
 layer 18: 	14.4	6.67805 GeV	1.79517	8.35892e-07 Gy	22.3705	&lt;br /&gt;
 layer 19: 	15.2	6.86252 GeV	1.84476	8.58982e-07 Gy	22.9884	&lt;br /&gt;
 layer 20: 	16	6.95226 GeV	1.86889	8.70215e-07 Gy	23.289	&lt;br /&gt;
 layer 21: 	16.8	7.11679 GeV	1.91312	8.90809e-07 Gy	23.8402	&lt;br /&gt;
 layer 22: 	17.6	7.15125 GeV	1.92238	8.95122e-07 Gy	23.9556	&lt;br /&gt;
 layer 23: 	18.4	7.43274 GeV	1.99805	9.30356e-07 Gy	24.8986	&lt;br /&gt;
 layer 24: 	19.2	7.58811 GeV	2.03981	9.49804e-07 Gy	25.419	&lt;br /&gt;
 layer 25: 	20	7.8156 GeV	2.10097	9.78279e-07 Gy	26.1811	&lt;br /&gt;
 layer 26: 	20.8	7.94754 GeV	2.13643	9.94794e-07 Gy	26.6231	&lt;br /&gt;
 layer 27: 	21.6	8.35363 GeV	2.2456	1.04562e-06 Gy	27.9834	&lt;br /&gt;
 layer 28: 	22.4	8.44564 GeV	2.27033	1.05714e-06 Gy	28.2917	&lt;br /&gt;
 layer 29: 	23.2	8.74817 GeV	2.35166	1.09501e-06 Gy	29.3051	&lt;br /&gt;
 layer 30: 	24	9.08194 GeV	2.44138	1.13679e-06 Gy	30.4232	&lt;br /&gt;
 layer 31: 	24.8	9.50886 GeV	2.55615	1.19022e-06 Gy	31.8533	&lt;br /&gt;
 layer 32: 	25.6	9.93302 GeV	2.67017	1.24332e-06 Gy	33.2741	&lt;br /&gt;
 layer 33: 	26.4	10.5627 GeV	2.83943	1.32213e-06 Gy	35.3834	&lt;br /&gt;
 layer 34: 	27.2	11.1563 GeV	2.99902	1.39644e-06 Gy	37.3721	&lt;br /&gt;
 layer 35: 	28	12.0025 GeV	3.22647	1.50235e-06 Gy	40.2065	&lt;br /&gt;
 layer 36: 	28.8	13.1124 GeV	3.52485	1.64128e-06 Gy	43.9247	&lt;br /&gt;
 layer 37: 	29.6	14.5158 GeV	3.90209	1.81694e-06 Gy	48.6257	&lt;br /&gt;
 layer 38: 	30.4	16.8932 GeV	4.54119	2.11452e-06 Gy	56.5898	&lt;br /&gt;
 layer 39: 	31.2	20.9827 GeV	5.64051	2.62641e-06 Gy	70.289	&lt;br /&gt;
 layer 40: 	32	29.8521 GeV	8.02475	3.73658e-06 Gy	100	&lt;br /&gt;
 layer 41: 	32.8	14.922 GeV	4.0113	1.86779e-06 Gy	49.9866	&lt;br /&gt;
 layer 42: 	33.6	330.005 MeV	0.088711     4.13067e-08 Gy  1.10547	&lt;br /&gt;
 layer 43: 	34.4	2.92265 MeV	0.000785658  3.65828e-10 Gy  0.00979044	&lt;br /&gt;
 layer 44: 	35.2	864.413 keV	0.000232369  1.08199e-10 Gy  0.00289566	&lt;br /&gt;
 layer 45: 	36	673.958 keV	0.000181172  8.43594e-11 Gy  0.00225766	&lt;br /&gt;
 layer 46: 	36.8	1.18851 MeV	0.000319491  1.48765e-10 Gy  0.00398132	&lt;br /&gt;
 layer 47: 	37.6	3.81319 MeV	0.00102505   4.77297e-10 Gy  0.0127736	&lt;br /&gt;
 layer 48: 	38.4	4.58219 MeV	0.00123177   5.73552e-10 Gy  0.0153496	&lt;br /&gt;
 layer 49: 	39.2	7.29449 MeV	0.00196088   9.13052e-10 Gy  0.0244355	&lt;br /&gt;
 layer 50: 	40	0 eV 	0	0 Gy	0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 proton of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 50 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 372 GeV&lt;br /&gt;
 Total energy deposit= 367.368 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding '''PlotDose.txt''' is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
0.8	17.3315	&lt;br /&gt;
1.6	17.5591	&lt;br /&gt;
2.4	17.7496	&lt;br /&gt;
3.2	18.1388	&lt;br /&gt;
4	18.216	&lt;br /&gt;
4.8	18.4946	&lt;br /&gt;
5.6	18.9144	&lt;br /&gt;
6.4	18.8921	&lt;br /&gt;
7.2	19.1526	&lt;br /&gt;
8	19.365	&lt;br /&gt;
8.8	19.9106	&lt;br /&gt;
9.6	20.1835	&lt;br /&gt;
10.4	20.4439	&lt;br /&gt;
11.2	20.7045	&lt;br /&gt;
12	20.9771	&lt;br /&gt;
12.8	21.3641	&lt;br /&gt;
13.6	21.8564	&lt;br /&gt;
14.4	22.3705	&lt;br /&gt;
15.2	22.9884	&lt;br /&gt;
16	23.289	&lt;br /&gt;
16.8	23.8402	&lt;br /&gt;
17.6	23.9556	&lt;br /&gt;
18.4	24.8986	&lt;br /&gt;
19.2	25.419	&lt;br /&gt;
20	26.1811	&lt;br /&gt;
20.8	26.6231	&lt;br /&gt;
21.6	27.9834	&lt;br /&gt;
22.4	28.2917	&lt;br /&gt;
23.2	29.3051	&lt;br /&gt;
24	30.4232	&lt;br /&gt;
24.8	31.8533	&lt;br /&gt;
25.6	33.2741	&lt;br /&gt;
26.4	35.3834	&lt;br /&gt;
27.2	37.3721	&lt;br /&gt;
28	40.2065	&lt;br /&gt;
28.8	43.9247	&lt;br /&gt;
29.6	48.6257	&lt;br /&gt;
30.4	56.5898	&lt;br /&gt;
31.2	70.289	&lt;br /&gt;
32	100	&lt;br /&gt;
32.8	49.9866	&lt;br /&gt;
33.6	1.10547	&lt;br /&gt;
34.4	0.00979044	&lt;br /&gt;
35.2	0.00289566	&lt;br /&gt;
36	0.00225766	&lt;br /&gt;
36.8	0.00398132	&lt;br /&gt;
37.6	0.0127736	&lt;br /&gt;
38.4	0.0153496	&lt;br /&gt;
39.2	0.0244355	&lt;br /&gt;
40	0		&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLongitudinalMesh.txt '''DoseLongitudinalMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/EnergyLongitudinalMesh.txt '''EnergyLongitudinalMesh.txt'''] contain information about the dose and energy deposition in 50 voxels along the beam.  &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLateralMesh.txt '''DoseLateralMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Proton.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l Proton.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT Files and Proton.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PB1.png &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PBzoom1.png  &lt;br /&gt;
&lt;br /&gt;
You can close your ROOT session by typing &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Folder '''RootScripts''' contains several ROOT scripts which plot dose deposition in data and simulation.&lt;br /&gt;
You can use script '''PlotSimulation.C''' to plot the dose deposition along the absorber. This script uses '''PlotDose.txt'''. Copy the script to your current ProtonPB_build directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/Simulation1.png  &lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
scp username@plus1.hep.ucl.ac.uk:/home/username/ProtonPBFolder/ProtonPB_build/PlotDose.txt .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, open MATLAB and follow the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. &lt;br /&gt;
* 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'.  &lt;br /&gt;
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.&lt;br /&gt;
&lt;br /&gt;
This plot will be created with added axis labels and a legend:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/matlab1proton.png&lt;br /&gt;
&lt;br /&gt;
You can also 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.&lt;br /&gt;
Before running the script substitude the commas in '''DoseLateralMesh.txt''' with spaces. Remove also the header in the text file. Then, save the text file as '''DoseLateralMesh_Mod.txt'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotLateralDoseMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotLateralDoseMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''LateralDose_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/SimulationLateralMesh.png&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton energy and number of slices etc. by&lt;br /&gt;
modifying the macro proton.mac. Open the macro with editor '''pico''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry &lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/sliceNumber 50 &lt;br /&gt;
#&lt;br /&gt;
# define longitudinal scoring mesh&lt;br /&gt;
# along the beam&lt;br /&gt;
/score/create/boxMesh waterMeshlongitudinal&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 50 1 1&lt;br /&gt;
/score/mesh/translate/xyz 0. 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# define lateral scoring mesh&lt;br /&gt;
# centered at the Bragg peak&lt;br /&gt;
/score/create/boxMesh waterMeshlateral&lt;br /&gt;
/score/mesh/boxSize 0.1 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 1 1 50&lt;br /&gt;
/score/mesh/translate/xyz 1.2 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range &lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonPB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonPB/phys/setGCut 1 um&lt;br /&gt;
#/protonPB/phys/setECut 1 um&lt;br /&gt;
#/protonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy used in Clatterbridge Centre  &lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonPB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output file&lt;br /&gt;
/analysis/setFileName Proton&lt;br /&gt;
#&lt;br /&gt;
# histogram &lt;br /&gt;
/analysis/h1/set 2 50 25 35 mm&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
# drawing projections&lt;br /&gt;
#/score/drawProjection waterMeshlongitudinal doseDeposit&lt;br /&gt;
#/score/drawProjection waterMeshlateral doseDeposit&lt;br /&gt;
#&lt;br /&gt;
# dump scores to a file&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal energyDeposit EnergyLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral doseDeposit DoseLateralMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral energyDeposit EnergyLateralMesh.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change dimensions of the water box'''&lt;br /&gt;
&lt;br /&gt;
The default size is 4x4x4 cm. You can change the dimensions by modifying the lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''QGSP_BIC_EMY'''. This is a physics list recommended for proton therapy. You can check what will be the dose deposition if you change the physics list. In proton.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the incident proton energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 62 MeV. This is one of the energies used in radiotherapy. In proton.mac you can change the value of 62 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 50 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 50 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 50. Keep in mind that &lt;br /&gt;
if you want to increase the number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/ProtonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to value bigger than the number of your slices. The default value is MaxLayer=60. For example, if you want to have 55 slices you do not need to modify MaxLayer. Then, only in proton.mac change the number of slices &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/sliceNumber 55 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Modify the mesh'''&lt;br /&gt;
&lt;br /&gt;
You can change the size of the mesh (longitudinal and lateral) and the number of voxels by modifying their corresponding lines &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 30 1 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After modifications in proton.mac'''&lt;br /&gt;
&lt;br /&gt;
After modifying the macro proton.mac you can run it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
If you modify files in directory ProtonPB_source (for example you change the value of MaxLayer) you need to comppile the code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro proton.mac.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
If you uncomment the lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections. In this example, we use '''DAWN''' event display. Before running the visualisation look at this [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, first uncomment lines '''/control/execute visualisation.mac''' and '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Then, run the proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. The first file contains detector geometry and particle interactions. The second file contains dose projections. While running the proton.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the opened window press OK and this will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_02_6000e.eps&lt;br /&gt;
&lt;br /&gt;
You can modify the .prim files in DAWN. For example, in the DAWN display change the polar and azimuthal angles. 1) (polar angle, azimuthal angle) = (0,90) will create this image&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
2) (polar angle, azimuthal angle) = (90,0) will create this image &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_04_6000e.eps&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_03_6000e.eps    &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data from The Clatterbridge Cancer Centre &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/ClatterbridgeBraggPeak.txt data] from the Clatterbridge Cancer Center. The first column represents the values in mm in depth, the second column represents the normalized values of deposited dose and normalized at the peak. You can use script '''PlotData.C''' from folder'''RootScripts''' to plot the data. Copy files '''ClatterbridgeData.txt''' and '''PlotData.C''' to your current ProtonPB_build directory and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotData.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/ClatterbridgeData.txt .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotData.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''ClatterbridgeData.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/Clatterbridge.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Comparison between data and simulation &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The scripts '''PlotDataAndSim.C''' and '''PlotDataAndSimMesh.C''' in folder '''RootScripts''' compare data with simulation. &lt;br /&gt;
You can use script '''PlotDataAndSim.C''' to compare data (ClatterbridgeData.txt) and simulation ('''PlotDose.txt'''). Both text files must be in the folder where you run the script. &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSim.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSim.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''BraggPeakComparison.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulation.png&lt;br /&gt;
&lt;br /&gt;
You can also compare data (ClatterbridgeData.txt) with simulation done with scoring mesh ('''DoseLongitudinalMesh.txt''').&lt;br /&gt;
This can be done with script '''PlotDataAndSimMesh.C'''. This script works only if before running it you substitude the commas &lt;br /&gt;
in '''DoseLongitudinalMesh.txt''' with spaces. Remove also the header in the text file. Save the new text file as '''DoseLongitudinalMesh_Mod.txt'''. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSimMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSimMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This creates '''BraggPeakComparison_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulationMesh.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic proton pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Proton_beam_with_realistic_geometry</id>
		<title>Proton beam with realistic geometry</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Proton_beam_with_realistic_geometry"/>
				<updated>2014-09-10T13:35:44Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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]. &lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonGBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonGBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonGBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonGB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonGBFolder]$ mv ProtonGB ProtonGB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonGBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ mkdir ProtonGB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ cd ProtonGB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonGB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonGBFolder/ProtonGB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonGB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ ./protonGB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* The two ways to record data should give similar result.   &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is an example output for '''DoseFile.txt''' with physics process '''QGSP_BIC_EMY''' and incident proton energy of '''62 MeV'''.&lt;br /&gt;
Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open text files. Now, open the text file '''DoseFile.txt''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers 	 x[mm]    Edep      Edep/Ebeam[%]  Dose 	Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	0.8	5.20624 GeV	1.399	6.517e-07 Gy	18.49	&lt;br /&gt;
 layer 2: 	1.6	5.255 GeV	1.413	6.578e-07 Gy	18.67	&lt;br /&gt;
 layer 3: 	2.4	5.349 GeV	1.438	6.696e-07 Gy	19	&lt;br /&gt;
 layer 4: 	3.2	5.464 GeV	1.469	6.839e-07 Gy	19.41	&lt;br /&gt;
 layer 5: 	4	5.533 GeV	1.487	6.926e-07 Gy	19.66	&lt;br /&gt;
 layer 6: 	4.8	5.546 GeV	1.491	6.942e-07 Gy	19.7	&lt;br /&gt;
 layer 7: 	5.6	5.592 GeV	1.503	7e-07 Gy	19.87	&lt;br /&gt;
 layer 8: 	6.4	5.586 GeV	1.502	6.993e-07 Gy	19.84	&lt;br /&gt;
 layer 9: 	7.2	5.748 GeV	1.545	7.194e-07 Gy	20.42	&lt;br /&gt;
 layer 10: 	8	5.827 GeV	1.566	7.293e-07 Gy	20.7	&lt;br /&gt;
 layer 11: 	8.8	5.922 GeV	1.592	7.412e-07 Gy	21.04	&lt;br /&gt;
 layer 12: 	9.6	5.949 GeV	1.599	7.446e-07 Gy	21.13	&lt;br /&gt;
 layer 13: 	10.4	6.05 GeV	1.626	7.573e-07 Gy	21.49	&lt;br /&gt;
 layer 14: 	11.2	6.195 GeV	1.665	7.755e-07 Gy	22.01	&lt;br /&gt;
 layer 15: 	12	6.306 GeV	1.695	7.894e-07 Gy	22.4	&lt;br /&gt;
 layer 16: 	12.8	6.365 GeV	1.711	7.967e-07 Gy	22.61	&lt;br /&gt;
 layer 17: 	13.6	6.499 GeV	1.747	8.135e-07 Gy	23.09	&lt;br /&gt;
 layer 18: 	14.4	6.634 GeV	1.783	8.303e-07 Gy	23.56	&lt;br /&gt;
 layer 19: 	15.2	6.731 GeV	1.809	8.425e-07 Gy	23.91	&lt;br /&gt;
 layer 20: 	16	6.915 GeV	1.859	8.655e-07 Gy	24.56	&lt;br /&gt;
 layer 21: 	16.8	7.099 GeV	1.908	8.886e-07 Gy	25.22	&lt;br /&gt;
 layer 22: 	17.6	7.168 GeV	1.927	8.972e-07 Gy	25.46	&lt;br /&gt;
 layer 23: 	18.4	7.301 GeV	1.963	9.138e-07 Gy	25.93	&lt;br /&gt;
 layer 24: 	19.2	7.593 GeV	2.041	9.505e-07 Gy	26.97	&lt;br /&gt;
 layer 25: 	20	7.718 GeV	2.075	9.66e-07 Gy	27.42	&lt;br /&gt;
 layer 26: 	20.8	7.952 GeV	2.138	9.954e-07 Gy	28.25	&lt;br /&gt;
 layer 27: 	21.6	8.149 GeV	2.191	1.02e-06 Gy	28.95	&lt;br /&gt;
 layer 28: 	22.4	8.446 GeV	2.27	1.057e-06 Gy	30	&lt;br /&gt;
 layer 29: 	23.2	8.784 GeV	2.361	1.1e-06 Gy	31.2	&lt;br /&gt;
 layer 30: 	24	9.082 GeV	2.441	1.137e-06 Gy	32.26	&lt;br /&gt;
 layer 31: 	24.8	9.47 GeV	2.546	1.185e-06 Gy	33.64	&lt;br /&gt;
 layer 32: 	25.6	9.929 GeV	2.669	1.243e-06 Gy	35.27	&lt;br /&gt;
 layer 33: 	26.4	10.54 GeV	2.833	1.319e-06 Gy	37.44	&lt;br /&gt;
 layer 34: 	27.2	11.25 GeV	3.023	1.408e-06 Gy	39.95	&lt;br /&gt;
 layer 35: 	28	12.11 GeV	3.256	1.516e-06 Gy	43.03	&lt;br /&gt;
 layer 36: 	28.8	13.21 GeV	3.55	1.653e-06 Gy	46.91	&lt;br /&gt;
 layer 37: 	29.6	14.65 GeV	3.938	1.834e-06 Gy	52.05	&lt;br /&gt;
 layer 38: 	30.4	16.98 GeV	4.564	2.125e-06 Gy	60.31	&lt;br /&gt;
 layer 39: 	31.2	21.42 GeV	5.759	2.682e-06 Gy	76.1	&lt;br /&gt;
 layer 40: 	32	28.15 GeV	7.567	3.524e-06 Gy	100	&lt;br /&gt;
 layer 41: 	32.8	15.14 GeV	4.07	1.895e-06 Gy	53.78	&lt;br /&gt;
 layer 42: 	33.6	1.256 GeV	0.3376	1.572e-07 Gy	4.462	&lt;br /&gt;
 layer 43: 	34.4	18.93 MeV	0.005087   2.369e-09 Gy	0.06723	&lt;br /&gt;
 layer 44: 	35.2	597.5 keV	0.0001606  7.479e-11 Gy	0.002122	&lt;br /&gt;
 layer 45: 	36	665.8 keV	0.000179   8.334e-11 Gy	0.002365	&lt;br /&gt;
 layer 46: 	36.8	130.1 keV	3.498e-05  1.629e-11 Gy	0.0004623	&lt;br /&gt;
 layer 47: 	37.6	457.2 keV	0.0001229  5.722e-11 Gy	0.001624	&lt;br /&gt;
 layer 48: 	38.4	247.8 keV	6.661e-05  3.102e-11 Gy	0.0008802	&lt;br /&gt;
 layer 49: 	39.2	236.6 keV	6.361e-05  2.962e-11 Gy	0.0008406	&lt;br /&gt;
 layer 50: 	40	0 eV 	0	0 Gy	0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000  protons of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided &lt;br /&gt;
 into 50 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 372 GeV&lt;br /&gt;
 Total energy deposit= 367.3 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding '''PlotDose.txt''' is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
0.8	18.4941	&lt;br /&gt;
1.6	18.668	&lt;br /&gt;
2.4	19.0022	&lt;br /&gt;
3.2	19.4096	&lt;br /&gt;
4	19.6559	&lt;br /&gt;
4.8	19.7012	&lt;br /&gt;
5.6	19.8661	&lt;br /&gt;
6.4	19.8446	&lt;br /&gt;
7.2	20.4168	&lt;br /&gt;
8	20.6987	&lt;br /&gt;
8.8	21.0351	&lt;br /&gt;
9.6	21.1327	&lt;br /&gt;
10.4	21.493	&lt;br /&gt;
11.2	22.0079	&lt;br /&gt;
12	22.4025	&lt;br /&gt;
12.8	22.6104	&lt;br /&gt;
13.6	23.0872	&lt;br /&gt;
14.4	23.5642	&lt;br /&gt;
15.2	23.9102	&lt;br /&gt;
16	24.564	&lt;br /&gt;
16.8	25.2168	&lt;br /&gt;
17.6	25.4611	&lt;br /&gt;
18.4	25.9348	&lt;br /&gt;
19.2	26.9738	&lt;br /&gt;
20	27.4152	&lt;br /&gt;
20.8	28.2496	&lt;br /&gt;
21.6	28.9492	&lt;br /&gt;
22.4	30.0033	&lt;br /&gt;
23.2	31.2049	&lt;br /&gt;
24	32.2636	&lt;br /&gt;
24.8	33.6414	&lt;br /&gt;
25.6	35.2707	&lt;br /&gt;
26.4	37.4412	&lt;br /&gt;
27.2	39.9539	&lt;br /&gt;
28	43.0264	&lt;br /&gt;
28.8	46.9139	&lt;br /&gt;
29.6	52.0461	&lt;br /&gt;
30.4	60.3067	&lt;br /&gt;
31.2	76.1028	&lt;br /&gt;
32	100	&lt;br /&gt;
32.8	53.7805	&lt;br /&gt;
33.6	4.46152	&lt;br /&gt;
34.4	0.0672278	&lt;br /&gt;
35.2	0.00212242	&lt;br /&gt;
36	0.00236509	&lt;br /&gt;
36.8	0.000462313	&lt;br /&gt;
37.6	0.00162397	&lt;br /&gt;
38.4	0.00088024	&lt;br /&gt;
39.2	0.000840567	&lt;br /&gt;
40	0	&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[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.  &lt;br /&gt;
&lt;br /&gt;
[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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open the '''Proton.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ root -l Proton.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT Files and Proton.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/BraggPeak_GB1.png &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/BraggPeak_GBzoom1.png  &lt;br /&gt;
&lt;br /&gt;
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: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create root file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/Simulation1.png  &lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
scp username@plus1.hep.ucl.ac.uk:/home/username/ProtonGBFolder/ProtonGB_build/PlotDose.txt .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, open MATLAB and follow the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. &lt;br /&gt;
* 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'.  &lt;br /&gt;
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.&lt;br /&gt;
&lt;br /&gt;
This plot will be created with added axis labels and a legend:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/matlab2protonreal.png&lt;br /&gt;
&lt;br /&gt;
Similarly to the previous tutorial you can plot the data in '''DoseLongitudinalMesh.txt''' and '''DoseLateralMesh.txt''' &lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ cp /home/username/ProtonGBFolder/ProtonGB_source/RootScripts/PlotLateralDoseMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonGB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotLateralDoseMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''LateralDose_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/SimulationLateralMesh.png&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton energy and number of slices by&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
Open the macro proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ pico proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
You will see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry &lt;br /&gt;
/protonGB/det/setSizeX  4 cm&lt;br /&gt;
/protonGB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonGB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonGB/det/sliceNumber 50 &lt;br /&gt;
#&lt;br /&gt;
# define longitudinal scoring mesh&lt;br /&gt;
# along the beam&lt;br /&gt;
/score/create/boxMesh waterMeshlongitudinal&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 50 1 1&lt;br /&gt;
/score/mesh/translate/xyz 0. 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# define lateral scoring mesh&lt;br /&gt;
# centered at the Bragg peak&lt;br /&gt;
/score/create/boxMesh waterMeshlateral&lt;br /&gt;
/score/mesh/boxSize 0.1 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 1 1 50&lt;br /&gt;
/score/mesh/translate/xyz 1.2 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonGB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonGB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonGB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range &lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonGB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonGB/phys/setGCut 1 um&lt;br /&gt;
#/protonGB/phys/setECut 1 um&lt;br /&gt;
#/protonGB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
# General particle source&lt;br /&gt;
# proton circle source  &lt;br /&gt;
/gps/pos/shape Circle&lt;br /&gt;
/gps/pos/centre -2. 0. 0. cm&lt;br /&gt;
/gps/pos/radius 0. mm&lt;br /&gt;
/gps/pos/sigma_r 2. mm&lt;br /&gt;
/gps/particle proton&lt;br /&gt;
/gps/pos/type Beam&lt;br /&gt;
#&lt;br /&gt;
# the incident surface is in the y-z plane&lt;br /&gt;
/gps/pos/rot1 0 1 0&lt;br /&gt;
/gps/pos/rot2 0 0 1&lt;br /&gt;
#&lt;br /&gt;
# the beam is travelling along the x-axis without any angular &lt;br /&gt;
#dispersion (angular despersion set to 0.0)&lt;br /&gt;
/gps/ang/rot1 0 0 1&lt;br /&gt;
/gps/ang/rot2 0 1 0 &lt;br /&gt;
/gps/ang/type beam1d &lt;br /&gt;
/gps/ang/sigma_r 0. deg&lt;br /&gt;
#&lt;br /&gt;
# the beam energy is in gaussian profile&lt;br /&gt;
/gps/ene/type Gauss&lt;br /&gt;
/gps/ene/mono 62 MeV&lt;br /&gt;
/gps/ene/sigma 0.3 MeV&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonGB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonGB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output file&lt;br /&gt;
/analysis/setFileName Proton&lt;br /&gt;
# &lt;br /&gt;
/analysis/h1/set 2 50 25 35 mm&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
# drawing projections&lt;br /&gt;
#/score/drawProjection waterMeshlongitudinal doseDeposit&lt;br /&gt;
#/score/drawProjection waterMeshlateral doseDeposit&lt;br /&gt;
&lt;br /&gt;
# dump scores to a file&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal energyDeposit EnergyLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral doseDeposit DoseLateralMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral energyDeposit EnergyLateralMesh.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can modify '''proton.mac''' as it is done in the tutorial '''Monoenergetic proton pencil beam'''.  &lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
In macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
The lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections in longitudinal and lateral directions. &lt;br /&gt;
&lt;br /&gt;
To run the visualisation, first uncomment lines '''/control/execute visualisation.mac''' and '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Then, run the proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ ./protonGB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file, '''g4_01.prim''' contains dose projections in longitudinal direction:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_02_6000e.eps  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Comparison with data from The Clatterbridge Cancer Centre &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/ClatterbridgeSimulation1.png   &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of proton beam with realistic geometry files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam</id>
		<title>Monoenergetic proton pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam"/>
				<updated>2014-09-10T13:33:03Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident proton 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and the dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining two scoring meshes in longitudinal and lateral direction of the beam. More information about the scoring meshes can be found [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s08.html here]. The protons are generated using '''G4ParticleGun''' class. There is an option to chose among several '''EM''' and the '''QGSP_BIC_EMY''' physics lists.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Protons are in blue, photons are in green. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mv ProtonPB ProtonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mkdir ProtonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cd ProtonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonPBFolder/ProtonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* The two ways to record data should give similar result.   &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''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. For example, open this text file with editor '''pico''': &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	x[mm]  	Edep 	    Edep/Ebeam[%]  Dose        Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	0.8	5.17382 GeV	1.39081	6.47608e-07 Gy	17.3315	&lt;br /&gt;
 layer 2: 	1.6	5.24175 GeV	1.40907	6.5611e-07 Gy	17.5591	&lt;br /&gt;
 layer 3: 	2.4	5.29862 GeV	1.42436	6.63229e-07 Gy	17.7496	&lt;br /&gt;
 layer 4: 	3.2	5.41481 GeV	1.45559	6.77772e-07 Gy	18.1388	&lt;br /&gt;
 layer 5: 	4	5.43787 GeV	1.46179	6.80658e-07 Gy	18.216	&lt;br /&gt;
 layer 6: 	4.8	5.52101 GeV	1.48414	6.91065e-07 Gy	18.4946	&lt;br /&gt;
 layer 7: 	5.6	5.64633 GeV	1.51783	7.06751e-07 Gy	18.9144	&lt;br /&gt;
 layer 8: 	6.4	5.63969 GeV	1.51605	7.0592e-07 Gy	18.8921	&lt;br /&gt;
 layer 9: 	7.2	5.71744 GeV	1.53695	7.15652e-07 Gy	19.1526	&lt;br /&gt;
 layer 10: 	8	5.78086 GeV	1.55399	7.2359e-07 Gy	19.365	&lt;br /&gt;
 layer 11: 	8.8	5.94371 GeV	1.59777	7.43975e-07 Gy	19.9106	&lt;br /&gt;
 layer 12: 	9.6	6.02518 GeV	1.61967	7.54172e-07 Gy	20.1835	&lt;br /&gt;
 layer 13: 	10.4	6.10292 GeV	1.64057	7.63903e-07 Gy	20.4439	&lt;br /&gt;
 layer 14: 	11.2	6.18071 GeV	1.66148	7.7364e-07 Gy	20.7045	&lt;br /&gt;
 layer 15: 	12	6.2621 GeV	1.68336	7.83827e-07 Gy	20.9771	&lt;br /&gt;
 layer 16: 	12.8	6.37762 GeV	1.71441	7.98286e-07 Gy	21.3641	&lt;br /&gt;
 layer 17: 	13.6	6.52458 GeV	1.75392	8.16682e-07 Gy	21.8564	&lt;br /&gt;
 layer 18: 	14.4	6.67805 GeV	1.79517	8.35892e-07 Gy	22.3705	&lt;br /&gt;
 layer 19: 	15.2	6.86252 GeV	1.84476	8.58982e-07 Gy	22.9884	&lt;br /&gt;
 layer 20: 	16	6.95226 GeV	1.86889	8.70215e-07 Gy	23.289	&lt;br /&gt;
 layer 21: 	16.8	7.11679 GeV	1.91312	8.90809e-07 Gy	23.8402	&lt;br /&gt;
 layer 22: 	17.6	7.15125 GeV	1.92238	8.95122e-07 Gy	23.9556	&lt;br /&gt;
 layer 23: 	18.4	7.43274 GeV	1.99805	9.30356e-07 Gy	24.8986	&lt;br /&gt;
 layer 24: 	19.2	7.58811 GeV	2.03981	9.49804e-07 Gy	25.419	&lt;br /&gt;
 layer 25: 	20	7.8156 GeV	2.10097	9.78279e-07 Gy	26.1811	&lt;br /&gt;
 layer 26: 	20.8	7.94754 GeV	2.13643	9.94794e-07 Gy	26.6231	&lt;br /&gt;
 layer 27: 	21.6	8.35363 GeV	2.2456	1.04562e-06 Gy	27.9834	&lt;br /&gt;
 layer 28: 	22.4	8.44564 GeV	2.27033	1.05714e-06 Gy	28.2917	&lt;br /&gt;
 layer 29: 	23.2	8.74817 GeV	2.35166	1.09501e-06 Gy	29.3051	&lt;br /&gt;
 layer 30: 	24	9.08194 GeV	2.44138	1.13679e-06 Gy	30.4232	&lt;br /&gt;
 layer 31: 	24.8	9.50886 GeV	2.55615	1.19022e-06 Gy	31.8533	&lt;br /&gt;
 layer 32: 	25.6	9.93302 GeV	2.67017	1.24332e-06 Gy	33.2741	&lt;br /&gt;
 layer 33: 	26.4	10.5627 GeV	2.83943	1.32213e-06 Gy	35.3834	&lt;br /&gt;
 layer 34: 	27.2	11.1563 GeV	2.99902	1.39644e-06 Gy	37.3721	&lt;br /&gt;
 layer 35: 	28	12.0025 GeV	3.22647	1.50235e-06 Gy	40.2065	&lt;br /&gt;
 layer 36: 	28.8	13.1124 GeV	3.52485	1.64128e-06 Gy	43.9247	&lt;br /&gt;
 layer 37: 	29.6	14.5158 GeV	3.90209	1.81694e-06 Gy	48.6257	&lt;br /&gt;
 layer 38: 	30.4	16.8932 GeV	4.54119	2.11452e-06 Gy	56.5898	&lt;br /&gt;
 layer 39: 	31.2	20.9827 GeV	5.64051	2.62641e-06 Gy	70.289	&lt;br /&gt;
 layer 40: 	32	29.8521 GeV	8.02475	3.73658e-06 Gy	100	&lt;br /&gt;
 layer 41: 	32.8	14.922 GeV	4.0113	1.86779e-06 Gy	49.9866	&lt;br /&gt;
 layer 42: 	33.6	330.005 MeV	0.088711     4.13067e-08 Gy  1.10547	&lt;br /&gt;
 layer 43: 	34.4	2.92265 MeV	0.000785658  3.65828e-10 Gy  0.00979044	&lt;br /&gt;
 layer 44: 	35.2	864.413 keV	0.000232369  1.08199e-10 Gy  0.00289566	&lt;br /&gt;
 layer 45: 	36	673.958 keV	0.000181172  8.43594e-11 Gy  0.00225766	&lt;br /&gt;
 layer 46: 	36.8	1.18851 MeV	0.000319491  1.48765e-10 Gy  0.00398132	&lt;br /&gt;
 layer 47: 	37.6	3.81319 MeV	0.00102505   4.77297e-10 Gy  0.0127736	&lt;br /&gt;
 layer 48: 	38.4	4.58219 MeV	0.00123177   5.73552e-10 Gy  0.0153496	&lt;br /&gt;
 layer 49: 	39.2	7.29449 MeV	0.00196088   9.13052e-10 Gy  0.0244355	&lt;br /&gt;
 layer 50: 	40	0 eV 	0	0 Gy	0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 proton of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 50 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 372 GeV&lt;br /&gt;
 Total energy deposit= 367.368 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding '''PlotDose.txt''' is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
0.8	17.3315	&lt;br /&gt;
1.6	17.5591	&lt;br /&gt;
2.4	17.7496	&lt;br /&gt;
3.2	18.1388	&lt;br /&gt;
4	18.216	&lt;br /&gt;
4.8	18.4946	&lt;br /&gt;
5.6	18.9144	&lt;br /&gt;
6.4	18.8921	&lt;br /&gt;
7.2	19.1526	&lt;br /&gt;
8	19.365	&lt;br /&gt;
8.8	19.9106	&lt;br /&gt;
9.6	20.1835	&lt;br /&gt;
10.4	20.4439	&lt;br /&gt;
11.2	20.7045	&lt;br /&gt;
12	20.9771	&lt;br /&gt;
12.8	21.3641	&lt;br /&gt;
13.6	21.8564	&lt;br /&gt;
14.4	22.3705	&lt;br /&gt;
15.2	22.9884	&lt;br /&gt;
16	23.289	&lt;br /&gt;
16.8	23.8402	&lt;br /&gt;
17.6	23.9556	&lt;br /&gt;
18.4	24.8986	&lt;br /&gt;
19.2	25.419	&lt;br /&gt;
20	26.1811	&lt;br /&gt;
20.8	26.6231	&lt;br /&gt;
21.6	27.9834	&lt;br /&gt;
22.4	28.2917	&lt;br /&gt;
23.2	29.3051	&lt;br /&gt;
24	30.4232	&lt;br /&gt;
24.8	31.8533	&lt;br /&gt;
25.6	33.2741	&lt;br /&gt;
26.4	35.3834	&lt;br /&gt;
27.2	37.3721	&lt;br /&gt;
28	40.2065	&lt;br /&gt;
28.8	43.9247	&lt;br /&gt;
29.6	48.6257	&lt;br /&gt;
30.4	56.5898	&lt;br /&gt;
31.2	70.289	&lt;br /&gt;
32	100	&lt;br /&gt;
32.8	49.9866	&lt;br /&gt;
33.6	1.10547	&lt;br /&gt;
34.4	0.00979044	&lt;br /&gt;
35.2	0.00289566	&lt;br /&gt;
36	0.00225766	&lt;br /&gt;
36.8	0.00398132	&lt;br /&gt;
37.6	0.0127736	&lt;br /&gt;
38.4	0.0153496	&lt;br /&gt;
39.2	0.0244355	&lt;br /&gt;
40	0		&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLongitudinalMesh.txt '''DoseLongitudinalMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/EnergyLongitudinalMesh.txt '''EnergyLongitudinalMesh.txt'''] contain information about the dose and energy deposition in 50 voxels along the beam.  &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLateralMesh.txt '''DoseLateralMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Proton.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l Proton.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT Files and Proton.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PB1.png &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PBzoom1.png  &lt;br /&gt;
&lt;br /&gt;
You can close your ROOT session by typing &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Folder '''RootScripts''' contains several ROOT scripts which plot dose deposition in data and simulation.&lt;br /&gt;
You can use script '''PlotSimulation.C''' to plot the dose deposition along the absorber. This script uses '''PlotDose.txt'''. Copy the script to your current ProtonPB_build directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/Simulation1.png  &lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
scp username@plus1.hep.ucl.ac.uk:/home/username/PhotonPBFolder/PhotonPB_build/PlotDose.txt .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, open MATLAB and follow the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. &lt;br /&gt;
* 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'.  &lt;br /&gt;
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.&lt;br /&gt;
&lt;br /&gt;
This plot will be created with added axis labels and a legend:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/matlab1proton.png&lt;br /&gt;
&lt;br /&gt;
You can also 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.&lt;br /&gt;
Before running the script substitude the commas in '''DoseLateralMesh.txt''' with spaces. Remove also the header in the text file. Then, save the text file as '''DoseLateralMesh_Mod.txt'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotLateralDoseMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotLateralDoseMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''LateralDose_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/SimulationLateralMesh.png&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton energy and number of slices etc. by&lt;br /&gt;
modifying the macro proton.mac. Open the macro with editor '''pico''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry &lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/sliceNumber 50 &lt;br /&gt;
#&lt;br /&gt;
# define longitudinal scoring mesh&lt;br /&gt;
# along the beam&lt;br /&gt;
/score/create/boxMesh waterMeshlongitudinal&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 50 1 1&lt;br /&gt;
/score/mesh/translate/xyz 0. 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# define lateral scoring mesh&lt;br /&gt;
# centered at the Bragg peak&lt;br /&gt;
/score/create/boxMesh waterMeshlateral&lt;br /&gt;
/score/mesh/boxSize 0.1 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 1 1 50&lt;br /&gt;
/score/mesh/translate/xyz 1.2 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range &lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonPB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonPB/phys/setGCut 1 um&lt;br /&gt;
#/protonPB/phys/setECut 1 um&lt;br /&gt;
#/protonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy used in Clatterbridge Centre  &lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonPB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output file&lt;br /&gt;
/analysis/setFileName Proton&lt;br /&gt;
#&lt;br /&gt;
# histogram &lt;br /&gt;
/analysis/h1/set 2 50 25 35 mm&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
# drawing projections&lt;br /&gt;
#/score/drawProjection waterMeshlongitudinal doseDeposit&lt;br /&gt;
#/score/drawProjection waterMeshlateral doseDeposit&lt;br /&gt;
#&lt;br /&gt;
# dump scores to a file&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal energyDeposit EnergyLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral doseDeposit DoseLateralMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral energyDeposit EnergyLateralMesh.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change dimensions of the water box'''&lt;br /&gt;
&lt;br /&gt;
The default size is 4x4x4 cm. You can change the dimensions by modifying the lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''QGSP_BIC_EMY'''. This is a physics list recommended for proton therapy. You can check what will be the dose deposition if you change the physics list. In proton.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the incident proton energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 62 MeV. This is one of the energies used in radiotherapy. In proton.mac you can change the value of 62 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 50 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 50 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 50. Keep in mind that &lt;br /&gt;
if you want to increase the number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/ProtonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to value bigger than the number of your slices. The default value is MaxLayer=60. For example, if you want to have 55 slices you do not need to modify MaxLayer. Then, only in proton.mac change the number of slices &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/sliceNumber 55 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Modify the mesh'''&lt;br /&gt;
&lt;br /&gt;
You can change the size of the mesh (longitudinal and lateral) and the number of voxels by modifying their corresponding lines &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 30 1 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After modifications in proton.mac'''&lt;br /&gt;
&lt;br /&gt;
After modifying the macro proton.mac you can run it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
If you modify files in directory ProtonPB_source (for example you change the value of MaxLayer) you need to comppile the code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro proton.mac.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
If you uncomment the lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections. In this example, we use '''DAWN''' event display. Before running the visualisation look at this [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, first uncomment lines '''/control/execute visualisation.mac''' and '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Then, run the proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. The first file contains detector geometry and particle interactions. The second file contains dose projections. While running the proton.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the opened window press OK and this will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_02_6000e.eps&lt;br /&gt;
&lt;br /&gt;
You can modify the .prim files in DAWN. For example, in the DAWN display change the polar and azimuthal angles. 1) (polar angle, azimuthal angle) = (0,90) will create this image&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
2) (polar angle, azimuthal angle) = (90,0) will create this image &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_04_6000e.eps&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_03_6000e.eps    &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data from The Clatterbridge Cancer Centre &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/ClatterbridgeBraggPeak.txt data] from the Clatterbridge Cancer Center. The first column represents the values in mm in depth, the second column represents the normalized values of deposited dose and normalized at the peak. You can use script '''PlotData.C''' from folder'''RootScripts''' to plot the data. Copy files '''ClatterbridgeData.txt''' and '''PlotData.C''' to your current ProtonPB_build directory and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotData.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/ClatterbridgeData.txt .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotData.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''ClatterbridgeData.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/Clatterbridge.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Comparison between data and simulation &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The scripts '''PlotDataAndSim.C''' and '''PlotDataAndSimMesh.C''' in folder '''RootScripts''' compare data with simulation. &lt;br /&gt;
You can use script '''PlotDataAndSim.C''' to compare data (ClatterbridgeData.txt) and simulation ('''PlotDose.txt'''). Both text files must be in the folder where you run the script. &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSim.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSim.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''BraggPeakComparison.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulation.png&lt;br /&gt;
&lt;br /&gt;
You can also compare data (ClatterbridgeData.txt) with simulation done with scoring mesh ('''DoseLongitudinalMesh.txt''').&lt;br /&gt;
This can be done with script '''PlotDataAndSimMesh.C'''. This script works only if before running it you substitude the commas &lt;br /&gt;
in '''DoseLongitudinalMesh.txt''' with spaces. Remove also the header in the text file. Save the new text file as '''DoseLongitudinalMesh_Mod.txt'''. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSimMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSimMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This creates '''BraggPeakComparison_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulationMesh.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic proton pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam</id>
		<title>Monoenergetic photon pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam"/>
				<updated>2014-09-10T13:31:55Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, electrons are in red. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder PhotonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir PhotonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd PhotonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mv PhotonPB PhotonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/PhotonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mkdir PhotonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cd PhotonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The macro produces root file '''Gamma.root''' with a histogram showing the energy deposition in &lt;br /&gt;
water box along the beam line. It also produces text files: '''DoseFile.txt''' with &lt;br /&gt;
energy and dose deposited in each slice and '''PlotDose.txt''' with dose deposited in each slice. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''DoseFile.txt''' with physics process '''emstandard_opt0''' and incident photon energy of '''20 MeV'''. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open text files. For example, use editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	 x[mm] 	Edep   	     Edep/Ebeam[%] 	Dose 	       Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	5	119.065 MeV	0.0992211	9.53818e-11 Gy	15.1483	&lt;br /&gt;
 layer 2: 	10	206.505 MeV	0.172088	1.65429e-10 Gy	26.2731	&lt;br /&gt;
 layer 3: 	15	259.584 MeV	0.21632	        2.07949e-10 Gy	33.026	&lt;br /&gt;
 layer 4: 	20	311.898 MeV	0.259915	2.49858e-10 Gy	39.6819	&lt;br /&gt;
 layer 5: 	25	395.255 MeV	0.329379	3.16634e-10 Gy	50.2871	&lt;br /&gt;
 layer 6: 	30	439.052 MeV	0.365876	3.51719e-10 Gy	55.8592	&lt;br /&gt;
 layer 7: 	35	503.311 MeV	0.419426	4.03197e-10 Gy	64.0348	&lt;br /&gt;
 layer 8: 	40	573.742 MeV	0.478118	4.59618e-10 Gy	72.9954	&lt;br /&gt;
 layer 9: 	45	624.707 MeV	0.520589	5.00446e-10 Gy	79.4796	&lt;br /&gt;
 layer 10: 	50	678.383 MeV	0.565319	5.43445e-10 Gy	86.3086	&lt;br /&gt;
 layer 11: 	55	694.602 MeV	0.578835	5.56437e-10 Gy	88.3721	&lt;br /&gt;
 layer 12: 	60	710.771 MeV	0.592309	5.6939e-10 Gy	90.4292	&lt;br /&gt;
 layer 13: 	65	744.826 MeV	0.620689	5.96672e-10 Gy	94.762	&lt;br /&gt;
 layer 14: 	70	742.436 MeV	0.618697	5.94757e-10 Gy	94.4579	&lt;br /&gt;
 layer 15: 	75	771.713 MeV	0.643094	6.1821e-10 Gy	98.1827	&lt;br /&gt;
 layer 16: 	80	767.22 MeV	0.63935	        6.14611e-10 Gy	97.611	&lt;br /&gt;
 layer 17: 	85	775.608 MeV	0.64634	        6.21331e-10 Gy	98.6783	&lt;br /&gt;
 layer 18: 	90	762.779 MeV	0.635649	6.11053e-10 Gy	97.046	&lt;br /&gt;
 layer 19: 	95	785.997 MeV	0.654997	6.29653e-10 Gy	100	&lt;br /&gt;
 layer 20: 	100	735.186 MeV	0.612655	5.88949e-10 Gy	93.5355	&lt;br /&gt;
 layer 21: 	105	761.414 MeV	0.634512	6.0996e-10 Gy	96.8724	&lt;br /&gt;
 layer 22: 	110	721.836 MeV	0.60153	        5.78254e-10 Gy	91.837	&lt;br /&gt;
 layer 23: 	115	730.726 MeV	0.608939	5.85376e-10 Gy	92.9681	&lt;br /&gt;
 layer 24: 	120	728.394 MeV	0.606995	5.83508e-10 Gy	92.6714	&lt;br /&gt;
 layer 25: 	125	744.904 MeV	0.620753	5.96734e-10 Gy	94.7719	&lt;br /&gt;
 layer 26: 	130	731.53 MeV	0.609608	5.8602e-10 Gy	93.0703	&lt;br /&gt;
 layer 27: 	135	702.85 MeV	0.585709	5.63045e-10 Gy	89.4215	&lt;br /&gt;
 layer 28: 	140	671.716 MeV	0.559763	5.38104e-10 Gy	85.4604	&lt;br /&gt;
 layer 29: 	145	676.297 MeV	0.56358	        5.41773e-10 Gy	86.0432	&lt;br /&gt;
 layer 30: 	150	653.849 MeV	0.544875	5.23791e-10 Gy	83.1873	&lt;br /&gt;
 layer 31: 	155	674.152 MeV	0.561793	5.40055e-10 Gy	85.7703	&lt;br /&gt;
 layer 32: 	160	687.008 MeV	0.572507	5.50354e-10 Gy	87.406	&lt;br /&gt;
 layer 33: 	165	706.2 MeV	0.5885	        5.65729e-10 Gy	89.8478	&lt;br /&gt;
 layer 34: 	170	700.841 MeV	0.584034	5.61435e-10 Gy	89.1659	&lt;br /&gt;
 layer 35: 	175	686.009 MeV	0.571674	5.49553e-10 Gy	87.2788	&lt;br /&gt;
 layer 36: 	180	658.891 MeV	0.549076	5.2783e-10 Gy	83.8287	&lt;br /&gt;
 layer 37: 	185	644.999 MeV	0.537499	5.16701e-10 Gy	82.0613	&lt;br /&gt;
 layer 38: 	190	655.81 MeV	0.546508	5.25362e-10 Gy	83.4367	&lt;br /&gt;
 layer 39: 	195	645.691 MeV	0.538075	5.17255e-10 Gy	82.1493	&lt;br /&gt;
 layer 40: 	200	0 eV 	        0	        0 Gy	        0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 gamma of 20 MeV through 20 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 40 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 120 GeV&lt;br /&gt;
 Total energy deposit= 24.8344 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is '''PlotDose.txt'''. These values can be analyzed with MATLAB and ROOT .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;  &lt;br /&gt;
5	15.1483	&lt;br /&gt;
10	26.2731	&lt;br /&gt;
15	33.026	&lt;br /&gt;
20	39.6819	&lt;br /&gt;
25	50.2871	&lt;br /&gt;
30	55.8592	&lt;br /&gt;
35	64.0348	&lt;br /&gt;
40	72.9954	&lt;br /&gt;
45	79.4796	&lt;br /&gt;
50	86.3086	&lt;br /&gt;
55	88.3721	&lt;br /&gt;
60	90.4292	&lt;br /&gt;
65	94.762	&lt;br /&gt;
70	94.4579	&lt;br /&gt;
75	98.1827	&lt;br /&gt;
80	97.611	&lt;br /&gt;
85	98.6783	&lt;br /&gt;
90	97.046	&lt;br /&gt;
95	100	&lt;br /&gt;
100	93.5355	&lt;br /&gt;
105	96.8724	&lt;br /&gt;
110	91.837	&lt;br /&gt;
115	92.9681	&lt;br /&gt;
120	92.6714	&lt;br /&gt;
125	94.7719	&lt;br /&gt;
130	93.0703	&lt;br /&gt;
135	89.4215	&lt;br /&gt;
140	85.4604	&lt;br /&gt;
145	86.0432	&lt;br /&gt;
150	83.1873	&lt;br /&gt;
155	85.7703	&lt;br /&gt;
160	87.406	&lt;br /&gt;
165	89.8478	&lt;br /&gt;
170	89.1659	&lt;br /&gt;
175	87.2788	&lt;br /&gt;
180	83.8287	&lt;br /&gt;
185	82.0613	&lt;br /&gt;
190	83.4367	&lt;br /&gt;
195	82.1493	&lt;br /&gt;
200	0	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Gamma.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Gamma.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The histogram inside Gamma.root shows the energy deposition in water box:&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/Edep_PhotonB1.png &lt;br /&gt;
&lt;br /&gt;
To exit the ROOT terminal type &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can plot the dose deposition along the depth of the absorber ('''PlotDose.txt''') using script '''PlotSimulation.C''' from folder '''PhotonPB_source'''. Copy this script to your current '''PhotonPB_build''' directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cp /home/username/PhotonPBFolder/PhotonPB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Then run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file. Open the root file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Simulation.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/DoseDeposition1.png   &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
Before proceeding with MATLAB you need to copy the text files from the cluster to your computer. In the terminal at your computer write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
scp username@plus1.hep.ucl.ac.uk:/home/username/PhotonPBFolder/PhotonPB_build/PlotDose.txt .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file '''PlotDose.txt''' will be copied in your current directory. Then, open MATLAB and follow the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. &lt;br /&gt;
* 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'.  &lt;br /&gt;
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.&lt;br /&gt;
&lt;br /&gt;
This plot will be created with added axis labels and a legend:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/matlab0photon.png &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident photon energy, phantom material, number of slices etc. by&lt;br /&gt;
modifying the macro gamma.mac. Open the macro with editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# gamma.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry and material&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
#/photonPB/det/setMat Lead&lt;br /&gt;
/photonPB/det/setSizeX  20 cm&lt;br /&gt;
/photonPB/det/setSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/setSliceSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/sliceNumber 40 &lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
#/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/photonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (range cut off-&lt;br /&gt;
# not bigger than 10% of slice thickness)&lt;br /&gt;
/photonPB/phys/setCuts 1 mm&lt;br /&gt;
#/photonPB/phys/setGCut 1 um&lt;br /&gt;
#/photonPB/phys/setECut 1 um&lt;br /&gt;
#/photonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
&lt;br /&gt;
# particle gun properties (type of &lt;br /&gt;
#particle and energy)&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
#/gun/particle e-&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/photonPB/stepMax 0.5 mm&lt;br /&gt;
#&lt;br /&gt;
/photonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output root file&lt;br /&gt;
/analysis/setFileName Gamma&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''emstandard_opt0'''. This package is used in high energy experiments. In gamma.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process '''emlivermore''' is used in low energy physics experiments. &lt;br /&gt;
&lt;br /&gt;
'''Change the incident particle energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 20 MeV. The typical therapeutic beam energy used in radiotherapy is in the interval 0.3 to 20 MeV. In gamma.mac you can change the value of 20 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 1.25 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 1.25 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the energy of the photon beams from cobalt-60 therapy machines.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that the primary particle generation is done at /PhotonPB_source/src/PrimaryGeneratorAction.cc.&lt;br /&gt;
This is part of the PrimaryGeneratorAction.cc:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()-&amp;gt;FindParticle(&amp;quot;proton&amp;quot;);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleDefinition(particle);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleEnergy(160*MeV);  &lt;br /&gt;
fParticleGun-&amp;gt;SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));&lt;br /&gt;
     &lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
G4double x0 = -0.5*(fDetector-&amp;gt;GetAbsorSizeX());&lt;br /&gt;
G4double y0 = 0.*cm, z0 = 0.*cm;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
fParticleGun-&amp;gt;SetParticlePosition(G4ThreeVector(x0,y0,z0));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
means that only one particle is generated, incident from (x0,y0,z0). The default number of&lt;br /&gt;
events is set to 6000. Therefore, 6000 particles are incident to the water box. &lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the material'''&lt;br /&gt;
&lt;br /&gt;
In this example we compute the energy deposition of photons in water box. However,&lt;br /&gt;
there is an option to change the box material from water to lead. &lt;br /&gt;
&lt;br /&gt;
In gamma.mac change &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Lead&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the type of incident particle'''&lt;br /&gt;
&lt;br /&gt;
In gamma.mac change the photon &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to electron&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle e-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 40. Keep in mind that &lt;br /&gt;
if you want to have bigger number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/PhotonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to a value which is bigger then the number of your slices. The default number is MaxLayer=50. For example, if you want your box to be divided to 60 slices you need to set the value of MaxLayer to ,for example, 65 then in gamma.mac you need to change the number of slices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/sliceNumber 60 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every time you modify files in directory PhotonPB_source you need to compile your code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''gamma.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
In this example, we use '''DAWN''' event display. Before running the visualisation look at the [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, uncomment line '''/control/execute visualisation.mac''' and run the  &lt;br /&gt;
gamma.mac macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. Both files contain detector geometry and particle interactions. While running the gamma.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the DAWN display change the polar and azimuthal angles to 0 and 90 degrees, then press OK.  This will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The color in the images indicates the type of the particle. Photons are in green, electrons are in red and positrons are in cyan. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic photon pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam</id>
		<title>Monoenergetic photon pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam"/>
				<updated>2014-09-10T13:29:42Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, electrons are in red. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder PhotonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir PhotonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd PhotonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mv PhotonPB PhotonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/PhotonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mkdir PhotonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cd PhotonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The macro produces root file '''Gamma.root''' with a histogram showing the energy deposition in &lt;br /&gt;
water box along the beam line. It also produces text files: '''DoseFile.txt''' with &lt;br /&gt;
energy and dose deposited in each slice and '''PlotDose.txt''' with dose deposited in each slice. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''DoseFile.txt''' with physics process '''emstandard_opt0''' and incident photon energy of '''20 MeV'''. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open text files. For example, use editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	 x[mm] 	Edep   	     Edep/Ebeam[%] 	Dose 	       Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	5	119.065 MeV	0.0992211	9.53818e-11 Gy	15.1483	&lt;br /&gt;
 layer 2: 	10	206.505 MeV	0.172088	1.65429e-10 Gy	26.2731	&lt;br /&gt;
 layer 3: 	15	259.584 MeV	0.21632	        2.07949e-10 Gy	33.026	&lt;br /&gt;
 layer 4: 	20	311.898 MeV	0.259915	2.49858e-10 Gy	39.6819	&lt;br /&gt;
 layer 5: 	25	395.255 MeV	0.329379	3.16634e-10 Gy	50.2871	&lt;br /&gt;
 layer 6: 	30	439.052 MeV	0.365876	3.51719e-10 Gy	55.8592	&lt;br /&gt;
 layer 7: 	35	503.311 MeV	0.419426	4.03197e-10 Gy	64.0348	&lt;br /&gt;
 layer 8: 	40	573.742 MeV	0.478118	4.59618e-10 Gy	72.9954	&lt;br /&gt;
 layer 9: 	45	624.707 MeV	0.520589	5.00446e-10 Gy	79.4796	&lt;br /&gt;
 layer 10: 	50	678.383 MeV	0.565319	5.43445e-10 Gy	86.3086	&lt;br /&gt;
 layer 11: 	55	694.602 MeV	0.578835	5.56437e-10 Gy	88.3721	&lt;br /&gt;
 layer 12: 	60	710.771 MeV	0.592309	5.6939e-10 Gy	90.4292	&lt;br /&gt;
 layer 13: 	65	744.826 MeV	0.620689	5.96672e-10 Gy	94.762	&lt;br /&gt;
 layer 14: 	70	742.436 MeV	0.618697	5.94757e-10 Gy	94.4579	&lt;br /&gt;
 layer 15: 	75	771.713 MeV	0.643094	6.1821e-10 Gy	98.1827	&lt;br /&gt;
 layer 16: 	80	767.22 MeV	0.63935	        6.14611e-10 Gy	97.611	&lt;br /&gt;
 layer 17: 	85	775.608 MeV	0.64634	        6.21331e-10 Gy	98.6783	&lt;br /&gt;
 layer 18: 	90	762.779 MeV	0.635649	6.11053e-10 Gy	97.046	&lt;br /&gt;
 layer 19: 	95	785.997 MeV	0.654997	6.29653e-10 Gy	100	&lt;br /&gt;
 layer 20: 	100	735.186 MeV	0.612655	5.88949e-10 Gy	93.5355	&lt;br /&gt;
 layer 21: 	105	761.414 MeV	0.634512	6.0996e-10 Gy	96.8724	&lt;br /&gt;
 layer 22: 	110	721.836 MeV	0.60153	        5.78254e-10 Gy	91.837	&lt;br /&gt;
 layer 23: 	115	730.726 MeV	0.608939	5.85376e-10 Gy	92.9681	&lt;br /&gt;
 layer 24: 	120	728.394 MeV	0.606995	5.83508e-10 Gy	92.6714	&lt;br /&gt;
 layer 25: 	125	744.904 MeV	0.620753	5.96734e-10 Gy	94.7719	&lt;br /&gt;
 layer 26: 	130	731.53 MeV	0.609608	5.8602e-10 Gy	93.0703	&lt;br /&gt;
 layer 27: 	135	702.85 MeV	0.585709	5.63045e-10 Gy	89.4215	&lt;br /&gt;
 layer 28: 	140	671.716 MeV	0.559763	5.38104e-10 Gy	85.4604	&lt;br /&gt;
 layer 29: 	145	676.297 MeV	0.56358	        5.41773e-10 Gy	86.0432	&lt;br /&gt;
 layer 30: 	150	653.849 MeV	0.544875	5.23791e-10 Gy	83.1873	&lt;br /&gt;
 layer 31: 	155	674.152 MeV	0.561793	5.40055e-10 Gy	85.7703	&lt;br /&gt;
 layer 32: 	160	687.008 MeV	0.572507	5.50354e-10 Gy	87.406	&lt;br /&gt;
 layer 33: 	165	706.2 MeV	0.5885	        5.65729e-10 Gy	89.8478	&lt;br /&gt;
 layer 34: 	170	700.841 MeV	0.584034	5.61435e-10 Gy	89.1659	&lt;br /&gt;
 layer 35: 	175	686.009 MeV	0.571674	5.49553e-10 Gy	87.2788	&lt;br /&gt;
 layer 36: 	180	658.891 MeV	0.549076	5.2783e-10 Gy	83.8287	&lt;br /&gt;
 layer 37: 	185	644.999 MeV	0.537499	5.16701e-10 Gy	82.0613	&lt;br /&gt;
 layer 38: 	190	655.81 MeV	0.546508	5.25362e-10 Gy	83.4367	&lt;br /&gt;
 layer 39: 	195	645.691 MeV	0.538075	5.17255e-10 Gy	82.1493	&lt;br /&gt;
 layer 40: 	200	0 eV 	        0	        0 Gy	        0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 gamma of 20 MeV through 20 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 40 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 120 GeV&lt;br /&gt;
 Total energy deposit= 24.8344 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is '''PlotDose.txt'''. These values can be analyzed with MATLAB and ROOT .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;  &lt;br /&gt;
5	15.1483	&lt;br /&gt;
10	26.2731	&lt;br /&gt;
15	33.026	&lt;br /&gt;
20	39.6819	&lt;br /&gt;
25	50.2871	&lt;br /&gt;
30	55.8592	&lt;br /&gt;
35	64.0348	&lt;br /&gt;
40	72.9954	&lt;br /&gt;
45	79.4796	&lt;br /&gt;
50	86.3086	&lt;br /&gt;
55	88.3721	&lt;br /&gt;
60	90.4292	&lt;br /&gt;
65	94.762	&lt;br /&gt;
70	94.4579	&lt;br /&gt;
75	98.1827	&lt;br /&gt;
80	97.611	&lt;br /&gt;
85	98.6783	&lt;br /&gt;
90	97.046	&lt;br /&gt;
95	100	&lt;br /&gt;
100	93.5355	&lt;br /&gt;
105	96.8724	&lt;br /&gt;
110	91.837	&lt;br /&gt;
115	92.9681	&lt;br /&gt;
120	92.6714	&lt;br /&gt;
125	94.7719	&lt;br /&gt;
130	93.0703	&lt;br /&gt;
135	89.4215	&lt;br /&gt;
140	85.4604	&lt;br /&gt;
145	86.0432	&lt;br /&gt;
150	83.1873	&lt;br /&gt;
155	85.7703	&lt;br /&gt;
160	87.406	&lt;br /&gt;
165	89.8478	&lt;br /&gt;
170	89.1659	&lt;br /&gt;
175	87.2788	&lt;br /&gt;
180	83.8287	&lt;br /&gt;
185	82.0613	&lt;br /&gt;
190	83.4367	&lt;br /&gt;
195	82.1493	&lt;br /&gt;
200	0	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Gamma.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Gamma.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The histogram inside Gamma.root shows the energy deposition in water box:&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/Edep_PhotonB1.png &lt;br /&gt;
&lt;br /&gt;
To exit the ROOT terminal type &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can plot the dose deposition along the depth of the absorber ('''PlotDose.txt''') using script '''PlotSimulation.C''' from folder '''PhotonPB_source'''. Copy this script to your current '''PhotonPB_build''' directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cp /home/username/PhotonPBFolder/PhotonPB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Then run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file. Open the root file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Simulation.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/DoseDeposition1.png   &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
Before proceeding with MATLAB you need to copy the text files from the cluster to your computer. In the terminal at your computer write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
scp username@plus1.hep.ucl.ac.uk:/home/username/PhotonPBFolder/PhotonPB_build/PlotDose.txt .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file '''PlotDose.txt''' will be copied in your current directory. Then, open MATLAB and follow the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. &lt;br /&gt;
* 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'.  &lt;br /&gt;
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.&lt;br /&gt;
&lt;br /&gt;
This plot will be created:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/matlab0photon.png &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident photon energy, phantom material, number of slices etc. by&lt;br /&gt;
modifying the macro gamma.mac. Open the macro with editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# gamma.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry and material&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
#/photonPB/det/setMat Lead&lt;br /&gt;
/photonPB/det/setSizeX  20 cm&lt;br /&gt;
/photonPB/det/setSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/setSliceSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/sliceNumber 40 &lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
#/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/photonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (range cut off-&lt;br /&gt;
# not bigger than 10% of slice thickness)&lt;br /&gt;
/photonPB/phys/setCuts 1 mm&lt;br /&gt;
#/photonPB/phys/setGCut 1 um&lt;br /&gt;
#/photonPB/phys/setECut 1 um&lt;br /&gt;
#/photonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
&lt;br /&gt;
# particle gun properties (type of &lt;br /&gt;
#particle and energy)&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
#/gun/particle e-&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/photonPB/stepMax 0.5 mm&lt;br /&gt;
#&lt;br /&gt;
/photonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output root file&lt;br /&gt;
/analysis/setFileName Gamma&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''emstandard_opt0'''. This package is used in high energy experiments. In gamma.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process '''emlivermore''' is used in low energy physics experiments. &lt;br /&gt;
&lt;br /&gt;
'''Change the incident particle energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 20 MeV. The typical therapeutic beam energy used in radiotherapy is in the interval 0.3 to 20 MeV. In gamma.mac you can change the value of 20 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 1.25 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 1.25 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the energy of the photon beams from cobalt-60 therapy machines.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that the primary particle generation is done at /PhotonPB_source/src/PrimaryGeneratorAction.cc.&lt;br /&gt;
This is part of the PrimaryGeneratorAction.cc:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()-&amp;gt;FindParticle(&amp;quot;proton&amp;quot;);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleDefinition(particle);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleEnergy(160*MeV);  &lt;br /&gt;
fParticleGun-&amp;gt;SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));&lt;br /&gt;
     &lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
G4double x0 = -0.5*(fDetector-&amp;gt;GetAbsorSizeX());&lt;br /&gt;
G4double y0 = 0.*cm, z0 = 0.*cm;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
fParticleGun-&amp;gt;SetParticlePosition(G4ThreeVector(x0,y0,z0));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
means that only one particle is generated, incident from (x0,y0,z0). The default number of&lt;br /&gt;
events is set to 6000. Therefore, 6000 particles are incident to the water box. &lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the material'''&lt;br /&gt;
&lt;br /&gt;
In this example we compute the energy deposition of photons in water box. However,&lt;br /&gt;
there is an option to change the box material from water to lead. &lt;br /&gt;
&lt;br /&gt;
In gamma.mac change &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Lead&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the type of incident particle'''&lt;br /&gt;
&lt;br /&gt;
In gamma.mac change the photon &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to electron&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle e-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 40. Keep in mind that &lt;br /&gt;
if you want to have bigger number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/PhotonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to a value which is bigger then the number of your slices. The default number is MaxLayer=50. For example, if you want your box to be divided to 60 slices you need to set the value of MaxLayer to ,for example, 65 then in gamma.mac you need to change the number of slices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/sliceNumber 60 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every time you modify files in directory PhotonPB_source you need to compile your code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''gamma.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
In this example, we use '''DAWN''' event display. Before running the visualisation look at the [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, uncomment line '''/control/execute visualisation.mac''' and run the  &lt;br /&gt;
gamma.mac macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. Both files contain detector geometry and particle interactions. While running the gamma.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the DAWN display change the polar and azimuthal angles to 0 and 90 degrees, then press OK.  This will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The color in the images indicates the type of the particle. Photons are in green, electrons are in red and positrons are in cyan. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic photon pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam</id>
		<title>Monoenergetic proton pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam"/>
				<updated>2014-09-10T11:41:23Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident proton 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and the dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining two scoring meshes in longitudinal and lateral direction of the beam. More information about the scoring meshes can be found [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s08.html here]. The protons are generated using '''G4ParticleGun''' class. There is an option to chose among several '''EM''' and the '''QGSP_BIC_EMY''' physics lists.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Protons are in blue, photons are in green. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mv ProtonPB ProtonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mkdir ProtonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cd ProtonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonPBFolder/ProtonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* The two ways to record data should give similar result.   &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''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. For example, open this text file with editor '''pico''': &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	x[mm]  	Edep 	    Edep/Ebeam[%]  Dose        Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	0.8	5.17382 GeV	1.39081	6.47608e-07 Gy	17.3315	&lt;br /&gt;
 layer 2: 	1.6	5.24175 GeV	1.40907	6.5611e-07 Gy	17.5591	&lt;br /&gt;
 layer 3: 	2.4	5.29862 GeV	1.42436	6.63229e-07 Gy	17.7496	&lt;br /&gt;
 layer 4: 	3.2	5.41481 GeV	1.45559	6.77772e-07 Gy	18.1388	&lt;br /&gt;
 layer 5: 	4	5.43787 GeV	1.46179	6.80658e-07 Gy	18.216	&lt;br /&gt;
 layer 6: 	4.8	5.52101 GeV	1.48414	6.91065e-07 Gy	18.4946	&lt;br /&gt;
 layer 7: 	5.6	5.64633 GeV	1.51783	7.06751e-07 Gy	18.9144	&lt;br /&gt;
 layer 8: 	6.4	5.63969 GeV	1.51605	7.0592e-07 Gy	18.8921	&lt;br /&gt;
 layer 9: 	7.2	5.71744 GeV	1.53695	7.15652e-07 Gy	19.1526	&lt;br /&gt;
 layer 10: 	8	5.78086 GeV	1.55399	7.2359e-07 Gy	19.365	&lt;br /&gt;
 layer 11: 	8.8	5.94371 GeV	1.59777	7.43975e-07 Gy	19.9106	&lt;br /&gt;
 layer 12: 	9.6	6.02518 GeV	1.61967	7.54172e-07 Gy	20.1835	&lt;br /&gt;
 layer 13: 	10.4	6.10292 GeV	1.64057	7.63903e-07 Gy	20.4439	&lt;br /&gt;
 layer 14: 	11.2	6.18071 GeV	1.66148	7.7364e-07 Gy	20.7045	&lt;br /&gt;
 layer 15: 	12	6.2621 GeV	1.68336	7.83827e-07 Gy	20.9771	&lt;br /&gt;
 layer 16: 	12.8	6.37762 GeV	1.71441	7.98286e-07 Gy	21.3641	&lt;br /&gt;
 layer 17: 	13.6	6.52458 GeV	1.75392	8.16682e-07 Gy	21.8564	&lt;br /&gt;
 layer 18: 	14.4	6.67805 GeV	1.79517	8.35892e-07 Gy	22.3705	&lt;br /&gt;
 layer 19: 	15.2	6.86252 GeV	1.84476	8.58982e-07 Gy	22.9884	&lt;br /&gt;
 layer 20: 	16	6.95226 GeV	1.86889	8.70215e-07 Gy	23.289	&lt;br /&gt;
 layer 21: 	16.8	7.11679 GeV	1.91312	8.90809e-07 Gy	23.8402	&lt;br /&gt;
 layer 22: 	17.6	7.15125 GeV	1.92238	8.95122e-07 Gy	23.9556	&lt;br /&gt;
 layer 23: 	18.4	7.43274 GeV	1.99805	9.30356e-07 Gy	24.8986	&lt;br /&gt;
 layer 24: 	19.2	7.58811 GeV	2.03981	9.49804e-07 Gy	25.419	&lt;br /&gt;
 layer 25: 	20	7.8156 GeV	2.10097	9.78279e-07 Gy	26.1811	&lt;br /&gt;
 layer 26: 	20.8	7.94754 GeV	2.13643	9.94794e-07 Gy	26.6231	&lt;br /&gt;
 layer 27: 	21.6	8.35363 GeV	2.2456	1.04562e-06 Gy	27.9834	&lt;br /&gt;
 layer 28: 	22.4	8.44564 GeV	2.27033	1.05714e-06 Gy	28.2917	&lt;br /&gt;
 layer 29: 	23.2	8.74817 GeV	2.35166	1.09501e-06 Gy	29.3051	&lt;br /&gt;
 layer 30: 	24	9.08194 GeV	2.44138	1.13679e-06 Gy	30.4232	&lt;br /&gt;
 layer 31: 	24.8	9.50886 GeV	2.55615	1.19022e-06 Gy	31.8533	&lt;br /&gt;
 layer 32: 	25.6	9.93302 GeV	2.67017	1.24332e-06 Gy	33.2741	&lt;br /&gt;
 layer 33: 	26.4	10.5627 GeV	2.83943	1.32213e-06 Gy	35.3834	&lt;br /&gt;
 layer 34: 	27.2	11.1563 GeV	2.99902	1.39644e-06 Gy	37.3721	&lt;br /&gt;
 layer 35: 	28	12.0025 GeV	3.22647	1.50235e-06 Gy	40.2065	&lt;br /&gt;
 layer 36: 	28.8	13.1124 GeV	3.52485	1.64128e-06 Gy	43.9247	&lt;br /&gt;
 layer 37: 	29.6	14.5158 GeV	3.90209	1.81694e-06 Gy	48.6257	&lt;br /&gt;
 layer 38: 	30.4	16.8932 GeV	4.54119	2.11452e-06 Gy	56.5898	&lt;br /&gt;
 layer 39: 	31.2	20.9827 GeV	5.64051	2.62641e-06 Gy	70.289	&lt;br /&gt;
 layer 40: 	32	29.8521 GeV	8.02475	3.73658e-06 Gy	100	&lt;br /&gt;
 layer 41: 	32.8	14.922 GeV	4.0113	1.86779e-06 Gy	49.9866	&lt;br /&gt;
 layer 42: 	33.6	330.005 MeV	0.088711     4.13067e-08 Gy  1.10547	&lt;br /&gt;
 layer 43: 	34.4	2.92265 MeV	0.000785658  3.65828e-10 Gy  0.00979044	&lt;br /&gt;
 layer 44: 	35.2	864.413 keV	0.000232369  1.08199e-10 Gy  0.00289566	&lt;br /&gt;
 layer 45: 	36	673.958 keV	0.000181172  8.43594e-11 Gy  0.00225766	&lt;br /&gt;
 layer 46: 	36.8	1.18851 MeV	0.000319491  1.48765e-10 Gy  0.00398132	&lt;br /&gt;
 layer 47: 	37.6	3.81319 MeV	0.00102505   4.77297e-10 Gy  0.0127736	&lt;br /&gt;
 layer 48: 	38.4	4.58219 MeV	0.00123177   5.73552e-10 Gy  0.0153496	&lt;br /&gt;
 layer 49: 	39.2	7.29449 MeV	0.00196088   9.13052e-10 Gy  0.0244355	&lt;br /&gt;
 layer 50: 	40	0 eV 	0	0 Gy	0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 proton of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 50 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 372 GeV&lt;br /&gt;
 Total energy deposit= 367.368 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding '''PlotDose.txt''' is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
0.8	17.3315	&lt;br /&gt;
1.6	17.5591	&lt;br /&gt;
2.4	17.7496	&lt;br /&gt;
3.2	18.1388	&lt;br /&gt;
4	18.216	&lt;br /&gt;
4.8	18.4946	&lt;br /&gt;
5.6	18.9144	&lt;br /&gt;
6.4	18.8921	&lt;br /&gt;
7.2	19.1526	&lt;br /&gt;
8	19.365	&lt;br /&gt;
8.8	19.9106	&lt;br /&gt;
9.6	20.1835	&lt;br /&gt;
10.4	20.4439	&lt;br /&gt;
11.2	20.7045	&lt;br /&gt;
12	20.9771	&lt;br /&gt;
12.8	21.3641	&lt;br /&gt;
13.6	21.8564	&lt;br /&gt;
14.4	22.3705	&lt;br /&gt;
15.2	22.9884	&lt;br /&gt;
16	23.289	&lt;br /&gt;
16.8	23.8402	&lt;br /&gt;
17.6	23.9556	&lt;br /&gt;
18.4	24.8986	&lt;br /&gt;
19.2	25.419	&lt;br /&gt;
20	26.1811	&lt;br /&gt;
20.8	26.6231	&lt;br /&gt;
21.6	27.9834	&lt;br /&gt;
22.4	28.2917	&lt;br /&gt;
23.2	29.3051	&lt;br /&gt;
24	30.4232	&lt;br /&gt;
24.8	31.8533	&lt;br /&gt;
25.6	33.2741	&lt;br /&gt;
26.4	35.3834	&lt;br /&gt;
27.2	37.3721	&lt;br /&gt;
28	40.2065	&lt;br /&gt;
28.8	43.9247	&lt;br /&gt;
29.6	48.6257	&lt;br /&gt;
30.4	56.5898	&lt;br /&gt;
31.2	70.289	&lt;br /&gt;
32	100	&lt;br /&gt;
32.8	49.9866	&lt;br /&gt;
33.6	1.10547	&lt;br /&gt;
34.4	0.00979044	&lt;br /&gt;
35.2	0.00289566	&lt;br /&gt;
36	0.00225766	&lt;br /&gt;
36.8	0.00398132	&lt;br /&gt;
37.6	0.0127736	&lt;br /&gt;
38.4	0.0153496	&lt;br /&gt;
39.2	0.0244355	&lt;br /&gt;
40	0		&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLongitudinalMesh.txt '''DoseLongitudinalMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/EnergyLongitudinalMesh.txt '''EnergyLongitudinalMesh.txt'''] contain information about the dose and energy deposition in 50 voxels along the beam.  &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLateralMesh.txt '''DoseLateralMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Proton.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l Proton.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT Files and Proton.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PB1.png &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PBzoom1.png  &lt;br /&gt;
&lt;br /&gt;
You can close your ROOT session by typing &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Folder '''RootScripts''' contains several ROOT scripts which plot dose deposition in data and simulation.&lt;br /&gt;
You can use script '''PlotSimulation.C''' to plot the dose deposition along the absorber. This script uses '''PlotDose.txt'''. Copy the script to your current ProtonPB_build directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/Simulation1.png  &lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
scp username@plus1.hep.ucl.ac.uk:/home/username/PhotonPBFolder/PhotonPB_build/PlotDose.txt .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, open MATLAB and follow the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. &lt;br /&gt;
* 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'.  &lt;br /&gt;
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.&lt;br /&gt;
&lt;br /&gt;
This plot will be created:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You can also 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.&lt;br /&gt;
Before running the script substitude the commas in '''DoseLateralMesh.txt''' with spaces. Remove also the header in the text file. Then, save the text file as '''DoseLateralMesh_Mod.txt'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotLateralDoseMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotLateralDoseMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''LateralDose_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/SimulationLateralMesh.png&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton energy and number of slices etc. by&lt;br /&gt;
modifying the macro proton.mac. Open the macro with editor '''pico''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry &lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/sliceNumber 50 &lt;br /&gt;
#&lt;br /&gt;
# define longitudinal scoring mesh&lt;br /&gt;
# along the beam&lt;br /&gt;
/score/create/boxMesh waterMeshlongitudinal&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 50 1 1&lt;br /&gt;
/score/mesh/translate/xyz 0. 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# define lateral scoring mesh&lt;br /&gt;
# centered at the Bragg peak&lt;br /&gt;
/score/create/boxMesh waterMeshlateral&lt;br /&gt;
/score/mesh/boxSize 0.1 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 1 1 50&lt;br /&gt;
/score/mesh/translate/xyz 1.2 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range &lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonPB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonPB/phys/setGCut 1 um&lt;br /&gt;
#/protonPB/phys/setECut 1 um&lt;br /&gt;
#/protonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy used in Clatterbridge Centre  &lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonPB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output file&lt;br /&gt;
/analysis/setFileName Proton&lt;br /&gt;
#&lt;br /&gt;
# histogram &lt;br /&gt;
/analysis/h1/set 2 50 25 35 mm&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
# drawing projections&lt;br /&gt;
#/score/drawProjection waterMeshlongitudinal doseDeposit&lt;br /&gt;
#/score/drawProjection waterMeshlateral doseDeposit&lt;br /&gt;
#&lt;br /&gt;
# dump scores to a file&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal energyDeposit EnergyLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral doseDeposit DoseLateralMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral energyDeposit EnergyLateralMesh.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change dimensions of the water box'''&lt;br /&gt;
&lt;br /&gt;
The default size is 4x4x4 cm. You can change the dimensions by modifying the lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''QGSP_BIC_EMY'''. This is a physics list recommended for proton therapy. You can check what will be the dose deposition if you change the physics list. In proton.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the incident proton energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 62 MeV. This is one of the energies used in radiotherapy. In proton.mac you can change the value of 62 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 50 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 50 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 50. Keep in mind that &lt;br /&gt;
if you want to increase the number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/ProtonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to value bigger than the number of your slices. The default value is MaxLayer=60. For example, if you want to have 55 slices you do not need to modify MaxLayer. Then, only in proton.mac change the number of slices &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/sliceNumber 55 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Modify the mesh'''&lt;br /&gt;
&lt;br /&gt;
You can change the size of the mesh (longitudinal and lateral) and the number of voxels by modifying their corresponding lines &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 30 1 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After modifications in proton.mac'''&lt;br /&gt;
&lt;br /&gt;
After modifying the macro proton.mac you can run it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
If you modify files in directory ProtonPB_source (for example you change the value of MaxLayer) you need to comppile the code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro proton.mac.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
If you uncomment the lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections. In this example, we use '''DAWN''' event display. Before running the visualisation look at this [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, first uncomment lines '''/control/execute visualisation.mac''' and '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Then, run the proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. The first file contains detector geometry and particle interactions. The second file contains dose projections. While running the proton.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the opened window press OK and this will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_02_6000e.eps&lt;br /&gt;
&lt;br /&gt;
You can modify the .prim files in DAWN. For example, in the DAWN display change the polar and azimuthal angles. 1) (polar angle, azimuthal angle) = (0,90) will create this image&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
2) (polar angle, azimuthal angle) = (90,0) will create this image &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_04_6000e.eps&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_03_6000e.eps    &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data from The Clatterbridge Cancer Centre &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/ClatterbridgeBraggPeak.txt data] from the Clatterbridge Cancer Center. The first column represents the values in mm in depth, the second column represents the normalized values of deposited dose and normalized at the peak. You can use script '''PlotData.C''' from folder'''RootScripts''' to plot the data. Copy files '''ClatterbridgeData.txt''' and '''PlotData.C''' to your current ProtonPB_build directory and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotData.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/ClatterbridgeData.txt .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotData.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''ClatterbridgeData.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/Clatterbridge.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Comparison between data and simulation &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The scripts '''PlotDataAndSim.C''' and '''PlotDataAndSimMesh.C''' in folder '''RootScripts''' compare data with simulation. &lt;br /&gt;
You can use script '''PlotDataAndSim.C''' to compare data (ClatterbridgeData.txt) and simulation ('''PlotDose.txt'''). Both text files must be in the folder where you run the script. &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSim.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSim.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''BraggPeakComparison.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulation.png&lt;br /&gt;
&lt;br /&gt;
You can also compare data (ClatterbridgeData.txt) with simulation done with scoring mesh ('''DoseLongitudinalMesh.txt''').&lt;br /&gt;
This can be done with script '''PlotDataAndSimMesh.C'''. This script works only if before running it you substitude the commas &lt;br /&gt;
in '''DoseLongitudinalMesh.txt''' with spaces. Remove also the header in the text file. Save the new text file as '''DoseLongitudinalMesh_Mod.txt'''. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSimMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSimMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This creates '''BraggPeakComparison_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulationMesh.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic proton pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam</id>
		<title>Monoenergetic photon pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam"/>
				<updated>2014-09-10T11:34:34Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, electrons are in red. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder PhotonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir PhotonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd PhotonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mv PhotonPB PhotonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/PhotonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mkdir PhotonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cd PhotonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The macro produces root file '''Gamma.root''' with a histogram showing the energy deposition in &lt;br /&gt;
water box along the beam line. It also produces text files: '''DoseFile.txt''' with &lt;br /&gt;
energy and dose deposited in each slice and '''PlotDose.txt''' with dose deposited in each slice. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''DoseFile.txt''' with physics process '''emstandard_opt0''' and incident photon energy of '''20 MeV'''. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open text files. For example, use editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	 x[mm] 	Edep   	     Edep/Ebeam[%] 	Dose 	       Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	5	119.065 MeV	0.0992211	9.53818e-11 Gy	15.1483	&lt;br /&gt;
 layer 2: 	10	206.505 MeV	0.172088	1.65429e-10 Gy	26.2731	&lt;br /&gt;
 layer 3: 	15	259.584 MeV	0.21632	        2.07949e-10 Gy	33.026	&lt;br /&gt;
 layer 4: 	20	311.898 MeV	0.259915	2.49858e-10 Gy	39.6819	&lt;br /&gt;
 layer 5: 	25	395.255 MeV	0.329379	3.16634e-10 Gy	50.2871	&lt;br /&gt;
 layer 6: 	30	439.052 MeV	0.365876	3.51719e-10 Gy	55.8592	&lt;br /&gt;
 layer 7: 	35	503.311 MeV	0.419426	4.03197e-10 Gy	64.0348	&lt;br /&gt;
 layer 8: 	40	573.742 MeV	0.478118	4.59618e-10 Gy	72.9954	&lt;br /&gt;
 layer 9: 	45	624.707 MeV	0.520589	5.00446e-10 Gy	79.4796	&lt;br /&gt;
 layer 10: 	50	678.383 MeV	0.565319	5.43445e-10 Gy	86.3086	&lt;br /&gt;
 layer 11: 	55	694.602 MeV	0.578835	5.56437e-10 Gy	88.3721	&lt;br /&gt;
 layer 12: 	60	710.771 MeV	0.592309	5.6939e-10 Gy	90.4292	&lt;br /&gt;
 layer 13: 	65	744.826 MeV	0.620689	5.96672e-10 Gy	94.762	&lt;br /&gt;
 layer 14: 	70	742.436 MeV	0.618697	5.94757e-10 Gy	94.4579	&lt;br /&gt;
 layer 15: 	75	771.713 MeV	0.643094	6.1821e-10 Gy	98.1827	&lt;br /&gt;
 layer 16: 	80	767.22 MeV	0.63935	        6.14611e-10 Gy	97.611	&lt;br /&gt;
 layer 17: 	85	775.608 MeV	0.64634	        6.21331e-10 Gy	98.6783	&lt;br /&gt;
 layer 18: 	90	762.779 MeV	0.635649	6.11053e-10 Gy	97.046	&lt;br /&gt;
 layer 19: 	95	785.997 MeV	0.654997	6.29653e-10 Gy	100	&lt;br /&gt;
 layer 20: 	100	735.186 MeV	0.612655	5.88949e-10 Gy	93.5355	&lt;br /&gt;
 layer 21: 	105	761.414 MeV	0.634512	6.0996e-10 Gy	96.8724	&lt;br /&gt;
 layer 22: 	110	721.836 MeV	0.60153	        5.78254e-10 Gy	91.837	&lt;br /&gt;
 layer 23: 	115	730.726 MeV	0.608939	5.85376e-10 Gy	92.9681	&lt;br /&gt;
 layer 24: 	120	728.394 MeV	0.606995	5.83508e-10 Gy	92.6714	&lt;br /&gt;
 layer 25: 	125	744.904 MeV	0.620753	5.96734e-10 Gy	94.7719	&lt;br /&gt;
 layer 26: 	130	731.53 MeV	0.609608	5.8602e-10 Gy	93.0703	&lt;br /&gt;
 layer 27: 	135	702.85 MeV	0.585709	5.63045e-10 Gy	89.4215	&lt;br /&gt;
 layer 28: 	140	671.716 MeV	0.559763	5.38104e-10 Gy	85.4604	&lt;br /&gt;
 layer 29: 	145	676.297 MeV	0.56358	        5.41773e-10 Gy	86.0432	&lt;br /&gt;
 layer 30: 	150	653.849 MeV	0.544875	5.23791e-10 Gy	83.1873	&lt;br /&gt;
 layer 31: 	155	674.152 MeV	0.561793	5.40055e-10 Gy	85.7703	&lt;br /&gt;
 layer 32: 	160	687.008 MeV	0.572507	5.50354e-10 Gy	87.406	&lt;br /&gt;
 layer 33: 	165	706.2 MeV	0.5885	        5.65729e-10 Gy	89.8478	&lt;br /&gt;
 layer 34: 	170	700.841 MeV	0.584034	5.61435e-10 Gy	89.1659	&lt;br /&gt;
 layer 35: 	175	686.009 MeV	0.571674	5.49553e-10 Gy	87.2788	&lt;br /&gt;
 layer 36: 	180	658.891 MeV	0.549076	5.2783e-10 Gy	83.8287	&lt;br /&gt;
 layer 37: 	185	644.999 MeV	0.537499	5.16701e-10 Gy	82.0613	&lt;br /&gt;
 layer 38: 	190	655.81 MeV	0.546508	5.25362e-10 Gy	83.4367	&lt;br /&gt;
 layer 39: 	195	645.691 MeV	0.538075	5.17255e-10 Gy	82.1493	&lt;br /&gt;
 layer 40: 	200	0 eV 	        0	        0 Gy	        0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 gamma of 20 MeV through 20 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 40 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 120 GeV&lt;br /&gt;
 Total energy deposit= 24.8344 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is '''PlotDose.txt'''. These values can be analyzed with MATLAB and ROOT .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;  &lt;br /&gt;
5	15.1483	&lt;br /&gt;
10	26.2731	&lt;br /&gt;
15	33.026	&lt;br /&gt;
20	39.6819	&lt;br /&gt;
25	50.2871	&lt;br /&gt;
30	55.8592	&lt;br /&gt;
35	64.0348	&lt;br /&gt;
40	72.9954	&lt;br /&gt;
45	79.4796	&lt;br /&gt;
50	86.3086	&lt;br /&gt;
55	88.3721	&lt;br /&gt;
60	90.4292	&lt;br /&gt;
65	94.762	&lt;br /&gt;
70	94.4579	&lt;br /&gt;
75	98.1827	&lt;br /&gt;
80	97.611	&lt;br /&gt;
85	98.6783	&lt;br /&gt;
90	97.046	&lt;br /&gt;
95	100	&lt;br /&gt;
100	93.5355	&lt;br /&gt;
105	96.8724	&lt;br /&gt;
110	91.837	&lt;br /&gt;
115	92.9681	&lt;br /&gt;
120	92.6714	&lt;br /&gt;
125	94.7719	&lt;br /&gt;
130	93.0703	&lt;br /&gt;
135	89.4215	&lt;br /&gt;
140	85.4604	&lt;br /&gt;
145	86.0432	&lt;br /&gt;
150	83.1873	&lt;br /&gt;
155	85.7703	&lt;br /&gt;
160	87.406	&lt;br /&gt;
165	89.8478	&lt;br /&gt;
170	89.1659	&lt;br /&gt;
175	87.2788	&lt;br /&gt;
180	83.8287	&lt;br /&gt;
185	82.0613	&lt;br /&gt;
190	83.4367	&lt;br /&gt;
195	82.1493	&lt;br /&gt;
200	0	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Gamma.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Gamma.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The histogram inside Gamma.root shows the energy deposition in water box:&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/Edep_PhotonB1.png &lt;br /&gt;
&lt;br /&gt;
To exit the ROOT terminal type &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can plot the dose deposition along the depth of the absorber ('''PlotDose.txt''') using script '''PlotSimulation.C''' from folder '''PhotonPB_source'''. Copy this script to your current '''PhotonPB_build''' directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cp /home/username/PhotonPBFolder/PhotonPB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Then run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file. Open the root file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Simulation.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/DoseDeposition1.png   &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
Before proceeding with MATLAB you need to copy the text files from the cluster to your computer. In the terminal at your computer write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
scp username@plus1.hep.ucl.ac.uk:/home/username/PhotonPBFolder/PhotonPB_build/PlotDose.txt .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The file '''PlotDose.txt''' will be copied in your current directory. Then, open MATLAB and follow the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. &lt;br /&gt;
* 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'.  &lt;br /&gt;
* Close the Import Window and in the Command Window type plot(x,Dose). Press Enter.&lt;br /&gt;
&lt;br /&gt;
This plot will be created:&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident photon energy, phantom material, number of slices etc. by&lt;br /&gt;
modifying the macro gamma.mac. Open the macro with editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# gamma.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry and material&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
#/photonPB/det/setMat Lead&lt;br /&gt;
/photonPB/det/setSizeX  20 cm&lt;br /&gt;
/photonPB/det/setSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/setSliceSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/sliceNumber 40 &lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
#/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/photonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (range cut off-&lt;br /&gt;
# not bigger than 10% of slice thickness)&lt;br /&gt;
/photonPB/phys/setCuts 1 mm&lt;br /&gt;
#/photonPB/phys/setGCut 1 um&lt;br /&gt;
#/photonPB/phys/setECut 1 um&lt;br /&gt;
#/photonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
&lt;br /&gt;
# particle gun properties (type of &lt;br /&gt;
#particle and energy)&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
#/gun/particle e-&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/photonPB/stepMax 0.5 mm&lt;br /&gt;
#&lt;br /&gt;
/photonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output root file&lt;br /&gt;
/analysis/setFileName Gamma&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''emstandard_opt0'''. This package is used in high energy experiments. In gamma.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process '''emlivermore''' is used in low energy physics experiments. &lt;br /&gt;
&lt;br /&gt;
'''Change the incident particle energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 20 MeV. The typical therapeutic beam energy used in radiotherapy is in the interval 0.3 to 20 MeV. In gamma.mac you can change the value of 20 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 1.25 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 1.25 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the energy of the photon beams from cobalt-60 therapy machines.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that the primary particle generation is done at /PhotonPB_source/src/PrimaryGeneratorAction.cc.&lt;br /&gt;
This is part of the PrimaryGeneratorAction.cc:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()-&amp;gt;FindParticle(&amp;quot;proton&amp;quot;);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleDefinition(particle);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleEnergy(160*MeV);  &lt;br /&gt;
fParticleGun-&amp;gt;SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));&lt;br /&gt;
     &lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
G4double x0 = -0.5*(fDetector-&amp;gt;GetAbsorSizeX());&lt;br /&gt;
G4double y0 = 0.*cm, z0 = 0.*cm;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
fParticleGun-&amp;gt;SetParticlePosition(G4ThreeVector(x0,y0,z0));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
means that only one particle is generated, incident from (x0,y0,z0). The default number of&lt;br /&gt;
events is set to 6000. Therefore, 6000 particles are incident to the water box. &lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the material'''&lt;br /&gt;
&lt;br /&gt;
In this example we compute the energy deposition of photons in water box. However,&lt;br /&gt;
there is an option to change the box material from water to lead. &lt;br /&gt;
&lt;br /&gt;
In gamma.mac change &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Lead&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the type of incident particle'''&lt;br /&gt;
&lt;br /&gt;
In gamma.mac change the photon &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to electron&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle e-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 40. Keep in mind that &lt;br /&gt;
if you want to have bigger number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/PhotonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to a value which is bigger then the number of your slices. The default number is MaxLayer=50. For example, if you want your box to be divided to 60 slices you need to set the value of MaxLayer to ,for example, 65 then in gamma.mac you need to change the number of slices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/sliceNumber 60 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every time you modify files in directory PhotonPB_source you need to compile your code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''gamma.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
In this example, we use '''DAWN''' event display. Before running the visualisation look at the [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, uncomment line '''/control/execute visualisation.mac''' and run the  &lt;br /&gt;
gamma.mac macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. Both files contain detector geometry and particle interactions. While running the gamma.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the DAWN display change the polar and azimuthal angles to 0 and 90 degrees, then press OK.  This will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The color in the images indicates the type of the particle. Photons are in green, electrons are in red and positrons are in cyan. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic photon pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam</id>
		<title>Monoenergetic photon pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam"/>
				<updated>2014-09-10T09:58:29Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, electrons are in red. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder PhotonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir PhotonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd PhotonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mv PhotonPB PhotonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/PhotonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mkdir PhotonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cd PhotonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The macro produces root file '''Gamma.root''' with a histogram showing the energy deposition in &lt;br /&gt;
water box along the beam line. It also produces text files: '''DoseFile.txt''' with &lt;br /&gt;
energy and dose deposited in each slice and '''PlotDose.txt''' with dose deposited in each slice. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''DoseFile.txt''' with physics process '''emstandard_opt0''' and incident photon energy of '''20 MeV'''. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open text files. For example, use editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	 x[mm] 	Edep   	     Edep/Ebeam[%] 	Dose 	       Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	5	119.065 MeV	0.0992211	9.53818e-11 Gy	15.1483	&lt;br /&gt;
 layer 2: 	10	206.505 MeV	0.172088	1.65429e-10 Gy	26.2731	&lt;br /&gt;
 layer 3: 	15	259.584 MeV	0.21632	        2.07949e-10 Gy	33.026	&lt;br /&gt;
 layer 4: 	20	311.898 MeV	0.259915	2.49858e-10 Gy	39.6819	&lt;br /&gt;
 layer 5: 	25	395.255 MeV	0.329379	3.16634e-10 Gy	50.2871	&lt;br /&gt;
 layer 6: 	30	439.052 MeV	0.365876	3.51719e-10 Gy	55.8592	&lt;br /&gt;
 layer 7: 	35	503.311 MeV	0.419426	4.03197e-10 Gy	64.0348	&lt;br /&gt;
 layer 8: 	40	573.742 MeV	0.478118	4.59618e-10 Gy	72.9954	&lt;br /&gt;
 layer 9: 	45	624.707 MeV	0.520589	5.00446e-10 Gy	79.4796	&lt;br /&gt;
 layer 10: 	50	678.383 MeV	0.565319	5.43445e-10 Gy	86.3086	&lt;br /&gt;
 layer 11: 	55	694.602 MeV	0.578835	5.56437e-10 Gy	88.3721	&lt;br /&gt;
 layer 12: 	60	710.771 MeV	0.592309	5.6939e-10 Gy	90.4292	&lt;br /&gt;
 layer 13: 	65	744.826 MeV	0.620689	5.96672e-10 Gy	94.762	&lt;br /&gt;
 layer 14: 	70	742.436 MeV	0.618697	5.94757e-10 Gy	94.4579	&lt;br /&gt;
 layer 15: 	75	771.713 MeV	0.643094	6.1821e-10 Gy	98.1827	&lt;br /&gt;
 layer 16: 	80	767.22 MeV	0.63935	        6.14611e-10 Gy	97.611	&lt;br /&gt;
 layer 17: 	85	775.608 MeV	0.64634	        6.21331e-10 Gy	98.6783	&lt;br /&gt;
 layer 18: 	90	762.779 MeV	0.635649	6.11053e-10 Gy	97.046	&lt;br /&gt;
 layer 19: 	95	785.997 MeV	0.654997	6.29653e-10 Gy	100	&lt;br /&gt;
 layer 20: 	100	735.186 MeV	0.612655	5.88949e-10 Gy	93.5355	&lt;br /&gt;
 layer 21: 	105	761.414 MeV	0.634512	6.0996e-10 Gy	96.8724	&lt;br /&gt;
 layer 22: 	110	721.836 MeV	0.60153	        5.78254e-10 Gy	91.837	&lt;br /&gt;
 layer 23: 	115	730.726 MeV	0.608939	5.85376e-10 Gy	92.9681	&lt;br /&gt;
 layer 24: 	120	728.394 MeV	0.606995	5.83508e-10 Gy	92.6714	&lt;br /&gt;
 layer 25: 	125	744.904 MeV	0.620753	5.96734e-10 Gy	94.7719	&lt;br /&gt;
 layer 26: 	130	731.53 MeV	0.609608	5.8602e-10 Gy	93.0703	&lt;br /&gt;
 layer 27: 	135	702.85 MeV	0.585709	5.63045e-10 Gy	89.4215	&lt;br /&gt;
 layer 28: 	140	671.716 MeV	0.559763	5.38104e-10 Gy	85.4604	&lt;br /&gt;
 layer 29: 	145	676.297 MeV	0.56358	        5.41773e-10 Gy	86.0432	&lt;br /&gt;
 layer 30: 	150	653.849 MeV	0.544875	5.23791e-10 Gy	83.1873	&lt;br /&gt;
 layer 31: 	155	674.152 MeV	0.561793	5.40055e-10 Gy	85.7703	&lt;br /&gt;
 layer 32: 	160	687.008 MeV	0.572507	5.50354e-10 Gy	87.406	&lt;br /&gt;
 layer 33: 	165	706.2 MeV	0.5885	        5.65729e-10 Gy	89.8478	&lt;br /&gt;
 layer 34: 	170	700.841 MeV	0.584034	5.61435e-10 Gy	89.1659	&lt;br /&gt;
 layer 35: 	175	686.009 MeV	0.571674	5.49553e-10 Gy	87.2788	&lt;br /&gt;
 layer 36: 	180	658.891 MeV	0.549076	5.2783e-10 Gy	83.8287	&lt;br /&gt;
 layer 37: 	185	644.999 MeV	0.537499	5.16701e-10 Gy	82.0613	&lt;br /&gt;
 layer 38: 	190	655.81 MeV	0.546508	5.25362e-10 Gy	83.4367	&lt;br /&gt;
 layer 39: 	195	645.691 MeV	0.538075	5.17255e-10 Gy	82.1493	&lt;br /&gt;
 layer 40: 	200	0 eV 	        0	        0 Gy	        0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 gamma of 20 MeV through 20 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 40 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 120 GeV&lt;br /&gt;
 Total energy deposit= 24.8344 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is '''PlotDose.txt'''. These values can be analyzed with MATLAB and ROOT .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;  &lt;br /&gt;
5	15.1483	&lt;br /&gt;
10	26.2731	&lt;br /&gt;
15	33.026	&lt;br /&gt;
20	39.6819	&lt;br /&gt;
25	50.2871	&lt;br /&gt;
30	55.8592	&lt;br /&gt;
35	64.0348	&lt;br /&gt;
40	72.9954	&lt;br /&gt;
45	79.4796	&lt;br /&gt;
50	86.3086	&lt;br /&gt;
55	88.3721	&lt;br /&gt;
60	90.4292	&lt;br /&gt;
65	94.762	&lt;br /&gt;
70	94.4579	&lt;br /&gt;
75	98.1827	&lt;br /&gt;
80	97.611	&lt;br /&gt;
85	98.6783	&lt;br /&gt;
90	97.046	&lt;br /&gt;
95	100	&lt;br /&gt;
100	93.5355	&lt;br /&gt;
105	96.8724	&lt;br /&gt;
110	91.837	&lt;br /&gt;
115	92.9681	&lt;br /&gt;
120	92.6714	&lt;br /&gt;
125	94.7719	&lt;br /&gt;
130	93.0703	&lt;br /&gt;
135	89.4215	&lt;br /&gt;
140	85.4604	&lt;br /&gt;
145	86.0432	&lt;br /&gt;
150	83.1873	&lt;br /&gt;
155	85.7703	&lt;br /&gt;
160	87.406	&lt;br /&gt;
165	89.8478	&lt;br /&gt;
170	89.1659	&lt;br /&gt;
175	87.2788	&lt;br /&gt;
180	83.8287	&lt;br /&gt;
185	82.0613	&lt;br /&gt;
190	83.4367	&lt;br /&gt;
195	82.1493	&lt;br /&gt;
200	0	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Gamma.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Gamma.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The histogram inside Gamma.root shows the energy deposition in water box:&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/Edep_PhotonB1.png &lt;br /&gt;
&lt;br /&gt;
To exit the ROOT terminal type &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can plot the dose deposition along the depth of the absorber ('''PlotDose.txt''') using script '''PlotSimulation.C''' from folder '''PhotonPB_source'''. Copy this script to your current '''PhotonPB_build''' directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cp /home/username/PhotonPBFolder/PhotonPB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Then run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file. Open the root file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Simulation.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/DoseDeposition1.png   &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
Before proceeding with MATLAB you need to copy the text files from the cluster to your computer. In the terminal at your computer write:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp username@plus1.hep.ucl.ac.uk:/home/username/.... .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'HOME' tab and 'Import Data'. &lt;br /&gt;
* Select the data points in the opened window and press 'Import Selection'&lt;br /&gt;
* Close the Import Window and in the Command Window type plot(xmm, DoseMaxDose) &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident photon energy, phantom material, number of slices etc. by&lt;br /&gt;
modifying the macro gamma.mac. Open the macro with editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# gamma.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry and material&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
#/photonPB/det/setMat Lead&lt;br /&gt;
/photonPB/det/setSizeX  20 cm&lt;br /&gt;
/photonPB/det/setSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/setSliceSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/sliceNumber 40 &lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
#/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/photonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (range cut off-&lt;br /&gt;
# not bigger than 10% of slice thickness)&lt;br /&gt;
/photonPB/phys/setCuts 1 mm&lt;br /&gt;
#/photonPB/phys/setGCut 1 um&lt;br /&gt;
#/photonPB/phys/setECut 1 um&lt;br /&gt;
#/photonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
&lt;br /&gt;
# particle gun properties (type of &lt;br /&gt;
#particle and energy)&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
#/gun/particle e-&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/photonPB/stepMax 0.5 mm&lt;br /&gt;
#&lt;br /&gt;
/photonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output root file&lt;br /&gt;
/analysis/setFileName Gamma&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''emstandard_opt0'''. This package is used in high energy experiments. In gamma.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process '''emlivermore''' is used in low energy physics experiments. &lt;br /&gt;
&lt;br /&gt;
'''Change the incident particle energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 20 MeV. The typical therapeutic beam energy used in radiotherapy is in the interval 0.3 to 20 MeV. In gamma.mac you can change the value of 20 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 1.25 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 1.25 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the energy of the photon beams from cobalt-60 therapy machines.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that the primary particle generation is done at /PhotonPB_source/src/PrimaryGeneratorAction.cc.&lt;br /&gt;
This is part of the PrimaryGeneratorAction.cc:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()-&amp;gt;FindParticle(&amp;quot;proton&amp;quot;);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleDefinition(particle);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleEnergy(160*MeV);  &lt;br /&gt;
fParticleGun-&amp;gt;SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));&lt;br /&gt;
     &lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
G4double x0 = -0.5*(fDetector-&amp;gt;GetAbsorSizeX());&lt;br /&gt;
G4double y0 = 0.*cm, z0 = 0.*cm;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
fParticleGun-&amp;gt;SetParticlePosition(G4ThreeVector(x0,y0,z0));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
means that only one particle is generated, incident from (x0,y0,z0). The default number of&lt;br /&gt;
events is set to 6000. Therefore, 6000 particles are incident to the water box. &lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the material'''&lt;br /&gt;
&lt;br /&gt;
In this example we compute the energy deposition of photons in water box. However,&lt;br /&gt;
there is an option to change the box material from water to lead. &lt;br /&gt;
&lt;br /&gt;
In gamma.mac change &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Lead&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the type of incident particle'''&lt;br /&gt;
&lt;br /&gt;
In gamma.mac change the photon &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to electron&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle e-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 40. Keep in mind that &lt;br /&gt;
if you want to have bigger number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/PhotonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to a value which is bigger then the number of your slices. The default number is MaxLayer=50. For example, if you want your box to be divided to 60 slices you need to set the value of MaxLayer to ,for example, 65 then in gamma.mac you need to change the number of slices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/sliceNumber 60 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every time you modify files in directory PhotonPB_source you need to compile your code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''gamma.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
In this example, we use '''DAWN''' event display. Before running the visualisation look at the [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, uncomment line '''/control/execute visualisation.mac''' and run the  &lt;br /&gt;
gamma.mac macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. Both files contain detector geometry and particle interactions. While running the gamma.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the DAWN display change the polar and azimuthal angles to 0 and 90 degrees, then press OK.  This will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The color in the images indicates the type of the particle. Photons are in green, electrons are in red and positrons are in cyan. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic photon pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4</id>
		<title>Introduction to GEANT4</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4"/>
				<updated>2014-09-04T17:00:24Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a software toolkit based on C++. In your code you have to define: &lt;br /&gt;
&lt;br /&gt;
* Your experimental setup - geometry, materials and primary particles.&lt;br /&gt;
* Which physics process you are interested in. &lt;br /&gt;
* Take actions during the simulation to inspect and store results. &lt;br /&gt;
&lt;br /&gt;
The interaction with GEANT4 is done via base classes.    &lt;br /&gt;
&lt;br /&gt;
; Mandatory classes:   &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt;: Describe the experimental setup, geometry and materials;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt;: Define particles, physics processes and range cuts;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt;: Describe particle source, source dimensions, initial position, energy spectrum, angular distributions;&lt;br /&gt;
&lt;br /&gt;
; Optional classes: &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt;: Define and store histograms; &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt;: Event selection and analysis of simulation data;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserStackingAction &amp;lt;/span&amp;gt;: Customize priority of tracks;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserTrackingAction &amp;lt;/span&amp;gt;: Decide whether a trajectory should be stored or not;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt;: Kill, suspend, postpone a track;&lt;br /&gt;
&lt;br /&gt;
; Manager class &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt;: Manages processing the run;&lt;br /&gt;
&lt;br /&gt;
; Useful terminology&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt;: the smallest unit of Geant4 simulation, a particle is transported from one point to another&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Trajectory and TrajectoryPoint &amp;lt;/span&amp;gt;: collection of steps and step points&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Process &amp;lt;/span&amp;gt;: physics along the step&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt;: a snapshot of a particle at some point along its path (not the same as trajectory)&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt;: a collection of information from tracks and trajectories&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt;: a collection of events&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The function main() &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; defines the skeleton of your simulation code. Inside the function you instantiate &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt; and notify it of your mandatory and optional classes. This is example &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; function, where &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyEventAction &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyRunAction &amp;lt;/span&amp;gt; are derived classes from the GEANT4 base classes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
int main() { &lt;br /&gt;
  &lt;br /&gt;
// Run manager construction &lt;br /&gt;
&lt;br /&gt;
G4RunManager* runManager = new G4RunManager; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user initialization classes&lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyDetectorConstruction); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyPhysicsList);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user action classes  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyPrimaryGeneratorAction); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// optional user action classes &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyEventAction);  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyRunAction); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Experimental setup &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt; base class. In the derived class you will: &lt;br /&gt;
&lt;br /&gt;
* Describe the shape and the size of your detector using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VSolid &amp;lt;/span&amp;gt; &lt;br /&gt;
* Construct materials and electromagnetic fields using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Logical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
* Place volumes of your detector geometry using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VPhysical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyDetectorConstruction:public G4VUserDetectorConstruction { &lt;br /&gt;
&lt;br /&gt;
public:  &lt;br /&gt;
    &lt;br /&gt;
MyDetectorConstruction();&lt;br /&gt;
&lt;br /&gt;
~MyDetectorConstruction(); &lt;br /&gt;
    &lt;br /&gt;
virtual G4VPhysicalVolume* Construct(); &lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
private: &lt;br /&gt;
   &lt;br /&gt;
void  DefineMaterials(); };    &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now construct the detector. Your detector is always placed in a mother volume called the world volume.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysicalVolume* MyDetectorConstruction::Construct() {  &lt;br /&gt;
&lt;br /&gt;
...  &lt;br /&gt;
&lt;br /&gt;
// World volume &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pWorld = new G4Box(&amp;quot;World&amp;quot;,5*m,5*m,5*m); &lt;br /&gt;
                                         &lt;br /&gt;
G4LogicalVolume* pWorldLog = new G4LogicalVolume(pWorld,vacuum, &amp;quot;World&amp;quot;);    &lt;br /&gt;
                                                                           &lt;br /&gt;
G4VPhysicalVolume* pWorldPhys = new G4PVPlacement(0,G4ThreeVector(),pWorldLog,&amp;quot;World&amp;quot;,0,false,0);  &lt;br /&gt;
&lt;br /&gt;
// Water box &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pBoxSolid = new G4Box(“WaterBox”, 1.*m, 2.*m, 3.*m);  &lt;br /&gt;
&lt;br /&gt;
G4LogicalVolume* pBoxLog = new G4LogicalVolume( pBoxSolid, water, “WaterBox”); &lt;br /&gt;
&lt;br /&gt;
G4VPhysicalVolume* aBoxPhys = new G4PVPlacement( pRotation, G4ThreeVector(posX, posY, posZ), pBoxLog, &lt;br /&gt;
&lt;br /&gt;
“WaterBox”, pWorldLog, false, copyNo); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements and materials are defined using classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Element &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Material &amp;lt;/span&amp;gt;. For example water, hydrogen and oxygen are defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyDetectorConstruction::DefineMaterials() { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
G4Element* H = new G4Element(&amp;quot;Hydrogen&amp;quot;,&amp;quot;H&amp;quot;,z=1.,a= 1.01*g/mole); &lt;br /&gt;
 &lt;br /&gt;
G4Element* O = new G4Element(&amp;quot;Oxygen&amp;quot;,&amp;quot;O&amp;quot;,z=8.,a=16.00*g/mole); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
density = 1.000*g/cm3; &lt;br /&gt;
&lt;br /&gt;
G4Material* water = new G4Material(&amp;quot;Water&amp;quot;,density,ncomp=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(H, natoms=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(O, natoms=1); ...}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__detectorConstruction.html Here] you can find more examples of DetectorConstruction classes.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Physics processes &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You can build your own physics list or chose from already built physics lists. To build your own physics lists, you can use two base physics list classes: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt;. The class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; is used for simple physics lists while &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt; is used to build more complex physics lists. There exist also already built pre-packaged physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Simple physics lists &amp;lt;/span&amp;gt; ===  &lt;br /&gt;
&lt;br /&gt;
If the particles in your simulation undergo a descrete number of physics processes you can use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; to define them. This class has three methods:&lt;br /&gt;
&lt;br /&gt;
* ConstructParticles() : Define all necessary particles;  &lt;br /&gt;
* ConstructProcesses() : Define all necessary processes and assign them to corresponding particles;&lt;br /&gt;
* SetCuts() : Define production thresholds in terms of range; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VUserPhysicsList() { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
void ConstructParticle(); &lt;br /&gt;
&lt;br /&gt;
void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
void SetCuts(); } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Now implement the methods ConstructParticle(), ConstructProcess() and SetCuts():&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructParticle() { &lt;br /&gt;
&lt;br /&gt;
// Define the particles &lt;br /&gt;
&lt;br /&gt;
G4Electron::ElectronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Positron::PositronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Proton::ProtonDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Neutron::NeutronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Gamma::GammaDefinition(); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GEANT4 provides a variety of physics processes. These processes are decoupled from one another and you can select those which are relevant to your simulation. The processes are grouped in seven categories &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:2;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
* electromagnetic &lt;br /&gt;
* hadronic&lt;br /&gt;
* decay&lt;br /&gt;
* photolepton-hadron&lt;br /&gt;
* optical&lt;br /&gt;
* parameterization&lt;br /&gt;
* transportation &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and their list is available [http://geant4.cern.ch/support/proc_mod_catalog/processes/ here]. For each particle in ConstructParticle() assign all the physics processes you want to consider in your simulation: &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
&lt;br /&gt;
AddTransportation(); // Assign transportation process to all particles &lt;br /&gt;
&lt;br /&gt;
ConstructEM(); // Electromagnetic processes &lt;br /&gt;
&lt;br /&gt;
ConstructGeneral(); // Other processes }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In methods ConstructEM() and ConstructGeneral() assign the physics processes to the corresponding particles: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructEM() { &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()){ &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
G4String particleName = particle-&amp;gt;GetParticleName(); &lt;br /&gt;
     &lt;br /&gt;
if (particleName == &amp;quot;gamma&amp;quot;) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddDiscreteProcess(new G4GammaConversion); ...} &lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructGeneral() { &lt;br /&gt;
&lt;br /&gt;
G4Decay* theDecayProcess = new G4Decay() &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()) { &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
if theDecayProcess-&amp;gt;IsApplicable(*particle)) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddProcess(theDecayProcess); &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxPostStep);  &lt;br /&gt;
    &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxAtRest); }}} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the full [http://geant4.cern.ch/support/proc_mod_catalog/particles/ list] of physics processes available for every  particle. Finally, in method SetCuts() you can define cuts on the particles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::SetCuts() { &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defaultCutValue = 1.0*mm; &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;gamma&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e+&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e-&amp;quot;); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[Computed tomography]] tutorial to learn more about simple physics lists .&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Detailed physics lists &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
If you want to build more realistic physics list you have to use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt;. In &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt; you can group the physics processes into separate modules which are already pre-build physics list and later chose one of those modules.   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VModularPhysicsList { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructParticle(); &lt;br /&gt;
    &lt;br /&gt;
virtual void SetCuts(); &lt;br /&gt;
        &lt;br /&gt;
void AddPhysicsList(const G4String&amp;amp; name); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
      &lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4String                             fEmName; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fEmPhysicsList; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fDecPhysicsList; &lt;br /&gt;
&lt;br /&gt;
std::vector&amp;lt;G4VPhysicsConstructor*&amp;gt;  fHadronPhysicsList; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, build the physics lists:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::AddPhysicsList(const G4String&amp;amp; name) { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
if (name == &amp;quot;emstandard_opt3&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name;   &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmStandardPhysics_option3(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;emlivermore&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmLivermorePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;empenelope&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmPenelopePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HElastic&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fHadronPhysicsList.push_back( new G4HadronHElasticPhysics()); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HInelastic&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fHadronPhysicsList.push_back(new G4HadronInelasticQBBC()); &lt;br /&gt;
    &lt;br /&gt;
} ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
 &lt;br /&gt;
AddTransportation(); // transportation &lt;br /&gt;
  &lt;br /&gt;
fEmPhysicsList-&amp;gt;ConstructProcess(); // electromagnetic physics list &lt;br /&gt;
&lt;br /&gt;
fDecPhysicsList-&amp;gt;ConstructProcess(); // decay physics list &lt;br /&gt;
  &lt;br /&gt;
for(size_t i=0; i&amp;lt;fHadronPhys.size(); i++) { // hadronic physics lists &lt;br /&gt;
  &lt;br /&gt;
fHadronPhys[i]-&amp;gt;ConstructProcess(); } } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
See the [[Monoenergetic proton pencil beam]] tutorial to learn more about detailed physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Pre-packaged physics lists &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Some built-in pre-packaged physics lists are available [http://geant4.web.cern.ch/geant4/support/proc_mod_catalog/physics_lists/referencePL.shtml here]. You can use them as a starting point of your simulation.    &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; pre-packaged physics list &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
In function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysListFactory factory* physListFactory = new G4PhysListFactory(); &lt;br /&gt;
&lt;br /&gt;
G4VUserPhysicsList* physicsList = physListFactory-&amp;gt;GetReferencePhysList(“FTFP_BERT”); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(physicsList); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if you want to simulate clinical proton beam of energy 150 MeV you can use pre-packaged physics list e.g. QGSP_BIC, QGSP_BERT and FTFP_BERT. If you are interested in Bragg curve physics, use a physics list ending in &amp;quot;EMV&amp;quot; or &amp;quot;EMX&amp;quot; e.g. QGSP_BERT_EMV. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Generate primary particles &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt; base class.&lt;br /&gt;
Actual generation of primary particles is done via classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; is used to simulate a beam of particles. It shoots a primary particle of a certain energy and direction from a given point at a given time.&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt; simulates a beam of particles and the primary vertex is randomly chosen on surface of a given volume with pre-defined energy spectra, spatial and angular distribution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using particle gun &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction( &lt;br /&gt;
&lt;br /&gt;
const G4String&amp;amp; particleName = &amp;quot;proton&amp;quot;, &lt;br /&gt;
      &lt;br /&gt;
G4double energy = 1.*CLHEP::MeV, &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector position= G4ThreeVector(0,0,0), &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));     &lt;br /&gt;
    &lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4ParticleGun*  fParticleGun; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using general particle source &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction();     &lt;br /&gt;
&lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
&lt;br /&gt;
static const G4String ParticleName; &lt;br /&gt;
&lt;br /&gt;
static const G4double ParticleEnergy; &lt;br /&gt;
&lt;br /&gt;
G4GeneralParticleSource*  fGeneralParticleSource; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__primaryGenerator.html Here] you can find how to implement MyPrimaryGeneratorAction class in your code.&lt;br /&gt;
&lt;br /&gt;
The [[Monoenergetic photon pencil beam]] example uses the '''G4ParticleGun''' class. The [[Proton beam with realistic geometry]] tutorial uses '''G4GeneralParticleSource'''.  &lt;br /&gt;
   &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Optional user classes &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you may book results of the run. The run starts with &amp;quot;Beam On&amp;quot; and within a run you can not change the detector geometry and physics processes. The run is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Run &amp;lt;/span&amp;gt;.   &lt;br /&gt;
  &lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined RunAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Event is the basic GEANT4 unit. At the beginning of an event are generated primary tracks which are pushed into a stack. The tracks from the stack are analyzed one by one. The primary tracks might lead to secondary tracks which are also pushed into the stack. When the stack becomes empty the processing of the event is over. The event is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Event &amp;lt;/span&amp;gt; which gives hits and trajectory collections as output.    &lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you can select and analize data. &lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined EventAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
Track is a snapshot of a particle and it is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class. At the end of the event the track objects do not exist. Tracks are pushed step by step. Moving by one step is called &amp;quot;stepping&amp;quot; and this can be controlled by the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; class (see below). At the end of each step the state of a track can be changed (killed, suspended, postponed).    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Step is defined by two points, it contains also information about the particle e.g. energy loss on the step. A step is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; classes. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; is optional class where you can kill, suspend, postpone a track. &lt;br /&gt;
&lt;br /&gt;
Status is attached to each &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; to show how step was determined. You can use ''PostStepPoint'' to get status of current step and ''PreStepPoint'' to get status of previous step. For example to get the &amp;quot;x&amp;quot; coordinate of a step you do the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4StepPoint* prePoint  = step-&amp;gt;GetPreStepPoint();&lt;br /&gt;
&lt;br /&gt;
G4double x1 = prePoint-&amp;gt;GetPosition().x(); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Trajectory &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Trajectories are represented by classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt;. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; class copies some of the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class information. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt; is the class which copies some of the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; information.&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4</id>
		<title>Introduction to GEANT4</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4"/>
				<updated>2014-09-04T16:57:19Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a software toolkit based on C++. In your code you have to define: &lt;br /&gt;
&lt;br /&gt;
* Your experimental setup - geometry, materials and primary particles.&lt;br /&gt;
* Which physics process you are interested in. &lt;br /&gt;
* Take actions during the simulation to inspect and store results. &lt;br /&gt;
&lt;br /&gt;
The interaction with GEANT4 is done via base classes.    &lt;br /&gt;
&lt;br /&gt;
; Mandatory classes:   &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt;: Describe the experimental setup, geometry and materials;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt;: Define particles, physics processes and range cuts;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt;: Describe particle source, source dimensions, initial position, energy spectrum, angular distributions;&lt;br /&gt;
&lt;br /&gt;
; Optional classes: &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt;: Define and store histograms; &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt;: Event selection and analysis of simulation data;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserStackingAction &amp;lt;/span&amp;gt;: Customize priority of tracks;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserTrackingAction &amp;lt;/span&amp;gt;: Decide whether a trajectory should be stored or not;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt;: Kill, suspend, postpone a track;&lt;br /&gt;
&lt;br /&gt;
; Manager class &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt;: Manages processing the run;&lt;br /&gt;
&lt;br /&gt;
; Useful terminology&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt;: the smallest unit of Geant4 simulation, a particle is transported from one point to another&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Trajectory and TrajectoryPoint &amp;lt;/span&amp;gt;: collection of steps and step points&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Process &amp;lt;/span&amp;gt;: physics along the step&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt;: a snapshot of a particle at some point along its path (not the same as trajectory)&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt;: a collection of information from tracks and trajectories&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt;: a collection of events&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The function main() &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; defines the skeleton of your simulation code. Inside the function you instantiate &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt; and notify it of your mandatory and optional classes. This is example &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; function, where &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyEventAction &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyRunAction &amp;lt;/span&amp;gt; are derived classes from the GEANT4 base classes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
int main() { &lt;br /&gt;
  &lt;br /&gt;
// Run manager construction &lt;br /&gt;
&lt;br /&gt;
G4RunManager* runManager = new G4RunManager; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user initialization classes&lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyDetectorConstruction); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyPhysicsList);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user action classes  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyPrimaryGeneratorAction); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// optional user action classes &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyEventAction);  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyRunAction); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Experimental setup &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt; base class. In the derived class you will: &lt;br /&gt;
&lt;br /&gt;
* Describe the shape and the size of your detector using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VSolid &amp;lt;/span&amp;gt; &lt;br /&gt;
* Construct materials and electromagnetic fields using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Logical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
* Place volumes of your detector geometry using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VPhysical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyDetectorConstruction:public G4VUserDetectorConstruction { &lt;br /&gt;
&lt;br /&gt;
public:  &lt;br /&gt;
    &lt;br /&gt;
MyDetectorConstruction();&lt;br /&gt;
&lt;br /&gt;
~MyDetectorConstruction(); &lt;br /&gt;
    &lt;br /&gt;
virtual G4VPhysicalVolume* Construct(); &lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
private: &lt;br /&gt;
   &lt;br /&gt;
void  DefineMaterials(); };    &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now construct the detector. Your detector is always placed in a mother volume called the world volume.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysicalVolume* MyDetectorConstruction::Construct() {  &lt;br /&gt;
&lt;br /&gt;
...  &lt;br /&gt;
&lt;br /&gt;
// World volume &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pWorld = new G4Box(&amp;quot;World&amp;quot;,5*m,5*m,5*m); &lt;br /&gt;
                                         &lt;br /&gt;
G4LogicalVolume* pWorldLog = new G4LogicalVolume(pWorld,vacuum, &amp;quot;World&amp;quot;);    &lt;br /&gt;
                                                                           &lt;br /&gt;
G4VPhysicalVolume* pWorldPhys = new G4PVPlacement(0,G4ThreeVector(),pWorldLog,&amp;quot;World&amp;quot;,0,false,0);  &lt;br /&gt;
&lt;br /&gt;
// Water box &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pBoxSolid = new G4Box(“WaterBox”, 1.*m, 2.*m, 3.*m);  &lt;br /&gt;
&lt;br /&gt;
G4LogicalVolume* pBoxLog = new G4LogicalVolume( pBoxSolid, water, “WaterBox”); &lt;br /&gt;
&lt;br /&gt;
G4VPhysicalVolume* aBoxPhys = new G4PVPlacement( pRotation, G4ThreeVector(posX, posY, posZ), pBoxLog, &lt;br /&gt;
&lt;br /&gt;
“WaterBox”, pWorldLog, false, copyNo); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements and materials are defined using classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Element &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Material &amp;lt;/span&amp;gt;. For example water, hydrogen and oxygen are defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyDetectorConstruction::DefineMaterials() { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
G4Element* H = new G4Element(&amp;quot;Hydrogen&amp;quot;,&amp;quot;H&amp;quot;,z=1.,a= 1.01*g/mole); &lt;br /&gt;
 &lt;br /&gt;
G4Element* O = new G4Element(&amp;quot;Oxygen&amp;quot;,&amp;quot;O&amp;quot;,z=8.,a=16.00*g/mole); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
density = 1.000*g/cm3; &lt;br /&gt;
&lt;br /&gt;
G4Material* water = new G4Material(&amp;quot;Water&amp;quot;,density,ncomp=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(H, natoms=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(O, natoms=1); ...}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__detectorConstruction.html Here] you can find more examples of DetectorConstruction classes.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Physics processes &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You can build your own physics list or chose from already built physics lists. To build your own physics lists, you can use two base physics list classes: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt;. The class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; is used for simple physics lists while &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt; is used to build more complex physics lists. There exist also already built pre-packaged physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Simple physics lists &amp;lt;/span&amp;gt; ===  &lt;br /&gt;
&lt;br /&gt;
If the particles in your simulation undergo a descrete number of physics processes you can use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; to define them. This class has three methods:&lt;br /&gt;
&lt;br /&gt;
* ConstructParticles() : Define all necessary particles;  &lt;br /&gt;
* ConstructProcesses() : Define all necessary processes and assign them to corresponding particles;&lt;br /&gt;
* SetCuts() : Define production thresholds in terms of range; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VUserPhysicsList() { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
void ConstructParticle(); &lt;br /&gt;
&lt;br /&gt;
void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
void SetCuts(); } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Now implement the methods ConstructParticle(), ConstructProcess() and SetCuts():&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructParticle() { &lt;br /&gt;
&lt;br /&gt;
// Define the particles &lt;br /&gt;
&lt;br /&gt;
G4Electron::ElectronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Positron::PositronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Proton::ProtonDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Neutron::NeutronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Gamma::GammaDefinition(); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GEANT4 provides a variety of physics processes. These processes are decoupled from one another and you can select those which are relevant to your simulation. The processes are grouped in seven categories &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:2;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
* electromagnetic &lt;br /&gt;
* hadronic&lt;br /&gt;
* decay&lt;br /&gt;
* photolepton-hadron&lt;br /&gt;
* optical&lt;br /&gt;
* parameterization&lt;br /&gt;
* transportation &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and their list is available [http://geant4.cern.ch/support/proc_mod_catalog/processes/ here]. For each particle in ConstructParticle() assign all the physics processes you want to consider in your simulation: &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
&lt;br /&gt;
AddTransportation(); // Assign transportation process to all particles &lt;br /&gt;
&lt;br /&gt;
ConstructEM(); // Electromagnetic processes &lt;br /&gt;
&lt;br /&gt;
ConstructGeneral(); // Other processes }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In methods ConstructEM() and ConstructGeneral() assign the physics processes to the corresponding particles: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructEM() { &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()){ &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
G4String particleName = particle-&amp;gt;GetParticleName(); &lt;br /&gt;
     &lt;br /&gt;
if (particleName == &amp;quot;gamma&amp;quot;) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddDiscreteProcess(new G4GammaConversion); ...} &lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructGeneral() { &lt;br /&gt;
&lt;br /&gt;
G4Decay* theDecayProcess = new G4Decay() &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()) { &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
if theDecayProcess-&amp;gt;IsApplicable(*particle)) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddProcess(theDecayProcess); &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxPostStep);  &lt;br /&gt;
    &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxAtRest); }}} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the full [http://geant4.cern.ch/support/proc_mod_catalog/particles/ list] of physics processes available for every  particle. Finally, in method SetCuts() you can define cuts on the particles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::SetCuts() { &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defaultCutValue = 1.0*mm; &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;gamma&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e+&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e-&amp;quot;); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[Computed tomography]] tutorial to learn more about simple physics lists .&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Detailed physics lists &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
If you want to build more realistic physics list you have to use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt;. In &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt; you can group the physics processes into separate modules: EM physics, hadronic physics, decay physics etc. and later chose one of them.   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VModularPhysicsList { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructParticle(); &lt;br /&gt;
    &lt;br /&gt;
virtual void SetCuts(); &lt;br /&gt;
        &lt;br /&gt;
void AddPhysicsList(const G4String&amp;amp; name); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
      &lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4String                             fEmName; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fEmPhysicsList; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fDecPhysicsList; &lt;br /&gt;
&lt;br /&gt;
std::vector&amp;lt;G4VPhysicsConstructor*&amp;gt;  fHadronPhysicsList; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, build the physics lists:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::AddPhysicsList(const G4String&amp;amp; name) { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
if (name == &amp;quot;emstandard_opt3&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name;   &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmStandardPhysics_option3(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;emlivermore&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmLivermorePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;empenelope&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmPenelopePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HElastic&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fHadronPhysicsList.push_back( new G4HadronHElasticPhysics()); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HInelastic&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fHadronPhysicsList.push_back(new G4HadronInelasticQBBC()); &lt;br /&gt;
    &lt;br /&gt;
} ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
 &lt;br /&gt;
AddTransportation(); // transportation &lt;br /&gt;
  &lt;br /&gt;
fEmPhysicsList-&amp;gt;ConstructProcess(); // electromagnetic physics list &lt;br /&gt;
&lt;br /&gt;
fDecPhysicsList-&amp;gt;ConstructProcess(); // decay physics list &lt;br /&gt;
  &lt;br /&gt;
for(size_t i=0; i&amp;lt;fHadronPhys.size(); i++) { // hadronic physics lists &lt;br /&gt;
  &lt;br /&gt;
fHadronPhys[i]-&amp;gt;ConstructProcess(); } } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
See the [[Monoenergetic proton pencil beam]] tutorial to learn more about detailed physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Pre-packaged physics lists &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Some built-in pre-packaged physics lists are available [http://geant4.web.cern.ch/geant4/support/proc_mod_catalog/physics_lists/referencePL.shtml here]. You can use them as a starting point of your simulation.    &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; pre-packaged physics list &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
In function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysListFactory factory* physListFactory = new G4PhysListFactory(); &lt;br /&gt;
&lt;br /&gt;
G4VUserPhysicsList* physicsList = physListFactory-&amp;gt;GetReferencePhysList(“FTFP_BERT”); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(physicsList); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if you want to simulate clinical proton beam of energy 150 MeV you can use pre-packaged physics list e.g. QGSP_BIC, QGSP_BERT and FTFP_BERT. If you are interested in Bragg curve physics, use a physics list ending in &amp;quot;EMV&amp;quot; or &amp;quot;EMX&amp;quot; e.g. QGSP_BERT_EMV. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Generate primary particles &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt; base class.&lt;br /&gt;
Actual generation of primary particles is done via classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; is used to simulate a beam of particles. It shoots a primary particle of a certain energy and direction from a given point at a given time.&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt; simulates a beam of particles and the primary vertex is randomly chosen on surface of a given volume with pre-defined energy spectra, spatial and angular distribution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using particle gun &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction( &lt;br /&gt;
&lt;br /&gt;
const G4String&amp;amp; particleName = &amp;quot;proton&amp;quot;, &lt;br /&gt;
      &lt;br /&gt;
G4double energy = 1.*CLHEP::MeV, &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector position= G4ThreeVector(0,0,0), &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));     &lt;br /&gt;
    &lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4ParticleGun*  fParticleGun; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using general particle source &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction();     &lt;br /&gt;
&lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
&lt;br /&gt;
static const G4String ParticleName; &lt;br /&gt;
&lt;br /&gt;
static const G4double ParticleEnergy; &lt;br /&gt;
&lt;br /&gt;
G4GeneralParticleSource*  fGeneralParticleSource; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__primaryGenerator.html Here] you can find how to implement MyPrimaryGeneratorAction class in your code.&lt;br /&gt;
&lt;br /&gt;
The [[Monoenergetic photon pencil beam]] example uses the '''G4ParticleGun''' class. The [[Proton beam with realistic geometry]] tutorial uses '''G4GeneralParticleSource'''.  &lt;br /&gt;
   &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Optional user classes &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you may book results of the run. The run starts with &amp;quot;Beam On&amp;quot; and within a run you can not change the detector geometry and physics processes. The run is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Run &amp;lt;/span&amp;gt;.   &lt;br /&gt;
  &lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined RunAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Event is the basic GEANT4 unit. At the beginning of an event are generated primary tracks which are pushed into a stack. The tracks from the stack are analyzed one by one. The primary tracks might lead to secondary tracks which are also pushed into the stack. When the stack becomes empty the processing of the event is over. The event is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Event &amp;lt;/span&amp;gt; which gives hits and trajectory collections as output.    &lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you can select and analize data. &lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined EventAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
Track is a snapshot of a particle and it is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class. At the end of the event the track objects do not exist. Tracks are pushed step by step. Moving by one step is called &amp;quot;stepping&amp;quot; and this can be controlled by the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; class (see below). At the end of each step the state of a track can be changed (killed, suspended, postponed).    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Step is defined by two points, it contains also information about the particle e.g. energy loss on the step. A step is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; classes. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; is optional class where you can kill, suspend, postpone a track. &lt;br /&gt;
&lt;br /&gt;
Status is attached to each &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; to show how step was determined. You can use ''PostStepPoint'' to get status of current step and ''PreStepPoint'' to get status of previous step. For example to get the &amp;quot;x&amp;quot; coordinate of a step you do the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4StepPoint* prePoint  = step-&amp;gt;GetPreStepPoint();&lt;br /&gt;
&lt;br /&gt;
G4double x1 = prePoint-&amp;gt;GetPosition().x(); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Trajectory &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Trajectories are represented by classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt;. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; class copies some of the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class information. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt; is the class which copies some of the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; information.&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4</id>
		<title>Introduction to GEANT4</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4"/>
				<updated>2014-09-04T11:15:14Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a software toolkit based on C++. In your code you have to define: &lt;br /&gt;
&lt;br /&gt;
* Your experimental setup - geometry, materials and primary particles.&lt;br /&gt;
* Which physics process you are interested in. &lt;br /&gt;
* Take actions during the simulation to inspect and store results. &lt;br /&gt;
&lt;br /&gt;
The interaction with GEANT4 is done via base classes.    &lt;br /&gt;
&lt;br /&gt;
; Mandatory classes:   &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt;: Describe the experimental setup, geometry and materials;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt;: Define particles, physics processes and range cuts;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt;: Describe particle source, source dimensions, initial position, energy spectrum, angular distributions;&lt;br /&gt;
&lt;br /&gt;
; Optional classes: &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt;: Define and store histograms; &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt;: Event selection and analysis of simulation data;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserStackingAction &amp;lt;/span&amp;gt;: Customize priority of tracks;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserTrackingAction &amp;lt;/span&amp;gt;: Decide whether a trajectory should be stored or not;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt;: Kill, suspend, postpone a track;&lt;br /&gt;
&lt;br /&gt;
; Manager class &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt;: Manages processing the run;&lt;br /&gt;
&lt;br /&gt;
; Useful terminology&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt;: the smallest unit of Geant4 simulation, a particle is transported from one point to another&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Trajectory and TrajectoryPoint &amp;lt;/span&amp;gt;: collection of steps and step points&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Process &amp;lt;/span&amp;gt;: physics along the step&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt;: a snapshot of a particle at some point along its path (not the same as trajectory)&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt;: a collection of information from tracks and trajectories&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt;: a collection of events&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The function main() &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; defines the skeleton of your simulation code. Inside the function you instantiate &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt; and notify it of your mandatory and optional classes. This is example &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; function, where &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyEventAction &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyRunAction &amp;lt;/span&amp;gt; are derived classes from the GEANT4 base classes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
int main() { &lt;br /&gt;
  &lt;br /&gt;
// Run manager construction &lt;br /&gt;
&lt;br /&gt;
G4RunManager* runManager = new G4RunManager; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user initialization classes&lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyDetectorConstruction); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyPhysicsList);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user action classes  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyPrimaryGeneratorAction); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// optional user action classes &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyEventAction);  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyRunAction); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Experimental setup &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt; base class. In the derived class you will: &lt;br /&gt;
&lt;br /&gt;
* Describe the shape and the size of your detector using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VSolid &amp;lt;/span&amp;gt; &lt;br /&gt;
* Construct materials and electromagnetic fields using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Logical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
* Place volumes of your detector geometry using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VPhysical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyDetectorConstruction:public G4VUserDetectorConstruction { &lt;br /&gt;
&lt;br /&gt;
public:  &lt;br /&gt;
    &lt;br /&gt;
MyDetectorConstruction();&lt;br /&gt;
&lt;br /&gt;
~MyDetectorConstruction(); &lt;br /&gt;
    &lt;br /&gt;
virtual G4VPhysicalVolume* Construct(); &lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
private: &lt;br /&gt;
   &lt;br /&gt;
void  DefineMaterials(); };    &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now construct the detector. Your detector is always placed in a mother volume called the world volume.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysicalVolume* MyDetectorConstruction::Construct() {  &lt;br /&gt;
&lt;br /&gt;
...  &lt;br /&gt;
&lt;br /&gt;
// World volume &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pWorld = new G4Box(&amp;quot;World&amp;quot;,5*m,5*m,5*m); &lt;br /&gt;
                                         &lt;br /&gt;
G4LogicalVolume* pWorldLog = new G4LogicalVolume(pWorld,vacuum, &amp;quot;World&amp;quot;);    &lt;br /&gt;
                                                                           &lt;br /&gt;
G4VPhysicalVolume* pWorldPhys = new G4PVPlacement(0,G4ThreeVector(),pWorldLog,&amp;quot;World&amp;quot;,0,false,0);  &lt;br /&gt;
&lt;br /&gt;
// Water box &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pBoxSolid = new G4Box(“WaterBox”, 1.*m, 2.*m, 3.*m);  &lt;br /&gt;
&lt;br /&gt;
G4LogicalVolume* pBoxLog = new G4LogicalVolume( pBoxSolid, water, “WaterBox”); &lt;br /&gt;
&lt;br /&gt;
G4VPhysicalVolume* aBoxPhys = new G4PVPlacement( pRotation, G4ThreeVector(posX, posY, posZ), pBoxLog, &lt;br /&gt;
&lt;br /&gt;
“WaterBox”, pWorldLog, false, copyNo); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements and materials are defined using classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Element &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Material &amp;lt;/span&amp;gt;. For example water, hydrogen and oxygen are defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyDetectorConstruction::DefineMaterials() { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
G4Element* H = new G4Element(&amp;quot;Hydrogen&amp;quot;,&amp;quot;H&amp;quot;,z=1.,a= 1.01*g/mole); &lt;br /&gt;
 &lt;br /&gt;
G4Element* O = new G4Element(&amp;quot;Oxygen&amp;quot;,&amp;quot;O&amp;quot;,z=8.,a=16.00*g/mole); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
density = 1.000*g/cm3; &lt;br /&gt;
&lt;br /&gt;
G4Material* water = new G4Material(&amp;quot;Water&amp;quot;,density,ncomp=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(H, natoms=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(O, natoms=1); ...}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__detectorConstruction.html Here] you can find more examples of DetectorConstruction classes.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Physics processes &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You can build your own physics list or chose from already built physics lists. To build your own physics lists, you can use two base physics list classes: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt;. The class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; is used for simple physics lists while &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt; is used to build more complex physics lists. There exist also already built pre-packaged physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Simple physics lists &amp;lt;/span&amp;gt; ===  &lt;br /&gt;
&lt;br /&gt;
If the particles in your simulation undergo a descrete number of physics processes you can use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; to define them. This class has three methods:&lt;br /&gt;
&lt;br /&gt;
* ConstructParticles() : Define all necessary particles;  &lt;br /&gt;
* ConstructProcesses() : Define all necessary processes and assign them to proper particles;&lt;br /&gt;
* SetCuts() : Define production thresholds in terms of range; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VUserPhysicsList() { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
void ConstructParticle(); &lt;br /&gt;
&lt;br /&gt;
void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
void SetCuts(); } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Now implement the methods ConstructParticle(), ConstructProcess() and SetCuts():&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructParticle() { &lt;br /&gt;
&lt;br /&gt;
// Define the particles &lt;br /&gt;
&lt;br /&gt;
G4Electron::ElectronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Positron::PositronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Proton::ProtonDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Neutron::NeutronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Gamma::GammaDefinition(); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GEANT4 provides a variety of physics processes. These processes are decoupled from one another and you can select those which are relevant to your simulation. The processes are grouped in seven categories &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:2;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
* electromagnetic &lt;br /&gt;
* hadronic&lt;br /&gt;
* decay&lt;br /&gt;
* photolepton-hadron&lt;br /&gt;
* optical&lt;br /&gt;
* parameterization&lt;br /&gt;
* transportation &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and their list is available [http://geant4.cern.ch/support/proc_mod_catalog/processes/ here]. For each particle in ConstructParticle() assign all the physics processes you want to consider in your simulation: &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
&lt;br /&gt;
AddTransportation(); // Assign transportation process to all particles &lt;br /&gt;
&lt;br /&gt;
ConstructEM(); // Electromagnetic processes &lt;br /&gt;
&lt;br /&gt;
ConstructGeneral(); // Other processes }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In methods ConstructEM() and ConstructGeneral() assign the physics processes to the corresponding particles: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructEM() { &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()){ &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
G4String particleName = particle-&amp;gt;GetParticleName(); &lt;br /&gt;
     &lt;br /&gt;
if (particleName == &amp;quot;gamma&amp;quot;) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddDiscreteProcess(new G4GammaConversion); ...} &lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructGeneral() { &lt;br /&gt;
&lt;br /&gt;
G4Decay* theDecayProcess = new G4Decay() &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()) { &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
if theDecayProcess-&amp;gt;IsApplicable(*particle)) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddProcess(theDecayProcess); &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxPostStep);  &lt;br /&gt;
    &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxAtRest); }}} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the full [http://geant4.cern.ch/support/proc_mod_catalog/particles/ list] of physics processes available for every  particle. Finally, in method SetCuts() you can define cuts on the particles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::SetCuts() { &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defaultCutValue = 1.0*mm; &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;gamma&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e+&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e-&amp;quot;); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[Computed tomography]] tutorial to learn more about simple physics lists .&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Detailed physics lists &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
If you want to build more realistic physics list you have to use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt;. In &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt; you can group the physics processes into separate modules: EM physics, hadronic physics, decay physics etc. and later chose one of them.   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VModularPhysicsList { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructParticle(); &lt;br /&gt;
    &lt;br /&gt;
virtual void SetCuts(); &lt;br /&gt;
        &lt;br /&gt;
void AddPhysicsList(const G4String&amp;amp; name); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
      &lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4String                             fEmName; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fEmPhysicsList; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fDecPhysicsList; &lt;br /&gt;
&lt;br /&gt;
std::vector&amp;lt;G4VPhysicsConstructor*&amp;gt;  fHadronPhysicsList; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, build the physics lists:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::AddPhysicsList(const G4String&amp;amp; name) { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
if (name == &amp;quot;emstandard_opt3&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name;   &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmStandardPhysics_option3(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;emlivermore&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmLivermorePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;empenelope&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmPenelopePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HElastic&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fHadronPhysicsList.push_back( new G4HadronHElasticPhysics()); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HInelastic&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fHadronPhysicsList.push_back(new G4HadronInelasticQBBC()); &lt;br /&gt;
    &lt;br /&gt;
} ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
 &lt;br /&gt;
AddTransportation(); // transportation &lt;br /&gt;
  &lt;br /&gt;
fEmPhysicsList-&amp;gt;ConstructProcess(); // electromagnetic physics list &lt;br /&gt;
&lt;br /&gt;
fDecPhysicsList-&amp;gt;ConstructProcess(); // decay physics list &lt;br /&gt;
  &lt;br /&gt;
for(size_t i=0; i&amp;lt;fHadronPhys.size(); i++) { // hadronic physics lists &lt;br /&gt;
  &lt;br /&gt;
fHadronPhys[i]-&amp;gt;ConstructProcess(); } } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
See the [[Monoenergetic proton pencil beam]] tutorial to learn more about detailed physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Pre-packaged physics lists &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Some built-in pre-packaged physics lists are available [http://geant4.web.cern.ch/geant4/support/proc_mod_catalog/physics_lists/referencePL.shtml here]. You can use them as a starting point of your simulation.    &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; pre-packaged physics list &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
In function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysListFactory factory* physListFactory = new G4PhysListFactory(); &lt;br /&gt;
&lt;br /&gt;
G4VUserPhysicsList* physicsList = physListFactory-&amp;gt;GetReferencePhysList(“FTFP_BERT”); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(physicsList); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if you want to simulate clinical proton beam of energy 150 MeV you can use pre-packaged physics list e.g. QGSP_BIC, QGSP_BERT and FTFP_BERT. If you are interested in Bragg curve physics, use a physics list ending in &amp;quot;EMV&amp;quot; or &amp;quot;EMX&amp;quot; e.g. QGSP_BERT_EMV. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Generate primary particles &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt; base class.&lt;br /&gt;
Actual generation of primary particles is done via classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; is used to simulate a beam of particles. It shoots a primary particle of a certain energy and direction from a given point at a given time.&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt; simulates a beam of particles and the primary vertex is randomly chosen on surface of a given volume with pre-defined energy spectra, spatial and angular distribution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using particle gun &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction( &lt;br /&gt;
&lt;br /&gt;
const G4String&amp;amp; particleName = &amp;quot;proton&amp;quot;, &lt;br /&gt;
      &lt;br /&gt;
G4double energy = 1.*CLHEP::MeV, &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector position= G4ThreeVector(0,0,0), &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));     &lt;br /&gt;
    &lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4ParticleGun*  fParticleGun; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using general particle source &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction();     &lt;br /&gt;
&lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
&lt;br /&gt;
static const G4String ParticleName; &lt;br /&gt;
&lt;br /&gt;
static const G4double ParticleEnergy; &lt;br /&gt;
&lt;br /&gt;
G4GeneralParticleSource*  fGeneralParticleSource; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__primaryGenerator.html Here] you can find how to implement MyPrimaryGeneratorAction class in your code.&lt;br /&gt;
&lt;br /&gt;
The [[Monoenergetic photon pencil beam]] example uses the '''G4ParticleGun''' class. The [[Proton beam with realistic geometry]] tutorial uses '''G4GeneralParticleSource'''.  &lt;br /&gt;
   &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Optional user classes &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you may book results of the run. The run starts with &amp;quot;Beam On&amp;quot; and within a run you can not change the detector geometry and physics processes. The run is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Run &amp;lt;/span&amp;gt;.   &lt;br /&gt;
  &lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined RunAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Event is the basic GEANT4 unit. At the beginning of an event are generated primary tracks which are pushed into a stack. The tracks from the stack are analyzed one by one. The primary tracks might lead to secondary tracks which are also pushed into the stack. When the stack becomes empty the processing of the event is over. The event is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Event &amp;lt;/span&amp;gt; which gives hits and trajectory collections as output.    &lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you can select and analize data. &lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined EventAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
Track is a snapshot of a particle and it is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class. At the end of the event the track objects do not exist. Tracks are pushed step by step. Moving by one step is called &amp;quot;stepping&amp;quot; and this can be controlled by the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; class (see below). At the end of each step the state of a track can be changed (killed, suspended, postponed).    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Step is defined by two points, it contains also information about the particle e.g. energy loss on the step. A step is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; classes. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; is optional class where you can kill, suspend, postpone a track. &lt;br /&gt;
&lt;br /&gt;
Status is attached to each &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; to show how step was determined. You can use ''PostStepPoint'' to get status of current step and ''PreStepPoint'' to get status of previous step. For example to get the &amp;quot;x&amp;quot; coordinate of a step you do the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4StepPoint* prePoint  = step-&amp;gt;GetPreStepPoint();&lt;br /&gt;
&lt;br /&gt;
G4double x1 = prePoint-&amp;gt;GetPosition().x(); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Trajectory &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Trajectories are represented by classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt;. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; class copies some of the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class information. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt; is the class which copies some of the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; information.&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4</id>
		<title>Introduction to GEANT4</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Introduction_to_GEANT4"/>
				<updated>2014-09-04T11:14:11Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a software toolkit based on C++. In your code you have to define: &lt;br /&gt;
&lt;br /&gt;
* Your experimental setup - geometry, materials and primary particles.&lt;br /&gt;
* Which physics process you are interested in. &lt;br /&gt;
* Take actions during the simulation to inspect and store results. &lt;br /&gt;
&lt;br /&gt;
The interaction with GEANT4 is done via base classes.    &lt;br /&gt;
&lt;br /&gt;
; Mandatory classes:   &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt;: Describe the experimental setup, geometry and materials;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt;: Define particles, physics processes and range cuts;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt;: Describe particle source, source dimensions, initial position, energy spectrum, angular distributions;&lt;br /&gt;
&lt;br /&gt;
; Optional classes: &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt;: Define and store histograms; &lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt;: Event selection and analysis of simulation data;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserStackingAction &amp;lt;/span&amp;gt;: Customize priority of tracks;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserTrackingAction &amp;lt;/span&amp;gt;: Decide whether a trajectory should be stored or not;&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt;: Kill, suspend, postpone a track;&lt;br /&gt;
&lt;br /&gt;
; Manager class &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt;: Manages processing the run;&lt;br /&gt;
&lt;br /&gt;
; Useful terminology&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt;: the smallest unit of Geant4 simulation, a particle is transported from one point to another&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Trajectory and TrajectoryPoint &amp;lt;/span&amp;gt;: collection of steps and step points&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Process &amp;lt;/span&amp;gt;: physics along the step&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt;: a snapshot of a particle at some point along its path (not the same as trajectory)&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt;: a collection of information from tracks and trajectories&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt;: a collection of events&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The function main() &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; defines the skeleton of your simulation code. Inside the function you instantiate &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4RunManager &amp;lt;/span&amp;gt; and notify it of your mandatory and optional classes. This is example &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt; function, where &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt;, &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyEventAction &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyRunAction &amp;lt;/span&amp;gt; are derived classes from the GEANT4 base classes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
int main() { &lt;br /&gt;
  &lt;br /&gt;
// Run manager construction &lt;br /&gt;
&lt;br /&gt;
G4RunManager* runManager = new G4RunManager; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user initialization classes&lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyDetectorConstruction); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(new MyPhysicsList);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// mandatory user action classes  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyPrimaryGeneratorAction); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// optional user action classes &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyEventAction);  &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserAction(new MyRunAction); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Experimental setup &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserDetectorConstruction &amp;lt;/span&amp;gt; base class. In the derived class you will: &lt;br /&gt;
&lt;br /&gt;
* Describe the shape and the size of your detector using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VSolid &amp;lt;/span&amp;gt; &lt;br /&gt;
* Construct materials and electromagnetic fields using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Logical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
* Place volumes of your detector geometry using &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VPhysical Volume &amp;lt;/span&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyDetectorConstruction &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyDetectorConstruction:public G4VUserDetectorConstruction { &lt;br /&gt;
&lt;br /&gt;
public:  &lt;br /&gt;
    &lt;br /&gt;
MyDetectorConstruction();&lt;br /&gt;
&lt;br /&gt;
~MyDetectorConstruction(); &lt;br /&gt;
    &lt;br /&gt;
virtual G4VPhysicalVolume* Construct(); &lt;br /&gt;
&lt;br /&gt;
     &lt;br /&gt;
private: &lt;br /&gt;
   &lt;br /&gt;
void  DefineMaterials(); };    &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now construct the detector. Your detector is always placed in a mother volume called the world volume.  &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysicalVolume* MyDetectorConstruction::Construct() {  &lt;br /&gt;
&lt;br /&gt;
...  &lt;br /&gt;
&lt;br /&gt;
// World volume &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pWorld = new G4Box(&amp;quot;World&amp;quot;,5*m,5*m,5*m); &lt;br /&gt;
                                         &lt;br /&gt;
G4LogicalVolume* pWorldLog = new G4LogicalVolume(pWorld,vacuum, &amp;quot;World&amp;quot;);    &lt;br /&gt;
                                                                           &lt;br /&gt;
G4VPhysicalVolume* pWorldPhys = new G4PVPlacement(0,G4ThreeVector(),pWorldLog,&amp;quot;World&amp;quot;,0,false,0);  &lt;br /&gt;
&lt;br /&gt;
// Water box &lt;br /&gt;
&lt;br /&gt;
G4VSolid* pBoxSolid = new G4Box(“WaterBox”, 1.*m, 2.*m, 3.*m);  &lt;br /&gt;
&lt;br /&gt;
G4LogicalVolume* pBoxLog = new G4LogicalVolume( pBoxSolid, water, “WaterBox”); &lt;br /&gt;
&lt;br /&gt;
G4VPhysicalVolume* aBoxPhys = new G4PVPlacement( pRotation, G4ThreeVector(posX, posY, posZ), pBoxLog, &lt;br /&gt;
&lt;br /&gt;
“WaterBox”, pWorldLog, false, copyNo); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The elements and materials are defined using classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Element &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Material &amp;lt;/span&amp;gt;. For example water, hydrogen and oxygen are defined as:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyDetectorConstruction::DefineMaterials() { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
G4Element* H = new G4Element(&amp;quot;Hydrogen&amp;quot;,&amp;quot;H&amp;quot;,z=1.,a= 1.01*g/mole); &lt;br /&gt;
 &lt;br /&gt;
G4Element* O = new G4Element(&amp;quot;Oxygen&amp;quot;,&amp;quot;O&amp;quot;,z=8.,a=16.00*g/mole); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
density = 1.000*g/cm3; &lt;br /&gt;
&lt;br /&gt;
G4Material* water = new G4Material(&amp;quot;Water&amp;quot;,density,ncomp=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(H, natoms=2);  &lt;br /&gt;
&lt;br /&gt;
water-&amp;gt;AddElement(O, natoms=1); ...}  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__detectorConstruction.html Here] you can find more examples of DetectorConstruction classes.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Physics processes &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You can build your own physics list or chose from already built physics lists. To build your own physics lists, you can use two base physics list classes: &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt;. The class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; is used for simple physics lists while &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ModularPhysicsList &amp;lt;/span&amp;gt; is used to build more complex physics lists. There exist also already built pre-packaged physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Simple physics lists &amp;lt;/span&amp;gt; ===  &lt;br /&gt;
&lt;br /&gt;
If the particles in your simulation undergo a descrete number of physics processes you can use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPhysicsList &amp;lt;/span&amp;gt; to define them. This class has three methods:&lt;br /&gt;
&lt;br /&gt;
* ConstructParticles() : Define all necessary particles;  &lt;br /&gt;
* ConstructProcesses() : Define all necessary processes and assign them to proper particles;&lt;br /&gt;
* SetCuts() : Define production thresholds in terms of range; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VUserPhysicsList() { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
void ConstructParticle(); &lt;br /&gt;
&lt;br /&gt;
void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
void SetCuts(); } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
Now implement the methods ConstructParticle(), ConstructProcess() and SetCuts():&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructParticle() { &lt;br /&gt;
&lt;br /&gt;
// Define the particles &lt;br /&gt;
&lt;br /&gt;
G4Electron::ElectronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Positron::PositronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Proton::ProtonDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Neutron::NeutronDefinition(); &lt;br /&gt;
&lt;br /&gt;
G4Gamma::GammaDefinition(); ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
GEANT4 provides a variety of physics processes. These processes are decoupled from one another and you can select those which are relevant to your simulation. The processes are grouped in seven categories &lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;column-count:2;-moz-column-count:2;-webkit-column-count:2&amp;quot;&amp;gt;&lt;br /&gt;
* electromagnetic &lt;br /&gt;
* hadronic&lt;br /&gt;
* decay&lt;br /&gt;
* photolepton-hadron&lt;br /&gt;
* optical&lt;br /&gt;
* parameterization&lt;br /&gt;
* transportation &lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and their list is available [http://geant4.cern.ch/support/proc_mod_catalog/processes/ here]. For each particle in ConstructParticle() assign all the physics processes you want to consider in your simulation: &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
&lt;br /&gt;
AddTransportation(); // Assign transportation process to all particles &lt;br /&gt;
&lt;br /&gt;
ConstructEM(); // Electromagnetic processes &lt;br /&gt;
&lt;br /&gt;
ConstructGeneral(); // Other processes }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In methods ConstructEM() and ConstructGeneral() assign the physics processes to the corresponding particles: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructEM() { &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()){ &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
G4String particleName = particle-&amp;gt;GetParticleName(); &lt;br /&gt;
     &lt;br /&gt;
if (particleName == &amp;quot;gamma&amp;quot;) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddDiscreteProcess(new G4GammaConversion); ...} &lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
  &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructGeneral() { &lt;br /&gt;
&lt;br /&gt;
G4Decay* theDecayProcess = new G4Decay() &lt;br /&gt;
&lt;br /&gt;
aParticleIterator-&amp;gt;reset(); &lt;br /&gt;
&lt;br /&gt;
while((*aParticleIterator)()) { &lt;br /&gt;
&lt;br /&gt;
G4ParticleDefinition* particle = aParticleIterator-&amp;gt;value(); &lt;br /&gt;
 &lt;br /&gt;
G4ProcessManager* pmanager = particle-&amp;gt;GetProcessManager(); &lt;br /&gt;
&lt;br /&gt;
if theDecayProcess-&amp;gt;IsApplicable(*particle)) { &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;AddProcess(theDecayProcess); &lt;br /&gt;
     &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxPostStep);  &lt;br /&gt;
    &lt;br /&gt;
pmanager-&amp;gt;SetProcessOrdering(theDecayProcess,idxAtRest); }}} &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the full [http://geant4.cern.ch/support/proc_mod_catalog/particles/ list] of physics processes available for every  particle. Finally, in method SetCuts() you can define cuts on the particles:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::SetCuts() { &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
defaultCutValue = 1.0*mm; &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;gamma&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e+&amp;quot;); &lt;br /&gt;
&lt;br /&gt;
SetCutValue(defaultCutValue, &amp;quot;e-&amp;quot;); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
See the [[Computed tomography]] tutorial to learn more about simple physics lists .&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Detailed physics lists &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
If you want to build more realistic physics list you have to use the class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt;. In &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VModularPhysicsList &amp;lt;/span&amp;gt; you can group the physics processes into separate modules: EM physics, hadronic physics, decay physics etc. and later chose one of them.   &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPhysicsList &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPhysicsList:public G4VModularPhysicsList { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
~MyPhysicsList(); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructParticle(); &lt;br /&gt;
    &lt;br /&gt;
virtual void SetCuts(); &lt;br /&gt;
        &lt;br /&gt;
void AddPhysicsList(const G4String&amp;amp; name); &lt;br /&gt;
&lt;br /&gt;
virtual void ConstructProcess(); &lt;br /&gt;
&lt;br /&gt;
      &lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4String                             fEmName; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fEmPhysicsList; &lt;br /&gt;
&lt;br /&gt;
G4VPhysicsConstructor*               fDecPhysicsList; &lt;br /&gt;
&lt;br /&gt;
std::vector&amp;lt;G4VPhysicsConstructor*&amp;gt;  fHadronPhysicsList; };&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, build the physics lists:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::AddPhysicsList(const G4String&amp;amp; name) { &lt;br /&gt;
&lt;br /&gt;
... &lt;br /&gt;
&lt;br /&gt;
if (name == &amp;quot;emstandard_opt3&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name;   &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmStandardPhysics_option3(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;emlivermore&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmLivermorePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;empenelope&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fEmName = name; &lt;br /&gt;
    &lt;br /&gt;
delete fEmPhysicsList; &lt;br /&gt;
    &lt;br /&gt;
fEmPhysicsList = new G4EmPenelopePhysics(); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HElastic&amp;quot;) { &lt;br /&gt;
    &lt;br /&gt;
fHadronPhysicsList.push_back( new G4HadronHElasticPhysics()); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
} else if (name == &amp;quot;HInelastic&amp;quot;) { &lt;br /&gt;
   &lt;br /&gt;
fHadronPhysicsList.push_back(new G4HadronInelasticQBBC()); &lt;br /&gt;
    &lt;br /&gt;
} ... } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
and &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
void MyPhysicsList::ConstructProcess() { &lt;br /&gt;
 &lt;br /&gt;
AddTransportation(); // transportation &lt;br /&gt;
  &lt;br /&gt;
fEmPhysicsList-&amp;gt;ConstructProcess(); // electromagnetic physics list &lt;br /&gt;
&lt;br /&gt;
fDecPhysicsList-&amp;gt;ConstructProcess(); // decay physics list &lt;br /&gt;
  &lt;br /&gt;
for(size_t i=0; i&amp;lt;fHadronPhys.size(); i++) { // hadronic physics lists &lt;br /&gt;
  &lt;br /&gt;
fHadronPhys[i]-&amp;gt;ConstructProcess(); } } &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
See the [[Monoenergetic proton pencil beam]] tutorial to learn more about detailed physics lists.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Pre-packaged physics lists &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Some built-in pre-packaged physics lists are available [http://geant4.web.cern.ch/geant4/support/proc_mod_catalog/physics_lists/referencePL.shtml here]. You can use them as a starting point of your simulation.    &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; pre-packaged physics list &amp;lt;/span&amp;gt; &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
In function &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; main() &amp;lt;/span&amp;gt;: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4PhysListFactory factory* physListFactory = new G4PhysListFactory(); &lt;br /&gt;
&lt;br /&gt;
G4VUserPhysicsList* physicsList = physListFactory-&amp;gt;GetReferencePhysList(“FTFP_BERT”); &lt;br /&gt;
&lt;br /&gt;
runManager-&amp;gt;SetUserInitialization(physicsList); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For example, if you want to simulate clinical proton beam of energy 150 MeV you can use pre-packaged physics list e.g. QGSP_BIC, QGSP_BERT and FTFP_BERT. If you are interested in Bragg curve physics, use a physics list ending in &amp;quot;EMV&amp;quot; or &amp;quot;EMX&amp;quot; e.g. QGSP_BERT_EMV. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Generate primary particles &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
You derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4VUserPrimaryGeneratorAction &amp;lt;/span&amp;gt; base class.&lt;br /&gt;
Actual generation of primary particles is done via classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4ParticleGun &amp;lt;/span&amp;gt; is used to simulate a beam of particles. It shoots a primary particle of a certain energy and direction from a given point at a given time.&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4GeneralParticleSource &amp;lt;/span&amp;gt; simulates a beam of particles and the primary vertex is randomly chosen on surface of a given volume with pre-defined energy spectra, spatial and angular distribution. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using particle gun &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction( &lt;br /&gt;
&lt;br /&gt;
const G4String&amp;amp; particleName = &amp;quot;proton&amp;quot;, &lt;br /&gt;
      &lt;br /&gt;
G4double energy = 1.*CLHEP::MeV, &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector position= G4ThreeVector(0,0,0), &lt;br /&gt;
      &lt;br /&gt;
G4ThreeVector momentumDirection = G4ThreeVector(0,0,1));     &lt;br /&gt;
    &lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
    &lt;br /&gt;
G4ParticleGun*  fParticleGun; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;u&amp;gt; Simple example of class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; MyPrimaryGeneratorAction &amp;lt;/span&amp;gt; using general particle source &amp;lt;/u&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
class MyPrimaryGeneratorAction:public G4VUserPrimaryGeneratorAction { &lt;br /&gt;
&lt;br /&gt;
public: &lt;br /&gt;
&lt;br /&gt;
MyPrimaryGeneratorAction();     &lt;br /&gt;
&lt;br /&gt;
~MyPrimaryGeneratorAction(); &lt;br /&gt;
&lt;br /&gt;
virtual void GeneratePrimaries(G4Event*); &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private: &lt;br /&gt;
&lt;br /&gt;
static const G4String ParticleName; &lt;br /&gt;
&lt;br /&gt;
static const G4double ParticleEnergy; &lt;br /&gt;
&lt;br /&gt;
G4GeneralParticleSource*  fGeneralParticleSource; }; &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__primaryGenerator.html Here] you can find how to implement MyPrimaryGeneratorAction class in your code.&lt;br /&gt;
&lt;br /&gt;
The [[Monoenergetic photon pencil beam]] example uses the '''G4ParticleGun''' class. The [[Proton beam with realistic geometry]] tutorial uses '''G4GeneralParticleSource'''.  &lt;br /&gt;
   &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Optional user classes &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserRunAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you may book results of the run. The run starts with &amp;quot;Beam On&amp;quot; and within a run you can not change the detector geometry and physics processes. The run is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Run &amp;lt;/span&amp;gt;.   &lt;br /&gt;
  &lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined RunAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Event &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Event is the basic GEANT4 unit. At the beginning of an event are generated primary tracks which are pushed into a stack. The tracks from the stack are analyzed one by one. The primary tracks might lead to secondary tracks which are also pushed into the stack. When the stack becomes empty the processing of the event is over. The event is represented by class &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Event &amp;lt;/span&amp;gt; which gives hits and trajectory collections as output.    &lt;br /&gt;
&lt;br /&gt;
You can derive your own class from &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserEventAction &amp;lt;/span&amp;gt; base class where &lt;br /&gt;
you can select and analize data. &lt;br /&gt;
&lt;br /&gt;
[http://geant4.web.cern.ch/geant4/UserDocumentation/Doxygen/examples_doc/html/group__extended__common__userActions.html Here] you can find examples of user defined EventAction classes.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Track &amp;lt;/span&amp;gt; === &lt;br /&gt;
&lt;br /&gt;
Track is a snapshot of a particle and it is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class. At the end of the event the track objects do not exist. Tracks are pushed step by step. Moving by one step is called &amp;quot;stepping&amp;quot; and this can be controlled by the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; class (see below). At the end of each step the state of a track can be changed (killed, suspended, postponed).    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Step &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Step is defined by two points, it contains also information about the particle e.g. energy loss on the step. A step is represented by &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; classes. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4UserSteppingAction &amp;lt;/span&amp;gt; is optional class where you can kill, suspend, postpone a track. &lt;br /&gt;
&lt;br /&gt;
Status is attached to each &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4StepPoint &amp;lt;/span&amp;gt; to show how step was determined. You can use ''PostStepPoint'' to get status of current step and ''PreStepPoint'' to get status of previous step. For example to get the &amp;quot;x&amp;quot; coordinate of a step you do the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
G4StepPoint* prePoint  = step-&amp;gt;GetPreStepPoint();&lt;br /&gt;
&lt;br /&gt;
G4double x1 = prePoint-&amp;gt;GetPosition().x(); &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Trajectory &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Trajectories are represented by classes &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; and &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt;. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Trajectory &amp;lt;/span&amp;gt; class copies some of the &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Track &amp;lt;/span&amp;gt; class information. &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4TrajectoryPoint &amp;lt;/span&amp;gt; is the class which copies some of &amp;lt;span style=&amp;quot;color:#ff0000&amp;quot;&amp;gt; G4Step &amp;lt;/span&amp;gt; information.&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=List_of_spread_out_Bragg_peaks_files_with_brief_description</id>
		<title>List of spread out Bragg peaks files with brief description</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=List_of_spread_out_Bragg_peaks_files_with_brief_description"/>
				<updated>2014-09-04T08:05:13Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: Created page with &amp;quot;protonSB.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/protonSB.cc code]  proton.mac [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;protonSB.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/protonSB.cc code]&lt;br /&gt;
&lt;br /&gt;
proton.mac [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/proton.mac code]&lt;br /&gt;
&lt;br /&gt;
protonLoop.mac [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/protonLoop.mac code]&lt;br /&gt;
&lt;br /&gt;
visualisation.mac [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/visualisation.mac code]&lt;br /&gt;
&lt;br /&gt;
'''Header files:'''&lt;br /&gt;
&lt;br /&gt;
include/DetectorConstruction.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/DetectorConstruction.hh code]&lt;br /&gt;
&lt;br /&gt;
include/DetectorMessenger.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/DetectorMessenger.hh code]&lt;br /&gt;
&lt;br /&gt;
include/EventAction.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/EventAction.hh code]&lt;br /&gt;
&lt;br /&gt;
include/EventActionMessenger.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/code/include/EventActionMessenger.hh code]&lt;br /&gt;
&lt;br /&gt;
include/PhysicsList.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/PhysicsList.hh code]&lt;br /&gt;
&lt;br /&gt;
include/PhysicsListMessenger.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/PhysicsListMessenger.hh code]&lt;br /&gt;
&lt;br /&gt;
include/PrimaryGeneratorAction.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/PrimaryGeneratorAction.hh code]&lt;br /&gt;
&lt;br /&gt;
include/RunAction.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/RunAction.hh code]&lt;br /&gt;
&lt;br /&gt;
include/StepMax.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/StepMax.hh code]&lt;br /&gt;
&lt;br /&gt;
include/StepMaxMessenger.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/StepMaxMessenger.hh code]&lt;br /&gt;
&lt;br /&gt;
include/SteppingAction.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/SteppingAction.hh code]&lt;br /&gt;
&lt;br /&gt;
include/SteppingVerbose.hh [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/include/SteppingVerbose.hh code]&lt;br /&gt;
&lt;br /&gt;
'''Source files:'''&lt;br /&gt;
&lt;br /&gt;
src/DetectorConstruction.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/DetectorConstruction.cc code]&lt;br /&gt;
&lt;br /&gt;
src/DetectorMessenger.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/DetectorMessenger.cc code]&lt;br /&gt;
&lt;br /&gt;
src/EventAction.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/EventAction.cc code]&lt;br /&gt;
&lt;br /&gt;
src/EventActionMessenger.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/EventActionMessenger.cc code]&lt;br /&gt;
&lt;br /&gt;
src/PhysicsList.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/PhysicsList.cc code]&lt;br /&gt;
&lt;br /&gt;
src/PhysicsListMessenger.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/PhysicsListMessenger.cc code]&lt;br /&gt;
&lt;br /&gt;
src/PrimaryGeneratorAction.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/PrimaryGeneratorAction.cc code]&lt;br /&gt;
&lt;br /&gt;
src/PrimaryGeneratorMessenger.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/PrimaryGeneratorMessenger.cc code]&lt;br /&gt;
&lt;br /&gt;
src/RunAction.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/RunAction.cc code]&lt;br /&gt;
&lt;br /&gt;
src/StepMax.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/StepMax.cc code]&lt;br /&gt;
&lt;br /&gt;
src/StepMaxMessenger.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/StepMaxMessenger.cc code]&lt;br /&gt;
&lt;br /&gt;
src/SteppingAction.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/SteppingAction.cc code]&lt;br /&gt;
&lt;br /&gt;
src/SteppingVerbose.cc [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/src/SteppingVerbose.cc code]&lt;br /&gt;
&lt;br /&gt;
'''Root script'''&lt;br /&gt;
&lt;br /&gt;
PlotSimulation.C [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/code/PlotSimulation.C code]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T19:06:26Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.png&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation (with DAWN), in macro proton.mac uncomment line '''#/control/execute visualisation.mac'''. Then, run the code.&lt;br /&gt;
You will have four images from the four proton beams.&lt;br /&gt;
&lt;br /&gt;
For proton energy of 50 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 52 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_01.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 54 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_02.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 56 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_03.eps&lt;br /&gt;
 &lt;br /&gt;
Protons are in blue, neutrons are in yellow, photons are in green. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T19:03:09Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, protons are in blue, neutrons are in yellow. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation (with DAWN), in macro proton.mac uncomment line '''#/control/execute visualisation.mac'''. Then, run the code.&lt;br /&gt;
You will have four images from the four proton beams.&lt;br /&gt;
&lt;br /&gt;
For proton energy of 50 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 52 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_01.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 54 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_02.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 56 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_03.eps&lt;br /&gt;
 &lt;br /&gt;
Protons are in blue, neutrons are in yellow, photons are in green. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam</id>
		<title>Monoenergetic photon pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_photon_pencil_beam"/>
				<updated>2014-09-03T19:00:48Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Photons are in green, electrons are in red. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder PhotonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir PhotonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd PhotonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cp -r /unix/pbt/tutorials/basic/PhotonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mv PhotonPB PhotonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/PhotonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ mkdir PhotonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPBFolder]$ cd PhotonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/PhotonPBFolder/PhotonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 PhotonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro gamma.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The macro produces root file '''Gamma.root''' with a histogram showing the energy deposition in &lt;br /&gt;
water box along the beam line. It also produces text files: '''DoseFile.txt''' with &lt;br /&gt;
energy and dose deposited in each slice and '''PlotDose.txt''' with dose deposited in each slice. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''DoseFile.txt''' with physics process '''emstandard_opt0''' and incident photon energy of '''20 MeV'''. Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open text files. For example, use editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	 x[mm] 	Edep   	     Edep/Ebeam[%] 	Dose 	       Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	5	119.065 MeV	0.0992211	9.53818e-11 Gy	15.1483	&lt;br /&gt;
 layer 2: 	10	206.505 MeV	0.172088	1.65429e-10 Gy	26.2731	&lt;br /&gt;
 layer 3: 	15	259.584 MeV	0.21632	        2.07949e-10 Gy	33.026	&lt;br /&gt;
 layer 4: 	20	311.898 MeV	0.259915	2.49858e-10 Gy	39.6819	&lt;br /&gt;
 layer 5: 	25	395.255 MeV	0.329379	3.16634e-10 Gy	50.2871	&lt;br /&gt;
 layer 6: 	30	439.052 MeV	0.365876	3.51719e-10 Gy	55.8592	&lt;br /&gt;
 layer 7: 	35	503.311 MeV	0.419426	4.03197e-10 Gy	64.0348	&lt;br /&gt;
 layer 8: 	40	573.742 MeV	0.478118	4.59618e-10 Gy	72.9954	&lt;br /&gt;
 layer 9: 	45	624.707 MeV	0.520589	5.00446e-10 Gy	79.4796	&lt;br /&gt;
 layer 10: 	50	678.383 MeV	0.565319	5.43445e-10 Gy	86.3086	&lt;br /&gt;
 layer 11: 	55	694.602 MeV	0.578835	5.56437e-10 Gy	88.3721	&lt;br /&gt;
 layer 12: 	60	710.771 MeV	0.592309	5.6939e-10 Gy	90.4292	&lt;br /&gt;
 layer 13: 	65	744.826 MeV	0.620689	5.96672e-10 Gy	94.762	&lt;br /&gt;
 layer 14: 	70	742.436 MeV	0.618697	5.94757e-10 Gy	94.4579	&lt;br /&gt;
 layer 15: 	75	771.713 MeV	0.643094	6.1821e-10 Gy	98.1827	&lt;br /&gt;
 layer 16: 	80	767.22 MeV	0.63935	        6.14611e-10 Gy	97.611	&lt;br /&gt;
 layer 17: 	85	775.608 MeV	0.64634	        6.21331e-10 Gy	98.6783	&lt;br /&gt;
 layer 18: 	90	762.779 MeV	0.635649	6.11053e-10 Gy	97.046	&lt;br /&gt;
 layer 19: 	95	785.997 MeV	0.654997	6.29653e-10 Gy	100	&lt;br /&gt;
 layer 20: 	100	735.186 MeV	0.612655	5.88949e-10 Gy	93.5355	&lt;br /&gt;
 layer 21: 	105	761.414 MeV	0.634512	6.0996e-10 Gy	96.8724	&lt;br /&gt;
 layer 22: 	110	721.836 MeV	0.60153	        5.78254e-10 Gy	91.837	&lt;br /&gt;
 layer 23: 	115	730.726 MeV	0.608939	5.85376e-10 Gy	92.9681	&lt;br /&gt;
 layer 24: 	120	728.394 MeV	0.606995	5.83508e-10 Gy	92.6714	&lt;br /&gt;
 layer 25: 	125	744.904 MeV	0.620753	5.96734e-10 Gy	94.7719	&lt;br /&gt;
 layer 26: 	130	731.53 MeV	0.609608	5.8602e-10 Gy	93.0703	&lt;br /&gt;
 layer 27: 	135	702.85 MeV	0.585709	5.63045e-10 Gy	89.4215	&lt;br /&gt;
 layer 28: 	140	671.716 MeV	0.559763	5.38104e-10 Gy	85.4604	&lt;br /&gt;
 layer 29: 	145	676.297 MeV	0.56358	        5.41773e-10 Gy	86.0432	&lt;br /&gt;
 layer 30: 	150	653.849 MeV	0.544875	5.23791e-10 Gy	83.1873	&lt;br /&gt;
 layer 31: 	155	674.152 MeV	0.561793	5.40055e-10 Gy	85.7703	&lt;br /&gt;
 layer 32: 	160	687.008 MeV	0.572507	5.50354e-10 Gy	87.406	&lt;br /&gt;
 layer 33: 	165	706.2 MeV	0.5885	        5.65729e-10 Gy	89.8478	&lt;br /&gt;
 layer 34: 	170	700.841 MeV	0.584034	5.61435e-10 Gy	89.1659	&lt;br /&gt;
 layer 35: 	175	686.009 MeV	0.571674	5.49553e-10 Gy	87.2788	&lt;br /&gt;
 layer 36: 	180	658.891 MeV	0.549076	5.2783e-10 Gy	83.8287	&lt;br /&gt;
 layer 37: 	185	644.999 MeV	0.537499	5.16701e-10 Gy	82.0613	&lt;br /&gt;
 layer 38: 	190	655.81 MeV	0.546508	5.25362e-10 Gy	83.4367	&lt;br /&gt;
 layer 39: 	195	645.691 MeV	0.538075	5.17255e-10 Gy	82.1493	&lt;br /&gt;
 layer 40: 	200	0 eV 	        0	        0 Gy	        0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 gamma of 20 MeV through 20 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 40 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 120 GeV&lt;br /&gt;
 Total energy deposit= 24.8344 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is '''PlotDose.txt'''. These values can be analyzed with MATLAB and ROOT .&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;  &lt;br /&gt;
5	15.1483	&lt;br /&gt;
10	26.2731	&lt;br /&gt;
15	33.026	&lt;br /&gt;
20	39.6819	&lt;br /&gt;
25	50.2871	&lt;br /&gt;
30	55.8592	&lt;br /&gt;
35	64.0348	&lt;br /&gt;
40	72.9954	&lt;br /&gt;
45	79.4796	&lt;br /&gt;
50	86.3086	&lt;br /&gt;
55	88.3721	&lt;br /&gt;
60	90.4292	&lt;br /&gt;
65	94.762	&lt;br /&gt;
70	94.4579	&lt;br /&gt;
75	98.1827	&lt;br /&gt;
80	97.611	&lt;br /&gt;
85	98.6783	&lt;br /&gt;
90	97.046	&lt;br /&gt;
95	100	&lt;br /&gt;
100	93.5355	&lt;br /&gt;
105	96.8724	&lt;br /&gt;
110	91.837	&lt;br /&gt;
115	92.9681	&lt;br /&gt;
120	92.6714	&lt;br /&gt;
125	94.7719	&lt;br /&gt;
130	93.0703	&lt;br /&gt;
135	89.4215	&lt;br /&gt;
140	85.4604	&lt;br /&gt;
145	86.0432	&lt;br /&gt;
150	83.1873	&lt;br /&gt;
155	85.7703	&lt;br /&gt;
160	87.406	&lt;br /&gt;
165	89.8478	&lt;br /&gt;
170	89.1659	&lt;br /&gt;
175	87.2788	&lt;br /&gt;
180	83.8287	&lt;br /&gt;
185	82.0613	&lt;br /&gt;
190	83.4367	&lt;br /&gt;
195	82.1493	&lt;br /&gt;
200	0	&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Gamma.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Gamma.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The histogram inside Gamma.root shows the energy deposition in water box:&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/Edep_PhotonB1.png &lt;br /&gt;
&lt;br /&gt;
To exit the ROOT terminal type &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can plot the dose deposition along the depth of the absorber ('''PlotDose.txt''') using script '''PlotSimulation.C''' from folder '''PhotonPB_source'''. Copy this script to your current '''PhotonPB_build''' directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ cp /home/username/PhotonPBFolder/PhotonPB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
Then run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file. Open the root file:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ root -l Simulation.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT files and Gamma.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
This is the result:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/DoseDeposition1.png   &lt;br /&gt;
&lt;br /&gt;
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 local installation of MATLAB you can import the '''PlotDose.txt''' file and plot it. This is the procedure:&lt;br /&gt;
&lt;br /&gt;
* Import the file: Chose 'Home' tab and 'Import Data'&lt;br /&gt;
* Select the data points in the opened window and press 'Import Selection'&lt;br /&gt;
* Close the Import Window and in the Command Window type plot(xmm, DoseMaxDose) &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident photon energy, phantom material, number of slices etc. by&lt;br /&gt;
modifying the macro gamma.mac. Open the macro with editor pico:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ pico gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# gamma.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry and material&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
#/photonPB/det/setMat Lead&lt;br /&gt;
/photonPB/det/setSizeX  20 cm&lt;br /&gt;
/photonPB/det/setSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/setSliceSizeYZ 20 cm&lt;br /&gt;
/photonPB/det/sliceNumber 40 &lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
#/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/photonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (range cut off-&lt;br /&gt;
# not bigger than 10% of slice thickness)&lt;br /&gt;
/photonPB/phys/setCuts 1 mm&lt;br /&gt;
#/photonPB/phys/setGCut 1 um&lt;br /&gt;
#/photonPB/phys/setECut 1 um&lt;br /&gt;
#/photonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
&lt;br /&gt;
# particle gun properties (type of &lt;br /&gt;
#particle and energy)&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
#/gun/particle e-&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/photonPB/stepMax 0.5 mm&lt;br /&gt;
#&lt;br /&gt;
/photonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output root file&lt;br /&gt;
/analysis/setFileName Gamma&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''emstandard_opt0'''. This package is used in high energy experiments. In gamma.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emstandard_opt0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The process '''emlivermore''' is used in low energy physics experiments. &lt;br /&gt;
&lt;br /&gt;
'''Change the incident particle energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 20 MeV. The typical therapeutic beam energy used in radiotherapy is in the interval 0.3 to 20 MeV. In gamma.mac you can change the value of 20 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 20 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 1.25 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 1.25 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the energy of the photon beams from cobalt-60 therapy machines.&lt;br /&gt;
&lt;br /&gt;
Keep in mind that the primary particle generation is done at /PhotonPB_source/src/PrimaryGeneratorAction.cc.&lt;br /&gt;
This is part of the PrimaryGeneratorAction.cc:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
G4ParticleDefinition* particle = G4ParticleTable::GetParticleTable()-&amp;gt;FindParticle(&amp;quot;proton&amp;quot;);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleDefinition(particle);&lt;br /&gt;
fParticleGun-&amp;gt;SetParticleEnergy(160*MeV);  &lt;br /&gt;
fParticleGun-&amp;gt;SetParticleMomentumDirection(G4ThreeVector(1.,0.,0.));&lt;br /&gt;
     &lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
G4double x0 = -0.5*(fDetector-&amp;gt;GetAbsorSizeX());&lt;br /&gt;
G4double y0 = 0.*cm, z0 = 0.*cm;&lt;br /&gt;
&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
fParticleGun-&amp;gt;SetParticlePosition(G4ThreeVector(x0,y0,z0));&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The line &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
fParticleGun  = new G4ParticleGun(1);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
means that only one particle is generated, incident from (x0,y0,z0). The default number of&lt;br /&gt;
events is set to 6000. Therefore, 6000 particles are incident to the water box. &lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the material'''&lt;br /&gt;
&lt;br /&gt;
In this example we compute the energy deposition of photons in water box. However,&lt;br /&gt;
there is an option to change the box material from water to lead. &lt;br /&gt;
&lt;br /&gt;
In gamma.mac change &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Water&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/setMat Lead&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the type of incident particle'''&lt;br /&gt;
&lt;br /&gt;
In gamma.mac change the photon &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle gamma&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to electron&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/particle e-&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 40. Keep in mind that &lt;br /&gt;
if you want to have bigger number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/PhotonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to a value which is bigger then the number of your slices. The default number is MaxLayer=50. For example, if you want your box to be divided to 60 slices you need to set the value of MaxLayer to ,for example, 65 then in gamma.mac you need to change the number of slices:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/det/sliceNumber 60 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Every time you modify files in directory PhotonPB_source you need to compile your code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''gamma.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
In this example, we use '''DAWN''' event display. Before running the visualisation look at the [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, uncomment line '''/control/execute visualisation.mac''' and run the  &lt;br /&gt;
gamma.mac macro&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ ./photonPB gamma.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. Both files contain detector geometry and particle interactions. While running the gamma.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the DAWN display change the polar and azimuthal angles to 0 and 90 degrees, then press OK.  This will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/PhotonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The color in the images indicates the type of the particle. Photons are in green, electrons are in red and positrons are in cyan. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic photon pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Proton_beam_with_realistic_geometry</id>
		<title>Proton beam with realistic geometry</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Proton_beam_with_realistic_geometry"/>
				<updated>2014-09-03T18:58:34Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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]. &lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
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.  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonGBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonGBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonGBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonGB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonGBFolder]$ mv ProtonGB ProtonGB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonGBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ mkdir ProtonGB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonGBFolder]$ cd ProtonGB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonGB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonGBFolder/ProtonGB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonGB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ ./protonGB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* The two ways to record data should give similar result.   &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is an example output for '''DoseFile.txt''' with physics process '''QGSP_BIC_EMY''' and incident proton energy of '''62 MeV'''.&lt;br /&gt;
Use your favorite editor '''pico''', '''vi''', '''emacs''' etc. to open text files. Now, open the text file '''DoseFile.txt''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers 	 x[mm]    Edep      Edep/Ebeam[%]  Dose 	Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	0.8	5.20624 GeV	1.399	6.517e-07 Gy	18.49	&lt;br /&gt;
 layer 2: 	1.6	5.255 GeV	1.413	6.578e-07 Gy	18.67	&lt;br /&gt;
 layer 3: 	2.4	5.349 GeV	1.438	6.696e-07 Gy	19	&lt;br /&gt;
 layer 4: 	3.2	5.464 GeV	1.469	6.839e-07 Gy	19.41	&lt;br /&gt;
 layer 5: 	4	5.533 GeV	1.487	6.926e-07 Gy	19.66	&lt;br /&gt;
 layer 6: 	4.8	5.546 GeV	1.491	6.942e-07 Gy	19.7	&lt;br /&gt;
 layer 7: 	5.6	5.592 GeV	1.503	7e-07 Gy	19.87	&lt;br /&gt;
 layer 8: 	6.4	5.586 GeV	1.502	6.993e-07 Gy	19.84	&lt;br /&gt;
 layer 9: 	7.2	5.748 GeV	1.545	7.194e-07 Gy	20.42	&lt;br /&gt;
 layer 10: 	8	5.827 GeV	1.566	7.293e-07 Gy	20.7	&lt;br /&gt;
 layer 11: 	8.8	5.922 GeV	1.592	7.412e-07 Gy	21.04	&lt;br /&gt;
 layer 12: 	9.6	5.949 GeV	1.599	7.446e-07 Gy	21.13	&lt;br /&gt;
 layer 13: 	10.4	6.05 GeV	1.626	7.573e-07 Gy	21.49	&lt;br /&gt;
 layer 14: 	11.2	6.195 GeV	1.665	7.755e-07 Gy	22.01	&lt;br /&gt;
 layer 15: 	12	6.306 GeV	1.695	7.894e-07 Gy	22.4	&lt;br /&gt;
 layer 16: 	12.8	6.365 GeV	1.711	7.967e-07 Gy	22.61	&lt;br /&gt;
 layer 17: 	13.6	6.499 GeV	1.747	8.135e-07 Gy	23.09	&lt;br /&gt;
 layer 18: 	14.4	6.634 GeV	1.783	8.303e-07 Gy	23.56	&lt;br /&gt;
 layer 19: 	15.2	6.731 GeV	1.809	8.425e-07 Gy	23.91	&lt;br /&gt;
 layer 20: 	16	6.915 GeV	1.859	8.655e-07 Gy	24.56	&lt;br /&gt;
 layer 21: 	16.8	7.099 GeV	1.908	8.886e-07 Gy	25.22	&lt;br /&gt;
 layer 22: 	17.6	7.168 GeV	1.927	8.972e-07 Gy	25.46	&lt;br /&gt;
 layer 23: 	18.4	7.301 GeV	1.963	9.138e-07 Gy	25.93	&lt;br /&gt;
 layer 24: 	19.2	7.593 GeV	2.041	9.505e-07 Gy	26.97	&lt;br /&gt;
 layer 25: 	20	7.718 GeV	2.075	9.66e-07 Gy	27.42	&lt;br /&gt;
 layer 26: 	20.8	7.952 GeV	2.138	9.954e-07 Gy	28.25	&lt;br /&gt;
 layer 27: 	21.6	8.149 GeV	2.191	1.02e-06 Gy	28.95	&lt;br /&gt;
 layer 28: 	22.4	8.446 GeV	2.27	1.057e-06 Gy	30	&lt;br /&gt;
 layer 29: 	23.2	8.784 GeV	2.361	1.1e-06 Gy	31.2	&lt;br /&gt;
 layer 30: 	24	9.082 GeV	2.441	1.137e-06 Gy	32.26	&lt;br /&gt;
 layer 31: 	24.8	9.47 GeV	2.546	1.185e-06 Gy	33.64	&lt;br /&gt;
 layer 32: 	25.6	9.929 GeV	2.669	1.243e-06 Gy	35.27	&lt;br /&gt;
 layer 33: 	26.4	10.54 GeV	2.833	1.319e-06 Gy	37.44	&lt;br /&gt;
 layer 34: 	27.2	11.25 GeV	3.023	1.408e-06 Gy	39.95	&lt;br /&gt;
 layer 35: 	28	12.11 GeV	3.256	1.516e-06 Gy	43.03	&lt;br /&gt;
 layer 36: 	28.8	13.21 GeV	3.55	1.653e-06 Gy	46.91	&lt;br /&gt;
 layer 37: 	29.6	14.65 GeV	3.938	1.834e-06 Gy	52.05	&lt;br /&gt;
 layer 38: 	30.4	16.98 GeV	4.564	2.125e-06 Gy	60.31	&lt;br /&gt;
 layer 39: 	31.2	21.42 GeV	5.759	2.682e-06 Gy	76.1	&lt;br /&gt;
 layer 40: 	32	28.15 GeV	7.567	3.524e-06 Gy	100	&lt;br /&gt;
 layer 41: 	32.8	15.14 GeV	4.07	1.895e-06 Gy	53.78	&lt;br /&gt;
 layer 42: 	33.6	1.256 GeV	0.3376	1.572e-07 Gy	4.462	&lt;br /&gt;
 layer 43: 	34.4	18.93 MeV	0.005087   2.369e-09 Gy	0.06723	&lt;br /&gt;
 layer 44: 	35.2	597.5 keV	0.0001606  7.479e-11 Gy	0.002122	&lt;br /&gt;
 layer 45: 	36	665.8 keV	0.000179   8.334e-11 Gy	0.002365	&lt;br /&gt;
 layer 46: 	36.8	130.1 keV	3.498e-05  1.629e-11 Gy	0.0004623	&lt;br /&gt;
 layer 47: 	37.6	457.2 keV	0.0001229  5.722e-11 Gy	0.001624	&lt;br /&gt;
 layer 48: 	38.4	247.8 keV	6.661e-05  3.102e-11 Gy	0.0008802	&lt;br /&gt;
 layer 49: 	39.2	236.6 keV	6.361e-05  2.962e-11 Gy	0.0008406	&lt;br /&gt;
 layer 50: 	40	0 eV 	0	0 Gy	0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000  protons of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) divided &lt;br /&gt;
 into 50 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 372 GeV&lt;br /&gt;
 Total energy deposit= 367.3 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding '''PlotDose.txt''' is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
0.8	18.4941	&lt;br /&gt;
1.6	18.668	&lt;br /&gt;
2.4	19.0022	&lt;br /&gt;
3.2	19.4096	&lt;br /&gt;
4	19.6559	&lt;br /&gt;
4.8	19.7012	&lt;br /&gt;
5.6	19.8661	&lt;br /&gt;
6.4	19.8446	&lt;br /&gt;
7.2	20.4168	&lt;br /&gt;
8	20.6987	&lt;br /&gt;
8.8	21.0351	&lt;br /&gt;
9.6	21.1327	&lt;br /&gt;
10.4	21.493	&lt;br /&gt;
11.2	22.0079	&lt;br /&gt;
12	22.4025	&lt;br /&gt;
12.8	22.6104	&lt;br /&gt;
13.6	23.0872	&lt;br /&gt;
14.4	23.5642	&lt;br /&gt;
15.2	23.9102	&lt;br /&gt;
16	24.564	&lt;br /&gt;
16.8	25.2168	&lt;br /&gt;
17.6	25.4611	&lt;br /&gt;
18.4	25.9348	&lt;br /&gt;
19.2	26.9738	&lt;br /&gt;
20	27.4152	&lt;br /&gt;
20.8	28.2496	&lt;br /&gt;
21.6	28.9492	&lt;br /&gt;
22.4	30.0033	&lt;br /&gt;
23.2	31.2049	&lt;br /&gt;
24	32.2636	&lt;br /&gt;
24.8	33.6414	&lt;br /&gt;
25.6	35.2707	&lt;br /&gt;
26.4	37.4412	&lt;br /&gt;
27.2	39.9539	&lt;br /&gt;
28	43.0264	&lt;br /&gt;
28.8	46.9139	&lt;br /&gt;
29.6	52.0461	&lt;br /&gt;
30.4	60.3067	&lt;br /&gt;
31.2	76.1028	&lt;br /&gt;
32	100	&lt;br /&gt;
32.8	53.7805	&lt;br /&gt;
33.6	4.46152	&lt;br /&gt;
34.4	0.0672278	&lt;br /&gt;
35.2	0.00212242	&lt;br /&gt;
36	0.00236509	&lt;br /&gt;
36.8	0.000462313	&lt;br /&gt;
37.6	0.00162397	&lt;br /&gt;
38.4	0.00088024	&lt;br /&gt;
39.2	0.000840567	&lt;br /&gt;
40	0	&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[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.  &lt;br /&gt;
&lt;br /&gt;
[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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open the '''Proton.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ root -l Proton.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT Files and Proton.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/BraggPeak_GB1.png &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/BraggPeak_GBzoom1.png  &lt;br /&gt;
&lt;br /&gt;
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: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create root file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/Simulation1.png  &lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ cp /home/username/ProtonGBFolder/ProtonGB_source/RootScripts/PlotLateralDoseMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonGB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotLateralDoseMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''LateralDose_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/SimulationLateralMesh.png&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton energy and number of slices by&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
Open the macro proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ pico proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
You will see:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry &lt;br /&gt;
/protonGB/det/setSizeX  4 cm&lt;br /&gt;
/protonGB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonGB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonGB/det/sliceNumber 50 &lt;br /&gt;
#&lt;br /&gt;
# define longitudinal scoring mesh&lt;br /&gt;
# along the beam&lt;br /&gt;
/score/create/boxMesh waterMeshlongitudinal&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 50 1 1&lt;br /&gt;
/score/mesh/translate/xyz 0. 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# define lateral scoring mesh&lt;br /&gt;
# centered at the Bragg peak&lt;br /&gt;
/score/create/boxMesh waterMeshlateral&lt;br /&gt;
/score/mesh/boxSize 0.1 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 1 1 50&lt;br /&gt;
/score/mesh/translate/xyz 1.2 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonGB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonGB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonGB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range &lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonGB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonGB/phys/setGCut 1 um&lt;br /&gt;
#/protonGB/phys/setECut 1 um&lt;br /&gt;
#/protonGB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
# General particle source&lt;br /&gt;
# proton circle source  &lt;br /&gt;
/gps/pos/shape Circle&lt;br /&gt;
/gps/pos/centre -2. 0. 0. cm&lt;br /&gt;
/gps/pos/radius 0. mm&lt;br /&gt;
/gps/pos/sigma_r 2. mm&lt;br /&gt;
/gps/particle proton&lt;br /&gt;
/gps/pos/type Beam&lt;br /&gt;
#&lt;br /&gt;
# the incident surface is in the y-z plane&lt;br /&gt;
/gps/pos/rot1 0 1 0&lt;br /&gt;
/gps/pos/rot2 0 0 1&lt;br /&gt;
#&lt;br /&gt;
# the beam is travelling along the x-axis without any angular &lt;br /&gt;
#dispersion (angular despersion set to 0.0)&lt;br /&gt;
/gps/ang/rot1 0 0 1&lt;br /&gt;
/gps/ang/rot2 0 1 0 &lt;br /&gt;
/gps/ang/type beam1d &lt;br /&gt;
/gps/ang/sigma_r 0. deg&lt;br /&gt;
#&lt;br /&gt;
# the beam energy is in gaussian profile&lt;br /&gt;
/gps/ene/type Gauss&lt;br /&gt;
/gps/ene/mono 62 MeV&lt;br /&gt;
/gps/ene/sigma 0.3 MeV&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonGB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonGB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output file&lt;br /&gt;
/analysis/setFileName Proton&lt;br /&gt;
# &lt;br /&gt;
/analysis/h1/set 2 50 25 35 mm&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
# drawing projections&lt;br /&gt;
#/score/drawProjection waterMeshlongitudinal doseDeposit&lt;br /&gt;
#/score/drawProjection waterMeshlateral doseDeposit&lt;br /&gt;
&lt;br /&gt;
# dump scores to a file&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal energyDeposit EnergyLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral doseDeposit DoseLateralMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral energyDeposit EnergyLateralMesh.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
You can modify '''proton.mac''' as it is done in the tutorial '''Monoenergetic proton pencil beam'''.  &lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
In macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
The lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections in longitudinal and lateral directions. &lt;br /&gt;
&lt;br /&gt;
To run the visualisation, first uncomment lines '''/control/execute visualisation.mac''' and '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Then, run the proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonGB_build]$ ./protonGB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file, '''g4_01.prim''' contains dose projections in longitudinal direction:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_02_6000e.eps  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Comparison with data from The Clatterbridge Cancer Centre &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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).&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/ClatterbridgeSimulation1.png   &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of proton beam with realistic geometry files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam</id>
		<title>Monoenergetic proton pencil beam</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Monoenergetic_proton_pencil_beam"/>
				<updated>2014-09-03T18:57:27Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This example shows the dose distribution in water along the incident proton 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. &lt;br /&gt;
&lt;br /&gt;
The slices are created using class '''G4PVReplica'''. The energy and the dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining two scoring meshes in longitudinal and lateral direction of the beam. More information about the scoring meshes can be found [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch04s08.html here]. The protons are generated using '''G4ParticleGun''' class. There is an option to chose among several '''EM''' and the '''QGSP_BIC_EMY''' physics lists.&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.png&lt;br /&gt;
&lt;br /&gt;
The image shows the water box divided into slices using class '''G4PVReplica'''. Protons are in blue, photons are in green. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; == &lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonPBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
 &lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonPBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonPBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonPB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mv ProtonPB ProtonPB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonPBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ mkdir ProtonPB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPBFolder]$ cd ProtonPB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonPBFolder/ProtonPB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
&lt;br /&gt;
* The two ways to record data should give similar result.   &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is output from '''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. For example, open this text file with editor '''pico''': &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico DoseFile.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :	x[mm]  	Edep 	    Edep/Ebeam[%]  Dose        Dose/MaxDose[%]&lt;br /&gt;
 layer 1: 	0.8	5.17382 GeV	1.39081	6.47608e-07 Gy	17.3315	&lt;br /&gt;
 layer 2: 	1.6	5.24175 GeV	1.40907	6.5611e-07 Gy	17.5591	&lt;br /&gt;
 layer 3: 	2.4	5.29862 GeV	1.42436	6.63229e-07 Gy	17.7496	&lt;br /&gt;
 layer 4: 	3.2	5.41481 GeV	1.45559	6.77772e-07 Gy	18.1388	&lt;br /&gt;
 layer 5: 	4	5.43787 GeV	1.46179	6.80658e-07 Gy	18.216	&lt;br /&gt;
 layer 6: 	4.8	5.52101 GeV	1.48414	6.91065e-07 Gy	18.4946	&lt;br /&gt;
 layer 7: 	5.6	5.64633 GeV	1.51783	7.06751e-07 Gy	18.9144	&lt;br /&gt;
 layer 8: 	6.4	5.63969 GeV	1.51605	7.0592e-07 Gy	18.8921	&lt;br /&gt;
 layer 9: 	7.2	5.71744 GeV	1.53695	7.15652e-07 Gy	19.1526	&lt;br /&gt;
 layer 10: 	8	5.78086 GeV	1.55399	7.2359e-07 Gy	19.365	&lt;br /&gt;
 layer 11: 	8.8	5.94371 GeV	1.59777	7.43975e-07 Gy	19.9106	&lt;br /&gt;
 layer 12: 	9.6	6.02518 GeV	1.61967	7.54172e-07 Gy	20.1835	&lt;br /&gt;
 layer 13: 	10.4	6.10292 GeV	1.64057	7.63903e-07 Gy	20.4439	&lt;br /&gt;
 layer 14: 	11.2	6.18071 GeV	1.66148	7.7364e-07 Gy	20.7045	&lt;br /&gt;
 layer 15: 	12	6.2621 GeV	1.68336	7.83827e-07 Gy	20.9771	&lt;br /&gt;
 layer 16: 	12.8	6.37762 GeV	1.71441	7.98286e-07 Gy	21.3641	&lt;br /&gt;
 layer 17: 	13.6	6.52458 GeV	1.75392	8.16682e-07 Gy	21.8564	&lt;br /&gt;
 layer 18: 	14.4	6.67805 GeV	1.79517	8.35892e-07 Gy	22.3705	&lt;br /&gt;
 layer 19: 	15.2	6.86252 GeV	1.84476	8.58982e-07 Gy	22.9884	&lt;br /&gt;
 layer 20: 	16	6.95226 GeV	1.86889	8.70215e-07 Gy	23.289	&lt;br /&gt;
 layer 21: 	16.8	7.11679 GeV	1.91312	8.90809e-07 Gy	23.8402	&lt;br /&gt;
 layer 22: 	17.6	7.15125 GeV	1.92238	8.95122e-07 Gy	23.9556	&lt;br /&gt;
 layer 23: 	18.4	7.43274 GeV	1.99805	9.30356e-07 Gy	24.8986	&lt;br /&gt;
 layer 24: 	19.2	7.58811 GeV	2.03981	9.49804e-07 Gy	25.419	&lt;br /&gt;
 layer 25: 	20	7.8156 GeV	2.10097	9.78279e-07 Gy	26.1811	&lt;br /&gt;
 layer 26: 	20.8	7.94754 GeV	2.13643	9.94794e-07 Gy	26.6231	&lt;br /&gt;
 layer 27: 	21.6	8.35363 GeV	2.2456	1.04562e-06 Gy	27.9834	&lt;br /&gt;
 layer 28: 	22.4	8.44564 GeV	2.27033	1.05714e-06 Gy	28.2917	&lt;br /&gt;
 layer 29: 	23.2	8.74817 GeV	2.35166	1.09501e-06 Gy	29.3051	&lt;br /&gt;
 layer 30: 	24	9.08194 GeV	2.44138	1.13679e-06 Gy	30.4232	&lt;br /&gt;
 layer 31: 	24.8	9.50886 GeV	2.55615	1.19022e-06 Gy	31.8533	&lt;br /&gt;
 layer 32: 	25.6	9.93302 GeV	2.67017	1.24332e-06 Gy	33.2741	&lt;br /&gt;
 layer 33: 	26.4	10.5627 GeV	2.83943	1.32213e-06 Gy	35.3834	&lt;br /&gt;
 layer 34: 	27.2	11.1563 GeV	2.99902	1.39644e-06 Gy	37.3721	&lt;br /&gt;
 layer 35: 	28	12.0025 GeV	3.22647	1.50235e-06 Gy	40.2065	&lt;br /&gt;
 layer 36: 	28.8	13.1124 GeV	3.52485	1.64128e-06 Gy	43.9247	&lt;br /&gt;
 layer 37: 	29.6	14.5158 GeV	3.90209	1.81694e-06 Gy	48.6257	&lt;br /&gt;
 layer 38: 	30.4	16.8932 GeV	4.54119	2.11452e-06 Gy	56.5898	&lt;br /&gt;
 layer 39: 	31.2	20.9827 GeV	5.64051	2.62641e-06 Gy	70.289	&lt;br /&gt;
 layer 40: 	32	29.8521 GeV	8.02475	3.73658e-06 Gy	100	&lt;br /&gt;
 layer 41: 	32.8	14.922 GeV	4.0113	1.86779e-06 Gy	49.9866	&lt;br /&gt;
 layer 42: 	33.6	330.005 MeV	0.088711     4.13067e-08 Gy  1.10547	&lt;br /&gt;
 layer 43: 	34.4	2.92265 MeV	0.000785658  3.65828e-10 Gy  0.00979044	&lt;br /&gt;
 layer 44: 	35.2	864.413 keV	0.000232369  1.08199e-10 Gy  0.00289566	&lt;br /&gt;
 layer 45: 	36	673.958 keV	0.000181172  8.43594e-11 Gy  0.00225766	&lt;br /&gt;
 layer 46: 	36.8	1.18851 MeV	0.000319491  1.48765e-10 Gy  0.00398132	&lt;br /&gt;
 layer 47: 	37.6	3.81319 MeV	0.00102505   4.77297e-10 Gy  0.0127736	&lt;br /&gt;
 layer 48: 	38.4	4.58219 MeV	0.00123177   5.73552e-10 Gy  0.0153496	&lt;br /&gt;
 layer 49: 	39.2	7.29449 MeV	0.00196088   9.13052e-10 Gy  0.0244355	&lt;br /&gt;
 layer 50: 	40	0 eV 	0	0 Gy	0	&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 The run consists of 6000 proton of 62 MeV through 4 cm  of Water (density: 1 g/cm3 ) &lt;br /&gt;
 divided into 50 slices.&lt;br /&gt;
&lt;br /&gt;
 Edep is the deposited energy in every slice.&lt;br /&gt;
 Total incident energy(Ebeam)= 372 GeV&lt;br /&gt;
 Total energy deposit= 367.368 GeV&lt;br /&gt;
 Dose is the deposited dose in every slice.&lt;br /&gt;
 MaxDose is the highest dose value from all slices.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The corresponding '''PlotDose.txt''' is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
0.8	17.3315	&lt;br /&gt;
1.6	17.5591	&lt;br /&gt;
2.4	17.7496	&lt;br /&gt;
3.2	18.1388	&lt;br /&gt;
4	18.216	&lt;br /&gt;
4.8	18.4946	&lt;br /&gt;
5.6	18.9144	&lt;br /&gt;
6.4	18.8921	&lt;br /&gt;
7.2	19.1526	&lt;br /&gt;
8	19.365	&lt;br /&gt;
8.8	19.9106	&lt;br /&gt;
9.6	20.1835	&lt;br /&gt;
10.4	20.4439	&lt;br /&gt;
11.2	20.7045	&lt;br /&gt;
12	20.9771	&lt;br /&gt;
12.8	21.3641	&lt;br /&gt;
13.6	21.8564	&lt;br /&gt;
14.4	22.3705	&lt;br /&gt;
15.2	22.9884	&lt;br /&gt;
16	23.289	&lt;br /&gt;
16.8	23.8402	&lt;br /&gt;
17.6	23.9556	&lt;br /&gt;
18.4	24.8986	&lt;br /&gt;
19.2	25.419	&lt;br /&gt;
20	26.1811	&lt;br /&gt;
20.8	26.6231	&lt;br /&gt;
21.6	27.9834	&lt;br /&gt;
22.4	28.2917	&lt;br /&gt;
23.2	29.3051	&lt;br /&gt;
24	30.4232	&lt;br /&gt;
24.8	31.8533	&lt;br /&gt;
25.6	33.2741	&lt;br /&gt;
26.4	35.3834	&lt;br /&gt;
27.2	37.3721	&lt;br /&gt;
28	40.2065	&lt;br /&gt;
28.8	43.9247	&lt;br /&gt;
29.6	48.6257	&lt;br /&gt;
30.4	56.5898	&lt;br /&gt;
31.2	70.289	&lt;br /&gt;
32	100	&lt;br /&gt;
32.8	49.9866	&lt;br /&gt;
33.6	1.10547	&lt;br /&gt;
34.4	0.00979044	&lt;br /&gt;
35.2	0.00289566	&lt;br /&gt;
36	0.00225766	&lt;br /&gt;
36.8	0.00398132	&lt;br /&gt;
37.6	0.0127736	&lt;br /&gt;
38.4	0.0153496	&lt;br /&gt;
39.2	0.0244355	&lt;br /&gt;
40	0		&lt;br /&gt;
&amp;lt;/pre&amp;gt; &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLongitudinalMesh.txt '''DoseLongitudinalMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/EnergyLongitudinalMesh.txt '''EnergyLongitudinalMesh.txt'''] contain information about the dose and energy deposition in 50 voxels along the beam.  &lt;br /&gt;
&lt;br /&gt;
[http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DoseLateralMesh.txt '''DoseLateralMesh.txt'''] and [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/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. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
Open '''Proton.root''' file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l Proton.root&lt;br /&gt;
&lt;br /&gt;
root [1] new TBrowser&lt;br /&gt;
&lt;br /&gt;
Select ROOT Files and Proton.root&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PB1.png &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; '''This is the energy deposition along the beam in the absorber, zoomed around the peak:''' &amp;lt;/span&amp;gt;&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/BraggPeak_PBzoom1.png  &lt;br /&gt;
&lt;br /&gt;
You can close your ROOT session by typing &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
.q&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Folder '''RootScripts''' contains several ROOT scripts which plot dose deposition in data and simulation.&lt;br /&gt;
You can use script '''PlotSimulation.C''' to plot the dose deposition along the absorber. This script uses '''PlotDose.txt'''. Copy the script to your current ProtonPB_build directory:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''Simulation.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/Simulation1.png  &lt;br /&gt;
&lt;br /&gt;
You can also 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.&lt;br /&gt;
Before running the script substitude the commas in '''DoseLateralMesh.txt''' with spaces. Remove also the header in the text file. Then, save the text file as '''DoseLateralMesh_Mod.txt'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotLateralDoseMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotLateralDoseMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''LateralDose_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/SimulationLateralMesh.png&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton energy and number of slices etc. by&lt;br /&gt;
modifying the macro proton.mac. Open the macro with editor '''pico''':&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ pico proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;   &lt;br /&gt;
&lt;br /&gt;
This is the content of the macro:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry &lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonPB/det/sliceNumber 50 &lt;br /&gt;
#&lt;br /&gt;
# define longitudinal scoring mesh&lt;br /&gt;
# along the beam&lt;br /&gt;
/score/create/boxMesh waterMeshlongitudinal&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 50 1 1&lt;br /&gt;
/score/mesh/translate/xyz 0. 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# define lateral scoring mesh&lt;br /&gt;
# centered at the Bragg peak&lt;br /&gt;
/score/create/boxMesh waterMeshlateral&lt;br /&gt;
/score/mesh/boxSize 0.1 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 1 1 50&lt;br /&gt;
/score/mesh/translate/xyz 1.2 0. 0. cm&lt;br /&gt;
/score/quantity/energyDeposit energyDeposit &lt;br /&gt;
/score/quantity/doseDeposit doseDeposit&lt;br /&gt;
/score/close&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonPB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonPB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range &lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonPB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonPB/phys/setGCut 1 um&lt;br /&gt;
#/protonPB/phys/setECut 1 um&lt;br /&gt;
#/protonPB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy used in Clatterbridge Centre  &lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonPB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of &lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonPB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonPB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# output file&lt;br /&gt;
/analysis/setFileName Proton&lt;br /&gt;
#&lt;br /&gt;
# histogram &lt;br /&gt;
/analysis/h1/set 2 50 25 35 mm&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
# drawing projections&lt;br /&gt;
#/score/drawProjection waterMeshlongitudinal doseDeposit&lt;br /&gt;
#/score/drawProjection waterMeshlateral doseDeposit&lt;br /&gt;
#&lt;br /&gt;
# dump scores to a file&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal doseDeposit DoseLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlongitudinal energyDeposit EnergyLongitudinalMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral doseDeposit DoseLateralMesh.txt&lt;br /&gt;
/score/dumpQuantityToFile waterMeshlateral energyDeposit EnergyLateralMesh.txt&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change dimensions of the water box'''&lt;br /&gt;
&lt;br /&gt;
The default size is 4x4x4 cm. You can change the dimensions by modifying the lines&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/setSizeX  4 cm&lt;br /&gt;
/protonPB/det/setSizeYZ 4 cm &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the physics process'''&lt;br /&gt;
&lt;br /&gt;
The default physics process is '''QGSP_BIC_EMY'''. This is a physics list recommended for proton therapy. You can check what will be the dose deposition if you change the physics list. In proton.mac change&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/photonPB/phys/addPhysics emlivermore&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the incident proton energy'''&lt;br /&gt;
&lt;br /&gt;
The default energy is 62 MeV. This is one of the energies used in radiotherapy. In proton.mac you can change the value of 62 MeV &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 62 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
to, for example, 50 MeV&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/gun/energy 50 MeV&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the diameter of the beam'''&lt;br /&gt;
&lt;br /&gt;
You can set the diameter of the beam with the command:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/gun/rndm 3 mm&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change the number of slices'''&lt;br /&gt;
&lt;br /&gt;
You can change the number of slices. The default number is 50. Keep in mind that &lt;br /&gt;
if you want to increase the number of slices you need to modify the file DetectorConstruction.hh in&lt;br /&gt;
/ProtonPB_source/include/.&lt;br /&gt;
&lt;br /&gt;
In DetectorConstruction.hh set MaxLayer to value bigger than the number of your slices. The default value is MaxLayer=60. For example, if you want to have 55 slices you do not need to modify MaxLayer. Then, only in proton.mac change the number of slices &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/protonPB/det/sliceNumber 55 &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Modify the mesh'''&lt;br /&gt;
&lt;br /&gt;
You can change the size of the mesh (longitudinal and lateral) and the number of voxels by modifying their corresponding lines &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/score/mesh/boxSize 2. 2. 2. cm&lt;br /&gt;
/score/mesh/nBin 30 1 1&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''After modifications in proton.mac'''&lt;br /&gt;
&lt;br /&gt;
After modifying the macro proton.mac you can run it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
If you modify files in directory ProtonPB_source (for example you change the value of MaxLayer) you need to comppile the code. In directory PhotonPB_build do&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ make &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then run the macro proton.mac.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro '''proton.mac''' uncomment the line '''/control/execute visualisation.mac'''. This will run macro '''visualisation.mac''' with a specific visualisation setup. &lt;br /&gt;
If you uncomment the lines '''/score/drawProjection waterMeshlongitudinal doseDeposit''' and '''/score/drawProjection waterMeshlateral doseDeposit''' you will draw the dose projections. In this example, we use '''DAWN''' event display. Before running the visualisation look at this [http://geant4.slac.stanford.edu/Presentations/vis/G4DAWNTutorial/G4DAWNTutorial.html DAWN tutorial].&lt;br /&gt;
&lt;br /&gt;
To run the visualisation, first uncomment lines '''/control/execute visualisation.mac''' and '''/score/drawProjection waterMeshlongitudinal doseDeposit'''. Then, run the proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ ./protonPB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In addition to the text files the code will create two .prim files, '''g4_00.prim''' and '''g4_01.prim'''. The first file contains detector geometry and particle interactions. The second file contains dose projections. While running the proton.mac you will be asked to open g4_00.prim in DAWN. In the opened window press OK. This will create your first visualisation:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_00_6000e.eps&lt;br /&gt;
&lt;br /&gt;
The second file g4_01.prim will not open automatically. It will be created after the running is finished. Open the file in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ dawn g4_01.prim&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the opened window press OK and this will create the image:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_02_6000e.eps&lt;br /&gt;
&lt;br /&gt;
You can modify the .prim files in DAWN. For example, in the DAWN display change the polar and azimuthal angles. 1) (polar angle, azimuthal angle) = (0,90) will create this image&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_01_6000e.eps&lt;br /&gt;
&lt;br /&gt;
2) (polar angle, azimuthal angle) = (90,0) will create this image &lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_04_6000e.eps&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/g4_03_6000e.eps    &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data from The Clatterbridge Cancer Centre &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/ClatterbridgeBraggPeak.txt data] from the Clatterbridge Cancer Center. The first column represents the values in mm in depth, the second column represents the normalized values of deposited dose and normalized at the peak. You can use script '''PlotData.C''' from folder'''RootScripts''' to plot the data. Copy files '''ClatterbridgeData.txt''' and '''PlotData.C''' to your current ProtonPB_build directory and run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotData.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/ClatterbridgeData.txt .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotData.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''ClatterbridgeData.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/Clatterbridge/Clatterbridge.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Comparison between data and simulation &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
The scripts '''PlotDataAndSim.C''' and '''PlotDataAndSimMesh.C''' in folder '''RootScripts''' compare data with simulation. &lt;br /&gt;
You can use script '''PlotDataAndSim.C''' to compare data (ClatterbridgeData.txt) and simulation ('''PlotDose.txt'''). Both text files must be in the folder where you run the script. &lt;br /&gt;
 &lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSim.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSim.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This will create '''BraggPeakComparison.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulation.png&lt;br /&gt;
&lt;br /&gt;
You can also compare data (ClatterbridgeData.txt) with simulation done with scoring mesh ('''DoseLongitudinalMesh.txt''').&lt;br /&gt;
This can be done with script '''PlotDataAndSimMesh.C'''. This script works only if before running it you substitude the commas &lt;br /&gt;
in '''DoseLongitudinalMesh.txt''' with spaces. Remove also the header in the text file. Save the new text file as '''DoseLongitudinalMesh_Mod.txt'''. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonPB_build]$ cp /home/username/ProtonPBFolder/ProtonPB_source/RootScripts/PlotDataAndSimMesh.C .&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonPB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotDataAndSimMesh.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
This creates '''BraggPeakComparison_Mesh.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonPB/DataSimulationMesh.png&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of monoenergetic proton pencil beam files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T18:32:26Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation (with DAWN), in macro proton.mac uncomment line '''#/control/execute visualisation.mac'''. Then, run the code.&lt;br /&gt;
You will have four images from the four proton beams.&lt;br /&gt;
&lt;br /&gt;
For proton energy of 50 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 52 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_01.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 54 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_02.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 56 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_03.eps&lt;br /&gt;
 &lt;br /&gt;
Protons are in blue, neutrons are in yellow, photons are in green. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T18:32:03Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation (DAWN), in macro proton.mac uncomment line '''#/control/execute visualisation.mac'''. Then, run the code.&lt;br /&gt;
You will have four images from the four proton beams.&lt;br /&gt;
&lt;br /&gt;
For proton energy of 50 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 52 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_01.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 54 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_02.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 56 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_03.eps&lt;br /&gt;
 &lt;br /&gt;
Protons are in blue, neutrons are in yellow, photons are in green. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T18:31:02Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro proton.mac uncomment line '''#/control/execute visualisation.mac'''. Then run the code.&lt;br /&gt;
You will have four images from the four proton beams.&lt;br /&gt;
&lt;br /&gt;
For proton energy of 50 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 52 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_01.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 54 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_02.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 56 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_03.eps&lt;br /&gt;
 &lt;br /&gt;
Protons are in blue, neutrons are in yellow, photons are in green. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T18:30:10Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro proton.mac uncomment line '''#/control/execute visualisation.mac'''. Then run the code.&lt;br /&gt;
You will have four images from the four proton beams.&lt;br /&gt;
&lt;br /&gt;
For proton energy of 50 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 52 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_01.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 54 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_02.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 56 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_03.eps&lt;br /&gt;
 &lt;br /&gt;
Protons are in blue, neutrons are in yellow, photons are in green. &lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T18:26:51Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Visualisation &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
If you want to use visualisation, in macro proton.mac uncomment line '''#/control/execute visualisation.mac'''. Then run the code.&lt;br /&gt;
With the current settings you will have four images from the four proton beams.&lt;br /&gt;
&lt;br /&gt;
For proton energy of 50 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_00.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 52 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_01.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 54 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_02.eps&lt;br /&gt;
&lt;br /&gt;
For proton energy of 56 MeV: http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/g4_03.eps&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T17:20:29Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T17:19:21Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
 Layers :        x[mm]          Edep    Edep/Ebeam[%]   Dose    Dose/MaxDose[%]&lt;br /&gt;
 layer 1:       0.8     6.14782 GeV     2.04927 7.69522e-07 Gy  17.9921&lt;br /&gt;
 layer 2:       1.6     6.3146 GeV      2.10487 7.90399e-07 Gy  18.4802&lt;br /&gt;
 layer 3:       2.4     6.408 GeV       2.136   8.02089e-07 Gy  18.7536&lt;br /&gt;
 layer 4:       3.2     6.57863 GeV     2.19288 8.23447e-07 Gy  19.2529&lt;br /&gt;
 layer 5:       4       6.67038 GeV     2.22346 8.34932e-07 Gy  19.5214&lt;br /&gt;
 layer 6:       4.8     6.83438 GeV     2.27813 8.55459e-07 Gy  20.0014&lt;br /&gt;
 layer 7:       5.6     7.01613 GeV     2.33871 8.78209e-07 Gy  20.5333&lt;br /&gt;
 layer 8:       6.4     7.13427 GeV     2.37809 8.92996e-07 Gy  20.879&lt;br /&gt;
 layer 9:       7.2     7.27016 GeV     2.42339 9.10006e-07 Gy  21.2768&lt;br /&gt;
 layer 10:      8       7.45719 GeV     2.48573 9.33417e-07 Gy  21.8241&lt;br /&gt;
 layer 11:      8.8     7.68621 GeV     2.56207 9.62083e-07 Gy  22.4943&lt;br /&gt;
 layer 12:      9.6     7.85903 GeV     2.61968 9.83715e-07 Gy  23.0001&lt;br /&gt;
 layer 13:      10.4    8.0806 GeV      2.69353 1.01145e-06 Gy  23.6486&lt;br /&gt;
 layer 14:      11.2    8.33342 GeV     2.77781 1.04309e-06 Gy  24.3885&lt;br /&gt;
 layer 15:      12      8.71141 GeV     2.9038  1.09041e-06 Gy  25.4947&lt;br /&gt;
 layer 16:      12.8    8.93703 GeV     2.97901 1.11865e-06 Gy  26.155&lt;br /&gt;
 layer 17:      13.6    9.3526 GeV      3.11753 1.17067e-06 Gy  27.3712&lt;br /&gt;
 layer 18:      14.4    9.6102 GeV      3.2034  1.20291e-06 Gy  28.1251&lt;br /&gt;
 layer 19:      15.2    10.1115 GeV     3.3705  1.26566e-06 Gy  29.5922&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
0.8     17.9921&lt;br /&gt;
1.6     18.4802&lt;br /&gt;
2.4     18.7536&lt;br /&gt;
3.2     19.2529&lt;br /&gt;
4       19.5214&lt;br /&gt;
4.8     20.0014&lt;br /&gt;
5.6     20.5333&lt;br /&gt;
6.4     20.879&lt;br /&gt;
7.2     21.2768&lt;br /&gt;
8       21.8241&lt;br /&gt;
8.8     22.4943&lt;br /&gt;
9.6     23.0001&lt;br /&gt;
10.4    23.6486&lt;br /&gt;
11.2    24.3885&lt;br /&gt;
12      25.4947&lt;br /&gt;
12.8    26.155&lt;br /&gt;
13.6    27.3712&lt;br /&gt;
14.4    28.1251&lt;br /&gt;
15.2    29.5922&lt;br /&gt;
16      31.5189&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2014-09-03T17:08:11Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. &lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water from several incident monoenergetic proton beams.  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Main_Page"/>
				<updated>2014-09-03T17:07:30Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This is a tutorial about applications of GEANT4 to medical physics. The GEANT4 is installed on the HEP Linux cluster at UCL. You will need an account on that cluster to be able to use this software, run example tutorials and create your own applications.&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Accounts and Discussion forum &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* Getting a computing account&lt;br /&gt;
Apply for a computing account on the HEP Linux cluster by sending e-mail to [mailto:support@hep.ucl.ac.uk HEPComputingSupport]. In your e-mail you have to state the reason for your application (e.g. medical physics student who will use GEANT4 on the HEP cluster).&lt;br /&gt;
&lt;br /&gt;
You will receive an e-mail from the HEP computing support with your ''username'' and ''password''. Now you can log in to the HEP cluster plus1 via  ssh ''username''@plus1.hep.ucl.ac.uk. Your personal area on plus1 cluster will be at /home/''username''/. &lt;br /&gt;
&lt;br /&gt;
* Discussion about the tutorials  &lt;br /&gt;
&lt;br /&gt;
You can write to the discussion forum by clicking the &amp;lt;span style=&amp;quot;color:#0000ff&amp;quot;&amp;gt; discussion &amp;lt;/span&amp;gt; tab at the top of the page.&lt;br /&gt;
 &lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; The basics of GEANT4 &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
GEANT4 is a toolkit for simulating the passage of particles through matter. You can use GEANT4 by creating your own simulation applications using the available GEANT4 tools. &lt;br /&gt;
&lt;br /&gt;
* [[Introduction to GEANT4]] will help you understand the basics of GEANT4 and the necessary ingredients to write your own application.   &lt;br /&gt;
* Useful links: &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ Geant4 User's Guide for Application Developers] &lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/G4UsersDocuments/UsersGuides/PhysicsReferenceManual/html/PhysicsReferenceManual.html Physics Reference Manual]&lt;br /&gt;
** [http://www-geant4.kek.jp/Reference/10.00/index.html GEANT4 Classes]&lt;br /&gt;
** [http://hypernews.slac.stanford.edu/HyperNews/geant4/cindex GEANT4 hypernews]&lt;br /&gt;
** [http://www-geant4.kek.jp/LXR/ Geant4 Cross Reference]&lt;br /&gt;
** [http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/FAQ/html/index.html Frequently Asked Questions] &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Data analysis software &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
These tutorials use ROOT to analyse data. Useful links:&lt;br /&gt;
* [http://root.cern.ch/drupal/content/root-users-guide-534 ROOT User's Guide]&lt;br /&gt;
* [http://root.cern.ch/root/html534/guides/primer/ROOTPrimer.html ROOT Primer]&lt;br /&gt;
* [http://root.cern.ch/root/html/tutorials/ ROOT tutorials] &lt;br /&gt;
&lt;br /&gt;
Similarly, data can be analysed using MATLAB. This is a link to interactive introduction to MATLAB:&lt;br /&gt;
* [http://www.see.ed.ac.uk/teaching/courses/matlab/ MATLAB introduction]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Basic tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several basic tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Monoenergetic photon pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic photon beam. &lt;br /&gt;
* [[Monoenergetic proton pencil beam]] is a simple code which shows the dose deposition in water along the incident monoenergetic proton beam. &lt;br /&gt;
* [[Proton beam with realistic geometry]] is a simple code with realistic geometry of the proton beam. The primary particles are generated with initial energy, position and direction described by Gaussian distributions. Computed is the dose deposition in water along the beam. &lt;br /&gt;
* [[Several proton beams with spread out Bragg peaks]] is a simple code which shows the dose deposition in water with several incident monoenergetic proton beams.  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Advanced tutorials &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This section includes several advanced tutorials:&lt;br /&gt;
&lt;br /&gt;
* [[Computed tomography]]&lt;br /&gt;
* [[High-precision dosimetry]]&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Installing GEANT4 locally &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
* [[Downloading the Geant4 package]]&lt;br /&gt;
* [[Linux terminal]]&lt;br /&gt;
* [[Installing Geant4]]&lt;br /&gt;
* [[Updating Geant4]]&lt;br /&gt;
* [[Running an example]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T17:02:31Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;quot;50&amp;quot; is the initial value, &amp;quot;56&amp;quot; is the final value and &amp;quot;2&amp;quot; is the step size in MeV. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
[[List of spread out Bragg peaks files with brief description]]&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T16:59:12Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line in proton.mac&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T16:58:00Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOBP.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T16:55:29Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOPB.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T16:54:27Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Text files &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/DoseFile.txt content] of '''DoseFile.txt''' with proton beam energies 50, 52, 54 and 56 MeV. This is the [http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/PlotDose.txt content] of the '''PlotDose.txt'''.&lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Root file &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
cp /home/username/ProtonSBFolder/ProtonSB_source/PlotSimulation.C .&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Then, run the script in the following way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ root -l &lt;br /&gt;
&lt;br /&gt;
root [1] .x PlotSimulation.C&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This will create '''SOBP.root''' file with the following plot:&lt;br /&gt;
&lt;br /&gt;
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonSB/SOPB.png    &lt;br /&gt;
&lt;br /&gt;
=== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Run with different settings &amp;lt;/span&amp;gt; ===&lt;br /&gt;
&lt;br /&gt;
You can change the physics process, incident proton beam energies, number of slices etc. by&lt;br /&gt;
modifying macros proton.mac and protonLoop.mac. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This is the content of proton.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# proton.mac&lt;br /&gt;
#&lt;br /&gt;
/control/verbose 2&lt;br /&gt;
/run/verbose 2&lt;br /&gt;
/tracking/verbose 0&lt;br /&gt;
/run/particle/verbose 1&lt;br /&gt;
/run/particle/dumpList&lt;br /&gt;
#&lt;br /&gt;
# set geometry&lt;br /&gt;
/protonSB/det/setSizeX  4 cm&lt;br /&gt;
/protonSB/det/setSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/setSliceSizeYZ 4 cm&lt;br /&gt;
/protonSB/det/sliceNumber 50&lt;br /&gt;
#&lt;br /&gt;
# set physics process&lt;br /&gt;
/protonSB/phys/addPhysics QGSP_BIC_EMY&lt;br /&gt;
#/protonSB/phys/addPhysics emlivermore&lt;br /&gt;
#/protonSB/phys/addPhysics empenelope&lt;br /&gt;
#&lt;br /&gt;
# production tresholds (recommended range&lt;br /&gt;
#cut off not bigger than 10% of slice thickness)&lt;br /&gt;
/protonSB/phys/setCuts 0.2 mm&lt;br /&gt;
#/protonSB/phys/setGCut 1 um&lt;br /&gt;
#/protonSB/phys/setECut 1 um&lt;br /&gt;
#/protonSB/phys/setPCut 1 um&lt;br /&gt;
#&lt;br /&gt;
# initialize&lt;br /&gt;
/run/initialize&lt;br /&gt;
#&lt;br /&gt;
# visualisation&lt;br /&gt;
#/control/execute visualisation.mac&lt;br /&gt;
#&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the content of protonLoop.mac:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
# protonLoop.mac&lt;br /&gt;
#&lt;br /&gt;
/gun/particle proton&lt;br /&gt;
# particle energy&lt;br /&gt;
/gun/energy {ene} MeV&lt;br /&gt;
#&lt;br /&gt;
# beam size&lt;br /&gt;
#/photonSB/gun/rndm 3 mm&lt;br /&gt;
#&lt;br /&gt;
# step limit (recommended not bigger than 5% of&lt;br /&gt;
# slice thickness)&lt;br /&gt;
/protonSB/stepMax 0.1 mm&lt;br /&gt;
#&lt;br /&gt;
/protonSB/event/printModulo 50&lt;br /&gt;
#&lt;br /&gt;
# number of events&lt;br /&gt;
/run/beamOn 6000&lt;br /&gt;
#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Change of the beam energies'''&lt;br /&gt;
&lt;br /&gt;
You can change the proton beam energies by modifying this line&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
/control/loop protonLoop.mac ene 50 56 2&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T16:27:48Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T16:26:52Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code run with several beam energies to produce spread out Bragg peak.  &lt;br /&gt;
&lt;br /&gt;
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. &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-03T06:29:41Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code is run with several beam energies to produce a SOBP.  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	<entry>
		<id>https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks</id>
		<title>Several proton beams with spread out Bragg peaks</title>
		<link rel="alternate" type="text/html" href="https://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/index.php?title=Several_proton_beams_with_spread_out_Bragg_peaks"/>
				<updated>2014-09-02T20:22:16Z</updated>
		
		<summary type="html">&lt;p&gt;IlinaMediaWiki: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Introduction &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
This tutorial is based on the [[Monoenergetic proton pencil beam]] example. The code is run with several beam energies to produce a SOBP.  &lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to run the tutorial &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
; Connect to the HEP cluster and create folder ProtonSBFolder in your area&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
ssh -X username@plus1.hep.ucl.ac.uk &lt;br /&gt;
&lt;br /&gt;
username@plus1.hep.ucl.ac.uk's password: type your password here&lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ mkdir ProtonSBFolder &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ~]$ cd ProtonSBFolder  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Setup your environment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Copy the code to your working directory and rename it&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cp -r /unix/pbt/tutorials/basic/ProtonSB .&lt;br /&gt;
  &lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mv ProtonSB ProtonSB_source&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Inside /home/username/ProtonSBFolder/ create a directory&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ mkdir ProtonSB_build  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; To compile the code enter this directory and run cmake and make &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 PhotonSBFolder]$ cd ProtonSB_build &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ cmake -DGeant4_DIR=/unix/pbt/software/dev /home/username/ProtonSBFolder/ProtonSB_source &lt;br /&gt;
&lt;br /&gt;
[username@plus1 ProtonSB_build]$ make  &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
; Run macro proton.mac with several beam energies. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre style=&amp;quot;color: #800000; background-color: #dcdcdc&amp;quot;&amp;gt;&lt;br /&gt;
[username@plus1 ProtonSB_build]$ ./protonSB proton.mac&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; How to analyze data &amp;lt;/span&amp;gt; ==&lt;br /&gt;
&lt;br /&gt;
== &amp;lt;span style=&amp;quot;color:#000080&amp;quot;&amp;gt; Files &amp;lt;/span&amp;gt; ==&lt;/div&gt;</summary>
		<author><name>IlinaMediaWiki</name></author>	</entry>

	</feed>