DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
hdf5rawdatafile.cpp
Go to the documentation of this file.
1
10
11#include <pybind11/pybind11.h>
12#include <pybind11/stl.h>
13#include <pybind11/stl_bind.h>
14
15#include <string>
16
17namespace py = pybind11;
18
19namespace dunedaq {
20namespace hdf5libs {
21namespace python {
22
23void
25{
26
27 py::class_<HDF5RawDataFile>(m, "_HDF5RawDataFile")
28 .def(py::init<std::string>())
29
30 .def("get_attribute_names",
31 &HDF5RawDataFile::get_attribute_names,
32 "Get a list of attribute names")
33
34 .def("get_attribute",
35 py::overload_cast<const std::string&>
36 (&HDF5RawDataFile::get_attribute<std::string>),
37 "Get attribute")
38
39 .def("get_int_attribute",
40 py::overload_cast<const std::string&>
41 (&HDF5RawDataFile::get_attribute<size_t>),
42 "Get integer attribute")
43
44 .def("get_file_name",
45 &HDF5RawDataFile::get_file_name,"Get file name")
46 .def("get_recorded_size",
47 &HDF5RawDataFile::get_recorded_size,"Get recorded size")
48 .def("get_record_type",
49 &HDF5RawDataFile::get_record_type,"Get record type")
50 .def("is_trigger_record_type",
51 &HDF5RawDataFile::is_trigger_record_type,"Is record type TriggerRecord")
52 .def("is_timeslice_type",
53 &HDF5RawDataFile::is_timeslice_type,"Is record type TimeSlice")
54 .def("get_version",
55 &HDF5RawDataFile::get_version,"FileLayout version number")
56
57 .def("get_dataset_paths",
58 &HDF5RawDataFile::get_dataset_paths,
59 "Get all dataset paths under specified top group in file",
60 py::arg("top_level_group_name")="")
61
62 .def("get_all_record_ids",
63 &HDF5RawDataFile::get_all_record_ids,"Get all record/sequence number pairs.")
64 .def("get_all_trigger_record_ids",
65 &HDF5RawDataFile::get_all_trigger_record_ids,"Get all trigger record/sequence number pairs.")
66 .def("get_all_timeslice_ids",
67 &HDF5RawDataFile::get_all_timeslice_ids,"Get all timeslice/sequence number pairs.")
68
69 .def("get_record_header_dataset_paths",
70 &HDF5RawDataFile::get_record_header_dataset_paths,"Get all paths to record header datasets")
71 .def("get_trigger_record_header_dataset_paths",
72 &HDF5RawDataFile::get_trigger_record_header_dataset_paths,"Get all paths to TriggerRecordHeader datasets")
73 .def("get_timeslice_header_dataset_paths",
74 &HDF5RawDataFile::get_timeslice_header_dataset_paths,"Get all paths to TimeSliceHeader datasets")
75
76 .def("get_record_header_dataset_path",
77 py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_record_header_dataset_path),
78 "Get record header path for record id")
79 .def("get_record_header_dataset_path",
80 py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t> //NOLINT(build/unsigned)
81 (&HDF5RawDataFile::get_record_header_dataset_path),
82 "Get record header path for record number and sequence number",
83 py::arg("rec_num"),py::arg("seq_num")=0)
84
85 .def("get_trigger_record_header_dataset_path",
86 py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_trigger_record_header_dataset_path),
87 "Get record header path for trigger record id")
88 .def("get_trigger_record_header_dataset_path",
89 py::overload_cast<const daqdataformats::trigger_number_t,const daqdataformats::sequence_number_t>
90 (&HDF5RawDataFile::get_trigger_record_header_dataset_path),
91 "Get record header path for trigger record number and sequence number",
92 py::arg("trig_num"),py::arg("seq_num")=0)
93
94 .def("get_timeslice_header_dataset_path",
95 py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_timeslice_header_dataset_path),
96 "Get record header path for timeslice record id")
97 .def("get_timeslice_header_dataset_path",
98 py::overload_cast<const daqdataformats::timeslice_number_t>
99 (&HDF5RawDataFile::get_timeslice_header_dataset_path),
100 "Get record header path for timeslice number")
101
102 .def("get_all_fragment_dataset_paths",
103 &HDF5RawDataFile::get_all_fragment_dataset_paths,
104 "Get all paths to Fragment datasets")
105 .def("get_fragment_dataset_paths",
106 py::overload_cast<const HDF5RawDataFile::record_id_t&>(&HDF5RawDataFile::get_fragment_dataset_paths),
107 "Get fragment datasets for record ID")
108 .def("get_fragment_dataset_paths",
109 py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t> //NOLINT(build/unsigned)
110 (&HDF5RawDataFile::get_fragment_dataset_paths),
111 "Get fragment datasets for record number and sequence number",
112 py::arg("rec_num"),py::arg("seq_num")=0)
113 .def("get_fragment_dataset_paths",
114 py::overload_cast<const HDF5RawDataFile::record_id_t&,const daqdataformats::SourceID::Subsystem>
115 (&HDF5RawDataFile::get_fragment_dataset_paths),
116 "Get fragment datasets for record ID and SourceID Subsystem")
117 .def("get_fragment_dataset_paths",
118 py::overload_cast<const HDF5RawDataFile::record_id_t&,const std::string&>
119 (&HDF5RawDataFile::get_fragment_dataset_paths),
120 "Get fragment datasets for record ID and SourceID Subsystem string")
121#if 0
122 .def("get_fragment_dataset_paths",
123 py::overload_cast<const daqdataformats::SourceID::Subsystem>(&HDF5RawDataFile::get_fragment_dataset_paths),
124 "Get fragment datasets for SourceID Subsystem")
125 .def("get_fragment_dataset_paths",
126 py::overload_cast<const std::string&>(&HDF5RawDataFile::get_fragment_dataset_paths),
127 "Get fragment datasets for SourceID Subsystem string")
128 .def("get_fragment_dataset_paths",
129 py::overload_cast<const daqdataformats::SourceID>(&HDF5RawDataFile::get_fragment_dataset_paths),
130 "Get fragment datasets for SourceID")
131 .def("get_fragment_dataset_paths",
132 py::overload_cast<const daqdataformats::SourceID::Subsystem,const uint32_t> //NOLINT(build/unsigned)
133 (&HDF5RawDataFile::get_fragment_dataset_paths),
134 "Get fragment datasets for SourceID Subsystem")
135 .def("get_fragment_dataset_paths",
136 py::overload_cast<const std::string&,const uint32_t> //NOLINT(build/unsigned)
137 (&HDF5RawDataFile::get_fragment_dataset_paths),
138 "Get fragment datasets for SourceID Subsystem string")
139#endif
140 .def("get_geo_ids",
141 py::overload_cast<const HDF5RawDataFile::record_id_t&>
142 (&HDF5RawDataFile::get_geo_ids),
143 "Get all GeoIDs in a record id")
144 .def("get_geo_ids",
145 py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t> //NOLINT(build/unsigned)
146 (&HDF5RawDataFile::get_geo_ids),
147 "Get all GeoIDs in a record/sequence number")
148 .def("get_geo_ids_for_subdetector",
149 py::overload_cast<const HDF5RawDataFile::record_id_t&,const detdataformats::DetID::Subdetector>
150 (&HDF5RawDataFile::get_geo_ids_for_subdetector),
151 "Get all GeoIDs in a record id with the specified Subdetector type")
152 .def("get_source_ids",
153 py::overload_cast<const HDF5RawDataFile::record_id_t&>
154 (&HDF5RawDataFile::get_source_ids),
155 "Get all source IDs in a record id")
156 .def("get_source_ids",
157 py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t> //NOLINT(build/unsigned)
158 (&HDF5RawDataFile::get_source_ids),
159 "Get all source IDs in a record/sequence number")
160 .def("get_source_ids_for_fragment_type",
161 py::overload_cast<const HDF5RawDataFile::record_id_t&,const std::string&>
162 (&HDF5RawDataFile::get_source_ids_for_fragment_type),
163 "Get all source IDs in a record id with a given fragment type")
164 .def("get_source_ids_for_fragtype_and_subdetector",
165 py::overload_cast<const HDF5RawDataFile::record_id_t&,const std::string&,const std::string&>
166 (&HDF5RawDataFile::get_source_ids_for_fragtype_and_subdetector),
167 "Get all source IDs in a record id matching the specified fragment and subdetector types")
168#if 0
169 .def("get_source_ids",
170 py::overload_cast<const HDF5RawDataFile::record_id_t&,const daqdataformats::SourceID::Subsystem>
171 (&HDF5RawDataFile::get_source_ids),
172 "Get all source IDs in a record id with a given SourceID Subsystem")
173 .def("get_source_ids",
174 py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t, //NOLINT(build/unsigned)
176 (&HDF5RawDataFile::get_source_ids),
177 "Get all source IDs in a record/sequence number with a given SourceID Subsystem")
178 .def("get_source_ids",
179 py::overload_cast<const HDF5RawDataFile::record_id_t&,const std::string&>
180 (&HDF5RawDataFile::get_source_ids),
181 "Get all source IDs in a record id with a given SourceID Subsystem string")
182 .def("get_source_ids",
183 py::overload_cast<const uint64_t,const daqdataformats::sequence_number_t, //NOLINT(build/unsigned)
184 const std::string&>
185 (&HDF5RawDataFile::get_source_ids),
186 "Get all source IDs in a record/sequence number with a given SourceID Subsystem string")
187 .def("get_source_ids",
188 py::overload_cast<const daqdataformats::SourceID::Subsystem>
189 (&HDF5RawDataFile::get_source_ids),
190 "Get all source IDs with a given SourceID Subsystem")
191 .def("get_source_ids",
192 py::overload_cast<const std::string&>
193 (&HDF5RawDataFile::get_source_ids),
194 "Get all source IDs with a given SourceID Subsystem string")
195#endif
196
197// .def("get_frag_ptr", py::overload_cast<const std::string & >
198// (&HDF5RawDataFile::get_frag_ptr),
199// "Get Fragment from dataset")
200 .def("get_frag",
201 py::overload_cast<const std::string & >
202 (&HDF5RawDataFile::get_frag_ptr),
203 "Get Fragment from dataset")
204 .def("get_frag",
205 py::overload_cast<const uint64_t, //NOLINT(build/unsigned)
208 (&HDF5RawDataFile::get_frag_ptr),
209 "Get Fragment from record/sequence number and SourceID")
210 .def("get_frag",
211 py::overload_cast<const HDF5RawDataFile::record_id_t&,
213 (&HDF5RawDataFile::get_frag_ptr),
214 "Get Fragment from record id and SourceID")
215
216 .def("get_frag",
217 py::overload_cast<const uint64_t, //NOLINT(build/unsigned)
220 const uint32_t> //NOLINT(build/unsigned)
221 (&HDF5RawDataFile::get_frag_ptr),
222 "Get Fragment from record/sequence number and SourceID elements")
223 .def("get_frag",
224 py::overload_cast<const HDF5RawDataFile::record_id_t&,
226 const uint32_t> //NOLINT(build/unsigned)
227 (&HDF5RawDataFile::get_frag_ptr),
228 "Get Fragment from record id and SourceID elements")
229
230 .def("get_frag",
231 py::overload_cast<const uint64_t, //NOLINT(build/unsigned)
233 const std::string&,
234 const uint32_t> //NOLINT(build/unsigned)
235 (&HDF5RawDataFile::get_frag_ptr),
236 "Get Fragment from record/sequence number and SourceID elements")
237 .def("get_frag",
238 py::overload_cast<const HDF5RawDataFile::record_id_t&,
239 const std::string&,
240 const uint32_t> //NOLINT(build/unsigned)
241 (&HDF5RawDataFile::get_frag_ptr),
242 "Get Fragment from record id and SourceID elements")
243
244 .def("get_frag",
245 py::overload_cast<const HDF5RawDataFile::record_id_t&,
246 const uint64_t> //NOLINT(build/unsigned)
247 (&HDF5RawDataFile::get_frag_ptr),
248 "Get Fragment from record id and GeoID")
249 .def("get_frag",
250 py::overload_cast<const uint64_t, //NOLINT(build/unsigned)
252 const uint64_t> //NOLINT(build/unsigned)
253 (&HDF5RawDataFile::get_frag_ptr),
254 "Get Fragment from record/sequence number and GeoID")
255
256// .def("get_trh_ptr",
257// py::overload_cast<const std::string & >(&HDF5RawDataFile::get_trh_ptr),
258// "Get TriggerRecordHeader from datset")
259 .def("get_trh",
260 py::overload_cast<const std::string & >
261 (&HDF5RawDataFile::get_trh_ptr),
262 "Get TriggerRecordHeader from dataset")
263 .def("get_trh",
264 py::overload_cast<const HDF5RawDataFile::record_id_t&>
265 (&HDF5RawDataFile::get_trh_ptr),
266 "Get TriggerRecordHeader from record id")
267 .def("get_trh",
268 py::overload_cast<const daqdataformats::trigger_number_t,daqdataformats::sequence_number_t>
269 (&HDF5RawDataFile::get_trh_ptr),
270 "Get TriggerRecordHeader from record/sequence number")
271// .def("get_tsh_ptr", py::overload_cast<const std::string & >(&HDF5RawDataFile::get_tsh_ptr),
272// "Get TimeSliceHeader from datset")
273 .def("get_tsh",
274 py::overload_cast<const std::string & >
275 (&HDF5RawDataFile::get_tsh_ptr),
276 "Get TimeSliceHeader from datset")
277 .def("get_tsh",
278 py::overload_cast<const HDF5RawDataFile::record_id_t&>
279 (&HDF5RawDataFile::get_tsh_ptr),
280 "Get TimeSliceHeader from record id")
281 .def("get_tsh",
282 py::overload_cast<const daqdataformats::timeslice_number_t> //NOLINT(build/unsigned)
283 (&HDF5RawDataFile::get_tsh_ptr),
284 "Get TimeSliceHeader from timeslince number")
285
286 .def("get_trigger_record",
287 py::overload_cast<const HDF5RawDataFile::record_id_t&>
288 (&HDF5RawDataFile::get_trigger_record),
289 "Get TriggerRecord object from record id")
290 .def("get_trigger_record",
291 py::overload_cast<const daqdataformats::trigger_number_t,
293 (&HDF5RawDataFile::get_trigger_record),
294 "Get TriggerRecord object from record/sequence number")
295 .def("get_timeslice",
296 py::overload_cast<const HDF5RawDataFile::record_id_t&>
297 (&HDF5RawDataFile::get_timeslice),
298 "Get TimeSlice object from record id")
299 .def("get_timeslice",
300 py::overload_cast<const daqdataformats::timeslice_number_t>
301 (&HDF5RawDataFile::get_timeslice),
302 "Get TimeSlice object from timeslice number")
303 ;
304
305} //NOLINT
306
307} // namespace python
308} // namespace hdf5libs
309} // namespace dunedaq
uint64_t trigger_number_t
Type used to represent trigger number.
Definition Types.hpp:24
uint16_t sequence_number_t
Type used to represent sequence within a trigger record.
Definition Types.hpp:45
void register_hdf5rawdatafile(py::module &m)
Including Qt Headers.
SourceID is a generalized representation of the source of a piece of data in the DAQ....
Definition SourceID.hpp:32
Subsystem
The Subsystem enum describes the kind of source we're dealing with.
Definition SourceID.hpp:43