|
|
(192 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
| == Simulation of the Clatterbridge beamline ==
| |
|
| |
|
| This simulation is a model of the monoenergetic 62.5 MeV proton beam at the Clatterbridge Cancer Centre [http://www.clatterbridgecc.nhs.uk/patients/treatment-and-support/proton-therapy] as it traverses the components of the beamline and finally hits a volume of water. The simulation was built using the existing example "monoenergetic proton pencil beam" [http://www.hep.ucl.ac.uk/pbt/wiki/Software/Geant4/Tutorials/Basic/Monoenergetic_Proton_Pencil_Beam]. The physics list used is QGSP_BIC_EMY, the standard for simulating clinical proton beams. | | This simulation is a model of the monoenergetic 62.5 MeV proton beam at the [http://www.clatterbridgecc.nhs.uk/patients/treatment-and-support/proton-therapy Clatterbridge Cancer Centre] as it traverses the components of the beamline and finally hits a volume of water. |
| | | The simulation was built using: |
| === Geometry ===
| | * [[/Geant4 | Geant4]] |
| ==== Treatment room ====
| | ** The simulation was built on the example in <code>examples/extended/electromagnetic/TestEm7</code> supplied with the Geant4 package and detailed [http://www.hep.ucl.ac.uk/pbt/wiki/Software/Geant4/Tutorials/Basic/Monoenergetic_Proton_Pencil_Beam here]. |
| The schematic below shows the Clatterbridge treatment room, illustrating the layout of the geometries defined in the <code>DetectorConstruction</code> class. The whole beamline is contained within the "inner room" volume, which is placed in the "outer room" volume. As the outer volume is a solid concrete box and the inner volume is a box filled with air, the small overlap models the concrete walls of the treatment room. The proton source is placed against the wall in the inner room (-4200 mm from the origin), and all beamline components are placed relative to this reference point.
| | * [[/TOPAS | TOPAS]] |
| | |
| | |
| [[File:treatmentRoomSchematic.png|centre|700px]] | |
| | |
| | |
| ==== Beamline ====
| |
| The beamline is shown below. The top figure is a perspective view. The second figure is a top-down view which also shows the borated plastic shielding (f) that was previously hidden to allow the full beamline to be visible.
| |
| | |
| | |
| [[File:beamline_perspective.png|right|650px]]
| |
| [[File:beamline_top_down.png|right|650px]]
| |
| | |
| The beamline consists of the following components:
| |
| | |
| *an aluminium tube (a) containing from left to right;
| |
| **a brass collimator
| |
| **a tungsten scattering foil
| |
| **a brass beam stopper
| |
| **another tungsten scattering foil
| |
| **a mylar window
| |
| | |
| *an empty aluminium box (b)
| |
| *an iron block (c)
| |
| *a second aluminium tube (d)
| |
| *a second aluminium box (e) containing from left to right;
| |
| **a brass collimator
| |
| **two dose monitors | |
| **cross wires
| |
| | |
| *a brass nozzle (g)
| |
| | |
| The water phantom (h) is also shown for completeness. | |
| | |
| | |
| | |
| ==== First aluminium tube ====
| |
| The proton beam at Clatterbridge is delivered using passive spreading. That is, the beam is spread out using dual scattering where the proton beam is scattered through a first scattering foil followed by a beam stopper and a second scattering foil. The beam stopper is used to reduce the intensity of the beam at its centre and a high-Z material such as tungsten is chosen for the foils as it is highly scattering.
| |
| | |
| [[File:First_tube_500_sim.png|right|500px]]
| |
| A visualisation of the first tube with 500 primary protons represented by blue tracks is shown below. The protons first travel through the collimator, followed by the first scattering foil which spreads out the beam. The brass stopper then blocks out approximately half of the remaining protons before the beam is again spread out through the second scattering foil. The intention is to produce a wide, homogeneous beam. The particles exit the first tube through a Kapton window which is used to keep the tube under vacuum to reduce random scattering off air molecules.
| |
| | |
| === Generation of primary protons ===
| |
| | |
| The protons are generated using the <code>G4GeneralParticleSource</code> (GPS) class which allows for a range of properties of the primary protons to be set in the <code>proton.mac</code> file (primaries are the initial particles generated by the GPS). First, the particle source is positioned against the wall on one side of the room which is at -4200 mm from the centre. In an attempt to achieve a more realistic beam, the primary protons are distributed normally in the x and y directions centred at 0 with standard deviations of 4.0 mm and 4.5 mm respectively. This gives the beam width and results in a nearly circular profile. The primaries are generated with initial energies following a Gaussian distribution with mean 62.5 MeV and standard deviation 0.082 MeV, and Gaussian radial distributions with respect to the z-axis with standard deviations of 2.3 mrad and 1.2 mrad in the x and y directions respectively.
| |
| | |
| The parameters are set in the following section of the <code>proton.mac</code> macro:
| |
| | |
| <pre>
| |
| ### particle gun settings
| |
| /gps/particle proton
| |
| /gps/number 1 # 1 proton per event
| |
| | |
| # energy
| |
| /gps/ene/type Gauss
| |
| /gps/ene/mono 62.5 MeV
| |
| /gps/ene/sigma 0.082 MeV
| |
| | |
| # source position
| |
| /gps/position 0.0 0.0 -4200 mm | |
| | |
| # beam width
| |
| /gps/pos/type Beam
| |
| /gps/pos/sigma_x 4.0 mm
| |
| /gps/pos/sigma_y 4.5 mm
| |
| | |
| # angular distribution of primaries for realistic emittance
| |
| /gps/ang/type beam2d
| |
| /gps/ang/sigma_x 2.3 mrad
| |
| /gps/ang/sigma_y 1.2 mrad
| |
| /gps/ang/rot1 -1 0 0 # aligns gps with positive z-axis
| |
| </pre>
| |
| | |
| [[File:visualisation.png|right|250px]]
| |
| | |
| The energy of the beam is monitored at several stages in the beamline through the <code>SteppingAction</code> class. If the protons traverse a position in z defined in the vector <code>trackingDistFiller</code> in the <code>SteppingAction</code> header, their parent ID, xyz-coordinates, orientation with respect to the z-axis and energy are recorded at the given position in z.
| |
| | |
| The figure to the right shows the visualisation output of the simulation, displaying the particle tracks. Protons are shown in blue, electrons in red, gammas in green and neutrons in yellow.
| |
| | |
| == Running the simulation ==
| |
| | |
| Follow the instructions below to copy the simulation files to your directory:
| |
| | |
| <pre>
| |
| [username@plus1 ~]$ mkdir Clatterbridge_sim | |
| [username@plus1 ~]$ cd Clatterbridge_sim
| |
| [username@plus1 Clatterbridge_sim]$ /unix/pbt/software/scripts/pbt.sh
| |
| [username@plus1 Clatterbridge_sim]$ cp -r /unix/pbt/rstephens/ProtonPBFolder/ProtonPB_source .
| |
| [username@plus1 Clatterbridge_sim]$ mkdir ProtonPB_build
| |
| [username@plus1 Clatterbridge_sim]$ cd ProtonPB_build
| |
| [username@plus1 ProtonPB_build]$ make -DGeant4_DIR=/unix/pbt/software/dev /home/username/Clatterbridge_sim/ProtonPB_source
| |
| [username@plus1 ProtonPB_build]$ make
| |
| </pre>
| |
| | |
| '''Run macro proton.mac'''
| |
| | |
| This will run the simulation and produce the required output files.
| |
| | |
| <pre>
| |
| [username@plus1 ProtonPB_build]$ ./protonPB proton.mac
| |
| </pre>
| |
| | |
| == Output files ==
| |
| | |
| The simulation code and <code> proton.mac </code> produce several output files:
| |
| | |
| === <code> protonKE.out </code> ===
| |
| | |
| This text file contains output information from <code> SteppingAction.cc </code>, printed on a step-by-step basis for each proton (event). The first two columns contain the <code> x </code> and <code> y </code> coordinates (mm) of the proton. The third column contains the <code> z </code> position of the proton (mm), relative to the position of the source at the inner room boundary. The last column contains the energy (MeV) of the proton at this <code> z </code> position.
| |
| | |
| <pre>
| |
| 6.66882 -11.4767 1770 59.8738
| |
| -7.60842 -11.4391 1770 60.186
| |
| -9.37841 -14.363 1770 43.1861
| |
| -13.2143 1.55943 1770 60.4776
| |
| 1.81337 11.558 1770 60.2989
| |
| </pre>
| |
| | |
| === <code> secondariesKE.out </code> ===
| |
| | |
| This text file contains information recorded in <code> SteppingAction.cc </code> about neutrons produced in the simulation. The values shown in the file are the kinetic energies [MeV] of the neutrons produced within the specified volume in the code.
| |
| | |
| <pre>
| |
| 5.12058
| |
| 2.71641
| |
| </pre>
| |
| | |
| === <code> sensitiveDetectors.out </code> ===
| |
| | |
| This file contains the ID of the sensitive detector (first column) and the energy deposited in that detector (second column). The ID number "0" corresponds to the water volume sensitive detector, and ID number "1" corresponds to the user-defined sensitive detector.
| |
| | |
| <pre>
| |
| 1 62.2594
| |
| 0 43.1061
| |
| 1 0
| |
| 0 0
| |
| 1 62.2851
| |
| </pre>
| |
| | |
| === <code> ProtonFluxBeamline.txt </code> ===
| |
| | |
| This file is automatically written by <code> proton.mac </code> and contains the proton flux data from the longitudinal scorer. The columns represent the bin number in the x, y and z directions, and the number of protons per cm<sup>2</sup>:
| |
| | |
| <pre>
| |
| # mesh name: waterMeshlongitudinal
| |
| # primitive scorer name: protonFlux
| |
| # iX, iY, iZ, value [percm2]
| |
| 0,0,0,25.97935669321147
| |
| 0,0,1,25.90015344712939
| |
| 0,0,2,25.84461190407653
| |
| </pre>
| |
| | |
| In <code> simulation_analysis.C </code> the data in <code> ProtonFluxBeamline.txt </code> is read in and written to another text file, <code> ProtonFluxBeamline_Mod.txt </code> to modify the standard formatting into a suitable format for further analysis:
| |
| | |
| <pre>
| |
| 0 0 0 25.97935669321147
| |
| 0 0 1 25.90015344712939
| |
| 0 0 2 25.84461190407653
| |
| </pre>
| |
| | |
| A similar output file, <code> NeutronFluxBeamline.txt </code> is produced in the simulation, and contains information about the flux of neutrons along the entire length of the beamline.
| |
| An additional two text files are produced from another longitudinal scoring mesh, located specifically along the length of the water volume. <code> ProtonFluxWaterLongitudinal.txt </code> contains information about the proton flux within the water volume, and <code> ProtonEnergyWaterLongitudinal.txt </code> contains information on the cumulative energy deposition of the proton beam within the water volume.
| |
| | |
| === <code> ProtonEnergyWaterLongitudinal.txt </code> ===
| |
| | |
| This text file is produced by <code> proton.mac </code> in the same way as <code> ProtonFluxBeamline.txt </code> above, and contains information about the proton energy deposited within the water volume, divided into bins parallel to the beam direction:
| |
| | |
| <pre>
| |
| # mesh name: waterMeshlongitudinal
| |
| # primitive scorer name: energyDeposit
| |
| # iX, iY, iZ, value [MeV]
| |
| 0,0,0,14778.66421571247
| |
| 0,0,1,14787.50686991539
| |
| 0,0,2,14943.0041959171
| |
| </pre>
| |
| | |
| === <code> EnergyLateralMesh.txt </code> ===
| |
| | |
| This text file is produced by <code> proton.mac </code> in the same way as the other scorers above, and contains information about the proton energy deposition in bins perpendicular to the beam:
| |
| | |
| <pre>
| |
| # mesh name: waterMeshlateral
| |
| # primitive scorer name: energyDeposit
| |
| # iX, iY, iZ, value [MeV]
| |
| 0,0,0,0
| |
| 1,0,0,0
| |
| | |
| ...
| |
| | |
| 16,0,0,0.002151585502782383
| |
| 17,0,0,0.01565800625140965
| |
| 18,0,0,9.09434626226223
| |
| 19,0,0,0.01811169052807143
| |
| </pre>
| |
| | |
| == Data Analysis ==
| |
| | |
| | |
| '''Open ROOT and run analysis file'''
| |
| | |
| The simulation analysis file reads the data in the output files and produces the associated plots.
| |
| | |
| <pre>
| |
| [username@plus1 ProtonPB_build]$ root -l
| |
| | |
| root [0] .x simulation_analysis.C
| |
| </pre>
| |
| | |
| === Proton energy deposition in water ===
| |
| | |
| On the left is a histogram showing the frequency of incident protons to the water box at different energy values. It is produced from data in <code> stopper.txt </code> which contains the hits data from the sensitive detectors in the simulation, including the water volume sensitive detector which is used here. The peak in proton energy deposited in the water volume is found to be at 60.08 MeV.
| |
| The plot on the right shows the cumulative proton energy deposited within the water volume, plotting data collected in the longitudinal water volume scoring mesh, showing the Bragg peak at 31 mm.
| |
| | |
| [[File:WaterEnergyDeposition.png|400px]]
| |
| [[File:Cumulative energy deposition in water.png|400px]]
| |
| | |
| === Proton stopping distance in water ===
| |
| | |
| This plot shows the stopping distance of protons in the water volume, with the stopping distance defined as the point at which the velocity of the protons is zero.
| |
| | |
| [[File:StoppingDistance.png|centre|400px]]
| |
| | |
| === Proton flux along beamline ===
| |
| | |
| This plot is produced from <code> FluxLongitudinal_Mod.txt </code> and shows the number of protons per cm<sup>2</sup> passing through distinct points along the beamline (in the z direction). The decrease in proton flux is clearly shown at particular points along the beamline, for example at the location of the brass stopper (30cm).
| |
| | |
| [[File:ProtonFluxBeamlinePlot.png|centre|700px]]
| |
| | |
| === Proton flux along water volume ===
| |
| Using a similar setup as the previous beamline flux plot, proton flux data from the scoring mesh within the water volume was plotted.
| |
| | |
| [[File:ProtonFluxWaterVolume.png|centre|500px]]
| |
| | |
| === Kinetic energy of the proton beam ===
| |
| | |
| This left-hand plot is produced from <code> kin.out </code> and shows the kinetic energy distribution of the proton beam at a specified point along the beamline. This location is specified in <code> SteppingAction.cc </code> in which a particular position in z can be input (see Section 5.6 Kinetic Energy Readings).
| |
| | |
| The xy coordinates of each proton are also recorded, and are used to produce a plot which shows the spatial coordinates and the kinetic energy of each proton at the specified position in z, along the beamline.
| |
| | |
| The z position along the beamline chosen to produce the following plots was just after the nozzle.
| |
| [[File:ProtonKineticEnergy.png|centre|700px]]
| |
| | |
| === Neutron production ===
| |
| | |
| ==== Neutron flux along beamline ====
| |
| | |
| This was plotted from data contained in the file NeutronFluxBeamline.txt, and shows the increase in flux of neutrons at certain points (locations of beamline components) along the beamline.
| |
| | |
| [[File:NeutronFluxBeamline.png|centre|400px]]
| |
| | |
| ==== Neutron kinetic energy ====
| |
| | |
| Data on the energy of neutrons produced within a particular volume along the beamline was collected, with the volume specified in <code> SteppingAction.cc </code> - the plot below shows the energy of neutrons produced within the water volume.
| |
| | |
| [[File:NeutronKineticEnergy.png|centre|400px]]
| |
| | |
| == Changing parameters ==
| |
| | |
| === Initial beam parameters ===
| |
| | |
| Initial parameters of the proton beam can be modified in <code> proton.mac </code>
| |
| | |
| ==== Beam radius ====
| |
| | |
| <pre>
| |
| /gps/pos/radius 3 mm
| |
| </pre>
| |
| | |
| ==== Beam energy ====
| |
| | |
| This simulation models the proton beam source with a Gaussian distribution.
| |
| | |
| <pre>
| |
| /gps/ene/type Gauss
| |
| /gps/ene/mono 62.5 MeV
| |
| /gps/ene/sigma 0.082 MeV
| |
| </pre>
| |
| | |
| ==== Source position ====
| |
| | |
| The proton source is positioned at <code> z = -420 cm </code> relative to the centre of the inner room (the mother volume), which translates as the wall surface of the inner room.
| |
| | |
| <pre>
| |
| /gps/pos/type Plane
| |
| /gps/pos/shape Circle
| |
| /gps/pos/centre 0.0 0.0 -420 cm
| |
| </pre>
| |
| | |
| === Scoring mesh ===
| |
| | |
| ==== Longitudinal scoring mesh ====
| |
| | |
| A longitudinal scoring mesh extends along the length of the beamline from the source to the water volume. The mesh utilises a filter to detect the flux of protons per cm<sup>2</sup> and writes the data to the text file <code> FluxLongitudinal.txt </code>. The location of the mesh centre can be changed in <code> proton.mac </code>, in addition to the dimensions of the mesh and the number of bins.
| |
| | |
| <pre>
| |
| /score/create/boxMesh waterMeshlongitudinal
| |
| /score/mesh/boxSize 10. 10. 10. cm
| |
| /score/mesh/nBin 1 1 400
| |
| /score/mesh/translate/xyz 0. 0. -226 cm
| |
| </pre>
| |
| | |
| The filter can also be changed to observe the flux of particles other than protons:
| |
| | |
| <pre>
| |
| /score/quantity/cellFlux protonFlux
| |
| /score/filter/particle protonFilter proton
| |
| </pre>
| |
| | |
| ==== Lateral scoring mesh ====
| |
| | |
| A lateral scoring mesh is positioned at the end of the nozzle to record the energy distribution of the protons perpendicular to the direction of the beam. The position, size and bin number of this mesh can be modified in the same way as the longitudinal mesh example above.
| |
| | |
| === Beamline components ===
| |
| | |
| Components of the beamline can be added/removed in <code> DetectorConstruction.cc </code>. If the dimensions of the water box are modified, the following lines in <code> simulation_analysis.C </code> will also need to be modified:
| |
| | |
| <pre>
| |
| Float_t lengthBox = 200, widthBox = 200;
| |
| </pre>
| |
| | |
| The <code> depthFix </code> variable to calculate the stopping distance of the protons within the analysis will also need to be adjusted if the water box dimensions or location are modified. <code> depthFix </code> is calculated by taking the z position of the centre of the water box (relative to the centre of the inner room), and subtracting the half length of the water box (calculated in mm):
| |
| | |
| <pre>
| |
| //depth fix - water box centred at -2260 mm, half length = 100 mm.
| |
| Double_t depthFix = 2360;
| |
| </pre>
| |
| | |
| === Sensitive detectors ===
| |
| | |
| In this simulation, the water volume is assigned as a sensitive detector in <code> DetectorConstruction.cc </code>:
| |
| | |
| <pre>
| |
| G4SDManager* SDman = G4SDManager::GetSDMpointer();
| |
| G4String name="SD";
| |
| DetectorSD = new SensitiveDetector(name);
| |
| SDman->AddNewDetector(DetectorSD);
| |
| logicWater->SetSensitiveDetector(DetectorSD);
| |
| </pre>
| |
| | |
| Another beamline component may be used by modifying the following line and setting its logical volume as a sensitive detector:
| |
| | |
| <pre>
| |
| logicWater->SetSensitiveDetector(DetectorSD);
| |
| </pre>
| |
| | |
| The component should be chosen such that a significant proportion of the proton beam deposits energy, such as in the brass stopper, in order to produce enough data for plots.
| |
| | |
| <code> SensitiveDetector.cc </code> is derived from the <code> G4VSensitiveDetector.cc </code> base class. On a step-by-step basis, the energy deposited by the proton is recorded as a "hit" and added to a <code> HitsCollection </code> object. Other parameters may be retrieved at each step in the method <code> ProcessHits </code>.
| |
| | |
| <pre>
| |
| G4bool SensitiveDetector::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
| |
| {
| |
| G4double edep = aStep->GetTotalEnergyDeposit();
| |
| if(aStep->GetTrack()->GetDefinition()->GetParticleName() == "proton"){
| |
| ::Hit* newHit = new ::Hit();
| |
| newHit->SetEdep(edep);
| |
| HitID = detectorCollection->insert(newHit);
| |
| return true;
| |
| }
| |
| </pre>
| |
| | |
| === Physics list ===
| |
| | |
| This simulation uses one of the standard physics lists: QGSP_BIC_HP. A user-defined physics list can be specified in the class <code> PhysicsList.cc </code>, and then selected in <code> protonPB.cc</code>
| |
| | |
| <pre>
| |
| runManager->SetUserInitialization(new PhysicsList);
| |
| </pre>
| |
| | |
| === Kinetic energy readings ===
| |
| | |
| The kinetic energy of the beam after passing through a particular component of the beamline is found in the class <code> SteppingAction.cc </code>. This class contains a map named <code> componentMap </code> with the names of the components as keys and the z coordinate of each component (taken as the furthest edge of the component from the source):
| |
| | |
| <pre>
| |
| componentMap.insert( std::pair<std::string,double>("ScatteringFoil1",80.025));
| |
| componentMap.insert( std::pair<std::string,double>("BrassStopper",306.6));
| |
| componentMap.insert( std::pair<std::string,double>("ScatteringFoil2",306.625));
| |
| </pre>
| |
| | |
| To find the kinetic energy distribution of the beam at a particular point, insert the component name from the map above into this line:
| |
| | |
| <pre>
| |
| double cPos = (double)componentMap.find("ScatteringFoil2")->second;
| |
| </pre>
| |
| | |
| The code then compares the z position of a proton with the position of the chosen component on a step-by-step basis, and if the proton is at the chosen position its kinetic energy is recorded in <code> kin.out </code>:
| |
| | |
| <pre>
| |
| if(fabs(zpos-cPos) < 1.0e-8){
| |
| std::ofstream hitsfile(filename, std::ios::app);
| |
| if(hitsfile.is_open()){
| |
| G4double ke = step->GetPreStepPoint()->GetKineticEnergy();
| |
| hitsfile << zpos << "\t"
| |
| << ke <<G4endl;
| |
| hitsfile.close();
| |
| }
| |
| }
| |
| </pre>
| |
| | |
| | |
| '''After any modifications to the simulation files, the code will need to be compiled. In the build directory, write:'''
| |
| | |
| <pre>
| |
| [username@plus1 ProtonPB_build]$ make | |
| </pre>
| |
| | |
| After this <code> proton.mac </code> can be run:
| |
| | |
| <pre>
| |
| [username@plus1 ProtonPB_build]$ ./protonPB proton.mac | |
| </pre>
| |
| | |
| == Modifying Analysis Methods ==
| |
| | |
| The number of bins to store the data for each histogram can be changed, here the number of bins is 800:
| |
| | |
| <pre>
| |
| TH1D* waterEnergy = new TH1D ("waterDep", "Energy deposition in water box", 800, 0., 65.);
| |
| </pre>
| |
| | |
| The range of the axes for each plot can also be specified in order to zoom into the energy peak:
| |
| | |
| <pre>
| |
| waterEnergy->GetXaxis()->SetRangeUser(0, 64);
| |
| </pre>
| |
| | |
| | |
| | |
| == Files ==
| |
| | |
| [[Clatterbridge files|List of files for Clatterbridge simulation]].
| |