Skip to content

added SST#19

Open
matclim wants to merge 3 commits into
ShipSoft:mainfrom
matclim:addSST
Open

added SST#19
matclim wants to merge 3 commits into
ShipSoft:mainfrom
matclim:addSST

Conversation

@matclim
Copy link
Copy Markdown
Contributor

@matclim matclim commented May 22, 2026

SST was added, no supporting structure but the B-field container is present and should support the map txt files as input

Summary by CodeRabbit

  • New Features

    • Completed Tracker subsystem with full straw-tube geometry: 4 stations × 4 stereo views (9,600 straws) and an inert tracker marker placed between stations.
  • Materials

    • Added Mylar for straw walls and an Ar/CO₂ (70/30) detector gas mixture.
  • Documentation

    • Rewrote Tracker docs with full geometry spec, parameters, materials, status, and targeted TODOs.
  • Tests

    • Expanded geometry tests to validate stations, views, sub-layers, straw counts, and tracker marker placement.

Review Change Stack

@matclim matclim requested a review from olantwin May 22, 2026 13:07
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7720a7b1-b9cb-4532-979d-f36d644ee059

📥 Commits

Reviewing files that changed from the base of the PR and between 0e921e8 and 1080965.

📒 Files selected for processing (1)
  • subsystems/Trackers/test_trackers.cpp

📝 Walkthrough

Walkthrough

Adds complete straw tracking station geometry: four stations with four stereo views per station, staggered straw sub-layers, and hollow frames. Introduces Mylar and ArCO2 materials; refactors TrackersFactory into hierarchical builder methods; adds validation tests and documentation updates.

Changes

Straw Tracker Geometry and Materials

Layer / File(s) Summary
Material Definitions
src/SHiPMaterials.cpp
Mylar (PET) and ArCO2_70_30 gas mixture materials are defined with density and mass-fraction composition calculations, then locked and registered in the materials registry.
TrackersFactory Specification and Constants
subsystems/Trackers/include/Trackers/TrackersFactory.h
Header expanded to declare public geometry constants (stations/views/sub-layers, straw sizing, stereo angle, frame dimensions, tracker-magnet placement), adds a private frame material member, and declares private builder method signatures for hierarchical construction.
Straw Geometry Implementation
subsystems/Trackers/src/TrackersFactory.cpp
TrackersFactory.cpp refactored from simple container placement into a multi-level geometry builder: build() orchestrates four stations and an inert tracker-magnet; buildStation() stacks views; buildView() creates view envelope with frame and two staggered sub-layers; buildFrame() constructs hollow rectangular frame via subtraction; buildSubLayer() populates an air slab with individual straws; buildStraw() creates Mylar wall cylinder with ArCO2 gas daughter; buildTrackerMagnet() creates placeholder inert volume.
Validation Tests and Documentation
subsystems/Trackers/test_trackers.cpp, README.md, subsystems/Trackers/README.md
New Catch2 test cases validate station count, view count per station, view internal structure (frame + 2 sub-layers and straw count), and tracker-magnet Z-extent non-overlap. Root README updates Trackers status to "Complete" with 9600 straw tubes. Trackers README rewritten with full subsystem specification including geometry hierarchy, parameter tables, materials list, test checklist, implementation status, and remaining verification tasks.

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 76.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'added SST' is extremely vague and does not clearly describe the changeset. While 'SST' likely refers to the Straw-tube Spectrometer Tracker subsystem being added, the title lacks specificity and context. Consider using a more descriptive title such as 'Add Straw-tube Spectrometer Tracker (SST) subsystem with geometry implementation' to clearly convey the main change and component being added.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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/Trackers/README.md`:
- Around line 21-33: Add the language tag "text" to the fenced code block that
contains the geometry tree starting with "/SHiP/trackers (Air, 3000 × 3430 ×
6000 mm half-extents)" by changing the opening triple backticks to ```text so
the block is recognized by markdownlint (MD040) while keeping the content
unchanged.

In `@subsystems/Trackers/src/TrackersFactory.cpp`:
- Around line 127-129: Replace the non-portable M_PI usage in the angleRad
calculation with the C++20 constant: include <numbers> and use
std::numbers::pi_v<double> in place of M_PI in the expression computing angleRad
(the line computing const double angleRad = stereoSignedDeg(v) * M_PI / 180.0;)
and ensure the same replacement is applied where GeoTrf::RotateZ3D(angleRad) is
used so the code builds with CMAKE_CXX_EXTENSIONS=OFF.
🪄 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: b18c53ba-40bb-4e7a-84e3-0817c2db0df1

📥 Commits

Reviewing files that changed from the base of the PR and between 0dd5b1b and 0e921e8.

📒 Files selected for processing (6)
  • README.md
  • src/SHiPMaterials.cpp
  • subsystems/Trackers/README.md
  • subsystems/Trackers/include/Trackers/TrackersFactory.h
  • subsystems/Trackers/src/TrackersFactory.cpp
  • subsystems/Trackers/test_trackers.cpp

Comment on lines 21 to 33
```
TrackersContainer (Air, 6000×6860×6000 mm)
├─ TrackerStation_1 (Air, 6000×6860×1000 mm) z = 84070 mm
├─ TrackerStation_2 (Air) z = 86070 mm
├─ TrackerStation_3 (Air) z = 93070 mm
└─ TrackerStation_4 (Air) z = 95070 mm
/SHiP/trackers (Air, 3000 × 3430 × 6000 mm half-extents)
├─ /SHiP/trackers/station_<n> (Air, 3000 × 3430 × 500 mm) n = 1..4
│ └─ /SHiP/trackers/station_<n>/view_<v>/envelope (Air) v = 0..3
│ (rotated about Z by the view stereo angle)
│ ├─ .../frame_body (Aluminium, hollow rectangle = outer − aperture)
│ ├─ .../sublayer_0_body (Air slab, 300 straws)
│ └─ .../sublayer_1_body (Air slab, 300 straws, half-pitch staggered)
│ └─ .../straw_<i>
│ └─ straw_wall_<uid> (Mylar tube)
│ └─ straw_gas_<uid> (ArCO2_70_30 tube)
└─ /SHiP/trackers/tracker_magnet (Air, inert marker box)
```
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add a language tag to the fenced code block to satisfy markdownlint.

The geometry tree fence is missing a language identifier (MD040). Adding text keeps the current rendering and clears lint noise.

Proposed patch
-```
+```text
 /SHiP/trackers (Air, 3000 × 3430 × 6000 mm half-extents)
  ├─ /SHiP/trackers/station_<n> (Air, 3000 × 3430 × 500 mm)   n = 1..4
  │    └─ /SHiP/trackers/station_<n>/view_<v>/envelope (Air)   v = 0..3
@@
-```
+```
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 21-21: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 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 `@subsystems/Trackers/README.md` around lines 21 - 33, Add the language tag
"text" to the fenced code block that contains the geometry tree starting with
"/SHiP/trackers (Air, 3000 × 3430 × 6000 mm half-extents)" by changing the
opening triple backticks to ```text so the block is recognized by markdownlint
(MD040) while keeping the content unchanged.

Comment on lines +127 to +129
const double angleRad = stereoSignedDeg(v) * M_PI / 180.0;
const GeoTrf::Transform3D viewTrf =
GeoTrf::Translate3D(0.0, 0.0, zView) * GeoTrf::RotateZ3D(angleRad);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== M_PI usages =="
rg -n '\bM_PI\b'

echo
echo "== C++ standard / extension settings in build files =="
rg -n 'CMAKE_CXX_STANDARD|CMAKE_CXX_EXTENSIONS|std=c\+\+|std=gnu\+\+'

Repository: ShipSoft/Geometry

Length of output: 528


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="subsystems/Trackers/src/TrackersFactory.cpp"
echo "== File: $FILE =="
echo
echo "== Header includes (top 80 lines) =="
nl -ba "$FILE" | head -n 80

echo
echo "== Context around line 127 =="
nl -ba "$FILE" | sed -n '110,145p'

echo
echo "== Context around line 240 =="
nl -ba "$FILE" | sed -n '220,255p'

echo
echo "== Any existing std::numbers::pi_v or numbers header =="
rg -n 'std::numbers::pi_v|<numbers>' "$FILE"

Repository: ShipSoft/Geometry

Length of output: 216


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="subsystems/Trackers/src/TrackersFactory.cpp"

echo "== File: $FILE =="
echo
echo "== Header includes (top 90 lines) =="
cat -n "$FILE" | head -n 90

echo
echo "== Context around line 127 =="
cat -n "$FILE" | sed -n '105,150p'

echo
echo "== Context around line 240 =="
cat -n "$FILE" | sed -n '215,255p'

echo
echo "== Any existing std::numbers::pi_v or numbers header (in file) =="
rg -n 'std::numbers::pi_v|<numbers>' "$FILE" || true

Repository: ShipSoft/Geometry

Length of output: 9107


Replace non-standard M_PI usage with std::numbers::pi_v<double> (C++20 portability)

subsystems/Trackers/src/TrackersFactory.cpp uses M_PI at the flagged sites; with CMAKE_CXX_STANDARD=20 and CMAKE_CXX_EXTENSIONS=OFF, relying on M_PI is non-portable. Switch to std::numbers::pi_v<double> and add <numbers>.

Proposed patch
 `#include` <cmath>
+#include <numbers>
 `#include` <string>
@@
-        const double angleRad = stereoSignedDeg(v) * M_PI / 180.0;
+        const double angleRad = stereoSignedDeg(v) * std::numbers::pi_v<double> / 180.0;
@@
-            GeoTrf::Translate3D(0.0, yStraw, 0.0) * GeoTrf::RotateY3D(M_PI / 2.0);
+            GeoTrf::Translate3D(0.0, yStraw, 0.0) *
+            GeoTrf::RotateY3D(std::numbers::pi_v<double> / 2.0);
🤖 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 `@subsystems/Trackers/src/TrackersFactory.cpp` around lines 127 - 129, Replace
the non-portable M_PI usage in the angleRad calculation with the C++20 constant:
include <numbers> and use std::numbers::pi_v<double> in place of M_PI in the
expression computing angleRad (the line computing const double angleRad =
stereoSignedDeg(v) * M_PI / 180.0;) and ensure the same replacement is applied
where GeoTrf::RotateZ3D(angleRad) is used so the code builds with
CMAKE_CXX_EXTENSIONS=OFF.

@matclim
Copy link
Copy Markdown
Contributor Author

matclim commented May 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

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.

@matclim
Copy link
Copy Markdown
Contributor Author

matclim commented May 22, 2026

Things seem to be in order. The SST is not nearly as detailed as the calo (because I don't know as much about that detector) but it should be functional. There is no frame because I don't know what it will look like. I suggest adding a .toml configuration in a separate commit, preferably with more input from the subsystem responsibles.

@olantwin olantwin requested a review from wcmartylee May 22, 2026 13:57
@olantwin
Copy link
Copy Markdown
Contributor

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 22, 2026

✅ Actions performed

Review triggered.

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.

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