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
43{
44public:
47
52
53private:
59 bool openConnection() override;
60
66 bool closeConnectionImpl() override;
67
77 bool startEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
78
85 bool endEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
86
93 bool publishEventHeaderImpl([[maybe_unused]] const std::unique_ptr<GEventHeader>& gevent_header) override;
94
102 bool publishEventTrueInfoDataImpl(const std::string& detectorName,
103 const std::vector<const GTrueInfoData*>& trueInfoData) override;
104
112 bool publishEventDigitizedDataImpl(const std::string& detectorName,
113 const std::vector<const GDigitizedData*>& digitizedData) override;
114
126 bool publishEventGeneratedParticlesImpl(const std::string& bankName,
127 const GGeneratedParticleBank& particles) override;
128
137 bool startRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
138
145 bool endRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
146
154 bool publishRunDigitizedDataImpl(const std::string& detectorName,
155 const std::vector<const GDigitizedData*>& digitizedData) override;
156
165 bool startStreamImpl(const GFrameDataCollection* frameRunData) override;
166
173 bool endStreamImpl(const GFrameDataCollection* frameRunData) override;
174
183 bool publishFrameHeaderImpl(const GFrameHeader* gframeHeader) override;
184
193 bool publishPayloadImpl(const std::vector<GIntegralPayload*>* payload) override;
194
196 std::ofstream ofile_true_info;
197
199 std::ofstream ofile_digitized;
200
202 std::ofstream ofile_generated;
203
205 std::ofstream ofile_generated_tracked;
206
215 [[nodiscard]] std::string filename() const override { return gstreamer_definitions.rootname + ".csv"; }
216
222 [[nodiscard]] std::string filename_true_info() const { return gstreamer_definitions.rootname + "_true_info.csv"; }
223
229 [[nodiscard]] std::string filename_digitized() const { return gstreamer_definitions.rootname + "_digitized.csv"; }
230
236 [[nodiscard]] std::string filename_generated() const { return gstreamer_definitions.rootname + "_generated.csv"; }
237
243 [[nodiscard]] std::string filename_generated_tracked() const {
244 return gstreamer_definitions.rootname + "_generated_tracked.csv";
245 }
246
253 std::ofstream& generated_stream_for_bank(const std::string& bankName);
254
256 bool is_first_event_with_truedata = false;
257
259 bool is_first_event_with_digidata = false;
260
262 std::string timestamp;
263
265 int event_number;
266
268 int runId;
269
271 int thread_id;
272};
Abstract base class for all gstreamer output plugins.
Definition gstreamer.h:78
GStreamer(const std::shared_ptr< GOptions > &g)
Construct the streamer base and initialize module logging.
Definition gstreamer.h:85
GStreamerDefinition gstreamer_definitions
Output definition currently bound to this streamer instance.
Definition gstreamer.h:207
CSV plugin writing flattened per-hit event and run data into two CSV files.
GstreamerCsvFactory & operator=(const GstreamerCsvFactory &)=delete
GstreamerCsvFactory & operator=(GstreamerCsvFactory &&)=delete
GstreamerCsvFactory(GstreamerCsvFactory &&)=delete
GstreamerCsvFactory(const GstreamerCsvFactory &)=delete
std::vector< GGeneratedParticleData > GGeneratedParticleBank
Core streaming interface and helper utilities for the gstreamer module.
std::string rootname
Base output filename without extension, optionally specialized by thread id.