Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


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

1 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 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 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 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 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 6 Geometry: Phantom & Detector build Typical volumes shape in Hadrontherapy are G4Box: a cuboid shape inherited by G4VSolid

7 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 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 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 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 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 = 35.453*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 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 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 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 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 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 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 18 Lookig inside the src/HadrontherapyPhysicsList.cc tell us how many PhysicsLists for the ElectroMagnetic processes are available. Exercises 8: EM Physics models

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

20 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 21

22 22 To zoom on the source: /vis/viewer/zoomTo 5 /vis/viewer/panTo -100 60 cm To zoom on the phantom: /vis/viewer/zoomTo 5 /vis/viewer/panTo 150 60 cm

23 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 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…


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

Similar presentations


Ads by Google