DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
DetID.hxx
Go to the documentation of this file.
1
3
4static_assert(DetID::s_det_id_version == 1,
5 "This is intentionally designed to tell the developer to update the static_assert checks (including this "
6 "one) when the version is bumped");
7static_assert(sizeof(DetID) == 4, "DetID struct size different than expected!");
8static_assert(offsetof(DetID, version) == 0, "DetID version field not at expected offset");
9static_assert(offsetof(DetID, subdetector) == 2, "DetID subdetector field not at expected offset");
10
17inline std::ostream&
18operator<<(std::ostream& o, DetID::Subdetector const& type)
19{
20 return o << DetID::subdetector_to_string(type);
21}
22
29inline std::ostream&
30operator<<(std::ostream& o, DetID const& det_id)
31{
32 return o << "subdetector: " << det_id.subdetector ;
33}
34
41inline std::istream&
42operator>>(std::istream& is, DetID::Subdetector& t)
43{
44 std::string tmp;
45 is >> tmp;
46
48
49 return is;
50}
57inline std::istream&
58operator>>(std::istream& is, DetID& det_id)
59{
60 std::string tmp;
61 is >> tmp >> det_id.subdetector;
62
63 return is;
64}
65
66std::string
68{
69 switch (type) {
71 return "DAQ";
73 return "HD_PDS";
75 return "HD_TPC";
77 return "HD_CRT";
79 return "VD_Cathode_PDS";
81 return "VD_Membrane_PDS";
83 return "VD_Bottom_TPC";
85 return "VD_Top_TPC";
87 return "VD_BernCRT";
89 return "VD_GrenobleCRT";
91 return "NDLAr_TPC";
93 return "NDLAr_PDS";
95 return "ND_GAr";
96 default:
97 return "Unknown";
98 }
99}
100
102DetID::string_to_subdetector(const std::string& typestring)
103{
104 if (typestring == "DAQ")
105 return Subdetector::kDAQ;
106 if (typestring == "HD_PDS")
108 if (typestring == "HD_TPC")
110 if (typestring == "HD_CRT")
112 if (typestring == "VD_Cathode_PDS")
114 if (typestring == "VD_Membrane_PDS")
116 if (typestring == "VD_Bottom_TPC")
118 if (typestring == "VD_Top_TPC")
120 if (typestring == "VD_BernCRT")
122 if (typestring == "VD_GrenobleCRT")
124 if (typestring == "NDLAr_TPC")
126 if (typestring == "NDLAr_PDS")
128 if (typestring == "ND_GAr")
130
132}
133
134} // namespace dunedaq::detdataformats
std::istream & operator>>(std::istream &is, DetID::Subdetector &t)
Read a DetID::Subdetector from a string stream.
Definition DetID.hxx:42
std::ostream & operator<<(std::ostream &o, DAQEthHeader const &h)
DetID is a versioned structure containing the 6 bits field of the unique identifier for a subdetector...
Definition DetID.hpp:30
static std::string subdetector_to_string(const Subdetector &type)
Definition DetID.hxx:67
static Subdetector string_to_subdetector(const std::string &typestring)
Definition DetID.hxx:102
static constexpr Version_t s_det_id_version
The version of this DetID struct.
Definition DetID.hpp:60
Subdetector
The Subdetector enum describes the kind of source we're dealing with.
Definition DetID.hpp:40