Geant4 Cross Reference |
1 ---------------------------------------------- 1 ------------------------------------------------------------------- 2 2 3 ========================================= 3 ========================================================= 4 Geant4 - an Object-Oriented Toolkit for S 4 Geant4 - an Object-Oriented Toolkit for Simulation in HEP 5 ========================================= 5 ========================================================= 6 6 7 purgin_magnet 7 purgin_magnet 8 ------------- 8 ------------- 9 s. Larsson, May 2004 9 s. Larsson, May 2004 10 10 11 ---------------------------------------------- 11 ----------------------------------------------------------------- 12 Acknowledgments to the GEANT4 Collaboration, i << 12 Acknowledgments to GEANT4 people, in particular to J. Apostolakis, 13 J Generowicz, G. Folger, Vladimir Ivanchenko, 13 J Generowicz, G. Folger, Vladimir Ivanchenko, M.G.Pia and 14 S. Guatelli. 14 S. Guatelli. 15 ---------------------------------------------- 15 ----------------------------------------------------------------- 16 16 17 0. Introduction 17 0. Introduction 18 ---------------- 18 ---------------- 19 19 20 This example simulates electrons traveling thr 20 This example simulates electrons traveling through a 3D magnetic field. 21 21 22 The Purging Magnet example is an application o 22 The Purging Magnet example is an application of Geant4 in a medical 23 environment. It simulates a strong purging mag 23 environment. It simulates a strong purging magnet in a treatment head. 24 The geometry is very simplified. The major ide 24 The geometry is very simplified. The major idea of this example is to 25 implement an external magnetic field grid and 25 implement an external magnetic field grid and test if the deviation of 26 electrons are as expected in this particular f 26 electrons are as expected in this particular field. The data (position, 27 energy and momentum) are collected in a measur << 27 energy and momentum) are collected in a measurement volume.The data is 28 stored in a CSV file (or, optionally in a ROOT << 28 stored in a CSV file (or, optionally in a ROOT, or a XML file, by 29 the G4AnalysisManager default file type in Pur << 29 commenting/uncommenting the appropriate #includes in PurgMagAnalysisManager.hh) 30 30 31 <<<<<<< HEAD << 31 32 32 33 ======= << 34 >>>>>>> Migration to G4RunManagerFactory done. << 35 1. Setting up the environment variables 33 1. Setting up the environment variables 36 --------------------------------------- 34 --------------------------------------- 37 35 38 The following environment variables need to be 36 The following environment variables need to be set: 39 37 40 G4LEDATA: points to low energy data base 38 G4LEDATA: points to low energy data base 41 39 42 The required data-file for the detailed field 40 The required data-file for the detailed field map can be downloaded from: 43 http://cern.ch/geant4-data/datasets/PurgMag 41 http://cern.ch/geant4-data/datasets/PurgMag3D.TABLE.gz 44 42 45 43 46 2. How to run the example 44 2. How to run the example 47 ------------------------- 45 ------------------------- 48 46 49 - Run the "PurgMag" executable. 47 - Run the "PurgMag" executable. 50 - File PurgMag.TABLE needs to be available in 48 - File PurgMag.TABLE needs to be available in the current directory in order to run correctly. 51 - For visualisation use vis.mac. 49 - For visualisation use vis.mac. 52 - Interactive or batch modes possible. 50 - Interactive or batch modes possible. 53 Default: Interactive mode. 51 Default: Interactive mode. 54 52 55 To run a certain number of events in interacti 53 To run a certain number of events in interactive mode, 56 type the following at the "idle>" prompt: 54 type the following at the "idle>" prompt: 57 55 58 idle> run/beamOn NumberOfEvents 56 idle> run/beamOn NumberOfEvents 59 idle> exit 57 idle> exit 60 58 61 - Simulation histogram output is stored in pur 59 - Simulation histogram output is stored in purgmag_101.cvs (e-), 62 purgmag_102.cvs (gammas), purgman_103.cvs (e+ 60 purgmag_102.cvs (gammas), purgman_103.cvs (e+) 63 61 64 1)Ntuple with position, energy and momentum fo 62 1)Ntuple with position, energy and momentum for electrons 65 2)Ntuple with position, energy and momentum fo 63 2)Ntuple with position, energy and momentum for photons 66 (not needed in this example, will be used in 64 (not needed in this example, will be used in further development) 67 3)Ntuple with position, energy and momentum fo 65 3)Ntuple with position, energy and momentum for positrons 68 (not needed in this example, will be used in 66 (not needed in this example, will be used in further development) 69 67 70 A default visualisation macro (vis.mac) is pre 68 A default visualisation macro (vis.mac) is pre-loaded before interactive runs. 71 Executing it from the build directory: 69 Executing it from the build directory: 72 $ ./PurgMag 70 $ ./PurgMag 73 runs vis.mac before giving you an interactive 71 runs vis.mac before giving you an interactive prompt. 74 72 75 73 76 3. Detector description 74 3. Detector description 77 ----------------------- 75 ----------------------- 78 76 79 Simply a measurement volume. All particles ent 77 Simply a measurement volume. All particles entering the volume are scored. 80 78 81 79 82 4. Physics processes 80 4. Physics processes 83 -------------------- 81 -------------------- 84 82 85 This example uses the standard Electromagnetic 83 This example uses the standard Electromagnetic processes. 86 84 87 85 88 5. Particle Generator 86 5. Particle Generator 89 ---------------------- 87 ---------------------- 90 88 91 The PurgMagPrimaryGeneratorAction sets the ini 89 The PurgMagPrimaryGeneratorAction sets the initial state of tracks to 92 90 93 -electrons 50MeV 91 -electrons 50MeV 94 -Start position (0, 0, 15cm) 92 -Start position (0, 0, 15cm) 95 -Momentum direction (0, 0, -1) 93 -Momentum direction (0, 0, -1) 96 94 97 95 98 6. Geometry and materials 96 6. Geometry and materials 99 -------------------------- 97 -------------------------- 100 98 101 The world consists of Vacuum to minimize inter 99 The world consists of Vacuum to minimize interactions of the electrons 102 with the medium. The purging magnet is impleme 100 with the medium. The purging magnet is implemented as a 3D field grid 103 of field values and geometerically as a pole g 101 of field values and geometerically as a pole gap made of iron. The 104 measurement volume also contains vacuum. 102 measurement volume also contains vacuum. 105 103 106 The field is interpolated using a simple linea 104 The field is interpolated using a simple linear interpolation in two 107 dimensions (z and rho). 105 dimensions (z and rho). 108 106 109 7. Comparison 107 7. Comparison 110 -------------- 108 -------------- 111 109 112 The design of the magnetic field was made with 110 The design of the magnetic field was made with the OPERA 3D package 113 which is an electromagnetic finite element and 111 which is an electromagnetic finite element and finite difference 114 analysis software. The deviation in the y-dire 112 analysis software. The deviation in the y-direction (ey in Ntuple 1) 115 has also been calculated in the OPERA 3D modul 113 has also been calculated in the OPERA 3D module TOSCA for comparison. 116 114 117 TOSCA: deviation y-direction: 35.112 cm 115 TOSCA: deviation y-direction: 35.112 cm 118 GEANT4: deviation y-direction: 35.170 cm (upda 116 GEANT4: deviation y-direction: 35.170 cm (updated after PurgMag.pdf) 119 117 120 ********************************************** 118 **************************************************************** 121 * 119 * * 122 * More information about the setup and geometr 120 * More information about the setup and geometry in PurgMag.pdf * 123 * 121 * * 124 ********************************************** 122 ****************************************************************