gstreamer
Loading...
Searching...
No Matches
publishTrueInfo.cc
Go to the documentation of this file.
1// gstreamer
4
5// Implementation summary:
6// Write one detector true-information bank for the current event in text form.
7// Use '\n' instead of std::endl so each line does not force a flush.
8
9bool GstreamerTextFactory::publishEventTrueInfoDataImpl(const std::string& detectorName,
10 const std::vector<const GTrueInfoData*>& trueInfoData) {
11 if (!ofile.is_open()) {
12 log->error(gstreamer::ERR_CANTOPENOUTPUT, SFUNCTION_NAME, "Error: can't access ", filename());
13 }
14
15 ofile << guts::GTAB << "Detector <" << detectorName << "> True Info Bank {\n";
16
17 for (auto trueInfoHit : trueInfoData) {
18 auto identifierString = getIdentityString(trueInfoHit->getIdentity());
19
20 ofile << guts::GTABTAB << "Hit address: " << identifierString << " {\n";
21
22 for (const auto& [variableName, value] : trueInfoHit->getDoubleVariablesMap()) {
23 ofile << guts::GTABTABTAB << variableName << ": " << value << "\n";
24 }
25 for (const auto& [variableName, value] : trueInfoHit->getStringVariablesMap()) {
26 ofile << guts::GTABTABTAB << variableName << ": " << value << "\n";
27 }
28
29 ofile << guts::GTABTAB << "}\n";
30 }
31 ofile << guts::GTAB << "}\n";
32
33 return true;
34}
35
36bool GstreamerTextFactory::publishEventGeneratedParticlesImpl(const std::string& bankName,
37 const GGeneratedParticleBank& particles) {
38 if (!ofile.is_open()) {
39 log->error(gstreamer::ERR_CANTOPENOUTPUT, SFUNCTION_NAME, "Error: can't access ", filename());
40 }
41
42 ofile << guts::GTAB << "Generated Particle Bank <" << bankName << "> {\n";
43
44 for (const auto& particle : particles) {
45 ofile << guts::GTABTAB << "Particle {\n";
46 ofile << guts::GTABTABTAB << "name: " << particle.name << "\n";
47 ofile << guts::GTABTABTAB << "pid: " << particle.pid << "\n";
48 ofile << guts::GTABTABTAB << "type: " << particle.type << "\n";
49 ofile << guts::GTABTABTAB << "multiplicity: " << particle.multiplicity << "\n";
50 ofile << guts::GTABTABTAB << "p: " << particle.p << "\n";
51 ofile << guts::GTABTABTAB << "theta: " << particle.theta << "\n";
52 ofile << guts::GTABTABTAB << "phi: " << particle.phi << "\n";
53 ofile << guts::GTABTABTAB << "vx: " << particle.vx << "\n";
54 ofile << guts::GTABTABTAB << "vy: " << particle.vy << "\n";
55 ofile << guts::GTABTABTAB << "vz: " << particle.vz << "\n";
56 ofile << guts::GTABTAB << "}\n";
57 }
58
59 ofile << guts::GTAB << "}\n";
60 return true;
61}
62
63bool GstreamerTextFactory::publishEventAncestorsImpl(const GAncestorBank& ancestors) {
64 if (!ofile.is_open()) {
65 log->error(gstreamer::ERR_CANTOPENOUTPUT, SFUNCTION_NAME, "Error: can't access ", filename());
66 }
67
68 ofile << guts::GTAB << "Ancestor Bank {\n";
69 for (const auto& ancestor : ancestors) {
70 ofile << guts::GTABTAB << "Track {\n";
71 ofile << guts::GTABTABTAB << "pid: " << ancestor.pid << "\n";
72 ofile << guts::GTABTABTAB << "tid: " << ancestor.tid << "\n";
73 ofile << guts::GTABTABTAB << "mtid: " << ancestor.mtid << "\n";
74 ofile << guts::GTABTABTAB << "trackE: " << ancestor.trackE << "\n";
75 ofile << guts::GTABTABTAB << "px: " << ancestor.px << "\n";
76 ofile << guts::GTABTABTAB << "py: " << ancestor.py << "\n";
77 ofile << guts::GTABTABTAB << "pz: " << ancestor.pz << "\n";
78 ofile << guts::GTABTABTAB << "vx: " << ancestor.vx << "\n";
79 ofile << guts::GTABTABTAB << "vy: " << ancestor.vy << "\n";
80 ofile << guts::GTABTABTAB << "vz: " << ancestor.vz << "\n";
81 ofile << guts::GTABTAB << "}\n";
82 }
83 ofile << guts::GTAB << "}\n";
84 return true;
85}
std::shared_ptr< GLogger > log
std::vector< GAncestorData > GAncestorBank
std::vector< GGeneratedParticleData > GGeneratedParticleBank
std::string getIdentityString(std::vector< GIdentifier > gidentity)
ASCII streamer plugin declarations.
Shared constants and error codes for the gstreamer module.
constexpr int ERR_CANTOPENOUTPUT
Output medium could not be opened successfully.
constexpr char GTABTAB[]
constexpr char GTABTABTAB[]
constexpr char GTAB[]