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

Use the new edm4hep::CellIDEncoding #156

Merged
merged 2 commits into from
Nov 3, 2023
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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ include(GNUInstallDirs)
find_package(Gaudi REQUIRED)
find_package(LCIO REQUIRED)
find_package(Marlin REQUIRED)
find_package(EDM4HEP REQUIRED)
find_package(EDM4HEP 0.10.1 REQUIRED)
find_package(k4FWCore REQUIRED)
find_package(k4EDM4hep2LcioConv REQUIRED)

Expand Down
10 changes: 6 additions & 4 deletions k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "k4MarlinWrapper/converters/EDM4hep2Lcio.h"
#include "GlobalConvertedObjectsMap.h"

#include "edm4hep/Constants.h"

#include "k4FWCore/DataHandle.h"
#include "k4FWCore/MetaDataHandle.h"

Expand Down Expand Up @@ -94,7 +96,7 @@ void EDM4hep2LcioTool::convertTrackerHits(TrackerHitMap& trackerhits_vec, const
DataHandle<edm4hep::TrackerHitCollection> trackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this};
const auto trackerhits_coll = trackerhits_handle.get();

MetaDataHandle<std::string> cellIDStrHandle{trackerhits_handle, "CellIDEncoding", Gaudi::DataHandle::Reader};
MetaDataHandle<std::string> cellIDStrHandle{trackerhits_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader};

auto* conv_trackerhits = convTrackerHits(trackerhits_coll, cellIDStrHandle.get(), trackerhits_vec);

Expand All @@ -111,7 +113,7 @@ void EDM4hep2LcioTool::convertSimTrackerHits(SimTrackerHitMap& simtrackerhits_ve
DataHandle<edm4hep::SimTrackerHitCollection> simtrackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this};
const auto simtrackerhits_coll = simtrackerhits_handle.get();

MetaDataHandle<std::string> cellIDHandle{simtrackerhits_handle, "CellIDEncoding", Gaudi::DataHandle::Reader};
MetaDataHandle<std::string> cellIDHandle{simtrackerhits_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader};
const auto cellIDstr = cellIDHandle.get();

auto* conv_simtrackerhits = convSimTrackerHits(simtrackerhits_coll, cellIDstr, simtrackerhits_vec, mcparticles_vec);
Expand All @@ -128,7 +130,7 @@ void EDM4hep2LcioTool::convertCalorimeterHits(CaloHitMap& calo_hits_vec, const s
DataHandle<edm4hep::CalorimeterHitCollection> calohit_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this};
const auto calohit_coll = calohit_handle.get();

MetaDataHandle<std::string> cellIDHandle{calohit_handle, "CellIDEncoding", Gaudi::DataHandle::Reader};
MetaDataHandle<std::string> cellIDHandle{calohit_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader};
const auto cellIDstr = cellIDHandle.get();

auto* conv_calohits = convCalorimeterHits(calohit_coll, cellIDstr, calo_hits_vec);
Expand Down Expand Up @@ -160,7 +162,7 @@ void EDM4hep2LcioTool::convertSimCalorimeterHits(SimCaloHitMap& sim_calo_hits_ve
DataHandle<edm4hep::SimCalorimeterHitCollection> sim_calohit_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this};
const auto simcalohit_coll = sim_calohit_handle.get();

MetaDataHandle<std::string> cellIDHandle{sim_calohit_handle, "CellIDEncoding", Gaudi::DataHandle::Reader};
MetaDataHandle<std::string> cellIDHandle{sim_calohit_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader};
const auto cellIDstr = cellIDHandle.get();

// TODO mcparticles_vdc
Expand Down
7 changes: 4 additions & 3 deletions k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <Exceptions.h>

#include <edm4hep/ClusterCollection.h>
#include <edm4hep/Constants.h>
#include <edm4hep/EventHeaderCollection.h>
#include <edm4hep/MCParticleCollection.h>
#include <edm4hep/ParticleIDCollection.h>
Expand Down Expand Up @@ -107,11 +108,11 @@ void Lcio2EDM4hepTool::registerCollection(
lcioColl->getParameters().getStringKeys(string_keys);

for (auto& elem : string_keys) {
if (elem == "CellIDEncoding") {
if (elem == edm4hep::CellIDEncoding) {
const auto& lcio_coll_cellid_str = lcioColl->getParameters().getStringVal(lcio::LCIO::CellIDEncoding);
auto& mdFrame = m_podioDataSvc->getMetaDataFrame();
mdFrame.putParameter(podio::collMetadataParamName(name, "CellIDEncoding"), lcio_coll_cellid_str);
debug() << "Storing CellIDEncoding " << podio::collMetadataParamName(name, "CellIDEncoding")
mdFrame.putParameter(podio::collMetadataParamName(name, edm4hep::CellIDEncoding), lcio_coll_cellid_str);
debug() << "Storing CellIDEncoding " << podio::collMetadataParamName(name, edm4hep::CellIDEncoding)
<< " value: " << lcio_coll_cellid_str << endmsg;
} else {
// TODO: figure out where this actually needs to go
Expand Down
Loading