Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix narrowing in Cov3f #59

Merged
merged 5 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 4 additions & 22 deletions k4EDM4hep2LcioConv/src/k4Lcio2EDM4hepConv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/src/ComparisonUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something compilers start to warn about?

if constexpr (has_size_method<EDM4hepT>::value) {
return edm4hepV.size();
}
Expand All @@ -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) << ")"
Expand Down
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;
Expand All @@ -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>;
Expand All @@ -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);
};
Expand Down
Loading