From aa8b0cbd3b6fd0dfee72fbcf67704e26eb40cf9c Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Thu, 20 Jun 2024 09:11:14 +0200 Subject: [PATCH] Fix a few warnings when compiling (#187) * Use edm4hep::labels * Add a default case --------- Co-authored-by: jmcarcell --- k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp | 16 ++++++++++------ k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp | 10 +++++----- .../src/components/MarlinProcessorWrapper.cpp | 3 +++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp index d56dd2a2..fd5a4da7 100644 --- a/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp +++ b/k4MarlinWrapper/src/components/EDM4hep2Lcio.cpp @@ -93,7 +93,8 @@ void EDM4hep2LcioTool::convertTrackerHits(TrackerHitMap& trackerhits_vec, const DataHandle trackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto trackerhits_coll = trackerhits_handle.get(); - MetaDataHandle cellIDStrHandle{trackerhits_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDStrHandle{trackerhits_handle, edm4hep::labels::CellIDEncoding, + Gaudi::DataHandle::Reader}; auto conv_trackerhits = EDM4hep2LCIOConv::convertTrackerHits(trackerhits_coll, cellIDStrHandle.get(""), trackerhits_vec); @@ -113,7 +114,8 @@ void EDM4hep2LcioTool::convertTrackerHitPlanes(TrackerHitPlaneMap& trackerhits_v DataHandle trackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto trackerhits_coll = trackerhits_handle.get(); - MetaDataHandle cellIDStrHandle{trackerhits_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDStrHandle{trackerhits_handle, edm4hep::labels::CellIDEncoding, + Gaudi::DataHandle::Reader}; auto conv_trackerhits = EDM4hep2LCIOConv::convertTrackerHitPlanes(trackerhits_coll, cellIDStrHandle.get(""), trackerhits_vec); @@ -130,7 +132,8 @@ void EDM4hep2LcioTool::convertSimTrackerHits(SimTrackerHitMap& simtrackerhits_ve DataHandle simtrackerhits_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto simtrackerhits_coll = simtrackerhits_handle.get(); - MetaDataHandle cellIDHandle{simtrackerhits_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDHandle{simtrackerhits_handle, edm4hep::labels::CellIDEncoding, + Gaudi::DataHandle::Reader}; const auto cellIDstr = cellIDHandle.get(); auto conv_simtrackerhits = @@ -148,7 +151,7 @@ void EDM4hep2LcioTool::convertCalorimeterHits(CaloHitMap& calo_hits_vec, const s DataHandle calohit_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto calohit_coll = calohit_handle.get(); - MetaDataHandle cellIDHandle{calohit_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; + MetaDataHandle 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); @@ -179,7 +182,8 @@ void EDM4hep2LcioTool::convertSimCalorimeterHits(SimCaloHitMap& sim_calo_hits_ve DataHandle sim_calohit_handle{e4h_coll_name, Gaudi::DataHandle::Reader, this}; const auto simcalohit_coll = sim_calohit_handle.get(); - MetaDataHandle cellIDHandle{sim_calohit_handle, edm4hep::CellIDEncoding, Gaudi::DataHandle::Reader}; + MetaDataHandle cellIDHandle{sim_calohit_handle, edm4hep::labels::CellIDEncoding, + Gaudi::DataHandle::Reader}; const auto cellIDstr = cellIDHandle.get(); // TODO mcparticles_vdc @@ -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 diff --git a/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp b/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp index 110708dc..091e961e 100644 --- a/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp +++ b/k4MarlinWrapper/src/components/Lcio2EDM4hep.cpp @@ -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 @@ -136,8 +136,8 @@ StatusCode Lcio2EDM4hepTool::convertCollections(lcio::LCEventImpl* the_event) { LCIO2EDM4hepConv::convertObjectParameters(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 diff --git a/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp b/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp index 619e84d6..7d89b1bf 100644 --- a/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp +++ b/k4MarlinWrapper/src/components/MarlinProcessorWrapper.cpp @@ -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