[807] | 1 | ------------------------------------------------------------------- |
---|
| 2 | |
---|
| 3 | ========================================================= |
---|
| 4 | Geant4 - an Object-Oriented Toolkit for Simulation in HEP |
---|
| 5 | ========================================================= |
---|
| 6 | |
---|
| 7 | purgin_magnet |
---|
| 8 | ------------- |
---|
| 9 | s. Larsson, May 2004 |
---|
| 10 | |
---|
| 11 | ----------------------------------------------------------------- |
---|
| 12 | Acknowledgments to GEANT4 people, in particular to J. Apostolakis, |
---|
| 13 | J Generowicz, G. Folger, Vladimir Ivanchenko, M.G.Pia and |
---|
| 14 | S. Guatelli. |
---|
| 15 | ----------------------------------------------------------------- |
---|
| 16 | |
---|
| 17 | 0. Introduction |
---|
| 18 | ---------------- |
---|
| 19 | |
---|
| 20 | This example simulates electrons traveling through a 3D magnetic field. |
---|
| 21 | |
---|
| 22 | The Purging Magnet example is an application of Geant4 in a medical |
---|
| 23 | environment. It simulates a strong purging magnet in a treatment head. |
---|
| 24 | The geometry is very simplified. The major idea of this example is to |
---|
| 25 | implement an external magnetic field grid and test if the deviation of |
---|
| 26 | electrons are as expected in this particular field. The data (position, |
---|
| 27 | energy and momentum) are collected in a measurement volume.The data is |
---|
| 28 | stored in a HBOOK file if the user has set up the AIDA 3.0 environment |
---|
| 29 | and Anaphe is available. |
---|
| 30 | |
---|
| 31 | |
---|
| 32 | 1. Setting up the environment variables |
---|
| 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++ |
---|
| 40 | |
---|
| 41 | The following environment variables need to be set: |
---|
| 42 | |
---|
| 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 |
---|
| 51 | |
---|
| 52 | The required data-file for the field map can be downloaded from: |
---|
| 53 | http://cern.ch/geant4/source/source/PurgMag3D.TABLE.gz |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | 2. How to run the example |
---|
| 57 | ------------------------- |
---|
| 58 | |
---|
| 59 | - Run the "PurgMag" executable. |
---|
| 60 | - File PurgMag.TABLE needs to be available in the current directory in order to run correctly. |
---|
| 61 | - For visualisation use vis.mac. |
---|
| 62 | Default visualization is with OpenGL |
---|
| 63 | - Interactive or batch modes possible. |
---|
| 64 | Default: Interactive mode. |
---|
| 65 | |
---|
| 66 | To run a certain number of events in interactive mode, |
---|
| 67 | type the following at the "idle>" prompt: |
---|
| 68 | |
---|
| 69 | idle> run/beamOn NumberOfEvents |
---|
| 70 | idle> exit |
---|
| 71 | |
---|
| 72 | - Simulation histogram output is stored in purgmag.hbk |
---|
| 73 | |
---|
| 74 | 1)Ntuple with position, energy and momentum for electrons |
---|
| 75 | 2)Ntuple with position, energy and momentum for photons |
---|
| 76 | (not needed in this example, will be used in further development) |
---|
| 77 | 3)Ntuple with position, energy and momentum for positrons |
---|
| 78 | (not needed in this example, will be used in further development) |
---|
| 79 | |
---|
| 80 | A default vizualisation macro (vis.mac) is pre-loaded before interactive runs. |
---|
| 81 | Executing it |
---|
| 82 | osmachine.3% $G4WORKDIR/bin/Linux-g++/PurgMag |
---|
| 83 | runs vis.mac before giving you an interactive prompt. |
---|
| 84 | |
---|
| 85 | |
---|
| 86 | 3. Detector description |
---|
| 87 | ----------------------- |
---|
| 88 | |
---|
| 89 | Simply a measurement volume. All particles entering the volume are scored. |
---|
| 90 | |
---|
| 91 | |
---|
| 92 | 4. Physics processes |
---|
| 93 | -------------------- |
---|
| 94 | |
---|
| 95 | This example uses the standard Electromagnetic processes. |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | 5. Particle Generator |
---|
| 99 | ---------------------- |
---|
| 100 | |
---|
| 101 | The PurgMagPrimaryGeneratorAction sets the initial state of tracks to |
---|
| 102 | |
---|
| 103 | -electrons 50MeV |
---|
| 104 | -Start position (0, 0, 15cm) |
---|
| 105 | -Momentum direction (0, 0, -1) |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | 6. Geometry and materials |
---|
| 109 | -------------------------- |
---|
| 110 | |
---|
| 111 | The world consists of Vacuum to minimize interactions of the electrons |
---|
| 112 | with the medium. The purging magnet is implemented as a 3D field grid |
---|
| 113 | of field values and geometerically as a pole gap made of iron. The |
---|
| 114 | measurement volume also contains vacuum. |
---|
| 115 | |
---|
| 116 | The field is interpolated using a simple linear interpolation in two |
---|
| 117 | dimensions (z and rho). |
---|
| 118 | |
---|
| 119 | 7. Comparison |
---|
| 120 | -------------- |
---|
| 121 | |
---|
| 122 | The design of the magnetic field was made with the OPERA 3D package |
---|
| 123 | which is an electromagnetic finite element and finite difference |
---|
| 124 | analysis software. The deviation in the y-direction (ey in Ntuple 1) |
---|
| 125 | has also been calculated in the OPERA 3D module TOSCA for comparison. |
---|
| 126 | |
---|
| 127 | TOSCA: deviation y-direction: 35.112 cm |
---|
| 128 | GEANT4: deviation y-direction: 35.170 cm (updated after PurgMag.pdf) |
---|
| 129 | |
---|
| 130 | **************************************************************** |
---|
| 131 | * * |
---|
| 132 | * More information about the setup and geometry in PurgMag.pdf * |
---|
| 133 | * * |
---|
| 134 | **************************************************************** |
---|