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
28{
29public:
30 // inherit the base (const std::shared_ptr<GOptions>&) ctor
32
33private:
34 // open and close the output media
35 bool openConnection() override;
36 bool closeConnectionImpl() override;
37
38 // event streams
39 bool startEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
40 bool endEventImpl([[maybe_unused]] const std::shared_ptr<GEventDataCollection>& event_data) override;
41
42 bool publishEventHeaderImpl([[maybe_unused]] const std::unique_ptr<GEventHeader>& gevent_header) override;
43 bool publishEventTrueInfoDataImpl(const std::string& detectorName,
44 const std::vector<const GTrueInfoData*>& trueInfoData) override;
45 bool publishEventDigitizedDataImpl(const std::string& detectorName,
46 const std::vector<const GDigitizedData*>& digitizedData) override;
47
48 // frame streams
49 bool startStreamImpl(const GFrameDataCollection* frameRunData) override;
50 bool endStreamImpl(const GFrameDataCollection* frameRunData) override;
51 bool publishFrameHeaderImpl(const GFrameHeader* gframeHeader) override;
52 bool publishPayloadImpl(const std::vector<GIntegralPayload*>* payload) override;
53
54 // returning raw pointers for access
55 // Note: these are private helpers; do not cross-reference them with \ref in documentation.
56 const std::unique_ptr<GRootTree>& getOrInstantiateHeaderTree(
57 [[maybe_unused]] const std::unique_ptr<GEventHeader>& event_header);
58 const std::unique_ptr<GRootTree>& getOrInstantiateTrueInfoDataTree(const std::string& treeName,
59 const GTrueInfoData* gdata);
60 const std::unique_ptr<GRootTree>& getOrInstantiateDigitizedDataTree(const std::string& treeName,
61 const GDigitizedData* gdata);
62
64 std::unordered_map<std::string, std::unique_ptr<GRootTree>> gRootTrees;
65
67 std::unique_ptr<TFile> rootfile; // ROOT file pointer
68
70 [[nodiscard]] std::string filename() const override { return gstreamer_definitions.rootname + ".root"; }
71};
Abstract base class for streaming GEMC event or frame data to output media.
Definition gstreamer.h:66
GStreamer(const std::shared_ptr< GOptions > &g)
Construct a streamer and bind it to module logging.
Definition gstreamer.h:72
GStreamerDefinition gstreamer_definitions
Output definition used by this streamer (format, base name, type, thread id).
Definition gstreamer.h:173
ROOT output gstreamer plugin writing event data into TTrees.
ROOT tree adapter used by the ROOT gstreamer plugin.
Core streaming interface for gstreamer output plugins.
std::string rootname
Base filename (without extension), possibly specialized by thread id.