Skip to main content

g4new

PyPI version License: MIT Python 3.12+ Ruff CI codecov Documentation

Easiest way to get a fully working Geant4 project ready to run

Quick Start

pip install g4new
g4new init myproject

g4new init options

g4new init PROJECT_NAME [OPTIONS]
Option Default Description
--particle TEXT e- Primary particle fired by the generated gun
--energy TEXT 6 MeV Primary energy, e.g. 6 MeV, 1.5 GeV (value + a Geant4 unit: eV/keV/MeV/GeV/TeV)
--physics TEXT FTFP_BERT Geant4 reference physics list
--skip-cmake Skip the CMake dependency check
--skip-geant4 Skip the Geant4 dependency check
--override Overwrite the project directory if it already exists

Generated project

g4new init myproject scaffolds a complete, buildable Geant4 application. Its geometry places a central water Target volume; an EventAction/SteppingAction pair scores the energy deposited there and writes analysis output through G4AnalysisManager. Alongside the sources it ships macros/vis.mac, macros/run.mac, a generated README.md, and a .gitignore.

myproject/
  CMakeLists.txt
  macros/
    vis.mac
    run.mac
  include/
  src/
  README.md
  .gitignore

Build it:

cmake -B myproject/build -S myproject
cmake --build myproject/build

Running the generated project

Run with no arguments to open an interactive OpenGL viewer (executes macros/vis.mac):

./build/myproject

Run headless/batch by passing a macro:

./build/myproject --mac macros/run.mac

The executable parses its own command-line options:

Option Description
--mac <file> Run the given macro in batch mode instead of opening the viewer
--verbose Enable verbose output (reserved for future use)
--out <file> Output file (reserved for future use)
--help, -h Show usage

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

g4new-0.1.0.tar.gz (24.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

g4new-0.1.0-py3-none-any.whl (25.1 kB view details)

Uploaded Python 3

File details

Details for the file g4new-0.1.0.tar.gz.

File metadata

  • Download URL: g4new-0.1.0.tar.gz
  • Upload date:
  • Size: 24.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for g4new-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2615e9d44e1bbd7a06ee6990ef8dd68623ce2b3908c3c4d9e0373283e06a32cf
MD5 20ed08d4bdcdff1031fc77ce2cc3d454
BLAKE2b-256 42bd82d001b80e2db3680a2b681ab7600f0d5279bbc6beea423239e5cb4d4f0f

See more details on using hashes here.

File details

Details for the file g4new-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: g4new-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 25.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.13

File hashes

Hashes for g4new-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3be12ccbdd73484f84c26b76454b80af6d75dbc08a9515fcd9bf9fc975807b34
MD5 ff381dfe3b83d739ecd45d988236201c
BLAKE2b-256 58f1b0507bf5137639c32e2fea35fc15c6e03c205bf2f5abc97c495069aca1f6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page