13 static const std::vector<std::string> formats = {
"jlabsro",
"root",
"ascii",
"csv",
"json"};
20 return std::find(supported.begin(), supported.end(), f) != supported.end();
29 if (!event_data->getHeader()) {
35 eventBuffer.emplace_back(event_data);
46 log->
info(2,
"GStreamer::publishRunData->startRun: ",
55 for (
const auto& [sdname, gDataCollection] : run_data->getDataCollectionMap()) {
59 std::vector<const GDigitizedData*> digitizedPtrs;
62 for (
const auto& hit : tdptr->
getDigitizedData()) { digitizedPtrs.push_back(hit.get()); }
68 log->
info(2,
"GStreamer::endEvent -> ",
74 log->
info(2,
"GStreamer::flushEventBuffer -> flushing ", eventBuffer.size(),
" events to file");
78 for (
const auto& eventData : eventBuffer) {
86 for (
const auto& [sdname, gDataCollection] : eventData->getDataCollectionMap()) {
91 std::vector<const GTrueInfoData*> trueInfoPtrs;
92 std::vector<const GDigitizedData*> digitizedPtrs;
96 for (
const auto& hit : tdptr->
getTrueInfoData()) { trueInfoPtrs.push_back(hit.get()); }
97 for (
const auto& hit : tdptr->
getDigitizedData()) { digitizedPtrs.push_back(hit.get()); }
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 output format tokens supported by the module.
bool publishEventDigitizedData(const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData)
Publish the digitized hit bank for one detector.
void publishEventData(const std::shared_ptr< GEventDataCollection > &event_data)
Queue one event for publication.
bool publishRunDigitizedData(const std::string &detectorName, const std::vector< const GDigitizedData * > &digitizedData)
Publish run-level digitized data for one detector.
bool endRun(const std::shared_ptr< GRunDataCollection > &run_data)
End publishing one run-level collection.
void flushEventBuffer()
Flush all buffered events to the backend in publish order.
static bool is_valid_format(const std::string &format)
Validate whether a format token is supported.
bool endEvent(const std::shared_ptr< GEventDataCollection > &event_data)
End publishing one buffered event.
bool publishEventHeader(const std::unique_ptr< GEventHeader > &gevent_header)
Publish the event header for the current event sequence.
bool startRun(const std::shared_ptr< GRunDataCollection > &run_data)
Begin publishing one run-level collection.
void publishRunData(const std::shared_ptr< GRunDataCollection > &run_data)
Publish one run-level data collection immediately.
bool publishRunHeader(const std::unique_ptr< GRunHeader > &run_header)
Publish the run header for the current run sequence.
bool startEvent(const std::shared_ptr< GEventDataCollection > &event_data)
Begin publishing one buffered event.
bool publishEventTrueInfoData(const std::string &detectorName, const std::vector< const GTrueInfoData * > &trueInfoData)
Publish the true-information hit bank for one detector.
#define ERR_PUBLISH_ERROR
Publish sequence encountered invalid state or invalid input data.
Core streaming interface and helper utilities for the gstreamer module.
std::string success_or_fail(bool condition)
string convertToLowercase(const string &str)