8bool GstreamerCsvFactory::publishEventTrueInfoDataImpl(
const std::string& detectorName,
9 const std::vector<const GTrueInfoData*>& trueInfoData) {
10 if (!ofile_true_info.is_open()) {
16 if (!is_first_event_with_truedata) {
17 if (trueInfoData.size() > 0) {
18 ofile_true_info <<
"evn, timestamp, thread_id, detector, ";
19 auto first_hit = trueInfoData[0];
21 const auto& smap = first_hit->getStringVariablesMap();
22 const auto& dmap = first_hit->getDoubleVariablesMap();
24 size_t total = dmap.size();
27 log->
debug(NORMAL, SFUNCTION_NAME,
"Writing header for event ", event_number,
" with ", total,
30 for (
const auto& [name, value] :
getIdentityMap(first_hit->getIdentity())) { ofile_true_info << name <<
", "; }
31 for (
const auto& [name, value] : smap) { ofile_true_info << name <<
", "; }
33 for (
const auto& [name, value] : dmap) {
34 ofile_true_info << name;
35 if (++i < total) ofile_true_info <<
", ";
38 ofile_true_info <<
"\n";
40 is_first_event_with_truedata =
true;
45 if (is_first_event_with_truedata) {
46 for (
auto trueInfoHit : trueInfoData) {
47 const auto& smap = trueInfoHit->getStringVariablesMap();
48 const auto& dmap = trueInfoHit->getDoubleVariablesMap();
50 size_t total = dmap.size();
53 ofile_true_info << event_number <<
", " << timestamp <<
", " << thread_id <<
", " << detectorName <<
", ";
55 for (
const auto& [name, value] :
getIdentityMap(trueInfoHit->getIdentity())) { ofile_true_info << value <<
", "; }
56 for (
const auto& [variableName, value] : smap) { ofile_true_info << value <<
", "; }
57 for (
const auto& [variableName, value] : dmap) {
58 ofile_true_info << value;
59 if (++i < total) ofile_true_info <<
", ";
61 ofile_true_info <<
"\n";
std::shared_ptr< GLogger > log
void debug(debug_type type, Args &&... args) const
void error(int exit_code, Args &&... args) const
std::map< std::string, int > getIdentityMap(std::vector< GIdentifier > gidentity)
CSV streamer plugin declarations.
Shared constants and error codes for the gstreamer module.
#define ERR_CANTOPENOUTPUT
Output medium could not be opened successfully.