Input Macro files
Contents
You're reading the documentation for a development version.
For the latest released version, please have a look at v0.5.1.
4. Input Macro files#
4.1. Standard macro file#
G4SEE macro files are ASCII files with .mac
file format, containing all the user-defined settings, parameters for a single G4SEE application run.
Comments in the macro file start with #
character.
Macro file structure:
PRE-INIT STATE:
Material commands (
/SEE/material/...
)Geometry commands (
/SEE/geometry/...
)Biasing commands (
/SEE/biasing/...
)Physics commands (
/SEE/physics/...
)
INITIALIZATION STATE:
/run/initialize
(mandatory macro command)
IDLE STATE:
Scoring commands (
/SEE/scoring/...
)General Particle Source commands (
/gps/...
)
STARTING RUN:
run/beamOn 100000
(mandatory macro command with arbitrary primary number)
Example macro files:
4.2. Macro file parametrization#
A parametric G4SEE run generates and uses as input a set of different (parametrized) macro files automatically generated by
the g4see.py submit
python script based on a single master macro (.mac
) file and parametric YAML (.yaml
) file.
4.2.1. Parametric macro file#
In the macro file,
@
placeholder characters indicate the exact place to insert the values by the python script.At least one
@
character needed per macro file.One macro command line could include multiple
@
charactersComments (strings after
#
characters) are ignored
Example (parametrizing mean and sigma of beam energy):
# File: examples_parametric/parametrized_macro.mac
# Primaries
/gps/ene/type Gauss
/gps/ene/mono @ # changing this value in a parametric run
/gps/ene/sigma @ # changing this value in a parametric run
/gps/direction 0 0 -1
/gps/pos/centre 0 0 1 mm
/gps/pos/type Point
See examples_parametric/parametrized_macro.mac
.
4.2.2. Parametric YAML file#
Define the related master macro file path with
macro
keyword, using a path relative to that yaml file or an absolute pathDefine list of commands with
command-list
keyword, which contain any@
placeholder to be replaced with values fromvalue-list
keywordDefine value combinations with
value-list
keyword, which will be inserted to placeholders of commands listed with thecommand-list
keywordAll placeholders need to have exactly one value per line in the same order as in
command-list
Example:
# File: examples_parametric/parametric_source.yaml
# macro file path, either absolute or relative to this yaml file
macro: 'parametrized_macro.mac'
# list of commands in macro file (uncommented)
command-list:
- '/gps/ene/mono @'
- '/gps/ene/sigma @'
# values combinations for the macro commands
value-list:
- ['2 MeV', '20 keV']
- ['10 MeV', '65 keV']
- ['15 MeV', '80 keV']
See examples_parametric/parametric_source.yaml
.
4.3. General Geant4 macro commands#
Macro commands related to the initialization and start of a run, as well as other commands, like random number engine and verbosity.
Macro command |
Type |
M? |
Description |
Example value |
Default value |
---|---|---|---|---|---|
|
- |
y |
Initialization of the run |
- |
- |
|
int |
y |
Number of primary particles, starting the simulation |
|
1 |
|
int[2] |
n |
Set seeds for random number engine |
|
random |
|
int |
n |
Verbosity, control ** |
|
0 |
|
int |
n |
Verbosity, event ** |
|
0 |
|
int |
n |
Verbosity, tracking ** |
|
0 |
|
int |
n |
Verbosity, general particle source ** |
|
0 |
|
int |
n |
Number of events to print progress after |
|
-1 |
** Higher verbosity degrades performance and generates large amount of output data. Recommended only for testing input macro files.