Metadata-Version: 2.4
Name: g4new
Version: 0.1.0
Summary: Easiest way to get a fully working Geant4 project ready to run
Author-email: Matteo Brini <brinimatteo@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Matteo Brini
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/brinus/g4new
Project-URL: Repository, https://github.com/brinus/g4new
Project-URL: Issues, https://github.com/brinus/g4new/issues
Keywords: geant4,cmake,scaffolding,particle-physics,simulation
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.0
Requires-Dist: jinja2>=3.0
Provides-Extra: test
Requires-Dist: pytest>=8.0; extra == "test"
Requires-Dist: pytest-cov>=5.0; extra == "test"
Dynamic: license-file

# g4new

[![PyPI version](https://badge.fury.io/py/g4new.svg)](https://badge.fury.io/py/g4new)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![CI](https://github.com/brinus/g4new/actions/workflows/ci.yml/badge.svg)](https://github.com/brinus/g4new/actions/workflows/ci.yml)
[![codecov](https://codecov.io/gh/brinus/g4new/graph/badge.svg)](https://codecov.io/gh/brinus/g4new)
[![Documentation](https://img.shields.io/badge/docs-brinus.github.io/g4new-blue)](https://brinus.github.io/g4new/)

> **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 |
