Skip to content

style: make every dimensional literal carry an explicit unit - #65

Merged
olantwin merged 2 commits into
mainfrom
chore/explicit-unit-literals
Jul 10, 2026
Merged

style: make every dimensional literal carry an explicit unit#65
olantwin merged 2 commits into
mainfrom
chore/explicit-unit-literals

Conversation

@olantwin

@olantwin olantwin commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Annotates the remaining bare-mm dimensional literals (Magnet, MuonShield, TimingDetector, Trackers, Calorimeter container, top-level placements) with explicit GeoModelKernelUnits units and documents the convention in the README. No numeric value changes — the exported GDML is byte-identical (verified modulo pointer-address name suffixes).

Summary by CodeRabbit

  • Documentation

    • Added guidance explaining that dimensional and angular values are explicitly annotated with their units.
  • Refactor

    • Standardized geometry dimensions and placements across detector components with explicit millimeter, centimeter, and meter units.
    • Preserved existing geometry values while improving consistency and clarity of unit handling.

Annotate bare mm doubles in the Magnet, MuonShield, TimingDetector,
Trackers and Calorimeter factories (and the top-level placements) with
GeoModelKernelUnits, following the convention already used by the
Cavern and Target factories. Values are unchanged (mm == 1.0,
m == 1000.0 exactly), so the geometry is bitwise identical; config
values with an _mm suffix keep their explicit conversion at the
GeoModel boundary. Document the convention in the README.
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

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

Next review available in: 43 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: 3ab92014-a5c4-4f6b-8c02-fef35b89215a

📥 Commits

Reviewing files that changed from the base of the PR and between 36d7997 and 9cd9565.

📒 Files selected for processing (1)
  • subsystems/Magnet/include/Magnet/MagnetFactory.h
📝 Walkthrough

Walkthrough

The PR documents an explicit GeoModel unit convention and applies unit multipliers to SHiP placements and geometry dimensions across the calorimeter, magnet, muon shield, timing detector, and tracker subsystems.

Changes

GeoModel unit annotations

Layer / File(s) Summary
Top-level placement conversions
README.md, src/SHiPGeometry.cpp
Documents explicit length and angle units, and replaces manual placement scaling with mm, cm, and m expressions.
Subsystem dimension annotations
subsystems/Calorimeter/..., subsystems/Magnet/..., subsystems/MuonShield/..., subsystems/TimingDetector/...
Adds GeoModel unit support and annotates subsystem geometry constants and muon-shield station data with millimeter units.
Tracker geometry annotations
subsystems/Trackers/...
Annotates tracker dimensions, clearances, offsets, station positions, and straw placement transforms with explicit millimeter units.

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

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding explicit units to dimensional literals throughout the geometry code and docs.
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
  • Commit unit tests in branch chore/explicit-unit-literals

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.

@olantwin
olantwin requested a review from matclim July 9, 2026 12:27
@olantwin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@olantwin

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@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: 1

🤖 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 `@subsystems/Magnet/include/Magnet/MagnetFactory.h`:
- Around line 42-71: Correct the comment above the container dimensions: do not
describe the container as the same size as the yoke outer volume. State that the
container is sized to enclose the yoke, coils, and connectors, reflecting that
s_containerHalfX and s_containerHalfZ exceed the corresponding yoke dimensions
while s_containerHalfY matches.
🪄 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: 4017ad86-4032-4201-8c6a-e4b5056b0f2c

📥 Commits

Reviewing files that changed from the base of the PR and between c8dee45 and 36d7997.

📒 Files selected for processing (9)
  • README.md
  • src/SHiPGeometry.cpp
  • subsystems/Calorimeter/include/Calorimeter/CalorimeterFactory.h
  • subsystems/Magnet/include/Magnet/MagnetFactory.h
  • subsystems/MuonShield/include/MuonShield/MuonShieldFactory.h
  • subsystems/MuonShield/src/MuonShieldFactory.cpp
  • subsystems/TimingDetector/include/TimingDetector/TimingDetectorFactory.h
  • subsystems/Trackers/include/Trackers/TrackersFactory.h
  • subsystems/Trackers/src/TrackersFactory.cpp

Comment thread subsystems/Magnet/include/Magnet/MagnetFactory.h
The container is not the same size as the yoke outer volume; it is sized
to enclose the yoke, coils, and connectors. HalfX and HalfZ exceed the
yoke outer dimensions, while HalfY matches.
@olantwin
olantwin merged commit 1fb2c12 into main Jul 10, 2026
4 checks passed
@olantwin
olantwin deleted the chore/explicit-unit-literals branch July 10, 2026 12:29
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.

2 participants