Warning, /geant4/examples/extended/eventgenerator/exgps/README.md is written in an unsupported language. File is not indexed.
0001 \page Exampleexgps Example exgps
0002
0003 exgps is created to demonstrate the usage of G4GeneralParticleSource
0004 for generating primary particle according to user defined distributions.
0005 These range from simple monocromatic point source to complicated mutiple
0006 sources with various biasing schemes.
0007
0008 ## GEOMETRY
0009
0010 Simple geometry consists of a "Vacuum" world and, in it, two other components:
0011 - An alunimium box : 20 x 20 x 20 cm in size, cerntered at the origin.
0012 - A SiO2 sphere (radius 5 cm) is placed at the centre of the aluminium box.
0013
0014 ## PHYSICS
0015
0016 Tranportation process only for all particles.
0017
0018 ## EVENT
0019
0020 The event generator is the G4GeneralParticleSource (GPS). The instantiation of
0021 G4GeneralParticleSource is same as that for G4ParticleGun.
0022 See the exGPSPrimaryGeneratorAction.cc file for details.
0023
0024 ## VISUALIZATION
0025
0026 Visualisation of the geometry and the tracks is possible with many of the
0027 G4 visualisation packages.
0028 An example of displaying the geometry and tracks using OGL is given in the
0029 macro vis.mac.
0030
0031 ## HISTOGRAMS
0032
0033 This example implements an histo manager which creates histograms and
0034 ntuples using Geant4 analysis tools.
0035
0036 The output file can contain the following histograms and one ntuple:
0037
0038 - histo1D 1: energy spectrum.
0039 - histo1D 2: vertex: radial distribution dN/dv.
0040 - histo1D 3: angular distribution: cos(theta).
0041 - histo1D 4: angular distribution: phi.
0042
0043 - histo2D 1: vertex position in the X-Y plane.
0044 - histo2D 2: vertex position in the X-Z plane.
0045 - histo2D 3: vertex position in the Y-Z plane.
0046 - histo2D 4: angular distribution: phi-cos(theta).
0047 - histo2D 5: angular distribution: of phi-theta.
0048
0049 In the ntuple the following data are recorded for each incident particle:
0050
0051 - Particle ID
0052 - Kinetic energy (Ekin);
0053 - Incident Position (x,y,z);
0054 - Incident Angle (theta,phi);
0055 - Particle weight;
0056
0057 The histograms are managed by G4AnalysisManager class and its Messenger.
0058 The histos, not activated by default, can be individually activated with the command :
0059 ```
0060 /analysis/h1/set id nbBins valMin valMax unit
0061 ```
0062 where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
0063
0064 One can control the name of the histograms file with the command:
0065 ```
0066 /analysis/setFileName name (default exgps)
0067 ```
0068
0069 It is possible to choose the format of the histogram file : root (default),
0070 xml, csv, by using namespace in HistoManager.hh
0071
0072
0073 ## GETTING STARTED
0074
0075 - Execute exgps in 'batch' mode from macro files
0076 ```
0077 % ./exgps exgps.in
0078 % ./exgps exgps_MT.in # larger number of events
0079 ```
0080
0081 - Execute exgps in 'interactive mode' with visualization
0082 ```
0083 % ./exgps
0084 ....
0085 Idle> type your commands
0086 ....
0087 Idle> exit
0088 ```
0089
0090 ## FURTHER EXAMPLES of MACRO FILES
0091
0092 There are a number of mac files in the ./macros subdirectory, to show the
0093 various features of GPS.
0094
0095 - test01.mac : point source, isotropic radiation, monoenergetic
0096
0097 - test02.mac : square plane source, cosine-law radiation, linear energy
0098
0099 - test03.mac : rectangular plane source, isotropic radiation, power-law energy
0100
0101 - test04.mac : circular plane source, cosine-law radiation, exponential energy
0102
0103 - test05.mac : elliptical plane source, isotropic radiation, bremsstrahlung energy
0104
0105 - test06.mac : spherical surface source, isotropic radiation, black-body energy
0106
0107 - test07.mac : cylindrical surface source, cosine-law radiation, Cosmic diffuse energy
0108
0109 - test08.mac : elliptical surface source, isotropic radiation, linear energy
0110
0111 - test09.mac : parallepiped surface source, isotropic radiation, linear energy
0112
0113 - test10.mac : spherical volume source, isotropic radiation, linear energy
0114
0115 - test11.mac : cylindrical volume source, isotropic radiation, power-law energy
0116
0117 - test12.mac : elliptical volume source, isotropic radiation, power-law energy
0118
0119 - test13.mac : parallelepiped volume source, cosine-law radiation, exponential energy
0120
0121 - test14.mac : rotated circular plane source, isotropic radiation, exponential energy
0122
0123 - test15.mac : rotated surface cylinder source, isotropic radiation, bremsstrahlung energy
0124
0125 - test16.mac : rotated parallelepiped volume source, isotropic radiation, bremsstrahlung energy
0126
0127 - test17.mac : confined spherical volume source, isotropic radiation, exponential energy
0128
0129 - test18.mac : square plane source, cosine-law radiation, user-defined energy histogram
0130
0131 - test19.mac : square plane source, cosine-law radiation, arbitrary point-wise energy function
0132 with linear interpolation.
0133
0134 - test20.mac : square plane source, cosine-law radiation, arbitrary point-wise energy function
0135 with logarithmic interpolation.
0136
0137 - test21.mac : square plane source, cosine-law radiation, arbitrary point-wise energy function
0138 with exponential interpolation.
0139
0140 - test22.mac : square plane source, cosine-law radiation, arbitrary point-wise energy function
0141 with spline interpolation.
0142
0143 - test23.mac : square plane source with x and y biasing, user-defined theta and phi
0144 distributions, user-defined EPN energy distribution.
0145
0146 - test24.mac : spherical volume source with z biasing, isotropic radiation with theta and phi
0147 biasing, arbitrary point-wise energy function with linear interpolation.
0148
0149 - test25.mac : spherical volume source, isotropic radiation with theta and phi biasing,
0150 user-defined energy histogram.
0151
0152 - test26.mac : square plane source, cosine-law radiation with lower and upper theta and phi
0153 limits, linear energy with biasing.
0154
0155 - test27.mac : square plane source, user-defined theta, arbitrary point-wise energy function
0156 with linear interpolation.
0157
0158 - test28.mac : particle=ion, square plane source, isotropic radiation, monoenergetic energy.
0159
0160 - test29.mac : plane source of type annulus, cosine-law radiation, exponential energy
0161
0162 - test30.mac : rotated 1d beam source, Gaussian beam energy.
0163
0164 - test31.mac : two-beam incidence, i.e. multiple sources with relative intensities.
0165
0166 - test32.mac : Sphere volume source, with biasing in theta and phi
0167 Isotropic directional distribution with theta and phi biasing.
0168
0169 - test33.mac : Focused angular distribution.
0170
0171 - test34.mac : Two simultaneous sources, both fired at the same time.
0172
0173 - test35.mac : automatic biasing of the energy distribution sampling, original in power-law.
0174
0175 - test36.mac : automatic biasing of the energy distribution sampling, original in arbitrary
0176 data points.
0177
0178 - test37.mac : automatic biasing of the energy distribution sampling, original in exponential
0179 form.
0180
0181 - test38.mac : arbitrary energy distribution, defined using the ascii input file: spectrum.dat
0182
0183 All these test macros can be run via the runall.csh script and the resulting ROOT
0184 files can be then analysed with the 'plotall.py' macro, calling internally
0185 'plotfiles.py':
0186
0187 ```
0188 % ./macros/runall.csh
0189 % python3 macros/plotall.py
0190 ```
0191
0192 In addition, the examples of ROOT macros plotHisto.C and plottest35.C are also available.
0193
0194 More information is available at:
0195 https://geant4-userdoc.web.cern.ch/UsersGuides/ForApplicationDeveloper/html/GettingStarted/generalParticleSource.html