diff --git a/README.rst b/README.rst index bc1b9e489452dac151d926ec156ad8f4c09ac7c7..cc8accacb3ba304069f1b54fa82360383bb9f379 100644 --- a/README.rst +++ b/README.rst @@ -8,7 +8,7 @@ The jppy Python package :target: https://km3py.pages.km3net.de/jppy This software provides Python access to functionalities in Jpp, like accessing -PDF functions. +PDF and NPE functions. It currently depends on a few Jpp headers (no Jpp compilation needed), make sure the ``$JPP_DIR`` is pointing to the Jpp directory. 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..271a4585d6bf5e2965f04cebe61277a423c6a28d --- /dev/null +++ b/src/npe.cc @@ -0,0 +1,29 @@ +#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 &>(), + py::arg("file_descriptor")) + .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") + ); +}