Skip to content

fix(event-display): use valid colors for edm4hep overlay and secondary hits - #1068

Merged
EdwardMoyse merged 1 commit into
HSF:mainfrom
SajalDevX:fix/edm4hep-hit-color
Nov 11, 2026
Merged

EdwardMoyse merged 1 commit into
HSF:mainfrom
SajalDevX:fix/edm4hep-hit-color

Conversation

@SajalDevX

Copy link
Copy Markdown
Contributor

The EDM4hep JSON loader gives overlay hits (quality bit 31) and hits produced by secondaries (bit 30) a random color per category. randomColor() already returns a string with a leading #, but those two places wrapped it in another #${...}, so the hits ended up with colors like ##DAF761.

three.js can't parse that. It logs THREE.Color: Unknown color ##DAF761 and keeps the material's default, so both categories are drawn white instead of their own color, and the collection shows as white in the menu too.

The fix passes the color through as is, the same way the vertices already use randomColor().

How I tested it:

  • Loaded a small .edm4hep.json event with one overlay and one secondary SimTrackerHit through Edm4hepJsonLoader and built the hits with PhoenixObjects.getHits. Before the change the colors were ##... and the material color came out ffffff, with the three.js warning. After the change the colors are valid and the material uses them.
  • Added a test in edm4hep-json-loader.test.ts for this. It fails without the fix (Received string: "##E32654") and passes with it.
  • jest src/tests/loaders passes (11 suites, 91 tests), and eslint and prettier are clean on the changed files.

@github-actions

Copy link
Copy Markdown

🚀 Preview deployed: http://phoenix-pr-1068.surge.sh

Built from dbc70f2.

@EdwardMoyse
EdwardMoyse merged commit df9692b into HSF:main Nov 11, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
pull-request — dbc70f21 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