gstreamer
Loading...
Searching...
No Matches
gstreamerROOTFactory.h
Go to the documentation of this file.
1#pragma once
2
3// gstreamer
4#include "gstreamer.h"
5#include "gRootTree.h"
6
7// ROOT
8#include "TFile.h"
9
36{
37public:
40
41private:
47 bool openConnection() override;
48
54 bool closeConnectionImpl() override;
55
62 bool startEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
63
70 bool endEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
71
78 bool publishEventHeaderImpl([[maybe_unused]] const std::unique_ptr<GEventHeader>& gevent_header) override;
79
87 bool publishEventTrueInfoDataImpl(const std::string& detectorName,
88 const std::vector<const GTrueInfoData*>& trueInfoData) override;
89
97 bool publishEventDigitizedDataImpl(const std::string& detectorName,
98 const std::vector<const GDigitizedData*>& digitizedData) override;
99
106 bool startRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
107
114 bool endRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
115
122 bool publishRunHeaderImpl([[maybe_unused]] const std::unique_ptr<GRunHeader>& run_header) override;
123
131 bool publishRunDigitizedDataImpl(const std::string& detectorName,
132 const std::vector<const GDigitizedData*>& digitizedData) override;
133
140 bool startStreamImpl(const GFrameDataCollection* frameRunData) override;
141
148 bool endStreamImpl(const GFrameDataCollection* frameRunData) override;
149
156 bool publishFrameHeaderImpl(const GFrameHeader* gframeHeader) override;
157
164 bool publishPayloadImpl(const std::vector<GIntegralPayload*>* payload) override;
165
166 // Private helper methods used to lazily create trees on first use.
167 const std::unique_ptr<GRootTree>& getOrInstantiateHeaderTree(
168 [[maybe_unused]] const std::unique_ptr<GEventHeader>& event_header);
169 const std::unique_ptr<GRootTree>& getOrInstantiateHeaderTree(
170 [[maybe_unused]] const std::unique_ptr<GRunHeader>& run_header);
171 const std::unique_ptr<GRootTree>& getOrInstantiateTrueInfoDataTree(const std::string& treeName,
172 const GTrueInfoData* gdata);
173 const std::unique_ptr<GRootTree>& getOrInstantiateDigitizedDataTree(const std::string& treeName,
174 const GDigitizedData* gdata);
175
177 std::unordered_map<std::string, std::unique_ptr<GRootTree>> gRootTrees;
178
180 std::unique_ptr<TFile> rootfile;
181
187 [[nodiscard]] std::string filename() const override { return gstreamer_definitions.rootname + ".root"; }
188};
Abstract base class for all gstreamer output plugins.
Definition gstreamer.h:77
GStreamer(const std::shared_ptr< GOptions > &g)
Construct the streamer base and initialize module logging.
Definition gstreamer.h:84
GStreamerDefinition gstreamer_definitions
Output definition currently bound to this streamer instance.
Definition gstreamer.h:206
ROOT plugin writing event and run content into TTree objects stored in one TFile.
ROOT tree adapter used internally by the ROOT gstreamer plugin.
Core streaming interface and helper utilities for the gstreamer module.
std::string rootname
Base output filename without extension, optionally specialized by thread id.