Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: compatibility for EDM4hep < 0.99 & >= 0.99 #3921

Merged
merged 4 commits into from
Nov 29, 2024

Conversation

paulgessinger
Copy link
Member

@paulgessinger paulgessinger commented Nov 29, 2024

This updates our code so it compiles with both EDM4hep versions below 0.99 and above/equal to 0.99.

Breaking changes are:

  • TrackerHit becomes TrackerHit3D.
  • SimTrackerHit::getMCParticle becomes SimTrackerHit::getParticle, with the original name being deprecated.

I'm aliasing the new name TrackerHit3D and TrackerHit3DCollection to the old types, so that when we drop support for < 0.99 versions, they're already correct.

Summary by CodeRabbit

  • New Features

    • Enhanced compatibility with different versions of the EDM4hep library for particle handling.
    • Introduced utility functions for retrieving and setting particle information in SimTrackerHit objects.
    • Added type aliases to streamline the handling of tracker hit collections.
  • Bug Fixes

    • Improved error handling in the EDM4hepReader for missing particles.
  • Refactor

    • Updated function signatures and internal logic to utilize new utility functions for better maintainability.
    • Streamlined the EDM4hepMeasurementWriter and EDM4hepMeasurementReader to accommodate new data structures.
    • Adjusted header inclusions and conditional compilation for better flexibility.
  • Documentation

    • Added comments to indicate changes in parameter handling for clarity.

@paulgessinger paulgessinger added this to the next milestone Nov 29, 2024
Copy link

coderabbitai bot commented Nov 29, 2024

Walkthrough

In this pull request, changes made involve the removal of specific include statements from EDM4hepMeasurementWriter.hpp, indicating a reduction in dependencies. Modifications across various files enhance compatibility with the EDM4hep library, introducing conditional inclusions and type aliases for TrackerHit3D collections. Method signatures in EDM4hepUtil and related files have been updated to reflect these changes, ensuring the code accommodates new data structures while maintaining core functionality.

Changes

File Change Summary
Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepMeasurementWriter.hpp Removed includes for TrackerHitCollection.h and TrackerHitPlaneCollection.h.
Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp Updated header inclusions, added conditional includes for TrackerHit3D, and defined type aliases for collections. Updated method signatures for readMeasurement and writeMeasurement.
Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp Added conditional compilation for TrackerHit3D and updated method to utilize TrackerHit3DCollection.
Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp Introduced compatibility handling for TrackerHit3DCollection and updated the type of hits variable.
Examples/Io/EDM4hep/src/EDM4hepReader.cpp Included new utility header, updated particle retrieval logic, and enhanced error handling in the read method.
Examples/Io/EDM4hep/src/EDM4hepUtil.cpp Refactored readSimHit, writeSimHit, readMeasurement, and writeMeasurement methods for better clarity and handling.
Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/EDM4hepUtil.hpp Added new functions for particle handling and updated header inclusions.
Plugins/EDM4hep/src/EDM4hepUtil.cpp Implemented new functions for particle retrieval and setting, with conditional compilation based on EDM4hep version.
Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp Introduced compatibility handling for TrackerHit3D and defined type aliases for collections.

Possibly related PRs

Suggested labels

automerge, Event Data Model

In the realm of code, changes take flight,
Streamlining dependencies, making things right.
With TrackerHit3D, new paths we pave,
Flexibility grows, as we code and we save.
Yoda’s wisdom, in each line we find,
A dance of logic, beautifully entwined. 🌌✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between deab3d2 and 47ef4d5.

📒 Files selected for processing (1)
  • Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins labels Nov 29, 2024
andiwand
andiwand previously approved these changes Nov 29, 2024
Copy link
Contributor

@andiwand andiwand left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (5)
Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp (1)

58-58: Changed the collection type has been, hmmmm.

Correctly aligned with the new EDM4hep structure, this change is. Yet remember you must, that temporary this compatibility layer is. Plan for future cleanup when support for older versions drops, you should.

