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
44{
45public:
48
53
54private:
60 bool openConnection() override;
61
67 bool closeConnectionImpl() override;
68
78 bool startEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
79
86 bool endEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
87
94 bool publishEventHeaderImpl([[maybe_unused]] const std::unique_ptr<GEventHeader>& gevent_header) override;
95
103 bool publishEventTrueInfoDataImpl(const std::string& detectorName,
104 const std::vector<const GTrueInfoData*>& trueInfoData) override;
105
113 bool publishEventDigitizedDataImpl(const std::string& detectorName,
114 const std::vector<const GDigitizedData*>& digitizedData) override;
115
127 bool publishEventGeneratedParticlesImpl(const std::string& bankName,
128 const GGeneratedParticleBank& particles) override;
129
131 bool publishEventAncestorsImpl(const GAncestorBank& ancestors) override;
132
141 bool startRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
142
149 bool endRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
150
158 bool publishRunDigitizedDataImpl(const std::string& detectorName,
159 const std::vector<const GDigitizedData*>& digitizedData) override;
160
169 bool startStreamImpl(const GFrameDataCollection* frameRunData) override;
170
177 bool endStreamImpl(const GFrameDataCollection* frameRunData) override;
178
187 bool publishFrameHeaderImpl(const GFrameHeader* gframeHeader) override;
188
197 bool publishPayloadImpl(const std::vector<GIntegralPayload*>* payload) override;
198
200 std::ofstream ofile_true_info;
201
203 std::ofstream ofile_digitized;
204
206 std::ofstream ofile_generated;
207
209 std::ofstream ofile_generated_tracked;
210
212 std::ofstream ofile_ancestors;
213
222 [[nodiscard]] std::string filename() const override { return gstreamer_definitions.rootname + ".csv"; }
223
229 [[nodiscard]] std::string filename_true_info() const { return gstreamer_definitions.rootname + "_true_info.csv"; }
230
236 [[nodiscard]] std::string filename_digitized() const { return gstreamer_definitions.rootname + "_digitized.csv"; }
237
243 [[nodiscard]] std::string filename_generated() const { return gstreamer_definitions.rootname + "_generated.csv"; }
244
250 [[nodiscard]] std::string filename_generated_tracked() const {
251 return gstreamer_definitions.rootname + "_generated_tracked.csv";
252 }
253
255 [[nodiscard]] std::string filename_ancestors() const {
256 return gstreamer_definitions.rootname + "_ancestors.csv";
257 }
258
265 std::ofstream& generated_stream_for_bank(const std::string& bankName);
266
268 bool is_first_event_with_truedata = false;
269
271 bool is_first_event_with_digidata = false;
272
274 std::string timestamp;
275
277 int event_number = -1;
278
280 int runId = -1;
281
283 int thread_id = -1;
284};
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 event and run data into separate CSV files.
GstreamerCsvFactory & operator=(const GstreamerCsvFactory &)=delete
GstreamerCsvFactory & operator=(GstreamerCsvFactory &&)=delete
GstreamerCsvFactory(GstreamerCsvFactory &&)=delete
GstreamerCsvFactory(const GstreamerCsvFactory &)=delete
std::vector< GAncestorData > GAncestorBank
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.