s. guatelli, m.g pia, infn genova g. cosmo, s. guatelli, m.g pia salamanca, 15-19 july 2002

33
S. Guatelli, M.G Pia, INFN Genova G. Cosmo, S. Guatelli, M.G Pia Salamanca, 15-19 July 2002 http://cern.ch/geant4/ geant4.html http://www.ge.infn.it/geant4/events/ salamanca.html Brachytherapy Brachytherapy exercise exercise

Upload: brendan-hamilton

Post on 03-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

S. Guatelli, M.G Pia, INFN Genova

G. Cosmo, S. Guatelli, M.G Pia

Salamanca, 15-19 July 2002

http://cern.ch/geant4/geant4.htmlhttp://www.ge.infn.it/geant4/events/salamanca.html

Brachytherapy exerciseBrachytherapy exercise

S. Guatelli, M.G Pia, INFN Genova

Plan of this exercise

Learn the basics of how to build a simple user application– Mandatory user classes– Optional user actions

Learn the basics of how to use interactive facilities– User Interface– Visualisation– Histogramming

How we’ll proceed– Illustrate design and implementation basic features– Propose a simple exercise on the same topic– Show the solution

S. Guatelli, M.G Pia, INFN Genova

Basics of user classes

See lecture on Monday

Would you like to refresh an overview of Geant4 user classes?

S. Guatelli, M.G Pia, INFN Genova

User requirements (main ones listed only)

The user shall be able to change the absorber material of the phantom

The user shall be able to change interactively the brachytherapic source

The user shall be able to put sources in different positions inside the phantom

Low Energy electromagnetic processes should be available

The user shall be able to calculate the total absorbed energy in the phantom– 3D distribution in the volume– 2D distribution in the plane containing the source

The dose should be collected 1mm voxels

The user shall be able to define the isodose curves in the phantom

The user shall be able to visualize the geometry involved and the trajectories of the particles

The application provides the simulation of dose distribution of brachytherapic sources in a phantom

S. Guatelli, M.G Pia, INFN Genova

Part 1Part 1

Use case: Use case: model a brachytherapy seed and a phantommodel a brachytherapy seed and a phantom

1. Use case: model a 192Ir brachytherapy seed

2. Use case: model a water phantom

3. Use case: visualise the geometry

4. Exercise: model a soft tissue phantom

5. Exercise: select phantom material from the UI

6. Exercise: model a 125I brachytherapy seed

7. Use case: model the radioactive source as a primary generator of monocromatic photons

8. Exercise: model the spectrum of a 125I source

S. Guatelli, M.G Pia, INFN Genova

OOAD

S. Guatelli, M.G Pia, INFN Genova

Implementation

Exercise Brachy1– header files in include/*.hh, source code in src/ *.cc– main in Brachy.cc– macro: initInter.mac

Classes– BrachyDetectorConstruction– BrachyPrimaryGeneratorAction– BrachyPhysicsList– BrachyRunAction– BrachyEventAction

- BrachyVisManager

S. Guatelli, M.G Pia, INFN Genova

How to run

Define necessary environment variables

– source setup_brachy.csh

How to compile and link

– gmake

How to run

– $G4WORKDIR/bin/Linux/Brachy

Default macro :initInter.mac

S. Guatelli, M.G Pia, INFN Genova

tomorrow

today

S. Guatelli, M.G Pia, INFN Genova

Run Brachy1

1. It will appear: the visualization of the box2. It will appear: |idle> (interactive mode)3. type /run/beamOn number of events4. The simulation is executed5. Type exit

Default visualization driverOGLIX

Defined in InitInter.mac

About VisualizationOGLIX : Immediate visualization No images saved!

DAWN : Interactive panel images saved

At the |idle> prompt, type help,

information about interactive commands

S. Guatelli, M.G Pia, INFN Genova

Model a 192Ir brachytherapy seed

Open BrachyDetectorConstruction in the editor

Follow the guided tour by Susanna

How the geometry is build:3 m m ste e l c a b le

5.0 m m

0.6 m m

3.5 m m

1.1 m m

Ac tive Ir-192 C o re

ExpHall: world volume

Phantom: Box

Capsule of the source

Iridium corethe mother volume is the

containing volume!

S. Guatelli, M.G Pia, INFN Genova

S. Guatelli, M.G Pia, INFN Genova

More about visualization

How to change driver:in initInter.mac

/vis/open OGLIX#/vis/open DAWNFILE

#/vis/open OGLIX/vis/open DAWNFILE

How to work with OGLIX:At the |idle> prompt• Type help• Type the number corresponding to /vis/• Information about visualization commandsEg. rotation of the geometry magnification…

How to work with DAWN:

The interactive panel appears:• devices: choose the format of the image• camera: choose the geometryparameters (rotation, magnification...)

S. Guatelli, M.G Pia, INFN Genova

Before starting

Documentation: http://geant4.web.cern.ch/geant4 click on documentation click on User’s Guide: For Application Developers

very useful !

S. Guatelli, M.G Pia, INFN Genova

Exercise: model a soft tissue phantom

Composition of soft tissue material

(from NIST data base)

Guidance– define necessary elementselements– define tissue materialmaterial– associate the tissue material to the phantom

volume

Solution:Brachy2

element Fractional mass

H 0.104472

C 0.23219

N 0.02488

O 0.630238

Na 0.00113

Mg 0.00013

P 0.00133

S 0.00199

Cl 0.00134

K 0.00199

Ca 0.00023

Fe 0.00005

Zn 0.00003

S. Guatelli, M.G Pia, INFN Genova

Exercise: select phantom material from UI

Select a water/tissue phantom

– The user shall be able to change interactively the material of the phantom

Guidance– create a BrachyDetectorMessenger– Create a BrachyDetectorMessenger pointer in BrachyDetectorConstruction– Create the member function SetMaterial in BrachyDetectorConstruction– Help! Novice example N02

Solution :Brachy3

S. Guatelli, M.G Pia, INFN Genova

Iodium core

3 tubs:•Iodium core•Air•Titanium capsule tip (box)

•Titanium tubeIodium core:Inner radius :0Outer radius: 0.30mmHalf length:1.75mm

Air:Outer radius:0.35mm half length:1.84mm

Titanium tube:Outer radius:0.40mmHalf length:1.84mm

Titanium capsule tip:Box Side :0.80mm

Exercise:Model a simplified I-125 brachytherapic sourcegeometry and materials

Change the geometry of the source inBrachyDetector Construction

Mean gamma energy :28.45keV

S. Guatelli, M.G Pia, INFN Genova

Exercise: model a 125I brachytherapy seed

Guidance– define necessary elements, materialselements, materials– define solids, logical volumes, physical volumessolids, logical volumes, physical volumes– suggestion: proceed incrementally (i.e. implement one/few features at a

time, compile, verify that it is OK, add a new feature etc…)

Solution Brachy4

In Brachy4 the initial energy of primary particles is 28.45 KeV

Pay attention to overlapping volumes: the simulation seems to ‘run’ but after few events it stops to work, it seems dead !

S. Guatelli, M.G Pia, INFN Genova

Model a monocromatic photon source

Open BrachyPrimaryGeneratorAction in the editor

Follow the guided tour by Susanna

S. Guatelli, M.G Pia, INFN Genova

Exercise: model a source spectrum

Description of the spectrum

Guidance– Change in the BrachyPrimaryGeneratorAction– Introduce an array (my array) with 3 cells(corr.3probabilities) in the

constructor– In the GeneratePrimaries method:

Solution Brachy5

Energy(keV) Probability

27.4 0.783913

31.4 0.170416

35.5 0.045671

G4double random=G4UniformRand();G4double sum=0;G4int i=0;while(sum<random){sum +=myarray[i]; i++;}………..

Generation of

Random numbers

G4UniformRand() returns a number between 0 and 1

To be implemented !

S. Guatelli, M.G Pia, INFN Genova

What you learned today

The design of a basic user application

The mandatory user classes

The optional user classes

How to describe materials

How to model a simple geometry– How to implement a DetectorConstruction

How to visualise geometry and tracks

How to control features from the user interface

How to model the primary generator– How to implement a UserPrimaryGeneratorAction

S. Guatelli, M.G Pia, INFN Genova

Part 2Part 2 Use case: calculate the energy deposit in a phantom

from a brachytherapy seed

9. Use case: generate physics interactions in the phantom

10.Exercise: select alternative physics processes

11.Exercise: modify the production thresholds

12.Use case: collect the energy deposit in the phantom

13.Exercise: model the hits as consisting of the energy deposited in each voxel and the coordinates of the voxel centre

14.Use case: produce a 1-D histogram with the energy deposited in the phantom

15.Exercise: produce a 2-D histogram with the dose distribution in the phantom

S. Guatelli, M.G Pia, INFN Genova

S. Guatelli, M.G Pia, INFN Genova

Generate physics interactions

Open BrachyPhysicsList in the editor

Follow the guided tour by Susanna

S. Guatelli, M.G Pia, INFN Genova

Exercise: select alternative processes

Replace LowEnergy processes with standard ones– For gamma and e-

Change the production thresholds to 0.1mm for all the particles involved

Guidance– User Guide: for Application Developers– Physics ReferenceManual– standard processes in geant4/source/processes/electromagnetic/standard/

Solution Brachy6

S. Guatelli, M.G Pia, INFN Genova

Collect energy deposited in the phantom

Open BrachyROGeometry, BrachyHit… in the editor

Follow the guided tour by Susanna

Example :Brachy7 This is the Geant4/examples/advanced/brachytherapy

S. Guatelli, M.G Pia, INFN Genova

S. Guatelli, M.G Pia, INFN Genova

Exercise: hits consisting of Edep, x,y,z

Add Edep

– Associate Edep to the voxel coordinates

Guidance– In BrachyEventAction– Take inspiration from

Solution Brachy8

i=((*CHC)[h])->GetZID(); k=((*CHC)[h])->GetXID();

S. Guatelli, M.G Pia, INFN Genova

Produce a 1-D histogram

Open BrachyAnalysis, Brachy… in the editor

Follow the guided tour by Susanna

S. Guatelli, M.G Pia, INFN Genova

S. Guatelli, M.G Pia, INFN Genova

S. Guatelli, M.G Pia, INFN Genova

Exercise: add a 2-D histogram

Produce a 2-D histogram with the dose distribution in the phantom

Guidance

– x, z, Edep in BrachyEventAction– Edep is the weight– Introduce 2-D histogram in BrachyAnalysisManager– Similar implementation as in 1-D histogram

Solution Brachy9

S. Guatelli, M.G Pia, INFN Genova

What you learned today

How to select particles, physics processes and production thresholds

– How to implement a PhysicsList

How to model the detector response– read-out geometry, hits

How to produce histograms in your simulation applications