21 {
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}