diff --git a/setup.py b/setup.py index 305f41df63fb4767abcf41de0d47e2028e3e98dd..922745ae4f2c5605d1ae8033daf302719c75b19a 100644 --- a/setup.py +++ b/setup.py @@ -26,14 +26,14 @@ def get_jpp_include(): ext_modules = [ Extension( - 'jppy.pdf', - ['src/pdf.cc'], + 'jppy.{}'.format(module), + ['src/{}.cc'.format(module)], include_dirs=[ get_pybind_include(), get_pybind_include(user=True), get_jpp_include() ], - language='c++') + language='c++') for module in ['pdf', 'npe'] ] # Populating the __init__.py with submodule imports, so that one can import diff --git a/src/npe.cc b/src/npe.cc new file mode 100644 index 0000000000000000000000000000000000000000..8e3eeabbe5f5931a2b1a95c8e2614a248cc31d74 --- /dev/null +++ b/src/npe.cc @@ -0,0 +1,32 @@ +#include <pybind11/pybind11.h> + +#include "JPhysics/JNPE_t.hh" + +namespace py = pybind11; + +PYBIND11_MODULE(npe, m) { + m.doc() = "NPE utilities"; + py::class_<JMuonNPE_t>(m, "JMuonNPE") + .def(py::init<const std::string &, double, int, double>(), + py::arg("file_descriptor"), + py::arg("TTS"), + py::arg("number_of_points") = 25, + py::arg("epsilon") = 1e-10) + .def("calculate", &JMuonNPE_t::calculate, + py::arg("E"), + py::arg("R"), + py::arg("theta"), + py::arg("phi") + ), + py::class_<JShowerNPE_t>(m, "JShowerNPE") + .def(py::init<const std::string &, int>(), + py::arg("file_descriptor"), + py::arg("number_of_points") = 0) + .def("calculate", &JShowerNPE_t::calculate, + py::arg("E"), + py::arg("D"), + py::arg("cd"), + py::arg("theta"), + py::arg("phi") + ); +}