Simulations With Gate Hands-On: Installation
Simulations With Gate Hands-On: Installation
Hands-on
Thomas Carlier & Ludovic Ferrer
4 juin 2019
Installation
Please, refer to wiki pages at wiki.opengatecolaboration.org. Installation process should
be quite straight forward (unless you decide to install gate on windows system). During this
lecture, you are going to use gate8.1. First step, initialize all the environment variables by
sourcing an environment file :
prompt> source /home/info/cussonno/geant4.10.04.p02/env-geant4.10.04.p02-Gate_V8.1-gcc4.9.2.csh
We provided you with a list of macro files needed for executing a basic simulation with gate.
Put those files in a directory of your choice, this directory will be your working directory and
go down to this working directory.
prompt> cd myworkingdirectory
Launch gatein a terminal to enter interactive commands. If all went well, you should end with
the following lines in your terminal :
[G4] **************************************************************
[G4] Geant4 version Name: geant4-10-04-patch-02 (25-May-2018)
[G4] Copyright : Geant4 Collaboration
[G4] References : NIM A 506 (2003), 250-303
[G4] : IEEE-TNS 53 (2006), 270-278
[G4] : NIM A 835 (2016), 186-225
[G4] WWW : http://geant4.org/
[G4] **************************************************************
[G4]
[Core-0] Initialization of geometry
[Core-0] Initialization of physics
[Core-0] Initialization of actors
[Core-0]
[Core-0] *************************************************
[Core-0] GATE version 8.1.p01 (April 2018)
[Core-0] Copyright : OpenGATE Collaboration
[Core-0] Reference : Phys. Med. Biol. 49 (2004) 4543-4561
[Core-0] Reference : Phys. Med. Biol. 56 (2011) 881-901
[Core-0] Reference : Med. Phys. 41(6) (2014)
[Core-0] http://www.opengatecollaboration.org
[Core-0] *************************************************
[Core-0]
[Core-0] You are using Geant4 version 10.4.2
PreInit>
Assuming that there is a macro file called main.mac in your working directory, execute gateby
typing at the gate prompt :
Idle>/control/execute main.mac
Last output lines should be very similar to :
1
========= Table of registered couples ==============================
====================================================================
This summarizes the production cut in range (and consequently in energy) for each region you
defined in your simulation. Pay attention that those values represent production cuts : secondary
particles are generated if their energy are sufficient to move themself farther than the range cut.
Otherwise, energy is locally deposited. In this example, all particles in each region have 1 mm
range cut.
2
1.2 Geometry setup
The setup consists of a cubic (30cmx30cmx30cm) cabinet with walls made of lead (0.5cm
thick). Inside, one lay a vial (diameter : 2cm height : 4cm wall thickness : 0.2 cm material : glass)
contening a water solution (2 cm height).
1.2.1 Cabinet
Create and position imbricated boxes into world with correct dimensions.
/run/application/startDAQ
Launch gatein interactive mode and enter the following command at gate prompt :
Idle>/geometry/test/recursive_test
In your working directory, the file sourceMono.mac contains the definition of a mono-
energetic (1 MeV) gamma point source. Modify the file in order to transform the point source
as a cylindrical volume source with the same dimensions as the water cylinder defined in § 1.2.3.
Create a new file in your working directory and try to create an iodine-131 source in the same
geometrical configuration as the previous point. Use ion type source.
In your working directory, modify the file main.mac according to :
/tracking/verbose 1
1. Use # character to comment lines.
3
Launching your first simulation. This simulation consists of monoenergetic electron point
source (5 particles) firing in all direction inside the geometry just defined. In your terminal
window, go to your working directory and launch your simulation.
prompt>gate mainpart1.mac
*********************************************************************************************************
* G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 -140 1 0 0 0 iodineSolution_phys initStep
1 1.48 0.383 -139 0.608 0.392 2.29 2.29 iodineSolution_phys ElectronIonisation
2 2.38 0.0424 -139 0.265 0.343 1.71 4 iodineSolution_phys ElectronIonisation
3 2.37 0.0414 -140 0 0.265 0.689 4.69 iodineSolution_phys ElectronIonisation
*********************************************************************************************************
* G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 -140 1 0 0 0 iodineSolution_phys initStep
1 -1.37 0.531 -142 0.442 0.558 2.29 2.29 iodineSolution_phys ElectronIonisation
2 -2.05 0.385 -142 0 0.442 1.35 3.64 iodineSolution_phys ElectronIonisation
*********************************************************************************************************
* G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 -140 1 0 0 0 iodineSolution_phys initStep
1 -1.32 -0.918 -139 0.571 0.429 2.29 2.29 iodineSolution_phys ElectronIonisation
2 -2.06 -1.56 -140 0 0.571 1.64 3.93 iodineSolution_phys ElectronIonisation
*********************************************************************************************************
* G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 -140 1 0 0 0 iodineSolution_phys initStep
1 1.17 0.423 -138 0.655 0.345 2.29 2.29 iodineSolution_phys ElectronIonisation
2 1.47 0.0559 -137 0.301 0.354 1.79 4.08 iodineSolution_phys ElectronIonisation
3 1.78 -0.245 -136 0 0.301 0.838 4.92 iodineSolution_phys ElectronIonisation
*********************************************************************************************************
* G4Track Information: Particle = e-, Track ID = 1, Parent ID = 0
*********************************************************************************************************
Step# X(mm) Y(mm) Z(mm) KinE(MeV) dE(MeV) StepLeng TrackLeng NextVolume ProcName
0 0 0 -140 1 0 0 0 iodineSolution_phys initStep
1 -2.03 -0.863 -140 0.585 0.415 2.29 2.29 iodineSolution_phys ElectronIonisation
2 -2.64 -0.598 -142 0.235 0.351 1.67 3.96 iodineSolution_phys ElectronIonisation
3 -2.49 -0.826 -142 0 0.235 0.573 4.53 iodineSolution_phys ElectronIonisation
In your terminal, you should end up with lines very similar to those above. Could you explain/-
comment, please ?
Playing with cuts : Add the following line at the end of your ”geometry” macrofile and
modify it accordingly.
/gate/physics/Electron/SetCutInRegion nameofYOURIodineSolution 2 um
This will define a new range cut for electron in the region named nameofYOURIodineSolution.
Relaunch gateand comment the differences with the previous output.
Playing with particles : Change particle type to gamma and energy to 140 keV. Comment
the electromagnetic shower. Modify electron cut range in regions that matter in order to knock
on secondary particles. Comment this new electromagnetic shower.
4
or dose. They can be applied and managed within a specified volume.
In this section, we are using a "realistic" object. The input data is a CT scan (voxelised object).
For clarity purpose, the CT scan is labelled and only few organs are available.
1. Open the CT scan with ImageJ 2 .
2. A complete set of macro files are provided in the directory "Part 3". Open the file
mainMacroTP_P.mac and remove all the comments following the sentence "Just for vi-
zualisation purpose". Comment all the line following the sentence "For dose output". Run
the macro with GATE and comment.
3. Remove (or comment) all the lines related to the previous question concerning the vizua-
lisation. Remove the comments for the dose output. Run again the simulation. A set of
files are now created in the directory "output". Open each file ending with the extension
".img" with ImageJ. 3 Explain the results.
4. Change the beam using photons with an initial energy of 18 MeV (σ = 1 MeV). Run the
simulation and explain again the results.
5. Same question by using an electron beam with an initial energy of 20 MeV (σ = 1 MeV).
6. The objective is now to use again the proton beam and to correctly target the spine
bone. Find (and demonstrate that your solution is correct) a method where the maximum
energy is deposited in the spine bone.
2. Data are encoded in unsigned integer and the image size is 128×128 × 204.
3. Data are encoded in 32-bits real and the image size is 128 × 128 × 204.