Add RecHit#5
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds new reconstruction data types, ACTS fit conversion, detector hit specializations, and build/ROOT wiring for the new headers. ChangesReconstruction data and conversion
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
include/SHiP/RecHit.hpp (1)
10-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDoc comment mismatch.
Comment says "Reconstructed particle" but this is
RecHit.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@include/SHiP/RecHit.hpp` at line 10, The doc comment on RecHit is incorrect and refers to a reconstructed particle instead of a rec hit. Update the comment in RecHit.hpp so it accurately describes the RecHit type, keeping the wording aligned with the RecHit declaration and related class naming.include/SHiP/TrackFitResult.hpp (1)
8-9: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove commented-out includes; fix doc comment.
Lines 8-9 are dead code (the same includes are added live in
Utilities.hpp). Line 13's comment "Reconstructed particle" is a copy-paste leftover — should describe a track-fit result.Proposed cleanup
- -//#include <Acts/EventData/VectorMultiTrajectory.hpp> -//#include <Acts/EventData/VectorTrackContainer.hpp> namespace SHiP { -/// Reconstructed particle +/// Reconstructed track fit result struct TrackFitResult {Also applies to: 13-13
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@include/SHiP/TrackFitResult.hpp` around lines 8 - 9, Remove the commented-out include lines from TrackFitResult.hpp since those headers are already brought in through Utilities.hpp, and update the doc comment on the TrackFitResult type/member so it describes a track-fit result rather than the copied “Reconstructed particle” text. Use the TrackFitResult declaration and its nearby comment as the anchor when cleaning up the header.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@include/SHiP/RecHit.hpp`:
- Around line 22-30: The fromSimHit helper currently omits SimHit::pathLength,
leaving RecHit::pathLength at its default value. Update the mapping in
fromSimHit in RecHit to copy sp.pathLength alongside the other fields so
reconstructed hits preserve the simulated path length.
In `@include/SHiP/Utilities.hpp`:
- Around line 32-36: The TrackFitResult::refLoc assignment in the utility
conversion is misleading because it stores Acts::eBoundLoc0/1 local surface
coordinates with a dummy zero z-value, which makes the field look like a global
position. Update the semantics in this conversion path by either
renaming/commenting the TrackFitResult::refLoc field to clearly indicate it is
local bound coordinates, or change the logic to transform the values into a true
global position before storing them. Use the existing parameter extraction in
the conversion helper to keep the chosen representation consistent throughout
the code.
---
Nitpick comments:
In `@include/SHiP/RecHit.hpp`:
- Line 10: The doc comment on RecHit is incorrect and refers to a reconstructed
particle instead of a rec hit. Update the comment in RecHit.hpp so it accurately
describes the RecHit type, keeping the wording aligned with the RecHit
declaration and related class naming.
In `@include/SHiP/TrackFitResult.hpp`:
- Around line 8-9: Remove the commented-out include lines from
TrackFitResult.hpp since those headers are already brought in through
Utilities.hpp, and update the doc comment on the TrackFitResult type/member so
it describes a track-fit result rather than the copied “Reconstructed particle”
text. Use the TrackFitResult declaration and its nearby comment as the anchor
when cleaning up the header.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 48333f5c-0a5b-4f51-923c-2e80bf069f69
📒 Files selected for processing (6)
CMakeLists.txtinclude/SHiP/LinkDef.hinclude/SHiP/RecHit.hppinclude/SHiP/RecParticle.hppinclude/SHiP/TrackFitResult.hppinclude/SHiP/Utilities.hpp
✅ Files skipped from review due to trivial changes (1)
- include/SHiP/LinkDef.h
🚧 Files skipped from review as they are similar to previous changes (1)
- include/SHiP/RecParticle.hpp
| result.qoverp = params[Acts::eBoundQOverP]; | ||
| result.phi = params[Acts::eBoundPhi]; | ||
| result.theta = params[Acts::eBoundTheta]; | ||
| result.time = params[Acts::eBoundTime]; | ||
| result.refLoc = {params[Acts::eBoundLoc0], params[Acts::eBoundLoc1], 0.0}; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## Utilities.hpp context\n'
sed -n '1,120p' include/SHiP/Utilities.hpp
printf '\n## refLoc usages/declarations\n'
rg -n --hidden --no-ignore-vcs '\brefLoc\b' include src . || true
printf '\n## nearby type definitions for the result struct/class\n'
rg -n --hidden --no-ignore-vcs 'struct|class.*refLoc|std::array<double, 3>|std::array<.*3>' include src || trueRepository: ShipSoft/data-model
Length of output: 4724
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '\n## TrackFitResult.hpp\n'
sed -n '1,120p' include/SHiP/TrackFitResult.hpp
printf '\n## TrackFitResult usages\n'
rg -n --hidden --no-ignore-vcs '\bTrackFitResult\b' include . || trueRepository: ShipSoft/data-model
Length of output: 1902
Clarify TrackFitResult::refLoc semantics Acts::eBoundLoc0/1 are local surface coordinates, so this field reads like a global point while storing local bound values plus a dummy z=0. Rename/comment it, or store a transformed global position instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@include/SHiP/Utilities.hpp` around lines 32 - 36, The TrackFitResult::refLoc
assignment in the utility conversion is misleading because it stores
Acts::eBoundLoc0/1 local surface coordinates with a dummy zero z-value, which
makes the field look like a global position. Update the semantics in this
conversion path by either renaming/commenting the TrackFitResult::refLoc field
to clearly indicate it is local bound coordinates, or change the logic to
transform the values into a true global position before storing them. Use the
existing parameter extraction in the conversion helper to keep the chosen
representation consistent throughout the code.
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
I think we need to be careful here. The ROOT dep here is only for the dictionary generation, none of the structs depend on ROOT. Adding ACTS here would pull it in as a dep basically everywhere. Maybe we can move the conversion utility to the reco project? |
|
Yes, that makes sense. I'll move the conversion |
olantwin
left a comment
There was a problem hiding this comment.
Some nitpicks and one general question:
Would it be better to introduce the currently identical hit structs now or better to introduce them once they diverge from the standard RecHit?
There was a problem hiding this comment.
This is currently unused. Was the intention to use this as the type of detectorId in RecHit? (also, could we make it detector_id?)
In that case, we might have to add a dict, not sure.
There was a problem hiding this comment.
This is used in the digitisation and will be in the reconstruction. I guess we could use it in Aegir too. The point is to make sure that each detector always uses something consistent.
Summary by CodeRabbit
RecHitreconstructed hit type, including a helper to convert from simulation hits.RecHit.TrackFitResultwith a helper to translate track-fit outputs.RecParticleto store associated reconstructed hits.