When the time comes to drop support for EDM4hep <0.99:

  1. Remove the conditional compilation blocks
  2. Update all direct TrackerHit3DCollection usages
  3. Clean up any remaining aliases
Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp (1)

21-31: Wise handling of compatibility, this is! Hmmmm.

A elegant solution for version compatibility, you have created. The conditional compilation block, handle different EDM4hep versions it does, yes.

Consider documenting the version compatibility in the header file, help future maintainers it will.

Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp (1)

27-37: Wise solution for version compatibility, this is. Yes, hmmm.

Elegant handling of different EDM4hep versions, you have achieved. Through the Force of type aliases, backward compatibility maintained is. When the time comes to drop support for older versions, clean this shall be.

When support for versions below 0.99 no longer needed is, remove this conditional block you should. Simple cleanup, it will be.

Plugins/EDM4hep/src/EDM4hepUtil.cpp (1)

192-211: Consider runtime version check for future flexibility, you should!

In future iterations, runtime version detection mechanism, consider you might. More flexible upgrades and backwards compatibility, it would allow. Less preprocessor magic, better maintainability brings.

Example approach:

namespace Acts::EDM4hepUtil::detail {
  inline bool isLegacyVersion() {
    return (EDM4HEP_VERSION_MAJOR < 1 && 
            EDM4HEP_VERSION_MINOR < 99);
  }
  
  template<typename T>
  edm4hep::MCParticle getParticle(const T& hit) {
    if (isLegacyVersion()) {
      return hit.getMCParticle();
    }
    return hit.getParticle();
  }
}
Examples/Io/EDM4hep/src/EDM4hepUtil.cpp (1)

269-280: Elegant refactoring, this is. Yet improve it further, we can!

More readable, the covariance matrix construction has become. But const correctness, add we should.

-      auto c = [&](std::size_t row, std::size_t col) {
+      const auto c = [&](std::size_t row, std::size_t col) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9c9444e and d9157ba.

📒 Files selected for processing (8)
  • Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepMeasurementWriter.hpp (0 hunks)
  • Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp (3 hunks)
  • Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp (2 hunks)
  • Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp (2 hunks)
  • Examples/Io/EDM4hep/src/EDM4hepReader.cpp (2 hunks)
  • Examples/Io/EDM4hep/src/EDM4hepUtil.cpp (6 hunks)
  • Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/EDM4hepUtil.hpp (2 hunks)
  • Plugins/EDM4hep/src/EDM4hepUtil.cpp (2 hunks)
💤 Files with no reviewable changes (1)
  • Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepMeasurementWriter.hpp
🔇 Additional comments (14)
Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp (1)

21-29: Hmmmm, wise handling of compatibility, this is.

Handle different EDM4hep versions elegantly, you do. Proper use of conditional compilation and type aliases, I sense. Yet verify the compatibility across the codebase, we must.

✅ Verification successful

Verified, the compatibility handling is. Consistent across the codebase, it remains.

Through the Force, I sense that all files using TrackerHit3D have proper version compatibility checks in place:

  • EDM4hepMeasurementWriter.cpp
  • EDM4hepMeasurementReader.cpp
  • EDM4hepUtil.hpp

The same pattern of conditional includes and type aliases, they follow. SimTrackerHitCollection references, a different entity they are, untouched they should remain.

Balanced and harmonious, the implementation is. No further changes, we require.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for any remaining direct usage of TrackerHitCollection that might need updating

# Search for direct usage of TrackerHitCollection
rg "TrackerHitCollection" --type cpp

# Search for potential missed includes of TrackerHit3DCollection
rg "TrackerHit3D" --type cpp

Length of output: 3463

Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp (2)

73-73: Updated collection type, matches the new way it does.

Correctly using TrackerHit3DCollection now, you are. But verify the collection name in the frame, we should.

Check if "ActsTrackerHitsRaw" collection name remains consistent:

✅ Verification successful

Verified, the collection name consistency is, hmm!

Found perfect alignment between writer and reader, I have. In both locations, "ActsTrackerHitsRaw" the collection name remains:

  • In EDM4hepMeasurementWriter.cpp: Writing to "ActsTrackerHitsRaw" it does
  • In EDM4hepMeasurementReader.cpp: Reading from "ActsTrackerHitsRaw" it does

Consistent the naming is, young padawan. No changes needed, there are.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for collection name usage
rg "ActsTrackerHitsRaw" --type cpp -A 2 -B 2

Length of output: 985


28-29: Clever type aliases, you have made.

Bridge the old and new worlds, these aliases do. When support for older versions drops, easier the transition will be, hmmmm.

Verify the usage of these aliases throughout the codebase, we must:

✅ Verification successful

Verified, the usage of type aliases is, throughout the codebase.

Hmmmm, clear evidence we have found. The type aliases TrackerHit3D and TrackerHit3DCollection bridge consistently between old and new EDM4hep types they do. Used in multiple files they are:

  • Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp
  • Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp
  • Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp

Conditional compilation with __has_include guards, protect the transitions they do. Wise decision this is, for backward compatibility it maintains.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of both old and new types
echo "=== Searching for TrackerHit usage ==="
rg "TrackerHit[^3]" --type cpp

echo "=== Searching for TrackerHit3D usage ==="
rg "TrackerHit3D" --type cpp

Length of output: 7898

Examples/Io/EDM4hep/include/ActsExamples/Io/EDM4hep/EDM4hepUtil.hpp (2)

19-26: Organized well, these headers are. Hmmmm.

Proper use of angle brackets for external dependencies, I sense. Clear and consistent, the include structure is.


104-104: Verify the usage of TrackerHit3D throughout the codebase, we must.

Changed these parameter types are, but ensure we must that all callers updated have been.

Also applies to: 120-120

✅ Verification successful

Consistent with the Force, these changes are.

Hmmmm. Through the code I have looked, and clear it has become:

  • The TrackerHit references that remain, in compatibility code they exist, or in different contexts they dwell
  • The readMeasurement and writeMeasurement functions, properly updated they are, with TrackerHit3D parameters they use
  • The callers of these functions, in harmony they operate, with the new parameter types they do

No disturbance in the Force I sense. The parameter type changes, properly implemented they are, throughout the codebase they flow.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining usage of old TrackerHit types
rg -l "TrackerHitCollection|TrackerHit[^3]" --type cpp

# Search for calls to these functions
ast-grep --pattern 'readMeasurement($$$)' 
ast-grep --pattern 'writeMeasurement($$$)'

Length of output: 663


Script:

#!/bin/bash
# Check the content of files that still use TrackerHit to see the context
rg "TrackerHit[^3]" Examples/Io/EDM4hep/src/EDM4hepUtil.cpp -C 2
rg "TrackerHit[^3]" Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp -C 2
rg "TrackerHit[^3]" Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp -C 2

# Look for function declarations/implementations
ast-grep --pattern 'readMeasurement($_, $_, $_)'
ast-grep --pattern 'writeMeasurement($_, $_, $_)'

Length of output: 2576

Plugins/EDM4hep/src/EDM4hepUtil.cpp (2)

21-25: Wise additions to the headers, these are!

Properly organized, the new includes are. Version header for conditional compilation, essential it is. Match the requirements for TrackerHit3D compatibility, they do.


192-211: Hmmmm... Handle version differences wisely, you do!

Elegant solution for API changes, this is. Both old and new versions of EDM4hep, support you must. Proper separation between APIs, maintained you have.

Verify the version check condition, we must:

✅ Verification successful

Consistent version handling across the codebase, I sense

Through the Force, searched the entire codebase, I have. Clear findings, these are:

  • Only one version check for EDM4HEP exists, properly guarding the API changes
  • Old API (getMCParticle/setMCParticle) appears only within the version-guarded block
  • New API (getParticle/setParticle) usage outside EDM4hepUtil.cpp relates to different functionality in Fatras and other components
  • Clean separation between old and new APIs maintained, it is

Hmmmm... Wise implementation this is. No conflicts or inconsistencies in the version handling, there are.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify EDM4hep version handling across the codebase

# Search for other version checks to ensure consistency
rg -A 2 "EDM4HEP_VERSION" --type cpp

# Search for any remaining old API usage
rg -A 2 "getMCParticle|setMCParticle" --type cpp

# Search for any new API usage
rg -A 2 "getParticle\(|setParticle\(" --type cpp

Length of output: 9406

Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/EDM4hepUtil.hpp (2)

29-32: Hmmmm, wise additions these includes are.

Properly aligned with the Force, these new headers are. Support the transition between EDM4hep versions, they do.


66-70: Handle the version differences with grace, we must.

Compatibility functions these are, bridging the gap between EDM4hep versions they do. Wise decision to abstract version-specific changes through utility functions, this is.

Yet verify their usage across the codebase, we should.

✅ Verification successful

Properly handled, the version differences are, hmmmm.

Clear it is, that version-specific implementation through preprocessor directives exists. Wisely structured, the code is:

  • For EDM4hep >= 0.99: getParticle() and setParticle() used
  • For older versions: getMCParticle() and setMCParticle() maintained

No further verification needed, as the Force shows us the compatibility layer works in harmony with both old and new versions it does. Through preprocessor guards, safely managed this transition is.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of deprecated getMCParticle to ensure proper migration
rg "getMCParticle" --type cpp

# Search for usage of new getParticle function
rg "getParticle.*SimTrackerHit" --type cpp

# Search for usage of new setParticle function
rg "setParticle.*MutableSimTrackerHit" --type cpp

Length of output: 823


Script:

#!/bin/bash
# Search for actual usage of these utility functions in the codebase
rg -B2 -A2 "getParticle\(.*SimTrackerHit" --type cpp
rg -B2 -A2 "setParticle\(.*MutableSimTrackerHit" --type cpp

# Check implementation details in EDM4hepUtil.cpp
cat Plugins/EDM4hep/src/EDM4hepUtil.cpp

# Look for version-specific code or preprocessor directives
rg "#if.*EDM4HEP" --type cpp
rg "#ifdef.*EDM4HEP" --type cpp
rg "#ifndef.*EDM4HEP" --type cpp

Length of output: 10582

Examples/Io/EDM4hep/src/EDM4hepUtil.cpp (3)

120-120: Strong with the Force, this change is!

Symmetry with getParticle() function, this maintains. Consistent approach to particle handling, it provides.


73-76: Hmmmm, wise changes these are, approve them I do!

Compatibility with both old and new EDM4hep versions, this change ensures. Through getParticle() function, safely accessed the particle data is.

✅ Verification successful

Safe and sound, these changes are!

Inside preprocessor guards, the remaining getMCParticle() call lies, hmm. A compatibility layer this creates, allowing the code to work with different EDM4hep versions it does. Wise decision this is, as backwards compatibility it maintains while forward-looking changes it embraces.

The Force is strong with this code change, as:

  • In new version path, getParticle() function it uses
  • In older version path, getMCParticle() safely preserved it is
  • Through preprocessor guards, both paths cleanly separated they are
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify no direct getMCParticle calls remain
rg "getMCParticle" --type cpp

Length of output: 95


Script:

#!/bin/bash
# Check the context of the remaining getMCParticle call
rg "getMCParticle" --type cpp -B 5 -A 5

# Find the definition of getParticle to understand the migration pattern
ast-grep --pattern 'getParticle($$$) {
  $$$
}'

