Skip to content

Commit

Permalink
Update to Geant4 11.3 interface
Browse files Browse the repository at this point in the history
  • Loading branch information
HaarigerHarald committed Dec 16, 2024
1 parent 4da3c84 commit c3e328c
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 0 deletions.
6 changes: 6 additions & 0 deletions source/digits_hits/pyG4SDManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <G4SDManager.hh>
#include <G4MultiFunctionalDetector.hh>

#include <G4Version.hh>

#include "typecast.hh"
#include "opaques.hh"

Expand All @@ -22,7 +24,11 @@ void export_G4SDManager(py::module &m)
[](G4SDManager &self, py::disown_ptr<G4VSensitiveDetector> aSD) { self.AddNewDetector(aSD); })

.def("Activate", &G4SDManager::Activate)
#if G4VERSION_NUMBER >= 1130
.def("GetCollectionID", py::overload_cast<const G4String &>(&G4SDManager::GetCollectionID))
#else
.def("GetCollectionID", py::overload_cast<G4String>(&G4SDManager::GetCollectionID))
#endif
.def("GetCollectionID", py::overload_cast<G4VHitsCollection *>(&G4SDManager::GetCollectionID))

.def("FindSensitiveDetector", &G4SDManager::FindSensitiveDetector, py::arg("dName"), py::arg("warning") = true,
Expand Down
6 changes: 6 additions & 0 deletions source/event/pyG4PrimaryTransformer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <G4Event.hh>
#include <G4PrimaryVertex.hh>

#include <G4Version.hh>

#include "typecast.hh"
#include "opaques.hh"

Expand Down Expand Up @@ -51,6 +53,10 @@ void export_G4PrimaryTransformer(py::module &m)
.def("GimmePrimaries", &G4PrimaryTransformer::GimmePrimaries, py::arg("anEvent"), py::arg("trackIDCounter") = 0,
py::return_value_policy::reference)

#if G4VERSION_NUMBER >= 1130
.def("SetUnknownParticleDefined", &G4PrimaryTransformer::SetUnknownParticleDefined, py::arg("vl"))
#else
.def("SetUnknnownParticleDefined", &G4PrimaryTransformer::SetUnknnownParticleDefined, py::arg("vl"))
#endif
.def("SetVerboseLevel", &G4PrimaryTransformer::SetVerboseLevel, py::arg("vl"));
}
6 changes: 6 additions & 0 deletions source/geometry/management/pyG4GeometryManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#include <G4SmartVoxelHeader.hh>
#include <G4VPhysicalVolume.hh>

#include <G4Version.hh>

#include "typecast.hh"
#include "opaques.hh"

Expand All @@ -21,7 +23,11 @@ void export_G4GeometryManager(py::module &m)
py::arg("vol") = static_cast<G4VPhysicalVolume *>(nullptr))

.def("OpenGeometry", &G4GeometryManager::OpenGeometry, py::arg("vol") = static_cast<G4VPhysicalVolume *>(nullptr))
#if G4VERSION_NUMBER >= 1130
.def("IsGeometryClosed", &G4GeometryManager::IsGeometryClosed)
#else
.def_static("IsGeometryClosed", &G4GeometryManager::IsGeometryClosed)
#endif
.def("SetWorldMaximumExtent", &G4GeometryManager::SetWorldMaximumExtent, py::arg("worldExtent"))
.def_static("GetInstance", &G4GeometryManager::GetInstance, py::return_value_policy::reference)
.def_static("GetInstanceIfExist", &G4GeometryManager::GetInstanceIfExist, py::return_value_policy::reference);
Expand Down
1 change: 1 addition & 0 deletions source/geometry/solids/specific/pyG4GenericTrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <G4VisExtent.hh>
#include <G4DisplacedSolid.hh>
#include <G4VisAttributes.hh>
#include <G4Polyhedron.hh>

#include "typecast.hh"
#include "opaques.hh"
Expand Down
6 changes: 6 additions & 0 deletions source/intercoms/pyG4UIcmdWith3VectorAndUnit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <G4UIcmdWith3VectorAndUnit.hh>
#include <G4UImessenger.hh>

#include <G4Version.hh>

#include "typecast.hh"
#include "opaques.hh"

Expand All @@ -13,7 +15,11 @@ class PyG4UIcmdWith3VectorAndUnit : public G4UIcmdWith3VectorAndUnit {
public:
using G4UIcmdWith3VectorAndUnit::G4UIcmdWith3VectorAndUnit;

#if G4VERSION_NUMBER >= 1130
G4int DoIt(const G4String &parameterList) override
#else
G4int DoIt(G4String parameterList) override
#endif
{
PYBIND11_OVERRIDE(G4int, G4UIcmdWith3VectorAndUnit, DoIt, parameterList);
}
Expand Down
6 changes: 6 additions & 0 deletions source/intercoms/pyG4UIcmdWithADoubleAndUnit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include <G4UIcmdWithADoubleAndUnit.hh>
#include <G4UImessenger.hh>

#include <G4Version.hh>

#include "typecast.hh"
#include "opaques.hh"

Expand All @@ -13,7 +15,11 @@ class PyG4UIcmdWithADoubleAndUnit : public G4UIcmdWithADoubleAndUnit {
public:
using G4UIcmdWithADoubleAndUnit::G4UIcmdWithADoubleAndUnit;

#if G4VERSION_NUMBER >= 1130
G4int DoIt(const G4String &parameterList) override
#else
G4int DoIt(G4String parameterList) override
#endif
{
PYBIND11_OVERRIDE(G4int, G4UIcmdWithADoubleAndUnit, DoIt, parameterList);
}
Expand Down
4 changes: 4 additions & 0 deletions source/intercoms/pyG4UIcommand.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ class PyG4UIcommand : public G4UIcommand {
public:
using G4UIcommand::G4UIcommand;

#if G4VERSION_NUMBER >= 1130
G4int DoIt(const G4String &parameterList) override { PYBIND11_OVERRIDE(G4int, G4UIcommand, DoIt, parameterList); }
#else
G4int DoIt(G4String parameterList) override { PYBIND11_OVERRIDE(G4int, G4UIcommand, DoIt, parameterList); }
#endif

void List() override { PYBIND11_OVERRIDE(void, G4UIcommand, List, ); }
};
Expand Down

0 comments on commit c3e328c

Please sign in to comment.