Celeritas is a particle physics library for detector simulation. The codebase uses C++17 with CUDA/HIP device support and typically integrates with Geant4.
You MUST annotate contributions with your identity, even when acting on behalf of a human.
- A contribution is a commit, pull request, issue, comment, or any other work with human-readable text.
- Your identity is the agent, assistant, or harness; add the model, if known.
- Annotations should be in a body or description, not in subjects or titles.
- "Body" parameters submitted to GitHub API endpoints must contain a π€ emoji.
Submission requirements:
- Issues: always read and follow the
issueskill (.claude/skills/issue/SKILL.md) to submit an issue. - Pull requests: always follow the
pull-requestskill (.claude/skills/pull-request/SKILL.md) to submit a pull request. The description must contain a π€ and a "Generated with" statement (the PR workflow then addsai-generated). - Comments: every comment on an issue or pull request (including review
replies) must disclose the agent harness and model in clear text and
include a π€ emoji, e.g.
π€ (Claude Code, Sonnet 5.5). - Credit:
ai-generatedsubmissions should not modifyscripts/release/contributors.jsonl; only human-authored orai-assistedwork is automatically eligible. Never add an entry for an agent or for purely generated work.
Commit requirements:
- Add a git trailer such as
Co-Authored-ByorAssisted-By(e.g.,git commit --trailer "Assisted-by: Codex (GPT-6)"). - Commit subjects and PR titles: imperative mood, capitalized, no trailing period, no labels/emoji. (PR titles are copied into the release notes.)
- History: you may force-push a PR branch only when it is in draft
form and not under review.
Local history modification is allowed unless it diverges from the remote
branch.
Push new commits rather than amending remote commits, and incorporate
upstream changes by merging
upstream/develop(seeCONTRIBUTING.rst).
Prohibitions:
- Never submit a pull request without
draft=True. - Never mark a pull request as ready.
- Never mark a review comment as resolved. Instead, add a comment linking and/or describing the implemented resolution.
- Never rebase or force-push a pull request branch that a user marked as ready. Instead, merge or rebase local changes.
See @README.md#Directory structure
corecel/: GPU abstractions, data structures, utilitiesgeocel/: Geometry interfaces (ORANGE, VecGeom, Geant4)orange/: Native Celeritas geometry engineceleritas/: Physics (EM processes, particles, materials)accel/: Geant4 integration layerlarceler,ddceler: special plugin integrations (possibly disabled)
Libraries depend strictly downward:
corecel β geocel β orange β celeritas β accel.
Optional-dependency code is compiled into separate targets (e.g.
src/celeritas/ext/ β celeritas_geant4) and guarded by
CELERITAS_USE_<Pkg> macros from the generated corecel/Config.hh.
Includes for library and test code are relative to the library and test directories.
(Library code uses -I{source}/src -I{build}/include, and test code also uses -I{source}/test).
Object files and binaries may have different paths and names than their source tree locations.
- Add Doxygen documentation to definitions, never on declarations. Prefer Doxygen-style markup
\c,<code>to Markdown in such blocks. - Document equations and algorithmic descriptions, as applicable, in the class definition's docs, as those are often rendered in the user manual. All
operator()behavior goes in the class definition's docs. - Always add
\sa {testpath}.test.ccunderneath\file {path}.hhto locate tests that break thesrc/{path}.hhβtest/{path}.test.ccrule. - Use only ASCII characters in CMake/C++/CUDA/shell files.
Celeritas sets up problems on CPU and executes on GPU or CPU with the same code. Most testing is CPU-only. The CELER_FUNCTION macro is __host__ __device__ when CUDA/HIP is active and decorates runtime functions.
Full rules: @doc/development/style.rst and @doc/development/coding.rst
| Concept | Convention | Example |
|---|---|---|
| Classes/structs | CapWords |
PhysicsTrackView |
| Functions/variables | snake_case |
calc_energy |
| Private members | trailing underscore | data_ |
Type-safe indices (OpaqueId) |
FooId |
MaterialId |
| Extension | Purpose |
|---|---|
.hh |
Headers, host+device compatible (use CELER_FUNCTION) |
.cc |
Host-only implementation β most code goes here, not .cu |
.cu |
CUDA kernel launches only (HIP-compatible via macros) |
.test.cc |
Unit tests, mirroring src/ under test/ |
- Avoid writing long functions (over ~50 lines): break into focused helper functions/classes with descriptive names.
- Avoid repeating long blocks of common code across files: refactor to a common
detail pattern (see
@src/AGENTS.md). - Always call member functions via
this->. - Write
template<class T>, not<typename T>. - Mark classes
finalwhere possible; use exactly one offinal/override. - Prefer enums over
boolparameters; avoid top-levelconston by-value params.