Language Bindings¶
Currently bindings to Python and Julia are available for Geant4. The Python bindings are more mature and are used by a larger number of users providing a very similar interface as the C++ interface to the Geant4 toolkit. The Julia bindings also provide a similar interface, but also attempt to provide an easier to use front-end interface to Geant4 core functionality.
The bindings are contributions from the Geant4 community and are not part of the Geant4 core distribution. Typically releases of them follow closely the release of the Geant4 core.
Python bindings¶
Python bindings to Geant4 are available from two packages.
geant4py¶
The geant4py package was originally implemented with Boost-Python. In Geant4 version 11, it was migrated to pybind11 as a Python binding tool and revised the tool set.
geant4_pybind¶
The geant4_pybind package is loosely based on geant4py, but retains an API closer to the standard C++ API. It currently includes all geant4py bindings plus a large portion of very commonly used classes and functions that aren’t currently present in geant4py. However, the complete Geant4 public API is not yet available.
Julia bindings¶
The Julia bindings to Geant4 are provided by the Geant4.jl package. The Geant4.jl package provides an API similar to the C++ API, but but with an easier to use interface to Geant4 core functionality. Besides ergonomics, Geant4.jl offers performance close to native C++ for applications with user actions and sensitive detectors.
The package is still under development and does not include all classes which maybe required for specific applications. Adding all classes directly is not prudent since they are not all used by application developers and they would bloat the wrapper library unnecessarily. In the case, a user needs a new class or classes there are the instructions on how to add them locally. Upon request these can be later added in the released package. The Geant4.jl package is a community driven project and contributions are welcome.
Documentation for the Geant4.jl package is available online. In addition, a set of tutorials and examples are available in the Geant4.jl package to help users get started.