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

Switch from Associations to Links #115

Merged
merged 2 commits into from
Oct 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions RecCalorimeter/src/components/CreateTruthJet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// EDM4hep
#include "edm4hep/MCParticleCollection.h"
#include "edm4hep/MCRecoParticleAssociationCollection.h"
#include "edm4hep/RecoMCParticleLinkCollection.h"
#include "edm4hep/ReconstructedParticleCollection.h"

// k4RecCalorimeter
Expand Down Expand Up @@ -39,7 +39,7 @@
struct CreateTruthJet final
: k4FWCore::MultiTransformer<
std::tuple<edm4hep::ReconstructedParticleCollection,
edm4hep::MCRecoParticleAssociationCollection>(
edm4hep::RecoMCParticleLinkCollection>(
const edm4hep::MCParticleCollection &)> {

CreateTruthJet(const std::string &name, ISvcLocator *svcLoc)
Expand All @@ -61,7 +61,7 @@ struct CreateTruthJet final
}

std::tuple<edm4hep::ReconstructedParticleCollection,
edm4hep::MCRecoParticleAssociationCollection>
edm4hep::RecoMCParticleLinkCollection>
operator()(const edm4hep::MCParticleCollection &input) const override {

std::vector<fastjet::PseudoJet> clustersPJ;
Expand All @@ -79,7 +79,7 @@ struct CreateTruthJet final
m_clusterer->cluster(clustersPJ);

auto edmJets = edm4hep::ReconstructedParticleCollection();
auto assoc = edm4hep::MCRecoParticleAssociationCollection();
auto links = edm4hep::RecoMCParticleLinkCollection();

for (auto cjet : inclusiveJets) {
edm4hep::MutableReconstructedParticle jet;
Expand All @@ -92,15 +92,15 @@ struct CreateTruthJet final
for (auto constit : constits) {
int index = constit.user_info<k4::recCalo::ClusterInfo>().index();

auto association = assoc.create();
association.setRec(jet);
association.setSim((input)[index]);
auto link = links.create();
link.setFrom(jet);
link.setTo((input)[index]);
}

edmJets.push_back(jet);
}

return std::make_tuple(std::move(edmJets), std::move(assoc));
return std::make_tuple(std::move(edmJets), std::move(links));
}

StatusCode finalize() override {
Expand Down
Loading