Skip to content

Define views for Geant4 step/track integration#2209

Draft
sethrj wants to merge 14 commits intoceleritas-project:developfrom
sethrj:geant-particle-view
Draft

Define views for Geant4 step/track integration#2209
sethrj wants to merge 14 commits intoceleritas-project:developfrom
sethrj:geant-particle-view

Conversation

@sethrj
Copy link
Member

@sethrj sethrj commented Jan 27, 2026

This expands #1954 to include Geant4 track views (and step/step point views) that will allow better code reuse for the optical primary creation (#2103) and hits (#1397), as well as step/track reconstruction (#1894).

Refactored with Copilot's assistance.

- Create GeantTrackView.hh to wrap G4Track with Celeritas units
- Provides particle() method returning GeantParticleView
- Implements position(), direction(), energy(), time(), weight() accessors
- Refactor LocalTransporter::Push to use GeantTrackView
- Update AGENTS.md with clearer commit workflow instructions

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
Create unified view interfaces for G4Step and G4StepPoint with:
- Getters/setters using Celeritas types and units
- Consistent API pattern with GeantTrackView
- update_from_volume() methods to encapsulate LV attribute updates

Refactor HitProcessor to use these views instead of direct G4 calls.

Also fix GeantTrackView::dir() implementation name.

Assisted-by: GitHub Copilot (Claude Sonnet 4.5)
@sethrj sethrj requested a review from Copilot January 27, 2026 00:51
@sethrj sethrj requested a review from drbenmorgan as a code owner January 27, 2026 00:51
@sethrj sethrj added the minor Refactoring or minor internal changes/fixes label Jan 27, 2026
@sethrj sethrj requested a review from stognini as a code owner January 27, 2026 00:51
@sethrj sethrj added the external Dependencies and framework-oriented features label Jan 27, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR defines view classes for accessing and modifying Geant4 step, track, and step point data with Celeritas units. These views provide a uniform interface between Geant4 and Celeritas, improving code reuse and maintainability for optical primary creation, hit processing, and step/track reconstruction.

Changes:

  • Introduced three new view classes: GeantTrackView, GeantStepView, and GeantStepPointView for uniform access to Geant4 data with Celeritas units
  • Refactored HitProcessor to use the new view classes, removing the old update_track implementation
  • Updated LocalTransporter to use GeantTrackView for cleaner code
  • Added documentation for the new view classes in the low-level Geant4 interface section

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/celeritas/ext/GeantTrackView.hh New template-based view class for accessing G4Track data with const and mutable specializations
src/celeritas/ext/GeantStepView.hh New view class for G4Step data with accessors and mutators, including track update functionality
src/celeritas/ext/GeantStepView.cc Implementation file (currently empty placeholder)
src/celeritas/ext/GeantStepPointView.hh New view class for G4StepPoint data with position, energy, time, and direction accessors
src/celeritas/ext/GeantStepPointView.cc Implementation of volume and particle update methods for step points
src/celeritas/ext/detail/HitProcessor.cc Refactored to use new view classes, removing old update_track implementation and macro-based setters
src/accel/LocalTransporter.cc Updated to use GeantTrackView for cleaner track data access and primary offloading
src/celeritas/CMakeLists.txt Added new source files to build
src/celeritas/global/detail/KillActive.hh Added documentation clarifying function purpose
src/celeritas/global/detail/KillActive.cc Added documentation clarifying function purpose
doc/implementation/geant4-interface/low-level.rst Added documentation section for new view classes

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link

github-actions bot commented Jan 27, 2026

Test summary

 5 497 files   8 841 suites   8m 0s ⏱️
 1 680 tests  1 671 ✅   9 💤 0 ❌
28 596 runs  28 471 ✅ 125 💤 0 ❌

Results for commit 0b6afc3.

♻️ This comment has been updated with latest results.

@sethrj sethrj marked this pull request as draft January 27, 2026 17:05
@sethrj sethrj marked this pull request as ready for review January 27, 2026 17:39
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 91.07143% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.71%. Comparing base (fa64aaf) to head (0b6afc3).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
src/celeritas/ext/GeantStepView.cc 76.00% 6 Missing ⚠️
src/accel/LocalTransporter.cc 72.22% 4 Missing and 1 partial ⚠️
src/celeritas/ext/GeantStepView.hh 88.88% 2 Missing ⚠️
src/celeritas/ext/detail/HitProcessor.cc 91.30% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2209      +/-   ##
===========================================
- Coverage    86.24%   84.71%   -1.53%     
===========================================
  Files         1314     1284      -30     
  Lines        41529    40094    -1435     
  Branches     12810    10424    -2386     
===========================================
- Hits         35815    33965    -1850     
- Misses        4522     4553      +31     
- Partials      1192     1576     +384     
Files with missing lines Coverage Δ
src/celeritas/ext/GeantParticleView.hh 100.00% <100.00%> (ø)
src/celeritas/ext/GeantStepPointView.cc 100.00% <100.00%> (ø)
src/celeritas/ext/GeantStepPointView.hh 100.00% <100.00%> (ø)
src/celeritas/ext/GeantTrackView.hh 100.00% <100.00%> (ø)
src/celeritas/ext/detail/HitProcessor.hh 100.00% <ø> (ø)
src/celeritas/optical/SimTrackView.hh 100.00% <ø> (ø)
src/celeritas/ext/GeantStepView.hh 88.88% <88.88%> (ø)
src/celeritas/ext/detail/HitProcessor.cc 79.54% <91.30%> (-3.55%) ⬇️
src/accel/LocalTransporter.cc 63.69% <72.22%> (-4.28%) ⬇️
src/celeritas/ext/GeantStepView.cc 76.00% <76.00%> (ø)

... and 712 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

external Dependencies and framework-oriented features minor Refactoring or minor internal changes/fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants