Repository navigation
fix(event-display): use valid colors for edm4hep overlay and secondary hits - #1068
Merged
Merged
Conversation
|
🚀 Preview deployed: http://phoenix-pr-1068.surge.sh Built from dbc70f2. |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 ##DAF761and 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:
.edm4hep.jsonevent with one overlay and one secondarySimTrackerHitthroughEdm4hepJsonLoaderand built the hits withPhoenixObjects.getHits. Before the change the colors were##...and the material color came outffffff, with the three.js warning. After the change the colors are valid and the material uses them.edm4hep-json-loader.test.tsfor this. It fails without the fix (Received string: "##E32654") and passes with it.jest src/tests/loaderspasses (11 suites, 91 tests), and eslint and prettier are clean on the changed files.