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

Add the possibility to set edm4hep::utils::ParticleIDMeta via the IMetadataSvc #273

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

tmadlener
Copy link
Contributor

@tmadlener tmadlener commented Dec 20, 2024

BEGINRELEASENOTES

  • Make it possible to use edm4hep::utils::ParticleIDMeta with the MetadataSvc
    • Add template specializations for get and put that defer to the corresponding utility calls in EDM4hep
    • Add tests to ensure that metadata is indeed usable this way with the utilities in EDM4hep

ENDRELEASENOTES

This would be option 1 sketched out in #272

@tmadlener
Copy link
Contributor Author

tmadlener commented Jan 16, 2025

I have added a "small" test case that runs similar checks as in the functional algorithm as a standalone application (effectively hard-coding the expected parameter and algorithm names). I have done it in c++ because the PIDHandler is not yet really usable in python (see key4hep/EDM4hep#396).

Once the nightly builds have picked up key4hep/EDM4hep#395, CI should also start to pass again (tomorrow).

@tmadlener tmadlener changed the title [WIP] Add the possibility to set edm4hep::utils::ParticleIDMeta via the IMetadataSvc Add the possibility to set edm4hep::utils::ParticleIDMeta via the IMetadataSvc Jan 16, 2025
Necessary because there is a new output collection in the functional
producer that is used in several places
@tmadlener
Copy link
Contributor Author

Since I touched the ExampleFunctionalProducerMultiple to also create ReconstructedParticles, I had to fix a few other tests to also make them pass. The alternative would be to introduce a dedicated producer for the ParticleID metadata tests. I am not sure if it's worth it, but it can obviously be done.

Technically already covered via Gaudi, but this makes it explicit
void operator()(const edm4hep::ParticleIDCollection& pidColl1, const edm4hep::ParticleIDCollection& pidColl2,
const edm4hep::ReconstructedParticleCollection& recos) const {
auto pidHandler = edm4hep::utils::PIDHandler::from(pidColl1, pidColl2);
pidHandler.addMetaInfos(m_pidMeta1, m_pidMeta2);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This requires a new version of EDM4hep. Should I go for a version that works with 0.99? Otherwise we need to bump the EDM4hep version, I think. Even if this is only a test.

Copy link
Member

@jmcarcell jmcarcell Jan 22, 2025

Choose a reason for hiding this comment

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

Up to you. But actually 0.99.1 in EDM4hep has the problem that key4hep/EDM4hep#379 is not merged in and this causes issues when trying to build on top of EDM4hep 0.99.1 since it won't find nlohmann_json, so having a tag with that is probably a good idea regardless.

@jmcarcell
Copy link
Member

I'll give this another look and update key4hep/k4MarlinWrapper#216 to use this to see if anything is missing between today and tomorrow.


edm4hep::ParticleIDCollection operator()(const edm4hep::ReconstructedParticleCollection& recos) const {
auto pidColl = edm4hep::ParticleIDCollection{};
for (const auto r : recos) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
for (const auto r : recos) {
for (const auto& r : recos) {

return StatusCode::SUCCESS;
}

edm4hep::ParticleIDCollection operator()(const edm4hep::ReconstructedParticleCollection& recos) const {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
edm4hep::ParticleIDCollection operator()(const edm4hep::ReconstructedParticleCollection& recos) const {
edm4hep::ParticleIDCollection operator()(const edm4hep::ReconstructedParticleCollection& recos) const override {

}

void operator()(const edm4hep::ParticleIDCollection& pidColl1, const edm4hep::ParticleIDCollection& pidColl2,
const edm4hep::ReconstructedParticleCollection& recos) const {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
const edm4hep::ReconstructedParticleCollection& recos) const {
const edm4hep::ReconstructedParticleCollection& recos) const override {

#include <Gaudi/Property.h>

#include "fmt/format.h"
#include "fmt/ranges.h"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#include "fmt/ranges.h"

Only fmt::format is being used

Copy link
Member

@jmcarcell jmcarcell left a comment

Choose a reason for hiding this comment

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

All good related to key4hep/k4MarlinWrapper#216

@@ -30,6 +30,7 @@ find_package(ROOT COMPONENTS RIO Tree REQUIRED)
find_package(Gaudi REQUIRED)
find_package(podio 1.0.1 REQUIRED)
find_package(EDM4HEP 0.99 REQUIRED)
find_package(fmt REQUIRED)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should fmt be also added to k4FWCoreConfig.cmake.in (and mentioned in README as a dependency)?

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.

3 participants