1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy.

Slides:



Advertisements
Similar presentations
Monte Carlo Based Implementation of an Energy Modulation System for Proton Therapy G.A.P. Cirrone Qualified Medical Physicist PhD Laboratori Nazionali.
Advertisements

Use of G EANT 4 in CMS AIHENP’99 Crete, April 1999 Véronique Lefébure CERN EP/CMC.
山下智弘 JST CREST/ 神戸大学 Borrowing especially from presentations of M. Asai(SLAC) Geant4 Japan Oct, RCNS, based on Geant4 9.0.p01.
GAMOS tutorial Histogram and Scorers Exercises
Geant4 v9.2p02 Particle Gun Makoto Asai (SLAC) Geant4 Tutorial Course.
Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002 Getting Started.
Primary particle generation Makoto Asai (SLAC) Geant4 Users SLAC Feb. 18 th, 2002.
14 User Documents and Examples I SLAC Geant4 Tutorial 3 November 2009 Dennis Wright Geant4 V9.2.p02.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Japan.
Tabular Editors for Geant4 Geant4 Geometry Editor and Geant4 Physics Editor CHEP 2000 at Padova Hajime Yoshida Naruto University of Education.
Gamma calorimeter for R3B: first simulation results INDEX ● The calGamma Geant4 simulation ( a short introduction ) ● Crystal and geometry selection: –
R 3 B Gamma Calorimeter Agenda. ● Introduction ● Short presentation on the first ● Task definition for R&D period ( )
User Documents and Examples I Sébastien Incerti Slides thanks to Dennis Wrigth, SLAC.
Geometry Detector geometry A detector geometry in Geant4 is made of a number of volumes. The largest volume is called the World volume. It must contain.
Geant4 Electromagnetic Physics Introduction V.Ivanchenko, M.Maire, M.Verderi  Process interface  Physics categories  Electromagnetic physics  PhysicsList.
17-19 Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan Oct, 2007Geant4 Japan 2007 Geant4 Collaboration.
Physics I: Physics Lists Geant4 Tutorial at Jefferson Lab 10 July 2012 Dennis Wright (SLAC) Geant4 9.6 beta.
S. Guatelli, CPS Innovations, Knoxville, 13 th -21 st January Brachytherapy exercise.
Pedro Arce Introducción a GEANT4 1 GAMOS tutorial Plug-in’s Exercises Pedro Arce Dubois CIEMAT
1 Primary particles Geant4 User's Tutorial CERN, February 2010 Talk from previous tutorial by Giovanni Santin Ecole Geant4, Annecy 2008.
Work_Geant4 Bo-Wen Shiou. #include "G4RunManager.hh“ #include "G4RunManager.hh“ #include "G4UImanager.hh" #include "G4UImanager.hh" #include "ExN01DetectorConstruction.hh“
Special Topics in Nuclear Physics, JU, Second Semester, (Saed Dababneh). 1 Course web or
Maria Grazia Pia Detector Response Acknowledgements: A. Lechner, J. Apostolakis, M. Asai, G. Cosmo, A. Howard.
S. Guatelli, M.G Pia, INFN Genova G. Cosmo, S. Guatelli, M.G Pia Salamanca, July 2002
Primary particle Giovanni Santin ESA / ESTEC and RheaTech Ltd On behalf of the Geant4 collaboration Ecole Geant4 Annecy, and Nov 2008 With.
6th April 2005Wah-kai Ngai1 First Example in Geant4 3rd HK simulation group meeting.
1 Physics I: Physics Lists Paris Geant4 Tutorial 4 June 2007 Marc Verderi Laboratoire Leprince-Ringuet (Heavily copied from D. Wright) Geant4 V8.3.
Monte Carlo /12/07. What is Geant ? Monte Carlo simulation tool for nuclear and particle physics Set up detectors –Sensitive detector which returns.
User Application Toolkit + User application toolkit Geant4 is a toolkit –i.e. you cannot “run” it out of the box –You must write.
User Application Luciano Pandola INFN-LNGS Partially based on a presentation by Maria Grazia Pia (INFN-Ge)
Gaudi Framework Tutorial, April Algorithm Tools: what they are, how to write them, how to use them.
Generating Primary Particles Each Geant4 Event starts with generation of one or multiple primary particles It is up to the user to define primary particle.
1 Calorimeter in G4MICE Berkeley 10 Feb 2005 Rikard Sandström Geneva University.
CBM Software Meeting 1 CBM Simulation & Analysis Framework Geant3 / Gean4 configuration M. Al-Turany, D. Bertini.
Geant4 Simulation of the Beam Line for the HARP Experiment M.Gostkin, A.Jemtchougov, E.Rogalev (JINR, Dubna)
Exercises Alberto Ribon Alberto Ribon CERN PH/SFT CERN PH/SFT Geant4 tutorial, May 2005.
Geant4 examples Sébastien Incerti On behalf of the Geant4 collaboration with special thanks to Luciano Pandola, INFN.
WORK Bo-Wen Shiou. GNUmakefile GNUmakefile XXX.cc (ex:try03.cc) XXX.cc (ex:try03.cc) include folder (xxx.hh) include folder (xxx.hh) src folder (xxx.cc)
Maria Grazia Pia Hands-on exercises Unit 2 Modelling the experimental set-up.
V.Ivanchenko Salamanca1 Geant4: Electromagnetic Processes 1  Introduction  Interfaces  PhysicsList  Optical process.
17-19 Oct, 2007Geant4 Japan 2007 Geant4 Collaboration KEK/CRC 1.
Physics I: Physics Lists Puebla Geant4 Tutorial 15 June 2010 Dennis Wright Geant4 V9.3.p01.
Pedro Arce Introducción a GEANT4 1 GAMOS tutorial RadioTherapy Exercises Pedro Arce Dubois CIEMAT
A. SarratILC TPC meeting, DESY, 15/02/06 Simulation Of a TPC For T2K Near Detector Using Geant 4 Antony Sarrat CEA Saclay, Dapnia.
MONTE CARLO TRANSPORT SIMULATION Panda Computing Week 2012, Torino.
Starting with an example PART I Set your environment up and get a Geant4 example.
Interaction with the Geant4 kernel
Simulation Tools for Test Beam
J. Apostolakis, M. Asai, G. Cosmo, A. Howard
L. Pandola INFN, Gran Sasso National Laboratories
Interaction with the Geant4 kernel
Primary Particle Generation
Makoto Asai (SLAC) Geant4 Users CERN Nov. 11th, 2002
200 kV gun GPT simulations Tee, shroom and sphere catohdes
G.A.P.Cirrone, S.E.Mazzaglia - INFN/LNS, Italy
Physics I: Physics Lists
Primary Particle Generation
The Hadrontherapy Geant4 advanced example
User Application
GAMOS tutorial Plug-in’s Exercises
Geant4 course - exercices
User Application
User Application
The full set of lecture notes of this Geant4 Course is available at
The full set of lecture notes of this Geant4 Course is available at
Kernel Author: Makoto Asai.
Primary particle Makoto Asai (SLAC Computing Services)
The full set of lecture notes of this Geant4 Course is available at
The Geant4 Hadrontherapy Advanced Example
Simulation in Experiments searching for rare events
Presentation transcript:

