diff --git a/bind/bindings.cpp b/bind/bindings.cpp index 782d2c1..89cc578 100644 --- a/bind/bindings.cpp +++ b/bind/bindings.cpp @@ -23,7 +23,8 @@ void makeG4System(M& m, std::string name){ .def("run_gui", &G4System::run_gui) .def("run_batch", &G4System::run_batch, py::arg("nEvents"), py::arg("partSpecies"), py::arg("minEnergy_GeV"), py::arg("maxEnergy_GeV")) .def("run_visualize", &G4System::run_visualize, py::arg("partSpecies"), py::arg("minEnergy_GeV"), py::arg("maxEnergy_GeV")) - .def("applyUICommand", &G4System::applyUICommand, py::arg("command")); + .def("applyUICommand", &G4System::applyUICommand, py::arg("command")) + .def("printMaterial", &G4System::printMaterial, py::arg("name")); } PYBIND11_MODULE(minicalo, m) { diff --git a/bind/example.py b/bind/example.py index 1d6c950..cf3e907 100644 --- a/bind/example.py +++ b/bind/example.py @@ -10,4 +10,5 @@ G4s = G4System() G4s.init(cw) G4s.run_batch(100, "gamma", 1, 5) #100 events, photons, 1000 MeV to 5000 MeV -G4s.run_visualize("gamma", 1, 5) \ No newline at end of file +#G4s.run_visualize("gamma", 1, 5) +G4s.printMaterial("G4_Pb") \ No newline at end of file diff --git a/include/G4System.hh b/include/G4System.hh index effe9c8..3e85711 100644 --- a/include/G4System.hh +++ b/include/G4System.hh @@ -45,6 +45,7 @@ void applyUICommand(const std::string& command){ void displayEvent()const{}; //just a placeholder, this will be implemented in python +void printMaterial(const std::string& name)const; private: diff --git a/src/G4System.cc b/src/G4System.cc index b3fd4e6..44f25a6 100644 --- a/src/G4System.cc +++ b/src/G4System.cc @@ -1,5 +1,8 @@ #include "G4System.hh" +#include +#include +#include void G4System::init(ConstructionWrapper &CW){ @@ -122,6 +125,12 @@ void G4System::run_visualize(const std::string& partSpecies, double minEnergy, d runManager->BeamOn(1); } +void G4System::printMaterial(const std::string& materialName)const{ + // Get the material from the material name + return ; //ToDo +} + + void G4System::run_gui(){ if(ui == nullptr){ throw std::runtime_error("GUI not initialized");