7bool GstreamerCsvFactory::publishEventTrueInfoDataImpl(
const std::string& detectorName,
8 const std::vector<const GTrueInfoData*>& trueInfoData) {
9 if (!ofile_true_info.is_open()) {
14 if (!is_first_event_with_truedata) {
15 if (trueInfoData.size() > 0) {
16 ofile_true_info <<
"evn, timestamp, thread_id, detector, ";
17 auto first_hit = trueInfoData[0];
19 const auto& smap = first_hit->getStringVariablesMap();
20 const auto& dmap = first_hit->getDoubleVariablesMap();
22 size_t total = dmap.size();
25 log->
debug(NORMAL, SFUNCTION_NAME,
"Writing header for event ", event_number,
" with ", total,
28 for (
const auto& [name, value] : smap) { ofile_true_info << name <<
", "; }
30 for (
const auto& [name, value] : dmap) {
31 ofile_true_info << name;
32 if (++i < total) ofile_true_info <<
", ";
35 ofile_true_info <<
"\n";
37 is_first_event_with_truedata =
true;
42 if (is_first_event_with_truedata) {
43 for (
auto trueInfoHit : trueInfoData) {
44 const auto& smap = trueInfoHit->getStringVariablesMap();
45 const auto& dmap = trueInfoHit->getDoubleVariablesMap();
47 size_t total = dmap.size();
50 ofile_true_info << event_number <<
", " << timestamp <<
", " << thread_id <<
", " << detectorName <<
", ";
52 for (
const auto& [variableName, value] : smap) { ofile_true_info << value <<
", "; }
53 for (
const auto& [variableName, value] : dmap) {
54 ofile_true_info << value;
55 if (++i < total) ofile_true_info <<
", ";
56 else 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
Shared constants and error codes for the gstreamer module.
#define ERR_CANTOPENOUTPUT
Output medium could not be opened (file/device not accessible).