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
39{
40public:
43
44private:
50 bool openConnection() override;
51
57 bool closeConnectionImpl() override;
58
65 bool startEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
66
73 bool endEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
74
81 bool publishEventHeaderImpl([[maybe_unused]] const std::unique_ptr<GEventHeader>& gevent_header) override;
82
90 bool publishEventTrueInfoDataImpl(const std::string& detectorName,
91 const std::vector<const GTrueInfoData*>& trueInfoData) override;
92
100 bool publishEventDigitizedDataImpl(const std::string& detectorName,
101 const std::vector<const GDigitizedData*>& digitizedData) override;
102
113 bool publishEventGeneratedParticlesImpl(const std::string& bankName,
114 const GGeneratedParticleBank& particles) override;
115
117 bool publishEventAncestorsImpl(const GAncestorBank& ancestors) override;
118
125 bool startRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
126
133 bool endRunImpl([[maybe_unused]] const std::shared_ptr<GRunDataCollection>& run_data) override;
134
141 bool publishRunHeaderImpl([[maybe_unused]] const std::unique_ptr<GRunHeader>& run_header) override;
142
150 bool publishRunDigitizedDataImpl(const std::string& detectorName,
151 const std::vector<const GDigitizedData*>& digitizedData) override;
152
159 bool startStreamImpl(const GFrameDataCollection* frameRunData) override;
160
167 bool endStreamImpl(const GFrameDataCollection* frameRunData) override;
168
175 bool publishFrameHeaderImpl(const GFrameHeader* gframeHeader) override;
176
183 bool publishPayloadImpl(const std::vector<GIntegralPayload*>* payload) override;
184
185 // Private helper methods used to lazily create trees on first use.
186 const std::unique_ptr<GRootTree>& getOrInstantiateHeaderTree(
187 [[maybe_unused]] const std::unique_ptr<GEventHeader>& event_header);
188 const std::unique_ptr<GRootTree>& getOrInstantiateHeaderTree(
189 [[maybe_unused]] const std::unique_ptr<GRunHeader>& run_header);
190 const std::unique_ptr<GRootTree>& getOrInstantiateTrueInfoDataTree(const std::string& treeName,
191 const GTrueInfoData* gdata);
192 const std::unique_ptr<GRootTree>& getOrInstantiateDigitizedDataTree(const std::string& treeName,
193 const GDigitizedData* gdata);
201 const std::unique_ptr<GRootTree>& getOrInstantiateGeneratedParticleTree(const std::string& treeName,
202 const GGeneratedParticleBank& particles);
203 const std::unique_ptr<GRootTree>& getOrInstantiateAncestorTree(const GAncestorBank& ancestors);
204
206 std::unordered_map<std::string, std::unique_ptr<GRootTree>> gRootTrees;
207
209 std::unique_ptr<TFile> rootfile;
210
216 [[nodiscard]] std::string filename() const override { return gstreamer_definitions.rootname + ".root"; }
217};
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< GAncestorData > GAncestorBank
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.