mcpl-geant4
This package faciliates the usage of Monte Carlo Particle Lists ( MCPL, https://mctools.github.io/mcpl/ ) files with Geant4.
Usage in Geant4 (C++) code
The interface between MCPL and Geant4 consists of two classes, G4MCPLGenerator
and G4MCPLWriter, which users can use to either generate primary events from
the particles in an existing MCPL file (1 particle per event), or to capture the
particle state of particles entering one or more specified volumes in the
simulation geometry and write them to a new MCPL file.
Refer to https://mctools.github.io/mcpl/hooks_geant4/ and section 3.1 of the MCPL paper (https://doi.org/10.1016/j.cpc.2017.04.012) for how to use these two classes in a Geant4 simulation.
G4MCPLWriter and G4MCPLGenerator do not support multi-threaded run managers
yet; create the run manager with G4RunManagerType::SerialOnly.
Usage Examples
Two complete usage examples along with the necessary CMake code is provided in the mcpl-geant4 repository at:
- https://github.com/mctools/mcpl-geant4/tree/main/example_write
- https://github.com/mctools/mcpl-geant4/tree/main/example_read
Installation and Configuration
To use the MCPL-Geant4 bindings, one must:
- Install MCPL and Geant4. Although it is possible to build both projects
manually, it should be noted that both are available on conda-forge. If not
using conda, note that MCPL is also available on PyPI, so assuming
Geant4 has already been installed in another manner, it might be possible to
simply complete the setup by a
pip install mcpl. - Install mcpl-geant4. This can be done by
pip install mcpl-geant4, or alternatively by cloning the repository at https://github.com/mctools/ncrystal-geant4 and setting the CMake variableNCrystalGeant4_DIRto point at thesrc/mcpl_geant4/cmakesubdir of the cloned repo. - Edit your projects CMakeLists.txt to add a
find_package(MCPLGeant4)statement, and adding theMCPLGeant4::MCPLGeant4target as a dependency of the Geant4 application you are building. - Edit your C++ code and include the header file(s)
MCPLGeant4/G4MCPLWriter.hhand/orMCPLGeant4/G4MCPLGenerator.hhas needed. Then use the corresponding classes in your Geant4 code as needed (see above for usage instructions.
Scientific reference
A substantial effort went into developing MCPL. If you use it for your work, we would appreciate it if you would use the following reference in your work:
T. Kittelmann, et al., Monte Carlo Particle Lists: MCPL, Computer Physics Communications, Volume 218, September 2017, Pages 17-42, ISSN 0010-4655, https://doi.org/10.1016/j.cpc.2017.04.012
Metadata
Release files for mcpl-geant4 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mcpl_geant4-0.1.0.tar.gz | 22.8 kB | With provenance | Details for mcpl_geant4-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mcpl_geant4-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for mcpl_geant4-0.1.0-py3-none-any.whl |
Total release size: 49.3 kB
Release files / mcpl_geant4-0.1.0.tar.gz
| Download URL | mcpl_geant4-0.1.0.tar.gz |
|---|---|
| Size | 22.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
46a8003655c2ecd97ad543ad428ac028e2ba205cd7bb200d6cc63a77d135d9b8
|
|
BLAKE2b-256 checksum How to use checksums |
140a3ec97ea98abf37a8d04ce9095f0df610d8b84bf953eb6ad86ee70bf4b8d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / mcpl_geant4-0.1.0-py3-none-any.whl
| Download URL | mcpl_geant4-0.1.0-py3-none-any.whl |
|---|---|
| Size | 26.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0d4a8270e0324d58a554e8232d37ca8e8635255dce06bdc2977af89e4c00896
|
|
BLAKE2b-256 checksum How to use checksums |
df0ebed09664e1ad29b2a87d0cfd263192c914af677bdfc83cc8312228dcdc5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for mcpl-geant4 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for mcpl_geant4-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.