Primary particle commands
You're reading an old version of this documentation.
For the latest released version, please have a look at v0.5.1.
10. Primary particle commands#
Macro commands related to the primary particle source definition.
All G4 General Particle Source (GPS) macro commands can be used to define primary particles, their attributes and distributions.
Here only few GPS commands are listed briefly. For more commands and details, please go to the Geant4 GPS documentation.
Macro command |
Type |
M? |
Description |
Example values |
Default value |
---|---|---|---|---|---|
|
string |
y |
Incident particle type, using G4 naming convention |
|
geantino |
|
int[2,3] (double) |
n |
Ion properties after |
|
1 1 0 0 |
|
double[3] |
y |
Particle momentum direction (unit vector is not mandatory) |
|
(1,0,0) |
|
string |
n |
Energy distribution type |
|
Mono |
|
double u |
n |
Particle kinetic energy (Gaussian or Mono energy) |
|
1 MeV |
|
double u |
n |
Standard deviation for Gaussian or Mono energy |
|
0 keV |
|
double[3] u |
y |
Source centre coordinates, Defined point has to be inside the World, but should be outside the Target volume! |
|
(0,0,0) cm |
|
string |
n |
Source distribution type |
|
Point |
|
string |
n |
Source shape for Plane, Surface or Volume type source |
|
null |
|
double u |
n |
Half length of source in x or y direction |
|
0 cm |
|
double u |
n |
Standard deviation of beam position profile in x or y direction |
|
0 cm |
|
double u |
n |
Radius of the source or the outer radius for annuli |
|
0 cm |
|
double u |
n |
Transverse (radial) standard deviation of beam position profile |
|
0 cm |
|
string |
n |
Angular distribution type |
|
iso |
|
double u |
n |
Min and Max value for the θ distribution, unit: deg or rad |
|
0 rad; \(\pi\) rad |
|
double u |
n |
Min and Max value for the ϕ distribution, unit: deg or rad |
|
0 rad; \(2\pi\) rad |
|
double u |
n |
Standard deviation of beam directional profile in x or y direction, unit: deg or rad |
|
0 rad |
|
double u |
n |
Standard deviation of beam directional profile in radial, unit: deg or rad |
|
0 rad |
|
string |
n |
User-defined histogram type |
|
- |
|
string |
n |
Re-set the previously specified histogram, it has same options as |
|
- |
|
string |
n |
Import an arbitrary energy histogram from an ASCII file, the format should be one \(E_{hi}\,Weight\) pair per line of the file, same applies for file content as for |
|
- |
|
double[2] |
n |
Specify one entry of a histogram: \(E_{hi}\,Weight\) |
|
- |
|
string |
n |
Interpolation type for point-wise (arb type) spectrum, this command must be issued immediately after the last data point! |
|
- |
|
int |
n |
Number of primary particles to simulate per event |
|
1 |
Please make sure that the centre of particle source (defined by /gps/pos/centre
) is located outside your Target volume! See geometry visualization on the How To Run page.
Using /gps/ion
, always define the ion charge too!
With /gps/direction
, to have a mono-directional particle beam, define (0,0,-1) as direction!
Regarding User-defined histograms: “Histograms are differential functions. Currently histograms are limited to 1024 bins.
The first value of each user input data pair is treated as the upper edge of the histogram bin and the second value is the bin content.
The exception is the very first data pair the user input whose first value is the treated as the lower edge of the first bin of the histogram,
and the second value is not used. This rule applies to all distribution histograms.”
Within histogram file, start lines with /gps/hist/point
macro command and bin width has to be uniform either on lin or log scale.
Specify one entry with Weight: \(E_{hi}\,Weight\) in a histogram, where \(E_{hi}\) is the bin upper edge, and \(E_{hi}\) must be in G4 default units (MeV for energy, rad for angle).
## User-defined histogram
/gps/ene/type User # User-defined histogram
/gps/hist/type energy
/control/execute /abs/path/to/spectrum/energy_histogram.mac
The energy_histogram.mac
:
# hist points E_hi(MeV) Weight
/gps/hist/point 0. 1.1
/gps/hist/point 1. 2.2
/gps/hist/point 2. 3.3
The other option is to define point-wise spectrum (differential or integral) with an ASCII file. Interpolation between data points has to be defined. One entry in hist file for point-wise distribution: \(E_{hi}\,Weight\). The abscissa \(E_{hi}\) must be in G4 default units (MeV for energy, rad for angle).
## Pointwise data with interpolation between data points
/gps/ene/type Arb # Point-wise data
/gps/ene/diffspec true # true = differential, false = integral
/gps/hist/type arb # arb (point-wise histogram)
/gps/hist/file /abs/path/to/spectrum/pointwise_energy.ascii
/gps/hist/inter Lin # interpolation: linear, logarithmic, exp, spline
When using /gps/hist/file
, define hist file with an absolute path!
With GPS, multiple source specification is also possible at the same time.