From feeadba6544d759d66caec7ae5420a354c0ac439 Mon Sep 17 00:00:00 2001 From: Juan Miguel Carceller <22276694+jmcarcell@users.noreply.github.com> Date: Fri, 3 May 2024 09:35:18 +0200 Subject: [PATCH] Fix narrowing in Cov3f (#59) * Fix narrowing from int to float in Cov3f * Fix warnings * Avoid forward declaration to make CI work --------- Co-authored-by: jmcarcell Co-authored-by: tmadlener --- k4EDM4hep2LcioConv/src/k4Lcio2EDM4hepConv.cpp | 26 +++---------------- tests/src/ComparisonUtils.h | 4 +-- tests/src/ObjectMapping.h | 11 ++++---- 3 files changed, 11 insertions(+), 30 deletions(-) diff --git a/k4EDM4hep2LcioConv/src/k4Lcio2EDM4hepConv.cpp b/k4EDM4hep2LcioConv/src/k4Lcio2EDM4hepConv.cpp index d49ede84..b778a328 100644 --- a/k4EDM4hep2LcioConv/src/k4Lcio2EDM4hepConv.cpp +++ b/k4EDM4hep2LcioConv/src/k4Lcio2EDM4hepConv.cpp @@ -21,27 +21,9 @@ namespace LCIO2EDM4hepConv { edmtrackState.referencePoint = Vector3fFrom({refPoint[0], refPoint[1], refPoint[2]}); const auto& covMatrix = trackState->getCovMatrix(); edmtrackState.covMatrix = { - covMatrix[0], - covMatrix[1], - covMatrix[2], - covMatrix[3], - covMatrix[4], - covMatrix[5], - covMatrix[6], - covMatrix[7], - covMatrix[8], - covMatrix[9], - covMatrix[10], - covMatrix[11], - covMatrix[12], - covMatrix[13], - covMatrix[14], - 0, - 0, - 0, - 0, - 0, - 0}; + covMatrix[0], covMatrix[1], covMatrix[2], covMatrix[3], covMatrix[4], covMatrix[5], covMatrix[6], + covMatrix[7], covMatrix[8], covMatrix[9], covMatrix[10], covMatrix[11], covMatrix[12], covMatrix[13], + covMatrix[14], 0.f, 0.f, 0.f, 0.f, 0.f, 0.f}; return edmtrackState; } @@ -76,7 +58,7 @@ namespace LCIO2EDM4hepConv { std::vector getPIDMetaInfo(const EVENT::LCCollection* recoColl) { std::vector pidInfos {}; - const auto pidHandler = UTIL::PIDHandler(recoColl); + auto pidHandler = UTIL::PIDHandler(recoColl); for (const auto id : pidHandler.getAlgorithmIDs()) { pidInfos.emplace_back(pidHandler.getAlgorithmName(id), id, pidHandler.getParameterNames(id)); } diff --git a/tests/src/ComparisonUtils.h b/tests/src/ComparisonUtils.h index 2454c4ab..8ab55964 100644 --- a/tests/src/ComparisonUtils.h +++ b/tests/src/ComparisonUtils.h @@ -98,7 +98,7 @@ bool compareValuesNanSafe(LCIO lcioV, EDM4hepT edm4hepV, const std::string& msg) >; if constexpr (isVectorLike) { - const auto vecSize = [&edm4hepV]() -> std::size_t { + const auto vecSize = [](EDM4hepT& edm4hepV) -> std::size_t { if constexpr (has_size_method::value) { return edm4hepV.size(); } @@ -109,7 +109,7 @@ bool compareValuesNanSafe(LCIO lcioV, EDM4hepT edm4hepV, const std::string& msg) return 2; } return 0; - }(); + }(edm4hepV); for (size_t i = 0; i < vecSize; ++i) { if (!nanSafeComp(lcioV[i], edm4hepV[i])) { std::cerr << msg << " at index " << i << ": (LCIO: " << (lcioV) << ", EDM4hep: " << (edm4hepV) << ")" diff --git a/tests/src/ObjectMapping.h b/tests/src/ObjectMapping.h index 9e472f17..0f36276e 100644 --- a/tests/src/ObjectMapping.h +++ b/tests/src/ObjectMapping.h @@ -1,9 +1,12 @@ #ifndef K4EDM4HEP2LCIOCONV_TEST_OBJECTMAPPINGS_H #define K4EDM4HEP2LCIOCONV_TEST_OBJECTMAPPINGS_H -#include +#include + #include "podio/ObjectID.h" +#include + namespace EVENT { class Track; class TrackerHit; @@ -25,10 +28,6 @@ namespace podio { class Frame; } // namespace podio -namespace edm4hep { - class ParticleID; -} - struct ObjectMappings { template using Map = std::unordered_map; @@ -46,7 +45,7 @@ struct ObjectMappings { Map tpcHits {}; Map vertices {}; - std::unordered_map particleIDs; + std::unordered_map particleIDs {}; static ObjectMappings fromEvent(EVENT::LCEvent* lcEvt, const podio::Frame& edmEvt); };