1 Exercises 0 Go inside the “hadrontherapy” directory: cd hadrontherapy Copy the Hadrontherapy example to your home folder: cp –r $G4INSTALL/examples/advanced/hadrontherapy $HOME Now you can follow the instruction reported on the foil on your table

2 The particles source A mandatory class for the generation of primaries must be inherited from G4VUserPrimaryGeneratorAction abstract class: This was been called HadrontherapyPrimaryGeneratorAction in hadrontherapy. At every event the following virtual method will be called: void HadrontherapyPrimaryGeneratorAction::GeneratePrimaries(G4Event* Ev) G4ParticleDefinition* particle = particleTable -> FindParticle("proton"); Set the position: particleGun = new G4ParticleGun();// In the constructor particleGun -> SetParticlePosition(G4ThreeVector( x, y, z ) ); Then set the initial kinetic energy, momentum and gun! G4double kineticEnergy = G4RandGauss::shoot( meanKineticEkin, sigmaEkin); particleGun -> SetParticleEnergy ( kineticEnergy ); particleGun -> SetParticleMomentumDirection(momentum) particleGun -> GeneratePrimaryVertex( Ev ); Inside it we have to set beam parameters: shape, initial energy, i. position,…:

3 Exercises 1: Change beam and particle type  Change the initial kinetic energy of the primaries 1. Comment out the lines in the "macro/proton_therapy" file where the energy is setted. 2. Enter in the src/HadrontherapyPrimaryGeneratorAction.cc source file and modify it: 3. Change the default mean kinetic energy to 50 MeV and see the results on the Bragg peak In this exercise you have to modify energy of the particle. Before starting a new exercise, please restore the original files, eg by copying from the geant4 examples directory to your home directory: see point 8 of the instructions !