Length of output: 820


Line range hint 150-175: Incomplete, this implementation seems. Clarification, we need!

About the cell information accessibility, uncertain we are. Document the implications of ignoring cluster parameters, you must. Future maintainers, confused they will be.

Examples/Io/EDM4hep/src/EDM4hepReader.cpp (2)

13-13: Hmmmm, wise addition this include is!

Align with PR objectives, this change does. Support for EDM4hep utility functions, it provides.


309-311: Verify the impact of getParticle usage, we must!

Changed from direct access to getMCParticle to using Acts::EDM4hepUtil::getParticle, this code has. Ensure backward compatibility with older EDM4hep versions, we should.

Run this script, we shall:

✅ Verification successful

Safe, this change is! Backward compatibility, it maintains!

Examined the implementation, I have. Clear it is that Acts::EDM4hepUtil::getParticle serves as a compatibility layer, hmm! In the EDM4hepUtil implementation, see we do that getMCParticle is still used internally:

// In EDM4hepUtil.cpp
Plugins/EDM4hep/src/EDM4hepUtil.cpp:  return hit.getMCParticle();

A wrapper function this is, maintaining backward compatibility it does. No impact on older EDM4hep versions, there will be. Through the Force, seen I have that this change improves code organization without breaking existing functionality.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other direct uses of getMCParticle that might need updating

