Skip to content

benchmarks/rich: fix compatibility with edm4hep-1.0, podio-1.7#307

Merged
wdconinc merged 4 commits into
masterfrom
fix/rich-benchmark-edm4hep-1.0-podio-1.7
May 23, 2026
Merged

benchmarks/rich: fix compatibility with edm4hep-1.0, podio-1.7#307
wdconinc merged 4 commits into
masterfrom
fix/rich-benchmark-edm4hep-1.0-podio-1.7

Conversation

@wdconinc
Copy link
Copy Markdown
Contributor

@wdconinc wdconinc commented May 22, 2026

Problem

The RICH benchmark failed when upgrading to edm4hep-1.0, podio-1.7, algorithms-1.3.0, k4fwcore-1.5 (CI job #7877888):

terminate called after throwing an instance of 'std::runtime_error'
what(): Cannot retrieve collection ReconstructedChargedParticleAssociations of type edm4eic::MCRecoParticleAssociationCollection

Root Cause

Three interacting issues:

  1. Stale collection name: run_benchmark.rb requested ReconstructedChargedParticleAssociationsWithDRICHPID in output_collections, but this collection no longer exists in EICrecon. Since JANA2's podio output writes only the explicitly listed collections, ReconstructedChargedParticleAssociations was absent from the rec file.

  2. podio 1.7 API change: Frame::get<C>(name) now throws std::runtime_error when a collection is absent or has a type mismatch (podio 1.6 and earlier returned a static empty collection instead). The old isValid() guard was therefore never reached — the exception propagated uncaught.

  3. Deprecated API: isValid() on collections is deprecated in the edm4eic-generated headers in favour of hasID().

Note: before the podio 1.7 upgrade the stale collection name caused the ReconstructedParticle analysis to silently produce empty results rather than crash, since Frame::get<C>() returned an invalid collection without throwing.

Fix

  • run_benchmark.rb: Replace non-existent ReconstructedChargedParticleAssociationsWithDRICHPID with ReconstructedChargedParticleAssociations (the correct current EICrecon output collection name).
  • src/benchmark.cc: Wrap frame.get<C>() in a try-catch; return an empty collection on error so callers can continue gracefully. The try-catch is harmless for older podio versions where get<C>() does not throw.
  • src/ReconstructedParticleAnalysis.cc: Replace deprecated isValid() with hasID().

The benchmark failed because:
1. The output_collections list requested 'ReconstructedChargedParticleAssociationsWithDRICHPID'
   which no longer exists in EICrecon. Since only specified collections are written,
   'ReconstructedChargedParticleAssociations' was absent from the rec file.
2. In podio >= 0.99.0, Frame::get<C>(name) throws std::runtime_error when the
   collection is absent or has a type mismatch, rather than returning an invalid
   collection as in older versions.
3. isValid() on collections is deprecated in favor of hasID().

Fix by replacing the stale collection name with the current
'ReconstructedChargedParticleAssociations', updating GetCollection() to catch
the podio >= 0.99.0 throwing behavior, and replacing isValid() with hasID().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 22, 2026 21:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the RICH benchmark’s breakage after upgrading to newer EDM/podio stacks by updating the requested output collection name and making collection retrieval resilient to podio’s newer exception-throwing behavior.

Changes:

  • Update run_benchmark.rb to request ReconstructedChargedParticleAssociations instead of the removed ...WithDRICHPID collection.
  • Wrap podio::Frame::get<C>() in a try/catch for podio ≥ 0.99 to avoid aborting when collections are missing/mismatched.
  • Replace deprecated collection validity check with hasID() in ReconstructedParticleAnalysis.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
benchmarks/rich/src/ReconstructedParticleAnalysis.cc Switches association-collection validity check from deprecated isValid() to hasID().
benchmarks/rich/src/benchmark.cc Makes collection retrieval robust to podio’s throwing Frame::get behavior via try/catch and returns an empty collection on failure.
benchmarks/rich/run_benchmark.rb Updates output_collections to the current EICrecon association collection name so it’s written to the rec file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread benchmarks/rich/src/benchmark.cc Outdated
Comment thread benchmarks/rich/src/benchmark.cc
Comment thread benchmarks/rich/src/ReconstructedParticleAnalysis.cc
@wdconinc wdconinc enabled auto-merge (squash) May 22, 2026 21:25
@wdconinc wdconinc merged commit 69d93a6 into master May 23, 2026
3 checks passed
@wdconinc wdconinc deleted the fix/rich-benchmark-edm4hep-1.0-podio-1.7 branch May 23, 2026 14:46
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