Skip to content

fix(event-display): give single edm4hep calo hits a finite cell size - #1070

Merged
EdwardMoyse merged 1 commit into
HSF:mainfrom
SajalDevX:fix/edm4hep-single-calo-cell-size
Nov 16, 2026
Merged

EdwardMoyse merged 1 commit into
HSF:mainfrom
SajalDevX:fix/edm4hep-single-calo-cell-size

Conversation

@SajalDevX

Copy link
Copy Markdown
Contributor

Title: fix(event-display): give single edm4hep calo hits a finite cell size

The EDM4hep JSON loader picks the calorimeter cell size from the smallest distance it finds between two cells of the same collection. When a collection has only one hit (for example a yoke or LumiCal collection with a single hit in the event), there is no pair to measure, so drmin keeps its 1e9 start value and the cell gets side = length = 1e8. That one cell is then drawn as a giant box that covers the whole scene.

To reproduce, load an event with one edm4hep::SimCalorimeterHitCollection (or CalorimeterHitCollection) holding a single hit through Edm4hepJsonLoader and build it with PhoenixObjects.getCaloCellsInstanced: the cell has side 100000000 and the mesh bounding sphere radius is about 8.7e7. With two hits in the same collection the size is normal.

The fix starts drmin at Infinity and falls back to the existing minimum size of 1 when no distance could be measured. Collections with two or more hits are unchanged.

Testing

  • Added a test in edm4hep-json-loader.test.ts that loads a one-hit calorimeter collection and checks the cell size and the drawn mesh. It fails on main (Expected: 1, Received: 100000000) and passes with the fix.
  • jest src/tests/loaders: 11 suites, 96 tests pass.
  • eslint and prettier are clean on the changed files.

The EDM4hep loader sizes calorimeter cells from the smallest distance
between two cells of the collection. A collection with only one hit has
no pair to measure, so the 1e9 start value was used and the cell was
drawn as a 1e8 sized box covering the whole scene. Fall back to the
existing minimum size of 1 when no distance could be measured.
@github-actions

Copy link
Copy Markdown

@EdwardMoyse
EdwardMoyse merged commit 791609c into HSF:main Nov 16, 2026
4 checks passed
@EdwardMoyse

Copy link
Copy Markdown
Member

Thanks!

This branch was successfully deployed

1 active deployment
pull-request — d43bf9b6 Deployed Nov 11, 2026 by github-actions[bot]
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