Skip to content

WIP: Add RecHit#5

Open
mesmith75 wants to merge 24 commits into
ShipSoft:mainfrom
mesmith75:rec_particle
Open

WIP: Add RecHit#5
mesmith75 wants to merge 24 commits into
ShipSoft:mainfrom
mesmith75:rec_particle

Conversation

@mesmith75

@mesmith75 mesmith75 commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Added support for reconstructed hit records and conversion from simulation hits.
    • Introduced a new track-fit result data structure and a helper to translate fit outputs into it.
    • Extended reconstructed particle data to include an associated list of hit records.
  • Refactor

    • Updated build configuration and ROOT dictionary generation/linking to include the new reconstruction hit and track-fit components.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@mesmith75, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 40 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5839bb70-3bcb-44f0-98bb-e7f5c3eb1c03

📥 Commits

Reviewing files that changed from the base of the PR and between b84aa05 and 8cd7edc.

📒 Files selected for processing (2)
  • CMakeLists.txt
  • include/SHiP/TrackFitResult.hpp
📝 Walkthrough

Walkthrough

Adds new reconstruction data structures, maps ACTS fit results into a track-fit record, extends RecParticle with hits, and wires the new headers into the build and ROOT dictionary generation.

Changes

Reconstruction data and conversion

Layer / File(s) Summary
New reconstruction types
include/SHiP/RecHit.hpp, include/SHiP/TrackFitResult.hpp
Defines SHiP::RecHit, its fromSimHit helper, and the SHiP::TrackFitResult struct with fit, location, and measurement-vector fields.
Track-fit conversion and particle hits
include/SHiP/Utilities.hpp, include/SHiP/RecParticle.hpp
Adds fromACTSFitResult to convert ACTS track data into TrackFitResult, and adds RecParticle::hits as a default-initialized std::vector<RecHit>.
Build and ROOT export wiring
CMakeLists.txt, include/SHiP/LinkDef.h
Registers RecHit.hpp for the data-model target and dictionary generation, links Acts::Core, and adds ROOT cling directives for RecHit and TrackFitResult.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • ShipSoft/data-model#2: Introduces RecParticle with the same header/export wiring pattern that this PR extends for RecHit support.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main addition of RecHit and is specific enough to describe a key part of the change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
include/SHiP/RecHit.hpp (1)

10-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Doc 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 value

Remove 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

📥 Commits

Reviewing files that changed from the base of the PR and between ddac47a and b84aa05.

📒 Files selected for processing (6)
  • CMakeLists.txt
  • include/SHiP/LinkDef.h
  • include/SHiP/RecHit.hpp
  • include/SHiP/RecParticle.hpp
  • include/SHiP/TrackFitResult.hpp
  • include/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

Comment thread include/SHiP/RecHit.hpp
Comment on lines +22 to +30
inline RecHit fromSimHit(SimHit const& sp) {
return {.detectorId = sp.detectorId,
.trackId = sp.trackId,
.pdgCode = sp.pdgCode,
.position = sp.position,
.momentum = sp.momentum,
.energyDeposit = sp.energyDeposit,
.time = sp.time};
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check whether SimHit has a pathLength-equivalent field
fd -a SimHit.hpp | xargs cat -n

Repository: ShipSoft/data-model

Length of output: 886


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect RecHit.hpp around the conversion and struct definition.
fd -a RecHit.hpp
printf '\n---\n'
cat -n include/SHiP/RecHit.hpp
printf '\n---\n'

# Check for any other conversions/usages that set RecHit::pathLength.
rg -n "pathLength" include src test . -g '!**/.git/**'

Repository: ShipSoft/data-model

Length of output: 1788


Populate pathLength in fromSimHit include/SHiP/RecHit.hpp:22-30 drops SimHit::pathLength, so reconstructed hits always keep the default 0. Map sp.pathLength here.

🤖 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` around lines 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.

Comment on lines +32 to +36
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};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 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 || true

Repository: 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 . || true

Repository: 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.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant