Skip to content

fix(event-display): extract EDM4hep track metadata - #1075

Merged
EdwardMoyse merged 2 commits into
HSF:mainfrom
ARYAN0-work:fix/edm4hep-track-metadata
Dec 1, 2026
Merged

EdwardMoyse merged 2 commits into
HSF:mainfrom
ARYAN0-work:fix/edm4hep-track-metadata

Conversation

@ARYAN0-work

Copy link
Copy Markdown
Contributor

Summary

While reviewing the EDM4hep JSON loader, I noticed that Edm4hepJsonLoader was not populating several track metadata fields, even though the required information was already available in the input data.

As a result, Phoenix's existing track-parameter handling could not make use of metadata already available in the input and could instead rely on values derived from track positions.

Investigation

I examined the EDM4hep TrackState schema and Phoenix's TrackParams implementation to identify which values could be extracted reliably.

Since a track can contain multiple states (AtIP, AtFirstHit, etc.), I verified that metadata should be taken from the AtIP state rather than simply using the first available state.

Changes

  • Extract phi, D0, and Z0 from the AtIP track state.
  • Calculate pseudorapidity (eta) using Math.asinh(tanLambda).
  • Validate values to prevent NaN and infinite values from entering track metadata.
  • Leave metadata unset when no valid IP state is available.
  • Keep pT and dparams unpopulated because their reliable calculation requires magnetic-field information.

The existing position extraction and track categorization logic remain unchanged.

Tests

Added tests covering:

  • Correct IP-state selection when multiple track states exist.
  • Missing IP track state.
  • Non-finite metadata values.

Validation

All checks passed:

  • Focused loader tests (10 tests)
  • TypeScript production build
  • yarn lint
  • yarn test:ci
  • Prettier and Git diff checks
  • lint-staged hooks

@github-actions

Copy link
Copy Markdown

@EdwardMoyse

Copy link
Copy Markdown
Member

Apologies for the (very long) delay in reviewing! This looks good. Thanks!

@EdwardMoyse
EdwardMoyse merged commit 8768370 into HSF:main Dec 1, 2026
4 checks passed
Shivansh1205 added a commit to Shivansh1205/phoenix that referenced this pull request Dec 1, 2026
HSF#1075 copied D0 and Z0 from the AtIP track state as they are, in mm,
while every other EDM4hep length in the loader, including the track
positions, is scaled by 0.1. When a track has no IP state, Phoenix
derives d0 and z0 from those scaled positions, so one collection could
mix both units under the same cut. HSF#1078 tests z0 in the scaled units,
which made main fail once both were merged.

Scale D0 and Z0 by 0.1 as well.

This branch was successfully deployed

1 active deployment
pull-request — daa7d1cd Deployed Nov 16, 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