Skip to content

Commit

Permalink
Use the new edm4hep::CellIDEncoding
Browse files Browse the repository at this point in the history
  • Loading branch information
jmcarcell committed Nov 1, 2023
1 parent 5e6bb7c commit e968942
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
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

0 comments on commit e968942

Please sign in to comment.