Proton beam with realistic geometry
From UCL HEP PBT Wiki
Line 3: | Line 3: | ||
This example shows the dose distribution in water along the incident proton beam. This example is very similar to the monoenergetic proton pencil beam example. The difference is that the beam is defined with realistic geometry. For the generation of the proton beam, instead of particle gun, we use general particle source. For more details about '''G4GeneralParticleSource''' class look [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch02s07.html here]. | This example shows the dose distribution in water along the incident proton beam. This example is very similar to the monoenergetic proton pencil beam example. The difference is that the beam is defined with realistic geometry. For the generation of the proton beam, instead of particle gun, we use general particle source. For more details about '''G4GeneralParticleSource''' class look [https://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/ForApplicationDeveloper/html/ch02s07.html here]. | ||
- | The volume of the water cube is divided into slices perpendicular to the incident beam. The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining scoring mesh. There is an option to chose among several '''EM''' and the '''QGSP_BIC_EMY''' physics lists. | + | The volume of the water cube is divided into slices perpendicular to the incident beam. The slices are created using class '''G4PVReplica'''. The energy and dose are scored using classes '''G4UserSteppingAction''' and '''G4UserRunAction'''. Alternatively, the energy and the dose are scored using class '''G4ScoringManager''' by defining a scoring mesh. There is an option to chose among several '''EM''' and the '''QGSP_BIC_EMY''' physics lists. |
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_00_6000e.png | http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/g4_00_6000e.png | ||
- | The image shows the water box divided into slices using class G4PVReplica. This tutorial is very similar to the | + | The image shows the water box divided into slices using class '''G4PVReplica'''. Protons are in blue, photons are in green. This tutorial is very similar to the [[Monoenergetic proton pencil beam]] tutorial. It is recommended to follow that tutorial first because some steps are similar. |
- | == <span style="color:#000080"> | + | == <span style="color:#000080"> How to run the tutorial </span> == |
- | ; Connect to HEP cluster and create folder ProtonGBFolder in your area | + | ; Connect to the HEP cluster and create folder ProtonGBFolder in your area |
<pre style="color: #800000; background-color: #dcdcdc"> | <pre style="color: #800000; background-color: #dcdcdc"> | ||
Line 28: | Line 28: | ||
[username@plus1 PhotonGBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh | [username@plus1 PhotonGBFolder]$ source /unix/pbt/software/dev/bin/pbt-dev.sh | ||
</pre> | </pre> | ||
- | |||
- | |||
; Copy the code to your working directory and rename it | ; Copy the code to your working directory and rename it | ||
Line 38: | Line 36: | ||
[username@plus1 PhotonGBFolder]$ mv ProtonGB ProtonGB_source | [username@plus1 PhotonGBFolder]$ mv ProtonGB ProtonGB_source | ||
</pre> | </pre> | ||
- | |||
- | |||
; Inside /home/username/ProtonGBFolder/ create a directory | ; Inside /home/username/ProtonGBFolder/ create a directory | ||
Line 57: | Line 53: | ||
</pre> | </pre> | ||
- | ; Run macro proton.mac | + | ; Run macro proton.mac |
<pre style="color: #800000; background-color: #dcdcdc"> | <pre style="color: #800000; background-color: #dcdcdc"> | ||
Line 237: | Line 233: | ||
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/Simulation1.png | http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/Simulation1.png | ||
- | 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. | + | You can also plot the file '''PlotDose.txt''' using MATLAB. Similarly to the previous example first copy the text file to your computer. In the terminal at your computer write: |
+ | |||
+ | <pre style="color: #800000; background-color: #dcdcdc"> | ||
+ | scp username@plus1.hep.ucl.ac.uk:/home/username/ProtonGBFolder/ProtonGB_build/PlotDose.txt . | ||
+ | </pre> | ||
+ | |||
+ | Then, open MATLAB and follow the procedure: | ||
+ | |||
+ | * Import the file: Chose 'HOME' tab and 'Import Data'. | ||
+ | * In the 'Import Data' window select the 'PlotDose.txt' file choosing the right path. | ||
+ | * In the opened window select the data points in the 'IMPORT' tab. If you like, you can change the name of the variables. For example, 'x' instead of 'VarName1' and 'Dose' instead of 'VarName2'. Then, press 'Import Selection'/'Import Data'. | ||
+ | * Close the Import Window and in the Command Window type plot(x,Dose). Press Enter. | ||
+ | |||
+ | This plot will be created with added axis labels and a legend: | ||
+ | |||
+ | http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/matlab2protonreal.png | ||
+ | |||
+ | Similarly to the previous tutorial you can plot the data in '''DoseLongitudinalMesh.txt''' and '''DoseLateralMesh.txt''' | ||
+ | which were created using commands '''/score/''' in the macro '''proton.mac'''. The file '''DoseLongitudinalMesh.txt''' will be used later to compare with data from the Clatterbridge Cancer Center. Now, use script '''PlotLateralDoseMesh.C''' to plot the lateral dose distribution. | ||
<pre style="color: #800000; background-color: #dcdcdc"> | <pre style="color: #800000; background-color: #dcdcdc"> | ||
Line 251: | Line 265: | ||
http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/SimulationLateralMesh.png | http://www.hep.ucl.ac.uk/pbt/RadiotherapyWorkbook/skins/common/images/ProtonGB/SimulationLateralMesh.png | ||
- | === <span style="color:#000080"> | + | === <span style="color:#000080"> Run with different settings </span> === |
You can change the physics process, incident proton energy and number of slices by | You can change the physics process, incident proton energy and number of slices by |