Define views for Geant4 step/track integration#2209
Define views for Geant4 step/track integration#2209sethrj wants to merge 14 commits intoceleritas-project:developfrom
Conversation
- 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)
There was a problem hiding this comment.
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, andGeantStepPointViewfor uniform access to Geant4 data with Celeritas units - Refactored
HitProcessorto use the new view classes, removing the oldupdate_trackimplementation - Updated
LocalTransporterto useGeantTrackViewfor 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.
Test summary 5 497 files 8 841 suites 8m 0s ⏱️ Results for commit 0b6afc3. ♻️ This comment has been updated with latest results. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
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.