10 static const std::vector<std::string> formats = {
"jlabsro",
"root",
"ascii",
"csv",
"json"};
17 return std::find(supported.begin(), supported.end(), f) != supported.end();
28 eventBuffer.emplace_back(event_data);
35 log->
info(2,
"GStreamer::flushEventBuffer -> flushing ", eventBuffer.size(),
" events to file");
38 for (
const auto& eventData : eventBuffer) {
40 log->
info(2,
"GStreamer::publishEventData->startEvent: ",
43 log->
info(2,
"GStreamer::publishEventData->publishEventHeader -> ",
47 for (
const auto& [sdname, gDataCollection] : eventData->getDataCollectionMap()) {
51 std::vector<const GTrueInfoData*> trueInfoPtrs;
52 std::vector<const GDigitizedData*> digitizedPtrs;
56 for (
const auto& hit : tdptr->
getTrueInfoData()) { trueInfoPtrs.push_back(hit.get()); }
57 for (
const auto& hit : tdptr->
getDigitizedData()) { digitizedPtrs.push_back(hit.get()); }
59 log->
info(2,
"GStreamer::publishEventData->publishEventTrueInfoData for detector -> ", sdname,
62 log->
info(2,
"GStreamer::publishEventData->publishEventDigitizedData for detector -> ", sdname,
std::shared_ptr< GLogger > log
auto getDigitizedData() const -> const std::vector< std::unique_ptr< GDigitizedData > > &
auto getTrueInfoData() const -> const std::vector< std::unique_ptr< GTrueInfoData > > &
void info(int level, Args &&... args) const
void error(int exit_code, Args &&... args) const
static const std::vector< std::string > & supported_formats()
Return the list of supported output formats.
bool publishEventDigitizedData(const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData)
Publish digitized hits for one detector.
void publishEventData(const std::shared_ptr< GEventDataCollection > &event_data)
Buffer an event for later serialization.
void flushEventBuffer()
Flush the internal event buffer, writing all buffered events to the output medium.
static bool is_valid_format(const std::string &format)
Check whether a format token is supported.
bool endEvent(const std::shared_ptr< GEventDataCollection > &event_data)
End an event publish sequence.
bool publishEventHeader(const std::unique_ptr< GEventHeader > &gevent_header)
Publish the event header.
bool startEvent(const std::shared_ptr< GEventDataCollection > &event_data)
Begin an event publish sequence.
bool publishEventTrueInfoData(const std::string &detectorName, const std::vector< const GTrueInfoData * > &trueInfoData)
Publish true (MC) information hits for one detector.
#define ERR_PUBLISH_ERROR
Generic publish-time error (null pointers, invalid state).
Core streaming interface for gstreamer output plugins.
std::string success_or_fail(bool condition)
string convertToLowercase(const string &str)