DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
detid.cpp
Go to the documentation of this file.
1
8
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
22register_detid(py::module& m)
23{
24 py::class_<DetID> py_detid(m, "DetID");
25 py_detid.def(py::init())
26 .def(py::init<const DetID::Subdetector&>())
27 .def("__repr__",
28 [](const DetID& gid) {
29 std::ostringstream oss;
30 oss << "<detdataformats::DetID " << DetID::subdetector_to_string(gid.subdetector) << ">";
31 return oss.str();
32 })
33 .def("subdetector_to_string", &DetID::subdetector_to_string)
34 .def("string_to_subdetector", &DetID::string_to_subdetector);
35
36 py::enum_<DetID::Subdetector>(py_detid, "Subdetector")
37 .value("kUnknown", DetID::Subdetector::kUnknown)
38 .value("kDAQ", DetID::Subdetector::kDAQ)
39 .value("kHD_PDS", DetID::Subdetector::kHD_PDS)
40 .value("kHD_TPC", DetID::Subdetector::kHD_TPC)
41 .value("kHD_CRT", DetID::Subdetector::kHD_CRT)
42 .value("kVD_CathodePDS", DetID::Subdetector::kVD_CathodePDS)
43 .value("kVD_MembranePDS", DetID::Subdetector::kVD_MembranePDS)
44 .value("kVD_BottomTPC", DetID::Subdetector::kVD_BottomTPC)
45 .value("kVD_TopTPC", DetID::Subdetector::kVD_TopTPC)
46 .value("kVD_BernCRT", DetID::Subdetector::kVD_BernCRT)
47 .value("kVD_GrenobleCRT", DetID::Subdetector::kVD_GrenobleCRT)
48 .value("kNDLAr_TPC", DetID::Subdetector::kNDLAr_TPC)
49 .value("kNDLAr_PDS", DetID::Subdetector::kNDLAr_PDS)
50 .value("kND_GAr", DetID::Subdetector::kND_GAr)
51 .export_values();
52
53 py_detid.def_readwrite("subdetector", &DetID::subdetector);
54}
55
56} // namespace dunedaq::detdataformats::python
void register_detid(py::module &m)
Definition detid.cpp:22
DetID is a structure containing the 6 bits field of the unique identifier for a subdetector in the ra...
Definition DetID.hpp:30
static std::string subdetector_to_string(const Subdetector &type)
Definition DetID.hxx:60
static Subdetector string_to_subdetector(const std::string &typestring)
Definition DetID.hxx:95
Subdetector subdetector
The general subdetector of the source of the data.
Definition DetID.hpp:56