Skip to content

Commit c3e328c

Browse files
Update to Geant4 11.3 interface
1 parent 4da3c84 commit c3e328c

File tree

7 files changed

+35
-0
lines changed

7 files changed

+35
-0
lines changed

source/digits_hits/pyG4SDManager.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <G4SDManager.hh>
55
#include <G4MultiFunctionalDetector.hh>
66

7+
#include <G4Version.hh>
8+
79
#include "typecast.hh"
810
#include "opaques.hh"
911

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

2426
.def("Activate", &G4SDManager::Activate)
27+
#if G4VERSION_NUMBER >= 1130
28+
.def("GetCollectionID", py::overload_cast<const G4String &>(&G4SDManager::GetCollectionID))
29+
#else
2530
.def("GetCollectionID", py::overload_cast<G4String>(&G4SDManager::GetCollectionID))
31+
#endif
2632
.def("GetCollectionID", py::overload_cast<G4VHitsCollection *>(&G4SDManager::GetCollectionID))
2733

2834
.def("FindSensitiveDetector", &G4SDManager::FindSensitiveDetector, py::arg("dName"), py::arg("warning") = true,

source/event/pyG4PrimaryTransformer.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include <G4Event.hh>
1616
#include <G4PrimaryVertex.hh>
1717

18+
#include <G4Version.hh>
19+
1820
#include "typecast.hh"
1921
#include "opaques.hh"
2022

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

56+
#if G4VERSION_NUMBER >= 1130
57+
.def("SetUnknownParticleDefined", &G4PrimaryTransformer::SetUnknownParticleDefined, py::arg("vl"))
58+
#else
5459
.def("SetUnknnownParticleDefined", &G4PrimaryTransformer::SetUnknnownParticleDefined, py::arg("vl"))
60+
#endif
5561
.def("SetVerboseLevel", &G4PrimaryTransformer::SetVerboseLevel, py::arg("vl"));
5662
}

source/geometry/management/pyG4GeometryManager.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <G4SmartVoxelHeader.hh>
77
#include <G4VPhysicalVolume.hh>
88

9+
#include <G4Version.hh>
10+
911
#include "typecast.hh"
1012
#include "opaques.hh"
1113

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

2325
.def("OpenGeometry", &G4GeometryManager::OpenGeometry, py::arg("vol") = static_cast<G4VPhysicalVolume *>(nullptr))
26+
#if G4VERSION_NUMBER >= 1130
27+
.def("IsGeometryClosed", &G4GeometryManager::IsGeometryClosed)
28+
#else
2429
.def_static("IsGeometryClosed", &G4GeometryManager::IsGeometryClosed)
30+
#endif
2531
.def("SetWorldMaximumExtent", &G4GeometryManager::SetWorldMaximumExtent, py::arg("worldExtent"))
2632
.def_static("GetInstance", &G4GeometryManager::GetInstance, py::return_value_policy::reference)
2733
.def_static("GetInstanceIfExist", &G4GeometryManager::GetInstanceIfExist, py::return_value_policy::reference);

source/geometry/solids/specific/pyG4GenericTrap.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <G4VisExtent.hh>
1111
#include <G4DisplacedSolid.hh>
1212
#include <G4VisAttributes.hh>
13+
#include <G4Polyhedron.hh>
1314

1415
#include "typecast.hh"
1516
#include "opaques.hh"

source/intercoms/pyG4UIcmdWith3VectorAndUnit.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <G4UIcmdWith3VectorAndUnit.hh>
55
#include <G4UImessenger.hh>
66

7+
#include <G4Version.hh>
8+
79
#include "typecast.hh"
810
#include "opaques.hh"
911

@@ -13,7 +15,11 @@ class PyG4UIcmdWith3VectorAndUnit : public G4UIcmdWith3VectorAndUnit {
1315
public:
1416
using G4UIcmdWith3VectorAndUnit::G4UIcmdWith3VectorAndUnit;
1517

18+
#if G4VERSION_NUMBER >= 1130
19+
G4int DoIt(const G4String &parameterList) override
20+
#else
1621
G4int DoIt(G4String parameterList) override
22+
#endif
1723
{
1824
PYBIND11_OVERRIDE(G4int, G4UIcmdWith3VectorAndUnit, DoIt, parameterList);
1925
}

source/intercoms/pyG4UIcmdWithADoubleAndUnit.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#include <G4UIcmdWithADoubleAndUnit.hh>
55
#include <G4UImessenger.hh>
66

7+
#include <G4Version.hh>
8+
79
#include "typecast.hh"
810
#include "opaques.hh"
911

@@ -13,7 +15,11 @@ class PyG4UIcmdWithADoubleAndUnit : public G4UIcmdWithADoubleAndUnit {
1315
public:
1416
using G4UIcmdWithADoubleAndUnit::G4UIcmdWithADoubleAndUnit;
1517

18+
#if G4VERSION_NUMBER >= 1130
19+
G4int DoIt(const G4String &parameterList) override
20+
#else
1621
G4int DoIt(G4String parameterList) override
22+
#endif
1723
{
1824
PYBIND11_OVERRIDE(G4int, G4UIcmdWithADoubleAndUnit, DoIt, parameterList);
1925
}

source/intercoms/pyG4UIcommand.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ class PyG4UIcommand : public G4UIcommand {
1616
public:
1717
using G4UIcommand::G4UIcommand;
1818

19+
#if G4VERSION_NUMBER >= 1130
20+
G4int DoIt(const G4String &parameterList) override { PYBIND11_OVERRIDE(G4int, G4UIcommand, DoIt, parameterList); }
21+
#else
1922
G4int DoIt(G4String parameterList) override { PYBIND11_OVERRIDE(G4int, G4UIcommand, DoIt, parameterList); }
23+
#endif
2024

2125
void List() override { PYBIND11_OVERRIDE(void, G4UIcommand, List, ); }
2226
};

0 commit comments

Comments
 (0)