Skip to content

Simulate an FCal hit again when no cell is at its position, instead of throwing - #209

Merged
jbeirer merged 2 commits into
mainfrom
fcal-missing-cell-retry
Nov 24, 2026
Merged

jbeirer merged 2 commits into
mainfrom
fcal-missing-cell-retry

Conversation

@jbeirer

@jbeirer jbeirer commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

TFCSHitCellMappingFCal::simulate_hit asks for FCSReturnCode::retry(5) when no FCal cell is at the position of a hit (if (!cell.is_valid())). That is what Athena does, where getFCalDDE returns no element and the mapping retries. Here, CaloGeo::get_cell throws std::runtime_error("Invalid cell ID from alternative geometry handler") for an invalid cell of an alternative handler (since #78), so the retry branch can never be reached: such a hit throws out of the simulation instead of being simulated again. Nothing between the mapping and Athena (FastCaloSimV2Tool) catches it. This is a regression of this library, not an Athena bug.

When does it happen? The FCal handlers (ATLASFCalGeoPlugin, Athena FCALGeoPlugin) give the closest tile for a position outside the tiles (e.g. in the beam hole), and an invalid cell only when that search fails. That happens when x * x + y * y is 0 in single precision although the hit is not exactly on the axis (the mapping already retries for x == y == 0), or when no tile is found within 100 steps of 1% along the radius. It is therefore rare, but it ends the job when it happens.

Change

  • New CaloGeo::find_cell(layer, pos): the same lookup as get_cell, but it returns the invalid cell of an alternative geometry handler instead of throwing. get_cell is find_cell plus the exception, so its other callers (extrapolation, rpos/zpos, binned showers, phi modulation), which need a valid cell, are unchanged.
  • TFCSHitCellMappingFCal uses find_cell, so a hit in no FCal cell is simulated again (retry(5)) as intended.
  • New test AtlasGeoTests.FCalPositionWithoutCell (real ATLAS FCal handler): a position in an FCal cell is found by both lookups. A position at x = y = 1e-30 (radius 0 in single precision) gives an invalid cell from find_cell, and get_cell throws.

Athena: no change needed (find_cell is additive, get_cell keeps its behaviour).

Checks

Run on main (73c5cc7) with #205 to #213 together, against main:

  • GCC 15 (LCG_110, developer build): 0 warnings; ctest 138/138 passed (main: 128/128), incl. the unchanged AtlasTransportTests and AtlasSimTests references
  • AtlasBenchmark dump (BENCH_N=50): byte-identical to main
  • SliceCheck on the MC23 file TFCSparam_dev_Hybrid_Ha_v5_all_baryons_0_500.root (BENCH_N=20): byte-identical to main, max RSS 4.76 GB on both
  • clang-format 20.1.8
  • GCC 16 and Clang 22 with the CI flags: 0 warnings
  • Alma 10 ci-linux (clang-tidy 21, cppcheck): 0 warnings; its ctest 138/138 passed
  • The first version of the new test used a position in the beam hole, where the FCal handler still finds the closest tile; it now uses a position where that search fails

@coderabbitai

coderabbitai Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 28 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ae1e9168-55fb-4d5f-a705-a92fb35aecbd
Commits

Reviewing files that changed from the base of the PR and between 73c5cc7 and 92a747e.

Files selected for processing: 4

  • include/FastCaloSim/Geometry/CaloGeo.h
  • source/Core/TFCSHitCellMappingFCal.cxx
  • source/Geometry/CaloGeo.cxx
  • test/source/AtlasGeoTests.cxx
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@github-actions github-actions Bot added the tests Issues affecting the CI tests label Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

Files with missing lines Coverage Δ
include/FastCaloSim/Geometry/CaloGeo.h 100.00% <ø> (ø)
source/Core/TFCSHitCellMappingFCal.cxx 85.00% <100.00%> (ø)
source/Geometry/CaloGeo.cxx 96.50% <100.00%> (+0.93%) ⬆️
test/source/AtlasGeoTests.cxx 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@jbeirer
jbeirer merged commit 70d7799 into main Nov 24, 2026
18 checks passed
@jbeirer
jbeirer deleted the fcal-missing-cell-retry branch November 24, 2026 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Issues affecting the CI tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant