Presentation is loading. Please wait.

Presentation is loading. Please wait.

S. Guatelli, M.G Pia, INFN Genova G. Cosmo, S. Guatelli, M.G Pia Salamanca, 15-19 July 2002

Similar presentations


Presentation on theme: "S. Guatelli, M.G Pia, INFN Genova G. Cosmo, S. Guatelli, M.G Pia Salamanca, 15-19 July 2002"— Presentation transcript:

1 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 exercise

2 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

3 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?

4 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

5 S. Guatelli, M.G Pia, INFN Genova Part 1 Use case: model a brachytherapy seed and a phantom 1.Use case: model a 192 Ir 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 125 I brachytherapy seed 7.Use case: model the radioactive source as a primary generator of monocromatic photons 8.Exercise: model the spectrum of a 125 I source

6 S. Guatelli, M.G Pia, INFN Genova OOAD

7 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

8 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

9 S. Guatelli, M.G Pia, INFN Genova tomorrow today

10 S. Guatelli, M.G Pia, INFN Genova Run Brachy1 1.It will appear: the visualization of the box 2.It will appear: |idle> (interactive mode) 3.type /run/beamOn number of events 4.The simulation is executed 5.Type exit Default visualization driver OGLIX Defined in InitInter.mac About Visualization OGLIX : Immediate visualization No images saved! DAWN : Interactive panel images saved At the |idle> prompt, type help, information about interactive commands

11 S. Guatelli, M.G Pia, INFN Genova Model a 192 Ir brachytherapy seed Open BrachyDetectorConstruction in the editor Follow the guided tour by Susanna How the geometry is build: ExpHall: world volume Phantom: Box Capsule of the source Iridium core the mother volume is the containing volume !

12 S. Guatelli, M.G Pia, INFN Genova

13 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 commands Eg. rotation of the geometry magnification… How to work with DAWN: The interactive panel appears: devices: choose the format of the image camera: choose the geometry parameters (rotation, magnification...)

14 S. Guatelli, M.G Pia, INFN Genova Before starting Documentation: http://geant4.web.cern.ch/geant4http://geant4.web.cern.ch/geant4 click on documentation click on User’s Guide: For Application Developers very useful !

15 S. Guatelli, M.G Pia, INFN Genova Exercise: model a soft tissue phantom Composition of soft tissue material (from NIST data base) Guidance elements –define necessary elements material –define tissue material –associate the tissue material to the phantom volume Solution:Brachy2 elementFractional mass H0.104472 C0.23219 N0.02488 O0.630238 Na0.00113 Mg0.00013 P0.00133 S0.00199 Cl0.00134 K0.00199 Ca0.00023 Fe0.00005 Zn0.00003

16 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

17 S. Guatelli, M.G Pia, INFN Genova Iodium core 3 tubs: Iodium core Air Titanium capsule tip (box) Titanium tube Iodium core: Inner radius :0 Outer radius: 0.30mm Half length:1.75mm Air: Outer radius:0.35mm half length:1.84mm Titanium tube: Outer radius:0.40mm Half length:1.84mm Titanium capsule tip: Box Side :0.80mm Exercise:Model a simplified I-125 brachytherapic source geometry and materials Change the geometry of the source in BrachyDetector Construction Mean gamma energy :28.45keV

18 S. Guatelli, M.G Pia, INFN Genova Exercise: model a 125 I brachytherapy seed Guidance elements, materials –define necessary elements, materials solids, logical volumes, physical volumes –define solids, 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 !

19 S. Guatelli, M.G Pia, INFN Genova Model a monocromatic photon source Open BrachyPrimaryGeneratorAction in the editor Follow the guided tour by Susanna

20 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.40.783913 31.40.170416 35.50.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 !

21 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

22 S. Guatelli, M.G Pia, INFN Genova Part 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

23 S. Guatelli, M.G Pia, INFN Genova

24 Generate physics interactions Open BrachyPhysicsList in the editor Follow the guided tour by Susanna

25 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

26 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 :Brachy7This is the Geant4/examples/advanced/brachytherapy

27 S. Guatelli, M.G Pia, INFN Genova

28 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();

29 S. Guatelli, M.G Pia, INFN Genova Produce a 1-D histogram Open BrachyAnalysis, Brachy… in the editor Follow the guided tour by Susanna

30 S. Guatelli, M.G Pia, INFN Genova

31

32 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

33 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


Download ppt "S. Guatelli, M.G Pia, INFN Genova G. Cosmo, S. Guatelli, M.G Pia Salamanca, 15-19 July 2002"

Similar presentations


Ads by Google