Back to home page

EIC code displayed by LXR

 
 

    


Warning, /eic-opticks/docs/configuration.md is written in an unsupported language. File is not indexed.

0001 # Runtime configuration
0002 
0003 Simphony applications use a named JSON file as the canonical runtime
0004 configuration. Pass the basename with `-c` or `--config`; for example,
0005 `-c wls_test` loads `wls_test.json`. Files are searched in the installed
0006 configuration directories, or only in `SIMPHONY_CONFIG_DIR` when that
0007 environment variable is set.
0008 
0009 ```bash
0010 SIMPHONY_CONFIG_DIR=$PWD/config \
0011     GPUPhotonSourceMinimal \
0012     -g tests/geom/wls_test.gdml \
0013     -c wls_test \
0014     -m tests/run.mac \
0015     -s 42
0016 ```
0017 
0018 The public typed representation is `simphony::Config` in
0019 `sysrap/config.h`. `Config` parses the selected file and applies event values
0020 through `SEventConfig`, which remains the process-wide low-level facade used
0021 by Opticks code.
0022 
0023 ## Defaults and discovery
0024 
0025 An event setting is selected from an explicit key in the chosen JSON file or,
0026 when omitted, from the typed application default documented below. `Config`
0027 applies the complete result to the process-wide `SEventConfig` facade before
0028 event creation.
0029 
0030 `SIMPHONY_CONFIG_DIR` and `SIMPHONY_PTX_DIR` are discovery variables, not
0031 event settings, and remain supported.
0032 
0033 Application entry points must construct `Config` before creating an `SEvt`
0034 or initializing the Simphony runtime. The DD4hep `OpticsRun` action does so
0035 once, at the first begin-of-run, from its `ConfigName` property. Its default
0036 basename is `dd4hep_gpu`; attempting to select another configuration after
0037 initialization is rejected because `SEventConfig` is process-wide.
0038 
0039 ## Event schema
0040 
0041 All keys in this table belong to the top-level `event` object. Defaults are
0042 the effective application values used when JSON omits a key.
0043 
0044 | JSON key | Type and default | Purpose |
0045 |----------|------------------|---------|
0046 | `event_mode` | name, `Minimal` | Selects GPU-to-CPU gathering and CPU-to-file persistence. Accepted names are `DebugHeavy`, `DebugLite`, `Nothing`, `Minimal`, `Hit`, `HitPhoton`, `HitPhotonSeq`, and `HitSeq`. The old `mode` spelling is not an alias. |
0047 | `integration_mode` | integer, `-1` | Selects Opticks/framework integration: `-1` disabled, `1` GPU, `2` CPU, `3` both. |
0048 | `running_mode` | name, `SRM_DEFAULT` | Selects the source or Geant4 state workflow. Accepted values are the `SRM_*` names understood by `SRM`. |
0049 | `start_index` | integer, `0` | Offset added to externally visible and persisted event indices. |
0050 | `num_event` | integer, `1` | Event count used by low-level multi-event helpers. Application run managers can have their own event-count control. |
0051 | `event_skipahead` | integer, `100000` | Number of random values skipped between event indices. |
0052 | `g4_state_spec` | string, `1000:38` | Geant4 random-state allocation specification. |
0053 | `g4_state_rerun` | integer, `-1` | Photon index selected when `running_mode` enables a saved-state rerun. |
0054 | `max_bounce` | integer, `31` | Maximum optical-photon bounce count. |
0055 | `max_genstep` | integer, `10000000` | Maximum number of uploaded gensteps. |
0056 | `maxslot` | integer, `0` | Maximum CUDA launch slots. Zero selects the VRAM-based heuristic. The historical `maxslot` spelling is retained in JSON. |
0057 | `max_simtrace` | integer, `1000000000000` | Maximum number of simtrace records allocated for a launch. |
0058 | `max_time` | number, `1e27` ns | Propagation time cutoff; the default is effectively unlimited. |
0059 | `mode_lite` | name, `Standard` | Photon/hit representation: `Standard`, `Lite`, or `DebugCompare`. |
0060 | `mode_merge` | name, `Separate` | Hit representation: `Separate` or `Merged`. |
0061 | `merge_window` | number, `0` ns | Time window used when merged hit output is enabled. |
0062 | `output_dir` | path, current working directory | Base directory for event folders and relative timing outputs. Low-level tools that do not construct `Config` retain their own `$DefaultOutputDir` convention. |
0063 | `event_reldir` | string, `ALL${VERSION:-0}` | Relative directory below `output_dir` used for event arrays. |
0064 | `hit_mask` | string, `SD` | Comma-delimited optical flag abbreviations selecting photons copied to hit output. |
0065 | `propagate_epsilon` | number, `0.05` mm | Ray-origin offset after a boundary crossing. |
0066 | `propagate_epsilon0` | number, `0.05` mm | Ray-origin offset after a bulk interaction. |
0067 | `propagate_epsilon0_mask` | string, `TO,CK,SI,SC,RE` | Interactions that use `propagate_epsilon0`. |
0068 | `propagate_refine` | unsigned integer, `0` | Bit mask enabling propagation-refinement diagnostics. |
0069 | `propagate_refine_distance` | number, `5000` mm | Maximum distance considered by propagation refinement. |
0070 | `input_genstep` | string, empty | Input genstep `.npy` path or indexed format pattern. |
0071 | `input_photon` | string, empty | Input photon `.npy` path. |
0072 | `input_photon_frame` | string, empty | Geometry frame specification used to transform input photons. |
0073 | `input_photon_change_time` | number, `-1` ns | Replacement time for input photons; a negative value preserves stored times. |
0074 | `input_photon_record_time` | string, empty | Time-selection expression when photons are sourced from a record array. |
0075 | `input_photon_record_slice` | string, empty | History slice expression when photons are sourced from a record array. |
0076 
0077 The `torch` object configures generated optical photons, including
0078 `numphoton`, position, direction, polarization, wavelength, and source shape.
0079 The low-level `SRM_TORCH` workflow creates one genstep per event from these
0080 same typed settings. Invalid `running_mode` names are rejected while loading
0081 the profile, with the accepted names included in the error.
0082 The `event_timing` object configures the per-event timeline and detailed
0083 profile CSV outputs. See [Simulation inputs and outputs](inputs-outputs.md)
0084 and [Performance and debugging](performance-and-debugging.md) for those
0085 workflows.
0086 
0087 ## Example
0088 
0089 ```json
0090 {
0091   "event": {
0092     "event_mode": "HitPhoton",
0093     "integration_mode": 1,
0094     "max_bounce": 100,
0095     "max_genstep": 10000000,
0096     "maxslot": 100000,
0097     "max_time": 1000000.0,
0098     "mode_lite": "Standard",
0099     "mode_merge": "Separate",
0100     "output_dir": "./output",
0101     "event_reldir": "wls-validation",
0102     "hit_mask": "SD",
0103     "propagate_epsilon": 0.05,
0104     "propagate_epsilon0": 0.05,
0105     "propagate_epsilon0_mask": "TO,CK,SI,SC,RE"
0106   }
0107 }
0108 ```
0109 
0110 Use `HitPhoton` for persisted final photons and hits, `HitPhotonSeq` when
0111 `seq.npy` is also required, and `DebugLite` when step-by-step `record.npy`
0112 output is required. Debug modes derive their component masks and diagnostic
0113 buffer maxima; those internals are not independent configuration knobs.