Output

GEMC writes simulation data through gstreamer plugins. Each plugin serializes the event, run, and frame data produced during a simulation run into a specific file format.

One or more outputs are configured with the gstreamer YAML key:

gstreamer:
  - format: csv
    filename: myrun
  - format: root
    filename: myrun

Multiple entries are allowed; GEMC instantiates all configured plugins in parallel.


Built-in formats

Format Type token Extension Best for
ASCII ascii .txt Inspection, debugging
CSV csv .csv Python / pandas analysis
JSON json .json Web tools, streaming pipelines
ROOT root .root HEP analysis with ROOT TTrees
JLAB SRO jlabsro .ev Jefferson Lab streaming readout frames
HIPO hipo .hipo CLAS12 analysis with standard banks

HIPO is a separately installed plugin specific to the CLAS12 detector suite. The remaining formats are bundled with GEMC.


Output types

The type sub-key selects what the plugin writes:

Type Content
event (default) per-event hits: headers, true info, digitized data, generated particles
stream per-frame time-snapshot payloads
gstreamer:
  - format: root
    filename: myrun
    type: event       # default
  - format: jlabsro
    filename: myrun
    type: stream      # frame snapshots


Threading and file naming

Event-based outputs (such as flux or custom plugins) produce one file per worker thread. The thread index is appended to the filename automatically:

myrun_t0.root   myrun_t1.root   myrun_t2.root   ...

Run-based outputs (such as dosimeter) accumulate across the full run and produce a single file per streamer:

myrun.root

The number of threads is controlled by nthreads. A value of 0 (the default) uses one thread per available core.


Event buffer

Each streamer instance accumulates events in memory and flushes them to disk in batches. The default batch size is 100 events. Adjust it with ebuffer:

ebuffer: 50

Smaller values reduce peak memory use at the cost of more frequent I/O.


Writing a custom plugin

When the built-in formats are not enough, you can ship your own output plugin as a .gplugin shared library. See Writing an output plugin for a step-by-step guide.