4 Exercises 2: Change beam and particle type 1. Comment out the lines in the macro/proton_therapy" file where the particle name is setted. 2. Change the particle type to the “gamma” one and see the results on the Bragg peak  Change the particle type

5 Geometry: Solids definition Three conceptual layers: G4VSolid  Info about shape and dimensions G4LogicalVolume  Add info about material, sensitivity, visualization, magnetic field, etc. G4VPhysicalVolume  Add information about placement, position and rotation (the same logical volume can be placed many times in the geometry)

6 Geometry: Phantom & Detector build Typical volumes shape in Hadrontherapy are G4Box: a cuboid shape inherited by G4VSolid

7 Geometry: solid definition World Volume B (daughter) Volume A (mother) e.g.: Volume A is mother of Volume B The mother must contain the daughter volume entirely A unique physical volume (the world volume), which represents the experimental area, must exist and fully contains all other components Open the file src/passiveProtonBeamLine.cc and its headers file in the include directory and search for Solid, Logical and Physical volumes.

8 Exercise 3: Change Geometry  Change detector dimension modifying the source code:  Enter in the source file HadrontherapyDetectorConstruction.cc, and modify the detector X size to 2 cm: detectorSizeX(2.*cm), detectorSizeY(2.*cm), detectorSizeZ(2.*cm) search also for the definition of the shape and size of the detector: detector = new G4Box("Detector",detectorSizeX,detectorSizeY,detectorSizeZ); How to change dimension and shape See what happens to the Bragg peak

9 Change the material in the geometry  In the next exercise we’ll change the material of the detector I n Hadrontherapy the materials are predefined: G4_WATER, G4_Cu, etc. You can see the complete list, for example, using the macro command /parameter/nist in Hadrontherapy, or looking into the file: $G4INSTALL/source/materials/src/G4NistMaterialBuilder.cc

10 Exercise 4/a: Change the phantom material Save the file, compile again and see what happen to the Bragg peak  Now, using the same system used in hadrontherapy, change the material of the detector, using this default materials in Geant4: G4_MUSCLE_STRIATED_ICRU

11 Exercise 4/b: Change the phantom material Open the file src/HadrontherapyDetectorConstruction.cc, you will find the method that buld the detector: G4double A; // atomic mass G4int Z; // atomic number G4double d; // density // Firstly let's define elements... A = 22.99*g/mole; G4Element* elNa = new G4Element("Sodium","Na",Z = 11.,A); A = *g/mole; G4Element* elCl = new G4Element("Chlorine","Cl",Z = 17.,A); // Now add my material NaCl d = 2.16*g/cm3; G4Material* NaCl = new G4Material("Sodium Chlorure",d,2); NaCl ->AddElement(elNa,1); // 1 is the number of Sodium atoms in NaCl NaCl ->AddElement(elCl,1); Now modify the pointer to the G4Material inside the Logical Volume of the detector Save the file, compile again and see what happen to the Bragg peak

12 Exercise 5: Add a new volume  Add a new volume (G4Box) before the phantom volume 1.Modify the name of the pointers : waterNist, detector, detectorLogicalVolume,, DetectorPhysicalVolume as you like 3.Modify also the id strings of the three objects (Detector, DetectorLog, DetectorPhys) 4.Change the dimensions to 4x40x40 mm and the position to x = -40, y=0, z=0 mm respect to the world volume! 5.Set the material to the cortical bone. Save the file, compile again and see what happen to the Bragg peak

