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

Change link name to follow edm4hep convention #140

Merged
merged 3 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace k4SimDelphes {
* Name of the RecoMCParticleLinkCollection holding the links of
* generated to reconstructed particles.
*/
std::string RecoMCParticleLinkCollectionName{"MCRecoAssociations"};
std::string RecoMCParticleLinkCollectionName{"RecoMCLink"};
};

template <typename T> std::ostream& operator<<(std::ostream& os, std::vector<T> const& container) {
Expand Down Expand Up @@ -160,7 +160,7 @@ namespace k4SimDelphes {
}

settings.RecoMCParticleLinkCollectionName =
confReader->GetString("EDM4HepOutput::RecoMCParticleLinkCollectionName", "MCRecoAssociations");
confReader->GetString("EDM4HepOutput::RecoMCParticleLinkCollectionName", "RecoMCLink");

return settings;
}
Expand Down
2 changes: 1 addition & 1 deletion examples/edm4hep_output_config.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ module EDM4HepOutput EDM4HepOutput {
add MissingETCollections MissingET
add ScalarHTCollections ScalarHT
set RecoParticleCollectionName ReconstructedParticles
set RecoMCParticleLinkCollectionName MCRecoAssociations
set RecoMCParticleLinkCollectionName RecoMCLink
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ module EDM4HepOutput EDM4HepOutput {
add MissingETCollections MissingET
add ScalarHTCollections ScalarHT
set RecoParticleCollectionName ReconstructedParticles
set MCRecoAssociationCollectionName MCRecoAssociations
set MCRecoAssociationCollectionName RecoMCLink
}
10 changes: 5 additions & 5 deletions framework/k4SimDelphes/src/k4SimDelphesAlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ StatusCode k4SimDelphesAlg::initialize() {
m_eventDataSvc.retrieve().ignore();
m_podioDataSvc = dynamic_cast<PodioDataSvc*>(m_eventDataSvc.get());

const auto branches = getBranchSettings(m_confReader->GetParam("TreeWriter::Branch"));
const auto outputSettings = getEDM4hepOutputSettings(m_DelphesOutputSettings.value().c_str());
m_edm4hepConverter = std::make_unique<k4SimDelphes::DelphesEDM4HepConverter>(
branches, outputSettings, m_confReader->GetDouble("ParticlePropagator::Bz", 0));
const auto branches = getBranchSettings(m_confReader->GetParam("TreeWriter::Branch"));
m_outputConfig = getEDM4hepOutputSettings(m_DelphesOutputSettings.value().c_str());
m_edm4hepConverter = std::make_unique<k4SimDelphes::DelphesEDM4HepConverter>(
branches, m_outputConfig, m_confReader->GetDouble("ParticlePropagator::Bz", 0));

return StatusCode::SUCCESS;
}
Expand Down Expand Up @@ -70,7 +70,7 @@ StatusCode k4SimDelphesAlg::execute(const EventContext&) const {

auto collections = m_edm4hepConverter->getCollections();
for (auto& c : collections) {
if (c.first == "MCRecoAssociations") {
if (c.first == m_outputConfig.RecoMCParticleLinkCollectionName) {
auto new_c = m_edm4hepConverter->createExternalRecoMCLinks(mapSimDelphes);
DataWrapper<podio::CollectionBase>* wrapper = new DataWrapper<podio::CollectionBase>();
wrapper->setData(new_c);
Expand Down
1 change: 1 addition & 0 deletions framework/k4SimDelphes/src/k4SimDelphesAlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class k4SimDelphesAlg : public Gaudi::Algorithm {
Gaudi::Property<std::string> m_DelphesOutputSettings{
this, "DelphesOutputSettings", "", "Name of config file with k4simdelphes specific output settings"};

k4SimDelphes::OutputSettings m_outputConfig{};
std::unique_ptr<Delphes> m_Delphes{nullptr};
std::unique_ptr<ExRootConfReader> m_confReader{nullptr};
std::unique_ptr<k4SimDelphes::DelphesEDM4HepConverter> m_edm4hepConverter{nullptr};
Expand Down
2 changes: 1 addition & 1 deletion tests/src/compare_delphes_converter_outputs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ int main(int, char* argv[]) {
return 1;
}

auto& mcRecoAssocColl = frame.get<edm4hep::RecoMCParticleLinkCollection>("MCRecoAssociations");
auto& mcRecoAssocColl = frame.get<edm4hep::RecoMCParticleLinkCollection>("RecoMCLink");

compareCollectionElements<Track>(tracks, recoColl, "EFlowTrack", 0, mcRecoAssocColl);
compareCollectionElements<Tower>(ecalClusters, recoColl, "EFlowPhoton", tracks->GetEntries(), mcRecoAssocColl);
Expand Down
Loading