|
gstreamer
|
The gstreamer module is the output layer responsible for taking in-memory GEMC data collections and serializing them through a plugin architecture. The module supports multiple output backends, allowing the same event or frame production flow to be directed to different storage formats without changing the event-building code.
In practice, a user configures one or more outputs through the -gstreamer option, and the module loads the corresponding plugin libraries at runtime. Each plugin then receives a high-level publish sequence from the common GStreamer interface.
Supported built-in format tokens currently include:
root ascii csv sro (upcoming in the next release)json The ordinary event/run formats map to plugins using the standard naming convention:
gstreamer_root_plugin gstreamer_ascii_plugin gstreamer_csv_plugin gstreamer_json_plugin Configure one shared SRO output alongside any ordinary event outputs:
The core GSROFactory selects this output and loads experiment_sro.gplugin through the normal plugin search path. The library exports GSROImplementationFactory and derives from GSROImplementation. Its configure_run supplies the timing model; create_crate supplies a frame sink and crate plugin. Filename suffixes, encoding, acquisition limits, overlap response, and incomplete-frame policy belong to that implementation. It must give each crate/run a distinct output filename.
Worker digitizers override GDynamicDigitization::stream_hit and invoke GSROEmit immediately for each owned GSROData contribution. The framework assigns event/sequence IDs, creates crates lazily, and calls complete_event even for empty events. An aborted event holds back the safe-time prefix. At run end the master (or sequential run owner) waits for delivery acknowledgments and joins all crate threads. A background or worker error cancels SRO input; checked shutdown reports it after joining.
SRO has no per-worker event buffer. The existing ebuffer option applies only to ordinary streamers. Crate queues apply backpressure; ordering buffers and event bookkeeping have separate failure limits. The old jlabsro factory and its fixed binary layout are replaced by this implementation API.
The module is designed around explicit ownership boundaries:
Event data ownership remains outside the streamer. The base streamer only stores std::shared_ptr<GEventDataCollection> objects in its buffer so that all event-owned hit data remain valid until the flush is complete. Concrete plugins receive read-only views during publication and do not take ownership of the source event content.
The normal lifecycle is:
The architecture is intentionally layered:
Each concrete plugin derives from GStreamer and overrides only the hooks relevant to its output model. For event publication, the base class drives a fixed sequence:
Similar hook sequences exist for run data and frame streams.
Event output includes two generated-particle banks when generator metadata is available:
generated : runtime records for particles propagated in Geant4 plus source-only file rows that are not propagated.generated_tracked : runtime records for particles propagated in Geant4. For Lund input, this corresponds to rows with type == 1.Both banks publish the same columns: particle name, pid, source type, multiplicity, momentum, theta, phi, and vertex components. The concrete representation is backend-specific:
_generated.csv and _generated_tracked.csv to the configured root filename.generated object.generated and generated_tracked.Design choices in this module include:
The module contributes the following user-facing options through gstreamer::defineOptions() :
ebuffer gstreamer::DEFAULT_GSTREAMER_BUFFER_FLUSH_LIMIT -gstreamer format filename type, defaulting to "event" Example:
The module also aggregates options defined by the gdynamicdigitization module through gdynamicdigitization::defineOptions(). Those options apply when the example or application simultaneously uses dynamic digitization and streaming.
Classes in this module log through the module logger category "gstreamer".
Typical verbosity interpretation is:
Debug output is intended for developers. It prints function-level traces, lifecycle transitions, and internal state information that help diagnose ordering, buffering, and plugin behavior.
The following example is documented as part of this module:
Example snippet: