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:

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 @ characters

  • Comments (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 path

  • Define list of commands with command-list keyword, which contain any @ placeholder to be replaced with values from value-list keyword

  • Define value combinations with value-list keyword, which will be inserted to placeholders of commands listed with the command-list keyword

    • All 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

/run/initialize

-

y

Initialization of the run

-

-

/run/beamOn

int

y

Number of primary particles, starting the simulation

10000

1

/random/setSeeds

int[2]

n

Set seeds for random number engine

1111 2222

random

/control/verbose

int

n

Verbosity, control **

1

0

/event/verbose

int

n

Verbosity, event **

1

0

/tracking/verbose

int

n

Verbosity, tracking **

1

0

/gps/verbose

int

n

Verbosity, general particle source **

1

0

/run/printProgress

int

n

Number of events to print progress after

1000

-1

** Higher verbosity degrades performance and generates large amount of output data. Recommended only for testing input macro files.