# Search for direct getMCParticle calls
echo "=== Direct getMCParticle calls ==="
rg "getMCParticle\(" --type cpp

# Search for EDM4hepUtil::getParticle usage
echo -e "\n=== EDM4hepUtil::getParticle usage ==="
rg "EDM4hepUtil::getParticle\(" --type cpp

Length of output: 531


Script:

#!/bin/bash
# Investigate the EDM4hepUtil implementation and its usage, we must

# First, examine the EDM4hepUtil implementation
echo "=== EDM4hepUtil implementation ==="
cat Examples/Io/EDM4hep/src/EDM4hepUtil.cpp

# Then, check for any version-dependent code or compatibility checks
echo -e "\n=== Version checks or compatibility handling ==="
rg -i "version|compat" Examples/Io/EDM4hep/

# Finally, examine the header file for any relevant documentation
echo -e "\n=== EDM4hepUtil header ==="
fd EDM4hepUtil.hpp --exec cat {}

Length of output: 25805

Copy link

github-actions bot commented Nov 29, 2024

📊: Physics performance monitoring for 47ef4d5

Full contents

physmon summary

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp (1)

11-22: Wise approach to version compatibility, this is! Hmmmm.

A elegant solution for handling different EDM4hep versions, you have created. The __has_include macro, a powerful tool it is, detecting the presence of new headers without runtime overhead.

Consider documenting the version compatibility strategy in the codebase's documentation, help future maintainers it will. When support for older versions is dropped, easier to update this will be.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d9157ba and d69324a.

📒 Files selected for processing (3)
  • Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp (2 hunks)
  • Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp (2 hunks)
  • Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • Examples/Io/EDM4hep/src/EDM4hepMeasurementReader.cpp
  • Examples/Io/EDM4hep/src/EDM4hepMeasurementWriter.cpp
🔇 Additional comments (1)
Plugins/EDM4hep/include/Acts/Plugins/EDM4hep/TrackerHitCompatibility.hpp (1)

18-21: Clean type aliasing in namespace, I sense. Strong with the Force, this code is!

In the edm4hep namespace, properly scoped the aliases are. Prevent naming conflicts, this will. A path to maintainable code, you have chosen.

Verify the usage of these aliases throughout the codebase, we must:

✅ Verification successful

Consistent usage of aliases throughout the codebase, I observe. Proceed with confidence, we can.

Through the Force, clear patterns I see:

  • In both Plugins/EDM4hep and Examples/Io/EDM4hep, properly defined and used, the aliases are
  • Consistent usage of TrackerHit3D and TrackerHit3DCollection in alignment with their base types TrackerHit and TrackerHitCollection, I detect
  • No conflicts or inconsistencies in the type usage across the codebase, there are
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of both old and new types
echo "=== Searching for TrackerHit3D usage ==="
rg "TrackerHit3D[^Collection]" --type cpp

