gstreamer
Loading...
Searching...
No Matches
gstreamerCSVFactory.h
Go to the documentation of this file.
1#pragma once
2
3// gstreamer
4#include "gstreamer.h"
5
6// c++
7#include <fstream>
8
27{
28public:
31
32 // One instance per thread: forbid copy/move to prevent accidental sharing.
37
38private:
40 bool openConnection() override;
41
43 bool closeConnectionImpl() override;
44
45 // Event stream hooks.
46 bool startEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
47 bool endEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
48 bool publishEventHeaderImpl([[maybe_unused]] const std::unique_ptr<GEventHeader>& gevent_header) override;
49 bool publishEventTrueInfoDataImpl(const std::string& detectorName,
50 const std::vector<const GTrueInfoData*>& trueInfoData) override;
51 bool publishEventDigitizedDataImpl(const std::string& detectorName,
52 const std::vector<const GDigitizedData*>& digitizedData) override;
53
54 // Frame stream hooks (present for interface completeness; currently implemented as no-ops).
55 bool startStreamImpl(const GFrameDataCollection* frameRunData) override;
56 bool endStreamImpl(const GFrameDataCollection* frameRunData) override;
57 bool publishFrameHeaderImpl(const GFrameHeader* gframeHeader) override;
58 bool publishPayloadImpl(const std::vector<GIntegralPayload*>* payload) override;
59
61 std::ofstream ofile_true_info;
62
64 std::ofstream ofile_digitized;
65
67 [[nodiscard]] std::string filename() const override { return gstreamer_definitions.rootname + ".csv"; }
68 // never actually called for CSV
69
71 [[nodiscard]] std::string filename_true_info() const { return gstreamer_definitions.rootname + "_true_info.csv"; }
72
74 [[nodiscard]] std::string filename_digitized() const { return gstreamer_definitions.rootname + "_digitized.csv"; }
75
77 bool is_first_event_with_truedata = false;
78
80 bool is_first_event_with_digidata = false;
81
83 std::string timestamp;
84
86 int event_number;
87
89 int thread_id;
90};
Abstract base class for streaming GEMC event or frame data to output media.
Definition gstreamer.h:66
GStreamer(const std::shared_ptr< GOptions > &g)
Construct a streamer and bind it to module logging.
Definition gstreamer.h:72
GStreamerDefinition gstreamer_definitions
Output definition used by this streamer (format, base name, type, thread id).
Definition gstreamer.h:173
CSV gstreamer plugin writing flattened per-hit rows for true and digitized data.
GstreamerCsvFactory & operator=(const GstreamerCsvFactory &)=delete
GstreamerCsvFactory & operator=(GstreamerCsvFactory &&)=delete
GstreamerCsvFactory(GstreamerCsvFactory &&)=delete
GstreamerCsvFactory(const GstreamerCsvFactory &)=delete
Core streaming interface for gstreamer output plugins.
std::string rootname
Base filename (without extension), possibly specialized by thread id.