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 HBOOK file if the user has set up the AIDA 3.0 environment 29 the G4AnalysisManager default file type in Pur << 29 and Anaphe is available. 30 << 30 31 <<<<<<< HEAD << 32 31 33 ======= << 34 >>>>>>> Migration to G4RunManagerFactory done. << 35 1. Setting up the environment variables 32 1. Setting up the environment variables 36 --------------------------------------- 33 --------------------------------------- >> 34 -example enviroment with the compiler 3.2.3 >> 35 -a standard Geant4 example GNUmakefile is provided >> 36 >> 37 setup with: >> 38 compiler = gcc-3.2.3 >> 39 G4SYSTEM = linux-g++ 37 40 38 The following environment variables need to be 41 The following environment variables need to be set: 39 42 40 G4LEDATA: points to low energy data base << 43 G4LEDATA: points to low energy data base - G4EMLOW2.3 >> 44 >> 45 setup for analysis: AIDA 3.2.1, PI 1.2.1 >> 46 >> 47 Users can download the analysis tools from: >> 48 >> 49 http://aida.freehep.org/ >> 50 http://www.cern.ch/PI 41 51 42 The required data-file for the detailed field << 52 The required data-file for the field map can be downloaded from: 43 http://cern.ch/geant4-data/datasets/PurgMag << 53 http://cern.ch/geant4/source/source/PurgMag3D.TABLE.gz 44 54 45 55 46 2. How to run the example 56 2. How to run the example 47 ------------------------- 57 ------------------------- 48 58 49 - Run the "PurgMag" executable. 59 - Run the "PurgMag" executable. 50 - File PurgMag.TABLE needs to be available in 60 - File PurgMag.TABLE needs to be available in the current directory in order to run correctly. 51 - For visualisation use vis.mac. 61 - For visualisation use vis.mac. >> 62 Default visualization is with OpenGL 52 - Interactive or batch modes possible. 63 - Interactive or batch modes possible. 53 Default: Interactive mode. 64 Default: Interactive mode. 54 65 55 To run a certain number of events in interacti 66 To run a certain number of events in interactive mode, 56 type the following at the "idle>" prompt: 67 type the following at the "idle>" prompt: 57 68 58 idle> run/beamOn NumberOfEvents 69 idle> run/beamOn NumberOfEvents 59 idle> exit 70 idle> exit 60 71 61 - Simulation histogram output is stored in pur << 72 - Simulation histogram output is stored in purgmag.hbk 62 purgmag_102.cvs (gammas), purgman_103.cvs (e+ << 63 73 64 1)Ntuple with position, energy and momentum fo 74 1)Ntuple with position, energy and momentum for electrons 65 2)Ntuple with position, energy and momentum fo 75 2)Ntuple with position, energy and momentum for photons 66 (not needed in this example, will be used in 76 (not needed in this example, will be used in further development) 67 3)Ntuple with position, energy and momentum fo 77 3)Ntuple with position, energy and momentum for positrons 68 (not needed in this example, will be used in 78 (not needed in this example, will be used in further development) 69 79 70 A default visualisation macro (vis.mac) is pre << 80 A default vizualisation macro (vis.mac) is pre-loaded before interactive runs. 71 Executing it from the build directory: << 81 Executing it 72 $ ./PurgMag << 82 osmachine.3% $G4WORKDIR/bin/Linux-g++/PurgMag 73 runs vis.mac before giving you an interactive 83 runs vis.mac before giving you an interactive prompt. 74 84 75 85 76 3. Detector description 86 3. Detector description 77 ----------------------- 87 ----------------------- 78 88 79 Simply a measurement volume. All particles ent 89 Simply a measurement volume. All particles entering the volume are scored. 80 90 81 91 82 4. Physics processes 92 4. Physics processes 83 -------------------- 93 -------------------- 84 94 85 This example uses the standard Electromagnetic 95 This example uses the standard Electromagnetic processes. 86 96 87 97 88 5. Particle Generator 98 5. Particle Generator 89 ---------------------- 99 ---------------------- 90 100 91 The PurgMagPrimaryGeneratorAction sets the ini 101 The PurgMagPrimaryGeneratorAction sets the initial state of tracks to 92 102 93 -electrons 50MeV 103 -electrons 50MeV 94 -Start position (0, 0, 15cm) 104 -Start position (0, 0, 15cm) 95 -Momentum direction (0, 0, -1) 105 -Momentum direction (0, 0, -1) 96 106 97 107 98 6. Geometry and materials 108 6. Geometry and materials 99 -------------------------- 109 -------------------------- 100 110 101 The world consists of Vacuum to minimize inter 111 The world consists of Vacuum to minimize interactions of the electrons 102 with the medium. The purging magnet is impleme 112 with the medium. The purging magnet is implemented as a 3D field grid 103 of field values and geometerically as a pole g 113 of field values and geometerically as a pole gap made of iron. The 104 measurement volume also contains vacuum. 114 measurement volume also contains vacuum. 105 115 106 The field is interpolated using a simple linea 116 The field is interpolated using a simple linear interpolation in two 107 dimensions (z and rho). 117 dimensions (z and rho). 108 118 109 7. Comparison 119 7. Comparison 110 -------------- 120 -------------- 111 121 112 The design of the magnetic field was made with 122 The design of the magnetic field was made with the OPERA 3D package 113 which is an electromagnetic finite element and 123 which is an electromagnetic finite element and finite difference 114 analysis software. The deviation in the y-dire 124 analysis software. The deviation in the y-direction (ey in Ntuple 1) 115 has also been calculated in the OPERA 3D modul 125 has also been calculated in the OPERA 3D module TOSCA for comparison. 116 126 117 TOSCA: deviation y-direction: 35.112 cm 127 TOSCA: deviation y-direction: 35.112 cm 118 GEANT4: deviation y-direction: 35.170 cm (upda 128 GEANT4: deviation y-direction: 35.170 cm (updated after PurgMag.pdf) 119 129 120 ********************************************** 130 **************************************************************** 121 * 131 * * 122 * More information about the setup and geometr 132 * More information about the setup and geometry in PurgMag.pdf * 123 * 133 * * 124 ********************************************** 134 ****************************************************************