Skip to content

Commit

Permalink
Fix a few warnings when compiling (#187)
Browse files Browse the repository at this point in the history
* Use edm4hep::labels

* Add a default case

---------

Co-authored-by: jmcarcell <[email protected]>
  • Loading branch information
jmcarcell and jmcarcell authored Jun 20, 2024
1 parent 4f66668 commit aa8b0cb
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 11 deletions.
16 changes: 10 additions & 6 deletions k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ void EDM4hep2LcioTool::convertTrackerHits(TrackerHitMap& trackerhits_vec, const
DataHandle<edm4hep::TrackerHit3DCollection> trackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this};
const auto trackerhits_coll = trackerhits_handle.get();

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

auto conv_trackerhits =
EDM4hep2LCIOConv::convertTrackerHits(trackerhits_coll, cellIDStrHandle.get(""), trackerhits_vec);
Expand All @@ -113,7 +114,8 @@ void EDM4hep2LcioTool::convertTrackerHitPlanes(TrackerHitPlaneMap& trackerhits_v
DataHandle<edm4hep::TrackerHitPlaneCollection> trackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this};
const auto trackerhits_coll = trackerhits_handle.get();

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

auto conv_trackerhits =
EDM4hep2LCIOConv::convertTrackerHitPlanes(trackerhits_coll, cellIDStrHandle.get(""), trackerhits_vec);
Expand All @@ -130,7 +132,8 @@ 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, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader};
MetaDataHandle<std::string> cellIDHandle{simtrackerhits_handle, edm4hep::labels::CellIDEncoding,
Gaudi::DataHandle::Reader};
const auto cellIDstr = cellIDHandle.get();

auto conv_simtrackerhits =
Expand All @@ -148,7 +151,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, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader};
MetaDataHandle<std::string> cellIDHandle{calohit_handle, edm4hep::labels::CellIDEncoding, Gaudi::DataHandle::Reader};
const auto cellIDstr = cellIDHandle.get();

auto conv_calohits = EDM4hep2LCIOConv::convertCalorimeterHits(calohit_coll, cellIDstr, calo_hits_vec);
Expand Down Expand Up @@ -179,7 +182,8 @@ 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, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader};
MetaDataHandle<std::string> cellIDHandle{sim_calohit_handle, edm4hep::labels::CellIDEncoding,
Gaudi::DataHandle::Reader};
const auto cellIDstr = cellIDHandle.get();

// TODO mcparticles_vdc
Expand Down Expand Up @@ -340,7 +344,7 @@ StatusCode EDM4hep2LcioTool::convertCollections(lcio::LCEventImpl* lcio_event) {
// Start off with the pre-defined collection name mappings
auto collsToConvert{m_collNames.value()};
// We *always* want to convert the EventHeader
collsToConvert.emplace(edm4hep::EventHeaderName, "");
collsToConvert.emplace(edm4hep::labels::EventHeader, "");
if (m_convertAll) {
info() << "Converting all collections from EDM4hep to LCIO" << endmsg;
// And simply add the rest, exploiting the fact that emplace will not
Expand Down
10 changes: 5 additions & 5 deletions k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,11 @@ void Lcio2EDM4hepTool::registerCollection(
lcioColl->getParameters().getStringKeys(string_keys);

for (auto& elem : string_keys) {
if (elem == edm4hep::CellIDEncoding) {
if (elem == edm4hep::labels::CellIDEncoding) {
const auto& lcio_coll_cellid_str = lcioColl->getParameters().getStringVal(lcio::LCIO::CellIDEncoding);
auto& mdFrame = m_podioDataSvc->getMetaDataFrame();
mdFrame.putParameter(podio::collMetadataParamName(name, edm4hep::CellIDEncoding), lcio_coll_cellid_str);
debug() << "Storing CellIDEncoding " << podio::collMetadataParamName(name, edm4hep::CellIDEncoding)
mdFrame.putParameter(podio::collMetadataParamName(name, edm4hep::labels::CellIDEncoding), lcio_coll_cellid_str);
debug() << "Storing CellIDEncoding " << podio::collMetadataParamName(name, edm4hep::labels::CellIDEncoding)
<< " value: " << lcio_coll_cellid_str << endmsg;
} else {
// TODO: figure out where this actually needs to go
Expand Down Expand Up @@ -136,8 +136,8 @@ StatusCode Lcio2EDM4hepTool::convertCollections(lcio::LCEventImpl* the_event) {
LCIO2EDM4hepConv::convertObjectParameters<lcio::LCEventImpl>(the_event, frame);

// Convert Event Header outside the collections loop
if (!collectionExist(edm4hep::EventHeaderName)) {
registerCollection(edm4hep::EventHeaderName, LCIO2EDM4hepConv::createEventHeader(the_event));
if (!collectionExist(edm4hep::labels::EventHeader)) {
registerCollection(edm4hep::labels::EventHeader, LCIO2EDM4hepConv::createEventHeader(the_event));
}

// Start off with the pre-defined collection name mappings
Expand Down
3 changes: 3 additions & 0 deletions k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ StatusCode MarlinProcessorWrapper::initialize() {
case MSG::DEBUG:
m_verbosity = "DEBUG";
break;
default:
m_verbosity = "MESSAGE";
break;
}

// pass m_verbosity to overwrite it if explicitly stated in wrapped parameters
Expand Down

0 comments on commit aa8b0cb

Please sign in to comment.