Skip to content

Commit

Permalink
Fix narrowing in Cov3f (#59)
Browse files Browse the repository at this point in the history
* Fix narrowing from int to float in Cov3f

* Fix warnings

* Avoid forward declaration to make CI work

---------

Co-authored-by: jmcarcell <[email protected]>
Co-authored-by: tmadlener <[email protected]>
  • Loading branch information
3 people authored May 3, 2024
1 parent f870d19 commit feeadba
Showing 3 changed files with 11 additions and 30 deletions.
26 changes: 4 additions & 22 deletions k4EDM4hep2LcioConv/src/k4Lcio2EDM4hepConv.cpp
Original file line number Diff line number Diff line change
@@ -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<edm4hep::utils::ParticleIDMeta> getPIDMetaInfo(const EVENT::LCCollection* recoColl)
{
std::vector<edm4hep::utils::ParticleIDMeta> 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));
}
4 changes: 2 additions & 2 deletions tests/src/ComparisonUtils.h
Original file line number Diff line number Diff line change
@@ -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<EDM4hepT>::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) << ")"
11 changes: 5 additions & 6 deletions tests/src/ObjectMapping.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#ifndef K4EDM4HEP2LCIOCONV_TEST_OBJECTMAPPINGS_H
#define K4EDM4HEP2LCIOCONV_TEST_OBJECTMAPPINGS_H

#include <unordered_map>
#include <edm4hep/ParticleID.h>

#include "podio/ObjectID.h"

#include <unordered_map>

namespace EVENT {
class Track;
class TrackerHit;
@@ -25,10 +28,6 @@ namespace podio {
class Frame;
} // namespace podio

namespace edm4hep {
class ParticleID;
}

struct ObjectMappings {
template<typename K>
using Map = std::unordered_map<K, podio::ObjectID>;
@@ -46,7 +45,7 @@ struct ObjectMappings {
Map<const EVENT::TPCHit*> tpcHits {};
Map<const EVENT::Vertex*> vertices {};

std::unordered_map<const EVENT::ParticleID*, edm4hep::ParticleID> particleIDs;
std::unordered_map<const EVENT::ParticleID*, edm4hep::ParticleID> particleIDs {};

static ObjectMappings fromEvent(EVENT::LCEvent* lcEvt, const podio::Frame& edmEvt);
};

0 comments on commit feeadba

Please sign in to comment.