DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
detid.cpp
Go to the documentation of this file.
1
10
11#include <pybind11/operators.h>
12#include <pybind11/pybind11.h>
13#include <pybind11/stl.h>
14
15#include <sstream>
16
17namespace py = pybind11;
18
20
21void register_detid(py::module& m) {
22 py::class_<DetID> py_detid(m, "DetID");
23 py_detid.def(py::init())
24 .def(py::init<const DetID::Subdetector&>())
25 .def("__repr__", [](const DetID& gid) {
26 std::ostringstream oss;
27 oss << "<detdataformats::DetID " << gid.to_string() << ">";
28 return oss.str();
29 })
30 .def("to_string", &DetID::to_string)
31 .def("is_in_valid_state", &DetID::is_in_valid_state)
32 .def("subdetector_to_string", &DetID::subdetector_to_string)
33 .def("string_to_subdetector", &DetID::string_to_subdetector);
34
35 py::enum_<DetID::Subdetector>(py_detid, "Subdetector")
36 .value("kUnknown", DetID::Subdetector::kUnknown)
37 .value("kDAQ", DetID::Subdetector::kDAQ)
38 .value("kHD_PDS", DetID::Subdetector::kHD_PDS)
39 .value("kHD_TPC", DetID::Subdetector::kHD_TPC)
40 .value("kHD_CRT", DetID::Subdetector::kHD_CRT)
41 .value("kVD_CathodePDS", DetID::Subdetector::kVD_CathodePDS)
42 .value("kVD_MembranePDS", DetID::Subdetector::kVD_MembranePDS)
43 .value("kVD_BottomTPC", DetID::Subdetector::kVD_BottomTPC)
44 .value("kVD_TopTPC", DetID::Subdetector::kVD_TopTPC)
45 .value("kNDLAr_TPC", DetID::Subdetector::kNDLAr_TPC)
46 .value("kNDLAr_PDS", DetID::Subdetector::kNDLAr_PDS)
47 .value("kND_GAr", DetID::Subdetector::kND_GAr)
48 .export_values();
49
50 py_detid.def_readwrite("version", &DetID::version)
51 .def_readwrite("subdetector", &DetID::subdetector);
52}
53
54} // namespace dunedaq::detdataformats::python
55
void register_detid(py::module &m)
Definition detid.cpp:21
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
std::string to_string() const
Definition DetID.hpp:77
static Subdetector string_to_subdetector(const std::string &typestring)
Definition DetID.hxx:102
bool is_in_valid_state() const noexcept
Definition DetID.hpp:84
Subdetector subdetector
The general subdetector of the source of the data.
Definition DetID.hpp:69
Version_t version
Version number of the DetID.
Definition DetID.hpp:65