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
38{
39public:
42
43private:
49 bool openConnection() override;
50
56 bool closeConnectionImpl() override;
57
64 bool startEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
65
72 bool endEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
73
80 bool publishEventHeaderImpl([[maybe_unused]] const std::unique_ptr<GEventHeader>& gevent_header) override;
81
89 bool publishEventTrueInfoDataImpl(const std::string& detectorName,
90 const std::vector<const GTrueInfoData*>& trueInfoData) override;
91
99 bool publishEventDigitizedDataImpl(const std::string& detectorName,
100 const std::vector<const GDigitizedData*>& digitizedData) override;
101
112 bool publishEventGeneratedParticlesImpl(const std::string& bankName,
113 const GGeneratedParticleBank& particles) override;
114
121 bool startRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
122
129 bool endRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
130
137 bool publishRunHeaderImpl([[maybe_unused]] const std::unique_ptr<GRunHeader>& run_header) override;
138
146 bool publishRunDigitizedDataImpl(const std::string& detectorName,
147 const std::vector<const GDigitizedData*>& digitizedData) override;
148
155 bool startStreamImpl(const GFrameDataCollection* frameRunData) override;
156
163 bool endStreamImpl(const GFrameDataCollection* frameRunData) override;
164
171 bool publishFrameHeaderImpl(const GFrameHeader* gframeHeader) override;
172
179 bool publishPayloadImpl(const std::vector<GIntegralPayload*>* payload) override;
180
181 // Private helper methods used to lazily create trees on first use.
182 const std::unique_ptr<GRootTree>& getOrInstantiateHeaderTree(
183 [[maybe_unused]] const std::unique_ptr<GEventHeader>& event_header);
184 const std::unique_ptr<GRootTree>& getOrInstantiateHeaderTree(
185 [[maybe_unused]] const std::unique_ptr<GRunHeader>& run_header);
186 const std::unique_ptr<GRootTree>& getOrInstantiateTrueInfoDataTree(const std::string& treeName,
187 const GTrueInfoData* gdata);
188 const std::unique_ptr<GRootTree>& getOrInstantiateDigitizedDataTree(const std::string& treeName,
189 const GDigitizedData* gdata);
197 const std::unique_ptr<GRootTree>& getOrInstantiateGeneratedParticleTree(const std::string& treeName,
198 const GGeneratedParticleBank& particles);
199
201 std::unordered_map<std::string, std::unique_ptr<GRootTree>> gRootTrees;
202
204 std::unique_ptr<TFile> rootfile;
205
211 [[nodiscard]] std::string filename() const override { return gstreamer_definitions.rootname + ".root"; }
212};
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
ROOT plugin writing event and run content into TTree objects stored in one TFile.
std::vector< GGeneratedParticleData > GGeneratedParticleBank
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.