|
| 1 | +#include <pybind11/pybind11.h> |
| 2 | +#include <pybind11/stl.h> |
| 3 | + |
| 4 | +#include <G4MultiSensitiveDetector.hh> |
| 5 | + |
| 6 | +#include "typecast.hh" |
| 7 | +#include "opaques.hh" |
| 8 | + |
| 9 | +namespace py = pybind11; |
| 10 | + |
| 11 | +class PublicG4MultiSensitiveDetector : public G4MultiSensitiveDetector { |
| 12 | +public: |
| 13 | + using G4MultiSensitiveDetector::ProcessHits; |
| 14 | +}; |
| 15 | + |
| 16 | +// Trampolin class |
| 17 | +class PyG4MultiSensitiveDetector : public G4MultiSensitiveDetector, public py::trampoline_self_life_support { |
| 18 | +public: |
| 19 | + using G4MultiSensitiveDetector::G4MultiSensitiveDetector; |
| 20 | + |
| 21 | + void Initialize(G4HCofThisEvent *hCofThisEvent) override |
| 22 | + { |
| 23 | + PYBIND11_OVERRIDE(void, G4MultiSensitiveDetector, Initialize, hCofThisEvent); |
| 24 | + } |
| 25 | + |
| 26 | + void EndOfEvent(G4HCofThisEvent *hCofThisEvent) override |
| 27 | + { |
| 28 | + PYBIND11_OVERRIDE(void, G4MultiSensitiveDetector, EndOfEvent, hCofThisEvent); |
| 29 | + } |
| 30 | + |
| 31 | + void clear() override { PYBIND11_OVERRIDE(void, G4MultiSensitiveDetector, clear, ); } |
| 32 | + |
| 33 | + void DrawAll() override { PYBIND11_OVERRIDE(void, G4MultiSensitiveDetector, DrawAll, ); } |
| 34 | + |
| 35 | + void PrintAll() override { PYBIND11_OVERRIDE(void, G4MultiSensitiveDetector, PrintAll, ); } |
| 36 | + |
| 37 | + G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist) override |
| 38 | + { |
| 39 | + PYBIND11_OVERRIDE(G4bool, G4MultiSensitiveDetector, ProcessHits, aStep, ROhist); |
| 40 | + } |
| 41 | +}; |
| 42 | + |
| 43 | +void export_G4MultiSensitiveDetector(py::module &m) |
| 44 | +{ |
| 45 | + py::class_<G4MultiSensitiveDetector, PyG4MultiSensitiveDetector, G4VSensitiveDetector>(m, "G4MultiSensitiveDetector") |
| 46 | + |
| 47 | + .def(py::init<G4String>()) |
| 48 | + |
| 49 | + .def("Initialize", &G4MultiSensitiveDetector::Initialize) |
| 50 | + .def("EndOfEvent", &G4MultiSensitiveDetector::EndOfEvent) |
| 51 | + .def("clear", &G4MultiSensitiveDetector::clear) |
| 52 | + .def("DrawAll", &G4MultiSensitiveDetector::DrawAll) |
| 53 | + .def("PrintAll", &G4MultiSensitiveDetector::PrintAll) |
| 54 | + .def("ProcessHits", &PublicG4MultiSensitiveDetector::ProcessHits) |
| 55 | + .def("GetSD", &G4MultiSensitiveDetector::GetSD) |
| 56 | + .def("GetSize", &G4MultiSensitiveDetector::GetSize) |
| 57 | + .def("ClearSDs", &G4MultiSensitiveDetector::ClearSDs) |
| 58 | + .def("AddSD", &G4MultiSensitiveDetector::AddSD); |
| 59 | +} |
0 commit comments