Skip to content

Commit

Permalink
Remove unnecessary map and unused parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Feb 20, 2024
1 parent 2139a7e commit 5b87b6f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ namespace LCIO2EDM4hepConv {
ObjectMapT<lcio::ReconstructedParticle*, edm4hep::MutableReconstructedParticle> recoParticles {};
ObjectMapT<lcio::MCParticle*, edm4hep::MutableMCParticle> mcParticles {};
ObjectMapT<lcio::TrackerHitPlane*, edm4hep::MutableTrackerHitPlane> trackerHitPlanes {};
ObjectMapT<lcio::ParticleID*, edm4hep::MutableParticleID> particleIDs {};
};

using CollNamePair = std::tuple<std::string, std::unique_ptr<podio::CollectionBase>>;
Expand Down Expand Up @@ -204,12 +203,9 @@ namespace LCIO2EDM4hepConv {
* part of the ReconstructedParticles in LCIO. The name of this collection is
* <name>_<pid_algo_name>
*/
template<typename RecoMapT, typename PIDMapT>
std::vector<CollNamePair> convertReconstructedParticles(
const std::string& name,
EVENT::LCCollection* LCCollection,
RecoMapT& recoparticlesMap,
PIDMapT& particleIDMap);
template<typename RecoMapT>
std::vector<CollNamePair>
convertReconstructedParticles(const std::string& name, EVENT::LCCollection* LCCollection, RecoMapT& recoparticlesMap);

/**
* Convert a Vertex collection and return the resulting collection.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,9 @@ namespace LCIO2EDM4hepConv {
return dest;
}

template<typename RecoMapT, typename PIDMapT>
std::vector<CollNamePair> convertReconstructedParticles(
const std::string& name,
EVENT::LCCollection* LCCollection,
RecoMapT& recoparticlesMap,
PIDMapT& particleIDMap)
template<typename RecoMapT>
std::vector<CollNamePair>
convertReconstructedParticles(const std::string& name, EVENT::LCCollection* LCCollection, RecoMapT& recoparticlesMap)
{
auto dest = std::make_unique<edm4hep::ReconstructedParticleCollection>();

Expand Down Expand Up @@ -163,12 +160,6 @@ namespace LCIO2EDM4hepConv {
for (const auto lcioPid : rval->getParticleIDs()) {
auto pid = convertParticleID(lcioPid);
pid.setParticle(lval);
const auto [pidIt, pidInserted] = k4EDM4hep2LcioConv::detail::mapInsert(
lcioPid, pid, particleIDMap, k4EDM4hep2LcioConv::detail::InsertMode::Checked);
if (!pidInserted) {
// Does this ever happen?
std::cerr << "WARNING: Duplicating an LCIO ParticleID object during conversion" << std::endl;
}
if (auto pidIt = particleIDs.find(pid.getAlgorithmType()); pidIt != particleIDs.end()) {
pidIt->second->push_back(pid);
}
Expand Down Expand Up @@ -482,7 +473,6 @@ namespace LCIO2EDM4hepConv {
std::unique_ptr<edm4hep::ClusterCollection>
convertClusters(const std::string& name, EVENT::LCCollection* LCCollection, ClusterMapT& clusterMap)
{
auto particleIDs = std::make_unique<edm4hep::ParticleIDCollection>();
auto dest = std::make_unique<edm4hep::ClusterCollection>();

for (unsigned i = 0, N = LCCollection->getNumberOfElements(); i < N; ++i) {
Expand Down Expand Up @@ -520,7 +510,7 @@ namespace LCIO2EDM4hepConv {
retColls.emplace_back(name, convertMCParticles(name, LCCollection, typeMapping.mcParticles));
}
else if (type == "ReconstructedParticle") {
return convertReconstructedParticles(name, LCCollection, typeMapping.recoParticles, typeMapping.particleIDs);
return convertReconstructedParticles(name, LCCollection, typeMapping.recoParticles);
}
else if (type == "Vertex") {
retColls.emplace_back(name, convertVertices(name, LCCollection, typeMapping.vertices));
Expand Down

0 comments on commit 5b87b6f

Please sign in to comment.