| 1 |
|
|---|
| 2 | =========================================================
|
|---|
| 3 | Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
|---|
| 4 | =========================================================
|
|---|
| 5 |
|
|---|
| 6 | Extended Example for G4GeneralParticleSource (GPS)
|
|---|
| 7 | ---------------------------------------
|
|---|
| 8 |
|
|---|
| 9 | exGPS is created to demonstrate the usage of G4GeneralParticleSource for generating
|
|---|
| 10 | primary incident particle according to user defined distributions. These range from simple
|
|---|
| 11 | monocromatic point source to complicated mutiple sources with various biasing schemes.
|
|---|
| 12 |
|
|---|
| 13 | More detailed information on the usage of GPS are available on its home site:
|
|---|
| 14 | http://reat.space.qinetiq.com/gps
|
|---|
| 15 |
|
|---|
| 16 | -------------------------------------------------------------------------------------------
|
|---|
| 17 | 1. GEOMETRY
|
|---|
| 18 |
|
|---|
| 19 | Simple geometry consists of a "Vacuum" world and, in it with two other components:
|
|---|
| 20 |
|
|---|
| 21 | - An alunimium box : 20 x 20 x 20 cm in size, cerntered at the origin.
|
|---|
| 22 |
|
|---|
| 23 | - A SiO2 sphere: 5 cm in radius and is placed in the centre of the aluminium box.
|
|---|
| 24 |
|
|---|
| 25 | 2. PHYSICS
|
|---|
| 26 |
|
|---|
| 27 | Tranportation process only for all particles.
|
|---|
| 28 |
|
|---|
| 29 | 3. EVENT:
|
|---|
| 30 |
|
|---|
| 31 | The event generator is the G4GeneralParticleSource (GPS). The instantiation of G4GeneralParticleSource
|
|---|
| 32 | is same as that for G4ParticleGun. See the exGPSPrimaryGeneratorAction.cc file for details .
|
|---|
| 33 |
|
|---|
| 34 | 5. VISUALIZATION:
|
|---|
| 35 |
|
|---|
| 36 | Visualisation of the geometry and the tracks is possible with many of the G4 visualisation packages. An
|
|---|
| 37 | example of displaying the geometry and tracks using VRML is given in the macro file vis.mac.
|
|---|
| 38 |
|
|---|
| 39 | 6. ANALYSIS:
|
|---|
| 40 |
|
|---|
| 41 | This example implements an AIDA-compliant analysis manager which creates histograms and ntuples.
|
|---|
| 42 | If user has an AIDA-compliant tool such as AIDAJNI, ANAPHE, OpenScientist or PI installed on his/her system. Some URLs :
|
|---|
| 43 | http://aida.freehep.org/
|
|---|
| 44 | http://java.freehep.org/aidajni
|
|---|
| 45 | http://www.cern.ch/PI
|
|---|
| 46 | http://OpenScientist.lal.in2p3.fr
|
|---|
| 47 |
|
|---|
| 48 | The analysis part of this example can be activated by doing a "source
|
|---|
| 49 | aida-setup" of the AIDA compliant tool (to activate the aida-config
|
|---|
| 50 | program) and by raising some environment variabless so that the
|
|---|
| 51 | G4 GNUmakefile system can take into account the AIDA tool.
|
|---|
| 52 | This can be done, for example on a UNIX under a csh like shell, with :
|
|---|
| 53 | csh> source <path_where_the_AIDA_tool_is_installed>/aida-setup.csh
|
|---|
| 54 | csh> aida-config # to check that this program is up and running
|
|---|
| 55 | G4 related part :
|
|---|
| 56 | csh> setenv G4ANALYSIS_USE 1
|
|---|
| 57 | csh> setenv G4ANALYSIS_AIDA_CONFIG_CFLAGS `aida-config --include`
|
|---|
| 58 | csh> setenv G4ANALYSIS_AIDA_CONFIG_LIBS `aida-config --lib`
|
|---|
| 59 |
|
|---|
| 60 | (It may be usefull to note that in the G4 GNUmakefile system,
|
|---|
| 61 | the upper variables are used in the file config/analysis.gmk).
|
|---|
| 62 |
|
|---|
| 63 | This needs to be done before building the executable.
|
|---|
| 64 |
|
|---|
| 65 | At the end of an excution, an xml file "exgps.aida" is created by default which contains
|
|---|
| 66 | histograms and ntuples. User can change the name and format of this output file with the commands
|
|---|
| 67 |
|
|---|
| 68 | /analysis/filetype new-type
|
|---|
| 69 | /analysis/fileName new-filename
|
|---|
| 70 |
|
|---|
| 71 | e.g.
|
|---|
| 72 |
|
|---|
| 73 | /analysis/filetype root
|
|---|
| 74 | /analysis/filename myfile.root
|
|---|
| 75 |
|
|---|
| 76 | these change the output file format to ROOT and output file name to "myfile.root". There are three file
|
|---|
| 77 | formats to choose from: xml, root or hbook.
|
|---|
| 78 |
|
|---|
| 79 | The output file conatins 6 histograms and one ntuple:
|
|---|
| 80 |
|
|---|
| 81 | histogram 1: The energy spectrum of the primary particles.
|
|---|
| 82 | histogram 2: 2d histogram of primary particle incident position distribution in the X-Y plane.
|
|---|
| 83 | histogram 3: 2d histogram of primary particle incident position distribution in the X-Z plane.
|
|---|
| 84 | histogram 4: 2d histogram of primary particle incident position distribution in the Y-Z plane.
|
|---|
| 85 | histogram 5: 2d histogram of primary particle incident angle distribution in terms of Phi/Cos(Theta).
|
|---|
| 86 | histogram 6: 2d histogram of primary particle incident angle distribution in terms of Phi/Theta.
|
|---|
| 87 |
|
|---|
| 88 | The binnings of the histograms can be changed with the UI commands avialable under the
|
|---|
| 89 | /analysis directory.
|
|---|
| 90 |
|
|---|
| 91 | In the ntuple the following data are recorded for each incident particle:
|
|---|
| 92 |
|
|---|
| 93 | Particle ID
|
|---|
| 94 | Incident Position (x,y,z);
|
|---|
| 95 | Incident Angle (theta,phi);
|
|---|
| 96 | Particle weight;
|
|---|
| 97 |
|
|---|
| 98 | 7. GETTING STARTED:
|
|---|
| 99 |
|
|---|
| 100 | i) If you have an AIDA-compliant analysis package installed, then you should switch on the analysis
|
|---|
| 101 | part of the example by:
|
|---|
| 102 |
|
|---|
| 103 | setenv G4ANALYSIS_USE 1
|
|---|
| 104 |
|
|---|
| 105 | otherwise do
|
|---|
| 106 |
|
|---|
| 107 | unsetenv G4ANALYSIS_USE
|
|---|
| 108 |
|
|---|
| 109 | to remove the generation of an output file.
|
|---|
| 110 |
|
|---|
| 111 | ii) Build the exGPS executable:
|
|---|
| 112 |
|
|---|
| 113 | cd to exgps
|
|---|
| 114 | gmake clean
|
|---|
| 115 | gmake
|
|---|
| 116 |
|
|---|
| 117 | gmake will create tmp and bin directories in your $G4TMP and $G4BIN directories.
|
|---|
| 118 | The executable, named exGPS, will be created in the $G4BIN/$G4SYSTEM/ directory.
|
|---|
| 119 |
|
|---|
| 120 | iii) Run the executable:
|
|---|
| 121 |
|
|---|
| 122 | while in the exgps directory do
|
|---|
| 123 |
|
|---|
| 124 | $G4BIN/$G4SYSTEM/exGPS exrgps.in
|
|---|
| 125 |
|
|---|
| 126 | If G4ANALYSIS_USE is defined, and dpends on the particular AIDA system used, e.g. JAIDA, one could see
|
|---|
| 127 | a display window of the six histograms. It may be neccessary to close the plotter window in order to
|
|---|
| 128 | terminate the execution. After the termination one will find the "exgps.aida", as well as a vrml file
|
|---|
| 129 | "g4_00.wrl" in the directory.
|
|---|
| 130 |
|
|---|
| 131 | 8. FURTHER EXAMPLES of MACRO FILES:
|
|---|
| 132 |
|
|---|
| 133 | There are a number of g4mac files in the ./macros subdirectory, to show the various features of GPS.
|
|---|
| 134 | Most of them will lead to the creation of an aida file in the same name as the macro file.
|
|---|
| 135 | These aida files can be examed and analysed with an analysis tool such as JAS3.
|
|---|
| 136 |
|
|---|
| 137 | Please see the README file there for further information.
|
|---|
| 138 |
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|