|
gparticle
|
The gparticle module implements a simple mechanism to define one or more primary particles from structured options and then shoot them into a G4Event using a G4ParticleGun.
The central class is Gparticle, which encapsulates:
Option parsing is performed via the functions in the gparticle namespace. Those functions translate structured option nodes, such as -gparticle=... and -gparticlefile=..., into inline particles, file-backed event particles, and output-bank records.
The -gparticlefile option configures one or more generated-particle files:
Each file source has a format token and a filename. Built-in readers are registered statically, while external formats can be provided by dynamic plugins named gparticle_<format>_plugin that export GParticleReaderFactory.
Readers expose two related views of the same input:
G4ParticleTable.For Lund files, rows with type == 1 are propagated in Geant4. All parsed rows are preserved in the record view.
During event generation GEMC publishes two generated-particle banks:
generated : inline -gparticle definitions plus all particles parsed from -gparticlefile sources, including rows not propagated in Geant4.generated_tracked : inline -gparticle definitions plus only the file-backed particles propagated in Geant4, normally rows with type == 1.Both banks carry particle name, pid, source type, multiplicity, momentum, theta, phi, and vertex coordinates.
gparticle uses logging through GLogger. When the logger verbosity is:
G4RunManager with a basic physics list.The following excerpt shows how the example program builds the options and retrieves particles: