13 static const std::vector<std::string> formats = {
"jlabsro",
"root",
"ascii",
"csv",
"json"};
20 return std::find(supported.begin(), supported.end(), f) != supported.end();
31 if (!event_data->getHeader()) {
37 eventBuffer.emplace_back(event_data);
48 log->info(2,
"GStreamer::publishRunData->startRun: ",
57 for (
const auto& [sdname, gDataCollection] : run_data->getDataCollectionMap()) {
61 std::vector<const GDigitizedData*> digitizedPtrs;
64 for (
const auto& hit : tdptr->
getDigitizedData()) { digitizedPtrs.push_back(hit.get()); }
66 log->info(2,
SFUNCTION_NAME,
"->publishEventDigitizedData for detector -> ", sdname,
70 log->info(2,
"GStreamer::endEvent -> ",
76 log->info(2,
"GStreamer::flushEventBuffer -> flushing ", eventBuffer.size(),
" events to file");
80 for (
const auto& eventData : eventBuffer) {
89 eventData->getGeneratedParticles())));
90 log->info(2,
SFUNCTION_NAME,
"->publishEventGeneratedParticles -> generated_tracked: ",
92 eventData->getGeneratedTrackedParticles())));
93 if (eventData->hasAncestorBank()) {
99 for (
const auto& [sdname, gDataCollection] : eventData->getDataCollectionMap()) {
104 std::vector<const GTrueInfoData*> trueInfoPtrs;
105 std::vector<const GDigitizedData*> digitizedPtrs;
109 for (
const auto& hit : tdptr->
getTrueInfoData()) { trueInfoPtrs.push_back(hit.get()); }
110 for (
const auto& hit : tdptr->
getDigitizedData()) { digitizedPtrs.push_back(hit.get()); }
112 log->info(2,
SFUNCTION_NAME,
"->publishEventTrueInfoData for detector -> ", sdname,
115 log->info(2,
SFUNCTION_NAME,
"->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 > > &
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 publishEventAncestors(const GAncestorBank &ancestors)
Publishes the event-local ancestor bank.
bool publishEventTrueInfoData(const std::string &detectorName, const std::vector< const GTrueInfoData * > &trueInfoData)
Publish the true-information hit bank for one detector.
bool publishEventGeneratedParticles(const std::string &bankName, const GGeneratedParticleBank &particles)
Core streaming interface and helper utilities for the gstreamer module.
constexpr int ERR_PUBLISH_ERROR
Publish sequence encountered invalid state or invalid input data.
std::string success_or_fail(bool condition)
string convertToLowercase(const string &str)