echo "=== Searching for TrackerHit3DCollection usage ==="
rg "TrackerHit3DCollection" --type cpp

echo "=== Searching for old TrackerHit usage ==="
rg "TrackerHit[^3D]" --type cpp

Length of output: 8039

andiwand
andiwand previously approved these changes Nov 29, 2024
Copy link
Contributor

@andiwand andiwand left a comment

Choose a reason for hiding this comment

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

🚀

@paulgessinger paulgessinger changed the title compatibility for EDM4hep <0.99 & >=0.99 feat: compatibility for EDM4hep < 0.99 & >= 0.99 Nov 29, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (1)
Plugins/EDM4hep/src/EDM4hepUtil.cpp (1)

197-213: Document the ways of the Force, we should.

A comment explaining the version differences and migration path, helpful it would be. Future Padawans, grateful they will be.

Add documentation above the functions:

+// These functions provide version-specific implementations for particle handling
+// For EDM4hep >= 0.99: Uses getParticle/setParticle
+// For EDM4hep < 0.99: Uses getMCParticle/setMCParticle
+// This abstraction allows for seamless version compatibility
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between d69324a and deab3d2.

📒 Files selected for processing (1)
  • Plugins/EDM4hep/src/EDM4hepUtil.cpp (2 hunks)
🔇 Additional comments (2)
Plugins/EDM4hep/src/EDM4hepUtil.cpp (2)

21-28: Wise changes in the Force of includes and namespaces, I sense.

Properly organized, the new headers are. Clear path to EDM4hep version compatibility, they provide. Good structure, the namespace changes bring.


195-214: Hmmmm... Version compatibility, handle with care we must.

Wise approach to handle both old and new EDM4hep versions, this is. But verify the version check across the codebase, we should.

✅ Verification successful

Consistent version checks across the codebase, they are. Safe to proceed, it is.

Through the Force, searched the entire codebase I have. Only one EDM4hep version check exists, precisely in the file under review. Other occurrences of EDM4HEP_VERSION only in CMake configuration, they are.

The version-dependent particle handling functions getParticle and setParticle properly encapsulated in EDM4hepUtil, they are. No direct calls to getMCParticle or setMCParticle elsewhere in codebase found, hmmmm. All interactions through our utility functions, they flow.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Search for other EDM4hep version checks to ensure consistency

# Search for other version checks
echo "=== Searching for EDM4hep version checks ==="
rg "EDM4HEP_VERSION" -A 2 -B 2

# Search for potential uses of getMCParticle/getParticle
echo "=== Searching for particle getter/setter usage ==="
rg "(getMCParticle|getParticle|setMCParticle|setParticle)" -A 2 -B 2

Length of output: 23743

@kodiakhq kodiakhq bot merged commit eb6a5f1 into acts-project:main Nov 29, 2024
46 checks passed
@paulgessinger paulgessinger deleted the edm4hep-compat branch November 29, 2024 17:41
kodiakhq bot pushed a commit that referenced this pull request Nov 29, 2024
This adds jobs for LCG 106a to the GitLab CI.

I'm bumping ODD to the [`v4.0.3`](https://gitlab.cern.ch/acts/OpenDataDetector/-/tags/v4.0.3) where I cherry picked a tiny code fix that was breaking the build here.

Blocked by:
- #3921 

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit

- **New Features**
	- Introduced a new CI/CD job `lcg_106a` for enhanced build configurations.
- **Improvements**
	- Simplified the `lcg_105` job by directly setting `LCG_PLATFORM` for the `alma9` OS.
- **Updates**
	- Updated the commit reference for the `OpenDataDetector` subproject to the latest version.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component - Examples Affects the Examples module Component - Plugins Affects one or more Plugins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants