fix: clear helium frustum from the SBT side sensors in X#58
Conversation
The helium decay frustum was inset from the container by the same container_thickness + helium_clearance (235 mm) in both X and Y. But the ±X (side) sensor containers are additionally shifted inward by half a flange width, so their inner face sits at x_half - 0.5*hbeam_flange_width - container_thickness. With the old inset the helium reached 120 mm past that face, interpenetrating the side sensors along the full length of the decay volume. Split the inset into insetY (unchanged: thickness + clearance) and insetX (adds 0.5*hbeam_flange_width). The helium X face now sits exactly helium_clearance (10 mm) inside the sensor inner face; the ±Y faces have no flange shift and are unchanged.
📝 WalkthroughWalkthroughThe helium decay region frustum geometry calculation in DecayVolumeFactory.cpp was updated to use distinct inset values for X and Y directions instead of a single shared inset, with insetX accounting for an additional H-beam flange width offset. The sbt.toml comment was expanded to document this logic. ChangesHelium Frustum Inset Calculation
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
There was a problem hiding this comment.
🧹 Nitpick comments (1)
subsystems/DecayVolume/src/DecayVolumeFactory.cpp (1)
124-130: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider a regression test asserting the numeric X clearance fix.
The existing test only checks that the helium
GeoTrapexists, not thatinsetX/insetYactually produce the 10 mm clearance from the ±X sensor faces this PR fixes. A targeted assertion (e.g., computing expecteddx1/dx2fromSBTConfigand comparing against the built shape's dimensions, or checking the gap between the helium X face and side sensor container) would lock in the fix and prevent regressions.🤖 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/DecayVolume/src/DecayVolumeFactory.cpp` around lines 124 - 130, Add a regression test around DecayVolumeFactory that verifies the numeric X clearance fix, not just that the helium GeoTrap is created. Use SBTConfig and the DecayVolumeFactory-built shape to assert the expected X-side gap derived from insetX/insetY, for example by checking the computed dx1/dx2 or the resulting helium container dimensions against the intended 10 mm clearance from the ±X sensor faces. Keep the test targeted to the geometry-building path so the fix in DecayVolumeFactory is locked in against future changes.
🤖 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.
Nitpick comments:
In `@subsystems/DecayVolume/src/DecayVolumeFactory.cpp`:
- Around line 124-130: Add a regression test around DecayVolumeFactory that
verifies the numeric X clearance fix, not just that the helium GeoTrap is
created. Use SBTConfig and the DecayVolumeFactory-built shape to assert the
expected X-side gap derived from insetX/insetY, for example by checking the
computed dx1/dx2 or the resulting helium container dimensions against the
intended 10 mm clearance from the ±X sensor faces. Keep the test targeted to the
geometry-building path so the fix in DecayVolumeFactory is locked in against
future changes.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 93cb1e5f-8241-4060-baec-71c29381c50d
📒 Files selected for processing (2)
subsystems/DecayVolume/sbt.tomlsubsystems/DecayVolume/src/DecayVolumeFactory.cpp
jasminwss
left a comment
There was a problem hiding this comment.
what is unclear to me here: from Santiagos STEP files I know: the distance in x between the inner walls of the cells In the beginning of the SBT is 1m in total. Here the helium should be placed (at the beginning of the SBT in +-dx = 0.635 cm = 100 -22.5-1-13 cm = x_half_entrance_mm - container_thickness_mm - helium_clearance_mm - 0.5 beam_flange_width_mm). Why are the containers additionally shifted inwards in X but not in Y?
|
I had a lool and I think the inset arithmetic can't be made right, because the problem isn't the value of the inset: it's that it's computed here at all. I mean this fix will work but it isn't robust to future changes in the SBT geometry. I suggest we tackle things a bit differently: the root cause is that I would suggest to instead move the placement rules ( With that, the helium touches the SBT everywhere and protrudes nowhere (min separation 0.000 mm), and the fiducial volume goes to 485.85 m³ vs 482.41 m³ for this PR's (overlapping) shape. The SBT geometry will anyways undergo some fixes which should fit in nicely with this category of change. I have an alternative build using this idea and can open a PR with it if this is seen as acceptable. |
Thanks a lot @matclim, this indeed seems like the correct way forward. Calculating the same thing in multiple places will always be extremely fragile and needs to be avoided. I'll create an Issue from your comment and would greatly appreciate the PR. Shall we merge this fix of the symptom here in the meantime or just wait for the fix of the underlying problem in your PR? |
|
I suggest we keep this PR up but not merge it, I'll try to bring my PR up this evening (can't earlier as I have a lot of meetings in the meantime). |
|
Ok, sounds good! |
…nd-written inset
The helium decay region was sized by an inset expression in DecayVolumeFactory
that duplicated, by hand, the placement rules used by SBTSensorBuilder and
SBTStructureBuilder. The two were not linked, and the copy was wrong in two
ways:
* It assumed the sensors' inner surface was linear in Z. It is not:
placeSideContainer gives each container a flat outer face over the first
zSplitOffset() of every sub-frustum so as to clear the columns, so the free
region is a sawtooth. The helium overlapped the side containers by 122.6 mm.
* It assumed the innermost material in Y was scintillator. It is not: the
top/bottom longitudinal beams straddle the sensor plane (the web is omitted
because it would pass through the cells) and their inner flange hangs below
it, into the decay region. The helium overlapped those flanges by 2.5 mm.
Neither was detectable: OverlapCheck is a subsystem-level bounding-box test and
does not probe siblings inside decay_volume.
Stop maintaining a second model of the geometry. The placement rules now live on
SBTConfig as primitives (sideContainerCentreX, topBottomContainerCentreY,
longBeamCentreY, zSplitOffset, xHalfAt/yHalfAt); both builders place with them,
and the new SBTEnvelope derives the inner free surface from the same
expressions. A change to a placement rule now moves the helium automatically.
The helium becomes a stack of GeoTraps (2 per sub-frustum, 20 total) so it can
follow the sawtooth exactly, and is inset from the true inner surface by
helium_clearance_mm, now 1 um — enough to avoid coincident boundaries, which
Geant4's navigator handles badly, and far below any engineering tolerance.
Verification is now a property, not a formula: SAT (exact for the convex
hexahedra involved) between every helium slab and every SBT volume in the built
tree, asserting both no protrusion and no margin. A parameter sweep repeats it
across 14 SBT configurations, so the guarantee survives re-parameterisation
rather than holding at one lucky point.
Fiducial helium volume: 534.80 -> 485.85 m^3. The old figure included steel.
Closes ShipSoft#58
|
PR #68 is up and ready to be reviewed, it should (in my opinion) supersede this one. |
|
Superseded by #68 |
Fixes a verified high-severity geometry overlap from the Fable review: the helium decay volume interpenetrated the ±X SBT side sensors by 120 mm along the full length of the decay volume.
Root cause
The helium frustum was inset from the container by the same
container_thickness + helium_clearance(235 mm) in both X and Y. But the ±X side-sensor containers are additionally shifted inward by half a flange width (SBTSensorBuilder.cpp:x_half - 0.5*hbeam_flange_width - container_thickness). So the sensor inner face sits further in than the helium's inset accounted for.Fix
Split the inset:
insetY = container_thickness + helium_clearance(unchanged — top/bottom faces have no flange shift)insetX = insetY + 0.5*hbeam_flange_widthNumeric check (entrance face,
x_half = 1000)1000 − 130 − 225 = 645 mm1000 − 235 = 765 mm→ overlap 120 mm1000 − 365 = 635 mm→ clears by 10 mm (=helium_clearance)Exit face (
x_half = 2000): 1635 vs 1645 → same 10 mm clearance.Verification
pixi run buildclean;pixi run test→ 33/33 passed. (Note: the automatedOverlapCheckis a subsystem-level bounding-box check and does not probe intra-decay_volumesibling overlaps, so this fix is verified algebraically rather than by that test.)Summary by CodeRabbit