This commit is contained in:
Jan Kieseler
2023-10-07 11:14:45 +02:00
parent 34a0305601
commit 51001d1b59
15 changed files with 69 additions and 69 deletions
+11 -11
View File
@@ -3,23 +3,23 @@
#include <pybind11/stl.h>
#include <pybind11/operators.h>
#include "ConstructionWrapper.hh"
#include "GeometryDescriptor.hh"
#include "G4System.hh"
namespace py = pybind11;
template<class M>
void makeConstructionWrapper(M & m, std::string name){
void makeGeometryDescriptor(M & m, std::string name){
py::class_<ConstructionWrapper>(m, name.data()).def(py::init())
.def("addLayer", &ConstructionWrapper::addLayer, py::arg("thickness"), py::arg("material"), py::arg("isActive")=true, py::arg("nx")=1, py::arg("ny")=-1)
.def("getXYWidth", &ConstructionWrapper::getXYWidth)
py::class_<GeometryDescriptor>(m, name.data()).def(py::init())
.def("addLayer", &GeometryDescriptor::addLayer, py::arg("thickness"), py::arg("material"), py::arg("isActive")=true, py::arg("nx")=1, py::arg("ny")=-1)
.def("getXYWidth", &GeometryDescriptor::getXYWidth)
// bind overloaded getLayers function
.def("getLayers", (std::vector<Layer> & (ConstructionWrapper::*)()) &ConstructionWrapper::getLayers)
.def("getLayers", (const std::vector<Layer> & (ConstructionWrapper::*)() const) &ConstructionWrapper::getLayers)
.def("isAssigned", &ConstructionWrapper::isAssigned)
.def("getNSensors", &ConstructionWrapper::getNSensors);
.def("getLayers", (std::vector<Layer> & (GeometryDescriptor::*)()) &GeometryDescriptor::getLayers)
.def("getLayers", (const std::vector<Layer> & (GeometryDescriptor::*)() const) &GeometryDescriptor::getLayers)
.def("isAssigned", &GeometryDescriptor::isAssigned)
.def("getNSensors", &GeometryDescriptor::getNSensors);
}
@@ -34,7 +34,7 @@ void makeG4System(M &m, std::string name)
.def("displayEvent", &G4System::displayEvent)
// .def("printMaterial", &G4System::printMaterial, py::arg("name"))
//.def("check", &G4System::check)
.def("getConstructionWrapper", &G4System::getConstructionWrapper);
.def("getGeometryDescriptor", &G4System::getGeometryDescriptor);
}
@@ -66,7 +66,7 @@ void makeSensor(M &m, std::string name){
PYBIND11_MODULE(minicalo, m)
{
m.doc() = "pybind11 plugin"; // optional module docstring
makeConstructionWrapper(m, "ConstructionWrapper");
makeGeometryDescriptor(m, "GeometryDescriptor");
makeG4System(m, "G4System");
makeSensor(m, "Sensor");
makeLayer(m, "Layer");