Adapted from https://github.com/micahfolsom/mgg4
Geant4, ROOT
- singlepixel: a single scintillator pixel
- Default: 2x2x2 mm
- pixelarray: an array of pixels
- Default: 8x8 array of 2x2x2mm pixels
Geometry-related commands defined in the
[GeometryMessenger](@ref MPND::GeometryMessenger)
Command directory: /mpnd/geometry/
General Commands
/mpnd/geometry/reload
Arguments: none
Description: clears out all geometric objects and rebuilds them based
on the current parameters. Must run after changing a physical detector
parameter.
/mpnd/geometry/config
Arguments: singlepixel pixelarray
Description: switch between detector geometries.
Default: singlepixel
/mpnd/geometry/singlepixel/dimensions
Arguments: [x] [y] [z] [units]
Description: set the pixel size.
Default: (2, 2, 2) mm
/mpnd/geometry/singlepixel/material
Arguments: [material name]
Description: set the scintillator material.
Default: ej200
/mpnd/geometry/pixelarray/dimensions
Arguments: [x] [y] [z] [units]
Description: set the pixel size.
Default: (2, 2, 2) mm
/mpnd/geometry/pixelarray/nx
Arguments: [nx]
Description: set the number of X pixels in the array.
Default: 8
/mpnd/geometry/pixelarray/ny
Arguments: [ny]
Description: set the number of Y pixels in the array.
Default: 8
This code uses the built-in Geant4 General Particle Source
(G4GeneralParticleSource). I am not aware of a good tutorial for GPS, but
if you look around online you can find various examples. It also helps
to look at the source code: https://geant4.kek.jp/Reference/10.06.p01/classG4GeneralParticleSource.html
/gps/particle
Arguments: gamma neutron opticalphoton e- proton alpha
Description: defines the particle type using Geant4 naming convention
Default: geantino
/gps/pos/type/
Arguments: Point Plane Beam Surface Volume
Description: set the source positional distribution type
/gps/pos/shape
Arguments: Circle Annulus Ellipse Square Rectangle for a Plane]
Sphere Ellipsoid Cylinder, Para (parallelpiped) [For Surface or Volume]
Descriptions: sets the source shape type after gps/pos/type
.
/gps/direction
Arguments: [Px] [Py] [Pz]
Description: set the momentum direction of generated particles using direction cosines.
Default: (1, 0, 0)
/gps/position
Arguments: [x] [y] [z] [units]
Description: sets the center coordinates (x,y,z) of the source.
Default: (0, 0, 0) cm
/gps/pos/halfx
Arguments:
Description: sets the half-length in x of the source for Square/Rectangle shape.
Default: 0 cm
/gps/pos/halfy
Arguments:
Description: sets the half-length in y of the source Square/Rectangle shape.
Default: 0 cm
/gps/ang/type
Arguments: iso cos planar beam1d beam2d focused user
Description: sets the angular distribution type.
Default: iso
/gps/ene/type
Arguments: Mono Lin Pow Exp Gauss Brem Bbody
Description: sets the energy distribution type.
Default: Mono (mono-energetic)
/gps/ene/min
Arguments: [Emin] [unit]
Description: sets the minimum for the energy distribution
Default: 0 keV
/gps/ene/max
Arguments: [Emax] [unit]
Description: sets the maximum for the energy distribution
Default: 0 keV
/gps/ene/alpha
Arguments: [alpha]
Description: sets the exponent alpha for a power-law distribution.
Default: 0
Commands to modify the different filters applied to the sensitive
detectors. This controls the interaction information that is written to
disk. Defined in [SDMessenger](@ref MPND::SDMessenger)
Command directory: /mpnd/sd/
/mpnd/sd/select_sd
Arguments: [sd_name]
Description: change current selection to specified SD.
Default: scintillator_sd
/mpnd/sd/particle/add
Arguments: [particle name]
Description: add a particle to the filter for the current SD.
/mpnd/sd/particle/remove
Arguments: [particle name]
Description: remove a particle from the filter for the current SD.
/mpnd/sd/particle/clear
Description: clear the particle filter for the current SD.
/mpnd/sd/particle/print
Description: print the particle filter for the current SD.
/mpnd/sd/energy/add
Arguments: [min, max)
Description: add an energy window to the filter for the current SD.
/mpnd/sd/energy/remove
Arguments: [index]
Description: remove an energy window from the filter for the current SD.
/mpnd/sd/energy/clear
Description: clear the energy filter for the current SD.
/mpnd/sd/energy/print
Description: print the energy filter for the current SD.
General run (file path, etc) commands defined in the
[RunMessenger](@ref MPND::RunMessenger)
Command directory: /mpnd/run/
/mpnd/run/path
Arguments: [path/to/file.root]
Description: specify the save file path for the simulation data.
Default: sim.root
/mpnd/run/write_data
Arguments: true false
Description: toggle writing simulation data to disk.
Default: true
/mpnd/run/buffer_limit
Arguments: [number of events] (> 0)
Description: number of events to hold before emptying the event buffer.
The FileManager will block as it empties the queue so if you are doing a
short run, this should be set larger than the number of events being run,
and if a long run, something reasonable (ie. 1000), depending on how long
you expect each write to take.
Default: 1000
/mpnd/run/max_file_size
Arguments: [GB] (> 0)
Description: set the maximum file size allowed before automatic file
splitting by ROOT. Calls TTree::SetMaxTreeSize().
Default: 100 GB
- Do not #include G4SystemOfUnits.hh in header (.hpp) files! You must
only #include it from .cpp files. Doing it in the headers can cause name
conflicts with ROOT which will break things. If you see complaints about
a shadow declaration of variable
s
in ROOT headers, this is why.