1 Gean4 medical_linac advanced example: A Geant4 accelerator model Dr. S. Guatelli Geant4 Collaboration member, Lecturer, Centre of Medical Radiation Physics, Engineering Physics Department, University of Wollongong, NSW, Australia [email protected]
Jan 03, 2016
1
Gean4 medical_linac advanced example: A Geant4 accelerator model
Dr. S. GuatelliGeant4 Collaboration member,
Lecturer, Centre of Medical Radiation Physics, Engineering Physics Department, University of Wollongong, NSW, Australia
Geant4 School, 12-14 October 2009, Catania, Italy2
Development of the medical_linac G4 application
Simulation of a typical linear accelerator used for radiation therapy, in particular IMRT
M. Piergentili, Master Thesis, Dipartimento di Fisica, Universita’ di Genova, Italy
Supervisors: F. Foppiano (IST, Genova) and M. G. Pia (INFN, Genova)
Code available in: Geant4/examples/advanced/medical_linac
Geant4 School, 12-14 October 2009, Catania, Italy3
Content Context User requirements Architecture Implementation details
Geometry component Primary particles Physics component User Interface Visualisation
Results Summary and conclusions
Geant4 School, 12-14 October 2009, Catania, Italy4
Context
Problem! The most used treatment planning systems
do not accurately predict dose in small fields where lateral equilibrium is not achieved This is crucial for IMRT
Solution! Monte Carlo simulation
Geant4 School, 12-14 October 2009, Catania, Italy5
Modeling a medical accelerator
Crucial issues: Complex geometries to be
modelled Accurate description of
the radiation field Accurate physics modeling Simple user interfaceSolution: Geant4!
6
Why Geant4?
Versatile and powerful MC Toolkit in: Physics modelling
Beam line descriptionDosimetry
User interface and visualisation
Geant4 School, 12-14 October 2009, Catania, Italy7
Multiple scattering BremsstrahlungIonisationAnnihilationPhotoelectric effect Compton scattering Rayleigh effect conversione+e- pair productionSynchrotron radiationTransition radiationCherenkovRefractionReflectionAbsorptionScintillationFluorescenceAuger
Electromagnetic physics
Low energy extensions are fundamental for Geant4 Medical Physics applications
Model based on evaluated data libraries
Penelope processes completely re-engineered in Geant4 thanks to OO Technology
• electrons and positrons• , X-ray and optical photons• charged hadrons• ions• muons
Geant4 School, 12-14 October 2009, Catania, Italy8
Detailed detector description and efficient navigation
CSGCSG (Constructed Solid Geometries)- simple solids
BREPSBREPS (Boundary REPresented Solids)- volumes defined by boundary surfaces- polyhedra, cylinders, cones, toroids etc.
Boolean solidsBoolean solids- union, subtraction…
Geometry
ATLASBaBar
Geant4 School, 12-14 October 2009, Catania, Italy9
Radiation field definition
ParticleGun beam of selectable particle type, energy etc.
GeneralParticleSource provides sophisticated facilities to model a
particle sourcehttp://reat.space.qinetiq.com/gps/
It is possible to input radiation field phase space files, to generate primary particles in a simulation
Geant4 School, 12-14 October 2009, Catania, Italy11
Software development of the G4 medical_linac example
User requirements
Architecture of the software
Implementation details
Use of the G4 medical_linac
12
Main user requirements of the G4 medical_linac
What should the software application do
Geometry component
Primary particle
Physics
User interface and visualisation
Geant4 School, 12-14 October 2009, Catania, Italy13
Geometry UR:beam line description
The beam line components to be described are: Primary collimator The target The vacuum window The flattening filter The mirror The secondary movable collimators (jaws) The multileaf collimator
The user should be able to change the position of the jaws
The user should be able to change the position of every single leaf
The water phantom is set at the end of the beam line
Geant4 School, 12-14 October 2009, Catania, Italy14
Geometry UR:Phantom definition
The detector is a phantom
The phantom is: made of water is divided in voxels
The distance between the upper surface of the target and the upper surface of the phantom is 100 cm
Geant4 School, 12-14 October 2009, Catania, Italy15
Primary particle UR:Definition of the radiation field
The primary particles are electrons generated in a point source with random direction (0 deg<Θ<30
deg) the energy has a gaussian distribution the momentum distribution is gaussian
Geant4 School, 12-14 October 2009, Catania, Italy16
Physics component UR
Gamma, electrons and positrons should be defined in the experimental set-up
The electromagnetic processes should be defined
The user shall be able to change the threshold of production of secondary particles interactively
Geant4 School, 12-14 October 2009, Catania, Italy17
Analysis UR
The user shall be able to retrieve the energy deposition in the phantom and store it in analysis objects
Geant4 School, 12-14 October 2009, Catania, Italy18
Software development of the G4 medical_linac example
User requirements
Architecture of the software
Implementation details
Use of the G4 medical_linac
Geant4 School, 12-14 October 2009, Catania, Italy19
Design of medical_linac
Flexibility Extensibility
Decorator design pattern for geometry component
Geant4 School, 12-14 October 2009, Catania, Italy20
Decorator design patternTo model geometries in the medical_linac
Decorator design pattern - attach additional responsibilities to an object dynamically
Advantage: develop a general, flexible, extensible software with the capability of choosing a specific experimental set-up
Dynamically loadable geometries: Position of the collimators Set the target and flattering filter in the
experimental set-up
Geant4 School, 12-14 October 2009, Catania, Italy21
Software development of the G4 medical_linac example
User requirements
Architecture of the software
Implementation details
Use of the G4 medical_linac
Geant4 School, 12-14 October 2009, Catania, Italy23
Beam line model +
phantom
Flattening filter
MLC
Primary collimators and target
M. Piergentili
Geant4 School, 12-14 October 2009, Catania, Italy24
Primary particle component:MedLinacPrimaryGeneratorAction class (1)
MedLinacPrimaryGeneratorAction::MedLinacPrimaryGeneratorAction() :pEnergy(99.0*MeV), sigma(12.7*MeV)
{…….
particleGun -> SetParticleDefinition(particleTable -> FindParticle("e-"));
particleGun -> SetParticleEnergy(pEnergy);
particleGun -> SetParticlePosition(G4ThreeVector(0.0*cm,
0.0*cm, 123.0*cm));
}
MedLinacPrimaryGeneratorAction::~MedLinacPrimaryGeneratorAction() {….}
Geant4 School, 12-14 October 2009, Catania, Italy25
void MedLinacPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent){
// Angular distribution of primary particlesG4double cosTheta = CLHEP::RandGauss::shoot(-1.,0.00003);
G4double phi = twopi * G4UniformRand();
G4double sinTheta = std::sqrt(1. - cosTheta*cosTheta); G4double ux = sinTheta*std::cos(phi); G4double uy = sinTheta*std::sin(phi); G4double uz = cosTheta;
particleGun -> SetParticleMomentumDirection(G4ThreeVector(ux,uy,uz));
// Energy distribution of primary particles
energy = CLHEP::RandGauss::shoot(pEnergy,sigma); particleGun -> SetParticleEnergy(energy);
particleGun -> GeneratePrimaryVertex(anEvent);}
Primary particle component:MedLinacPrimaryGeneratorAction class (2)
Geant4 School, 12-14 October 2009, Catania, Italy26
Physics component: particle definition
MedLinacPhysicsList class (1)
MedLinacPhysicsList::MedLinacPhysicsList(): G4VUserPhysicsList(){ // Instantiate a messenger to change the parameters of the physics
list physicsListMessenger = new MedLinacPhysicsListMessenger(this);}
MedLinacPhysicsList::~MedLinacPhysicsList(){;}
void MedLinacPhysicsList::ConstructParticle(){ G4Gamma::GammaDefinition(); G4Electron::ElectronDefinition(); G4Positron::PositronDefinition();}
Geant4 School, 12-14 October 2009, Catania, Italy27
Physics component: definition of
processesvoid MedLinacPhysicsList::ConstructProcess(){ AddTransportation(); ConstructEM();}void MedLinacPhysicsList::ConstructEM(){…..if (particleName == "gamma") { pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh); pmanager->AddDiscreteProcess(new G4LowEnergyPhotoelectric); pmanager->AddDiscreteProcess(new G4LowEnergyCompton); pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);}
else if (particleName == "e-") { pmanager->AddProcess(new G4MultipleScattering, -1, 1,1); pmanager->AddProcess(G4LowEnergyIonisation, -1, 2,2); pmanager->AddProcess(G4LowEnergyBremsstrahlung, -1,-1,3);} else if (particleName == "e+") {
pmanager->AddProcess(new G4MultipleScattering,-1, 1,1); pmanager->AddProcess(new G4eIonisation, -1, 2,2); pmanager->AddProcess(new G4eBremsstrahlung, -1,-1,3); pmanager->AddProcess(new G4eplusAnnihilation, 0,-1,4);} }
MedLinacPhysicsList class (2)
Geant4 School, 12-14 October 2009, Catania, Italy28
void MedLinacPhysicsList::SetCuts(){…defaultCutValue = defaultCut;
// Production thresholds for detector regions G4String regionName = "PrimaryCollimatorLow"; G4double cutValue = 8.*cm; G4Region* region = G4RegionStore::GetInstance()-
>GetRegion(regionName); G4ProductionCuts* cuts = new G4ProductionCuts; cuts -> SetProductionCut(cutValue); region -> SetProductionCuts(cuts);……}
Physics component: definition of
cuts
MedLinacPhysicsList class (3)
Geant4 School, 12-14 October 2009, Catania, Italy29
Dosimetry in medical_linac (1)
The result of the simulation is the energy deposition in the phantom
The phantom is A water box, with size = 30 cm
The sensitive detector of the experimental set-up
The phantom is divided in voxels (size = 2 mm) G4MedLinacReadOutGeometry
The ReadOut geometry is a virtual, parallel geometry to describe the read-out configuration of the detector
Geant4 School, 12-14 October 2009, Catania, Italy30
Dosimetry in medical_linac (2) Hits
Hit is a user-defined class derived from G4VHit
You can store various types information by implementing your own concrete Hit class:
position and time of the step
momentum and energy of the track
energy deposit of the step
geometrical information
etc.
Hit objects of a concrete hit class must be stored in a dedicated collection, which is instantiated from G4THitsCollection template classG4THitsCollection template class
Geant4 School, 12-14 October 2009, Catania, Italy31
Analysis component
The energy deposition in the voxels of the phantom is Step 1: stored in a G4Hit collection Step 2: stored in analysis objects, in a xml file
MedLinacAnalysisManager.cc
AIDA and PI used
Geant4 School, 12-14 October 2009, Catania, Italy32
User interface
Definition of messenger classes to change parameters of the simulation experimental set-up:
Mean energy of the electron beam Position of the leafs Rotation of the jaws Phantoms sizes Threshold of production of secondary particles
Easy to define simulation parameters in a macro file
Geant4 School, 12-14 October 2009, Catania, Italy
G4MedLinacPhysicsMessenger.cc
MedLinacPhysicsListMessenger::MedLinacPhysicsListMessenger(....){ PhysicsDir = new G4UIdirectory("/PhysicsList/"); PhysicsDir -> SetGuidance("physics parameters"); CutCmd = new G4UIcmdWithADoubleAndUnit("/PhysicsList/cut",this); CutCmd -> SetGuidance("Set cut length (mm)"); CutCmd -> SetParameterName("defaultCut",false); CutCmd -> SetDefaultUnit( "mm" ); CutCmd -> SetUnitCategory("Length"); CutCmd -> AvailableForStates(G4State_PreInit);}..........void MedLinacPhysicsListMessenger::SetNewValue(G4UIcommand* command,G4String
newValue){ if( command == CutCmd ) pMedLinacPhysicsList -> SetCut(CutCmd -> GetNewDoubleValue(newValue));} 33
Geant4 School, 12-14 October 2009, Catania, Italy34
/PhysicsList/cut 0.2 mm
/run/initialize
/Phantom/dimension 15. cm
/Phantom/Nvoxels 150
/Phantom/maxStep 0.2 mm
/MLC/leaf_selection a1 # Multi Leaf
/MLC/position 0. cm
/Jaws/X1/DistanceFromAxis -4.2 cm
/Jaws/X2/DistanceFromAxis 5.2 cm
/Jaws/Y1/DistanceFromAxis -6.6 cm
/Jaws/Y2/DistanceFromAxis 6.8 cm
/primary/energy 6.0 MeV
/primary/sourceType 0.127 MeV
/run/beamOn 10
Macro file
Geometry
Physics
Primary particles
Geant4 School, 12-14 October 2009, Catania, Italy35
How to run the medical_linac example
Install Geant4 Install analysis tool Source the environment Compile the code
Run the executable $G4WORDIR/bin/Linux-g++/MedLinac
Guidance options:OpenGL visualisation: $G4WORDIR/bin/Linux-g++/MedLinac vis.mac
DAWN visualisation: $G4WORDIR/bin/Linux-g++/MedLinac dawnvis.mac
VRML visualisation: $G4WORDIR/bin/Linux-g++/MedLinac vrmlvis.mac
without visualization: $G4WORDIR/bin/Linux-g++/MedLinac macro.mac
Geant4 School, 12-14 October 2009, Catania, Italy37
Initialisationmain Run manager user detector
const ructionuser physics
list
1: initialize2 : const ruct
3: material const ruct ion
4: geometry construct ion5: world volume
6 : const ruct
7 : physics process const ruction
8: set cuts
Describe the geometrical set-up
Activate electromagnetic/hadronic
processes appropriate to the energy range of the experiment
Geant4 School, 12-14 October 2009, Catania, Italy38
Beam Onmain Run Manager Geometry
managerEvent
generatorEvent
Manager
1: Beam On2: close
3: generate one event
4: process one event
5: open
Generate primary events
Geant4 School, 12-14 October 2009, Catania, Italy39
Event processing
Event manager
Stacking manager
Tracking manager
Stepping manager
User sensitive detector
1: pop
2: process one track3: Stepping
4: generate hits
5: secondaries
6: push
Record the energy deposit and the position associated
41
Results
Comparison experimental measurements and simulation
results
Authors: F. Foppiano (IST, Genova), B. Mascialino, M. G. Pia (INFN, Genova), M.
Piergentili
Geant4 School, 12-14 October 2009, Catania, Italy42
Test Important and crucial issue
Always with respect to experimental experimental datadata
Levels of tests:: Microscopic test: Test on components of the
application (i.e. Physics models adopted)
Macroscopic test: Test on the experimental set-up (physics, geometry, etc. together)
Geant4 School, 12-14 October 2009, Catania, Italy43
Percent Depth Dose
Experimental measurements with ion chamber
Squared fields 5x5 cm, 10x10 cm, 40x40 cm
PTW MP3
Geant4 School, 12-14 October 2009, Catania, Italy44
Comparison with experimental data
range D p-value
-84 -60 mm 0.385 0.23
-59 -48 mm 0.27 0.90
-47 47 mm 0.43 0.19
48 59 mm 0.30 0.82
60 84 mm 0.40 0.10
range D p-value
-56 -35 mm 0.26 0.89
-34 -22 mm 0.43 0.42
-21 21 mm 0.38 0.08
22 32 mm 0.26 0.98
33 36 mm 0.57 0.13
Kolmogorov-Smirnov test
1010 events
100 CPU dayson Pentium IV 3 GHz
Geant4 School, 12-14 October 2009, Catania, Italy45
Comparison with experimental data
D = 0.005; p-value = 1
range D p-value
0 14 mm 0.548 0.09
15 300 mm
0.144 0.123
Kolmogorov-Smirnov test
Voxels 5mmVoxels 1mm
Geant4 School, 12-14 October 2009, Catania, Italy47
Modeling a beam line Accurate modeling of a complete beam line in terms of:
Geometry: Materials Geometry components Magnetic fields Moving leafs
Particle beam line: Define the particle type Define the energy, angular distribution of the beam with a defined
algorithm
Complete tracking of primary and secondary particles in the experimental set-up
Geant4 School, 12-14 October 2009, Catania, Italy48
Problem: how to obtain quick response!
Optimise the simulation Use of G4Regions Variance reduction techniques Split the simulation in two
subcomponents Step 1: Tracking of the electron beam down to the phantom
interface Step2: Store radiation field phase space at the phantom
interface (input of Step 3) Step3: Repeat simulations, tracking the radiation field just in
the phantom, to accumulate significant statistics
Geant4 School, 12-14 October 2009, Catania, Italy49
Parallelisation of the G4 simulation
Use a cluster or distributed computing resources (GRID)
Possible solution: http://cern.ch/ganga http://cern.ch/diane Simulation and production of analysis objects e.g. histograms, in parallel mode
- Medical Physics – brachytherapy - Radioprotection
- Detector Simulation