13 Physics inside Hadrontherapy G4VUserPhysicsList virtual Methods  ConstructParticle()  ConstructProcess()  SetCuts() this will set energy cut for e-, e+ and gamma HadrontherapyPhysicsList methods to insert physics:  AddPackage()  AddPhysicsList() G4VPhysicsConstructor* list of physics Packages: $G4INSTALL/source/physics_lists/lists Hadrontherapy derive his concrete class HadrontherapyPhysicsList from the G4VUserPhysicsList virtual G4 class, then define particles, processes and production threshold.

14 Physics inside Hadrontherapy // Set Electromagnetic Model (one) if (name == "standard_opt3") { emName = name; delete emPhysicsList; emPhysicsList = new G4EmStandardPhysics_option3(); G4cout << "THE FOLLOWING ELECTROMAGNETIC PHYSICS LIST HAS BEEN ACTIVATED: G4EmStandardPhysics_option3" << G4endl; } // Set the hadronic Ones else if (name == "elastic" && !helIsRegisted) { G4cout << "THE FOLLOWING HADRONIC ELASTIC PHYSICS LIST HAS BEEN ACTIVATED: G4HadronElasticPhysics()" << G4endl; hadronPhys.push_back( new G4HadronElasticPhysics()); helIsRegisted = true ; … AddPhysicsList() method: Open the file src/HadrontherapyPhysicsList.cc List of G4VPhysicsConstructor*

15 Physics inside Hadrontherapy A physical parameter that is crucial to obtain good corrispondence with experimental data is the cut (in range). The macro command: /physic/setCuts [length] set the cut for all secondaries (e-, e+, gamma) (open the file src/HadrontherapyPhysicsListMessenger.cc to see all available commands) It define the threshold (measured in terms of range) below wich all secondary particles will NOT be produced: so, for example, a cut of 1 km means that probably no secondary particle will be produced (and tracked). Physical models can be changed with a macro command or directly changing the source.

16 Exercise 6: Change the production cut Let’s now try to change this parameter: Take a look at the file macro/proton_therapy.mac and search for: /physic/setCuts 0.01 mm change this parameter to 1 km then plot the resulting dose distribution. After running your simulation go to the directory RootScripts\proton\BraggPeak Then use the command “root –l comparison.C” to perform the comparison with experimental data. Firstly copy again Hadrontherapy in your $HOME to restore the original configuration of the program

17 Now, playing with the same macro file, run the simulation switching off all the hadronic models. Then plot the Bragg peak. Exercises 7: Modify the Physics models

18 Lookig inside the src/HadrontherapyPhysicsList.cc tell us how many PhysicsLists for the ElectroMagnetic processes are available. Exercises 8: EM Physics models

19 Finally run the simulation activating only the hadronic models! What do you think will happen? Exercises 9: Change Physics parameters

20 1.Open the src/HadrontherapySteppingAction.cc file, then add to the include list the header file 2. Go inside the UserSteppingAction method and add the C++ code to write in a two columns file the following information: The particle name and the kinetic energy of each particle and at each step: 3. Put into the include file the declaration of an ofstream object: std::ofstream ofs; 4. Put this code into class constructor definition : ofs.open(“File.out");// open the file 5. Take a G4ParticleDefinition* pointer just below the UserSteppingAction method: G4ParticleDefinition *def = aStep -> GetTrack() -> GetDefinition(); 6.Use this pointer to move the requested data to the file in a fashion like: 7.ofs GetParticleName() << ‘\t’ << complete by yourself! << G4endl; 6.Save, compile and run for 100 particles hystories. Exercise 10: Store data in an output file

21

22 To zoom on the source: /vis/viewer/zoomTo 5 /vis/viewer/panTo cm To zoom on the phantom: /vis/viewer/zoomTo 5 /vis/viewer/panTo cm

23 Additional Exercises : Set beam source shape 1.Create a rectangular planar beam source whose sizes are (5 x 10 cm) using the function G4UniformRand() that generate a uniform distribution in [0,1] interval. 2. Create a circular planar beam source (radius = 5 cm) similar to the default of Hadrontherapy, but with uniform emission probability.

24 Additional Exercises: Geometry change Remember that any change in the geometry after G4 initialization (namely after the /run/initialize macro command) must be notified to the kernel: G4RunManager::GetRunManager() -> GeometryHasBeenModified(); Now you have to do the geometry modifications, but after the initialization process is done, so after the first /run/initialize macro command…