Geant4 Python documentation with minimal examples

Hello!

It must be very stupid, but I can not find documentation on the Python interface for Geant4 (v 11). Could someone guide me to the docs?

The module being installed is called “Geant4”, whereas the examples, some from 2006, in the /geant4-11.0.3/environments/ either refer to g4py and/or include some C++ sources. My goal is to have a Python script that creates minimal geometry, similar to example B1. Google search brings code that has too much for a start and possibly too old.

The big idea is to allow students who are more familiar with Python the opportunity to learn basic simulations.

I have checked the dates of the Python interface code in the Geant4 source. Unfortunately, they are more than ten years old. It is a shame that the Python interface did not reach a usable state, but maybe in the future, that could be possible.

Hello!
I did not understand the question. I have installed Geant4 with python interface successfully by two ways and both of them are working. Could you please to clarify what is the question? Is it problems with Installation procedure or you need an example?
P/S
I’m not big expert in Geant4, but I use it to make some not complicated simulations.

I wanted to see a 100% Python example similar to B1. However, the supplied examples contain complex 2.x code written 10+ years ago.

As far as i see you already have Geant4 installed and Geant4-Python interface too&
So I believe that the best way to have an example B1 working you need to use geant4-pybind. You can find package and examples (B1 particularly) at geant4-pybind · PyPI. The other way is to get B1example.py and rewrite it for Geant4 which build on Boost.Python.

That was the second option. Unfortunately, it is way too much work to rewrite B1 for the present Geant4 Python interface, as many function calls require C++ objects as parameters. It works fine with a hybrid C++/Python source, but it is not the way one can teach physics students.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.