exgps is created to demonstrate the usage of G4GeneralParticleSource for generating primary particle according to user defined distributions. These range from simple monocromatic point source to complicated mutiple sources with various biasing schemes.
Simple geometry consists of a "Vacuum" world and, in it, two other components:
Tranportation process only for all particles.
The event generator is the G4GeneralParticleSource (GPS). The instantiation of G4GeneralParticleSource is same as that for G4ParticleGun. See the exGPSPrimaryGeneratorAction.cc file for details.
Visualisation of the geometry and the tracks is possible with many of the G4 visualisation packages. An example of displaying the geometry and tracks using OGL is given in the macro vis.mac.
This example implements an histo manager which creates histograms and ntuples using Geant4 analysis tools.
The output file contains 6 histograms and one ntuple:
histo1D 1: energy spectrum. histo1D 2: vertex: radial distribution dN/dv. histo1D 3: angular distribution: cos(theta). histo1D 4: angular distribution: phi.
histo2D 1: vertex position in the X-Y plane. histo2D 2: vertex position in the X-Z plane. histo2D 3: vertex position in the Y-Z plane. histo2D 4: angular distribution: phi-cos(theta). histo2D 5: angular distribution: of phi-theta.
In the ntuple the following data are recorded for each incident particle:
Particle ID Incident Position (x,y,z); Incident Angle (theta,phi); Particle weight;
The histograms are managed by G4AnalysisManager class and its Messenger. The histos can be individually activated with the command :
/analysis/h1/set id nbBins valMin valMax unit
where unit is the desired unit for the histo (MeV or keV, deg or mrad, etc..)
One can control the name of the histograms file with the command:
/analysis/setFileName name (default exgps)
It is possible to choose the format of the histogram file : root (default), xml, csv, by using namespace in HistoManager.hh
% exgps exgps.in
% exgps .... Idle> type your commands .... Idle> exit
There are a number of mac files in the ./macros subdirectory, to show the various features of GPS. Please see macros/README file for further informations.