Clatterbridge: Difference between revisions

From PBTWiki
Jump to navigation Jump to search
Line 168: Line 168:
[could go under data analysis section]
[could go under data analysis section]


'''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.


== Modifying Analysis Methods ==
== Modifying Analysis Methods ==


== Files ==
== Files ==

Revision as of 10:16, 27 July 2016

Simulation of the Clatterbridge beamline

This simulation models the monoenergetic 62.5 MeV proton beam at Clatterbridge Cancer Centre, as it traverses the components of the beamline and is then deposited into a volume of water. The beamline components are contained within a geometry modelling the Clatterbridge treatment room.

The protons are generated using the G4ParticleGun class, and the physics list used is QGSP_BIC_HP, standard for simulating clinical proton beams.

The energy of the beam after travelling through the beamline components is measured by tracking the energy deposition of individual protons within the water volume, using an implementation of the G4VSensitiveDetector.cc class. This simulation produces a post-beamline energy of 60.08 MeV and a Bragg peak at depth [insert depth].

[insert image of visualisation]

Running the simulation

Run macro proton.mac

This will run the simulation and produce the required output files.

[username@plus1 ProtonPB_build]$ ./protonPB proton.mac

Output files

The simulation code and proton.mac produce several output files:

kin.txt

This text file contains the output information from SteppingAction.cc , printed on a step-by-step basis for each proton (event). The first column contains the z position of the particle, relative to the position of the source at the inner room boundary. The second column contains the energy (MeV) of the proton at this z position.

300	62.3248
300	62.0776
300	62.2042
300	62.4347
300	62.2698
300	62.2164

Data Analysis

Open ROOT and run analysis file

The simulation analysis file reads the data in the output files and produces the associated plots.

[username@plus1 ProtonPB_build]$ root -l

root [0] .x simulation_analysis.C

Proton energy deposition in water

Proton stopping distance in water

Proton flux along beamline

Kinetic energy of beam

Changing parameters

Initial beam parameters

Initial parameters of the proton beam can be modified in proton.mac

Beam radius

/gps/pos/radius 3 mm

Beam energy

This simulation models the proton beam source with a Gaussian distribution.

/gps/ene/type Gauss
/gps/ene/mono 62.5 MeV
/gps/ene/sigma 0.082 MeV

Source position

The proton source is positioned at z = -420 cm relative to the centre of the inner room (the mother volume), which translates as the wall surface of the inner room.

/gps/pos/type Plane
/gps/pos/shape Circle
/gps/pos/centre 0.0 0.0 -420 cm

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 cm2 and writes the data to the text file FluxLongitudinal.txt . The location of the mesh centre can be changed in proton.mac , in addition to the dimensions of the mesh and the number of bins.

/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

The filter can also be changed to observe the flux of particles other than protons:

/score/quantity/cellFlux protonFlux
/score/filter/particle protonFilter proton


Lateral scoring mesh

A lateral scoring mesh is positioned at the end of the nozzle to record the dose distribution of the protons. 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 DetectorConstruction.cc . If the dimensions of the water box are modified, the following lines in simulation_analysis.C will also need to be modified:

Float_t lengthBox = 200, widthBox = 200;

The depthFix 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. depthFix 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):

//depth fix - water box centred at -2260 mm, half length = 100 mm. 
Double_t depthFix = 2360;

Sensitive detectors

In this simulation, the water volume is assigned as a sensitive detector in DetectorConstruction.cc :

G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String name="SD";
DetectorSD = new SensitiveDetector(name);
SDman->AddNewDetector(DetectorSD);
logicWater->SetSensitiveDetector(DetectorSD);

Another beamline component may be used by modifying the following line and setting its logical volume as a sensitive detector:

logicWater->SetSensitiveDetector(DetectorSD);

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.

SensitiveDetector.cc is derived from the G4VSensitiveDetector.cc base class. On a step-by-step basis, the energy deposited by the proton is recorded as a "hit" and added to a HitsCollection object. Other parameters may be retrieved at each step in the method ProcessHits .

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;
  }

Physics list

Kinetic energy readings

[could go under data analysis section]


After any modifications to the simulation files, the code will need to be compiled. In the build directory, write:

[username@plus1 ProtonPB_build]$ make 

After this proton.mac can be run.

Modifying Analysis Methods

Files