Skip to content

Commit

Permalink
Make object map names consistent in both directions
Browse files Browse the repository at this point in the history
  • Loading branch information
tmadlener committed Sep 14, 2023
1 parent 6b25316 commit 49dccf2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,16 +85,16 @@ namespace EDM4hep2LCIOConv {

struct CollectionsPairVectors {
ObjectMapT<lcio::TrackImpl*, edm4hep::Track> tracks {};
ObjectMapT<lcio::TrackerHitImpl*, edm4hep::TrackerHit> trackerhits {};
ObjectMapT<lcio::SimTrackerHitImpl*, edm4hep::SimTrackerHit> simtrackerhits {};
ObjectMapT<lcio::CalorimeterHitImpl*, edm4hep::CalorimeterHit> calohits {};
ObjectMapT<lcio::RawCalorimeterHitImpl*, edm4hep::RawCalorimeterHit> rawcalohits {};
ObjectMapT<lcio::SimCalorimeterHitImpl*, edm4hep::SimCalorimeterHit> simcalohits {};
ObjectMapT<lcio::TPCHitImpl*, edm4hep::RawTimeSeries> tpchits {};
ObjectMapT<lcio::TrackerHitImpl*, edm4hep::TrackerHit> trackerHits {};
ObjectMapT<lcio::SimTrackerHitImpl*, edm4hep::SimTrackerHit> simTrackerHits {};
ObjectMapT<lcio::CalorimeterHitImpl*, edm4hep::CalorimeterHit> caloHits {};
ObjectMapT<lcio::RawCalorimeterHitImpl*, edm4hep::RawCalorimeterHit> rawCaloHits {};
ObjectMapT<lcio::SimCalorimeterHitImpl*, edm4hep::SimCalorimeterHit> simCaloHits {};
ObjectMapT<lcio::TPCHitImpl*, edm4hep::RawTimeSeries> tpcHits {};
ObjectMapT<lcio::ClusterImpl*, edm4hep::Cluster> clusters {};
ObjectMapT<lcio::VertexImpl*, edm4hep::Vertex> vertices {};
ObjectMapT<lcio::ReconstructedParticleImpl*, edm4hep::ReconstructedParticle> recoparticles {};
ObjectMapT<lcio::MCParticleImpl*, edm4hep::MCParticle> mcparticles {};
ObjectMapT<lcio::ReconstructedParticleImpl*, edm4hep::ReconstructedParticle> recoParticles {};
ObjectMapT<lcio::MCParticleImpl*, edm4hep::MCParticle> mcParticles {};
};

template<
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -716,15 +716,15 @@ namespace EDM4hep2LCIOConv {
if (lcio_tr->getTrackerHits().size() == 0) {
for (const auto& edm_tr_trh : edm_tr.getTrackerHits()) {
if (
const auto lcio_trh = k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_tr_trh, collection_pairs.trackerhits)) {
const auto lcio_trh = k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_tr_trh, collection_pairs.trackerHits)) {
lcio_tr->addHit(lcio_trh.value());
}
}
}
}

// Fill missing ReconstructedParticle collections
for (auto& [lcio_rp, edm_rp] : collection_pairs.recoparticles) {
for (auto& [lcio_rp, edm_rp] : collection_pairs.recoParticles) {
// Link Vertex
if (lcio_rp->getStartVertex() == nullptr) {
if (edm_rp.getStartVertex().isAvailable()) {
Expand Down Expand Up @@ -766,7 +766,7 @@ namespace EDM4hep2LCIOConv {
if (lcio_vertex->getAssociatedParticle() == nullptr) {
const auto edm_rp = edm_vertex.getAssociatedParticle();
if (edm_rp.isAvailable()) {
if (const auto lcio_rp = k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_rp, collection_pairs.recoparticles)) {
if (const auto lcio_rp = k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_rp, collection_pairs.recoParticles)) {
lcio_vertex->setAssociatedParticle(lcio_rp.value());
}
}
Expand All @@ -778,7 +778,7 @@ namespace EDM4hep2LCIOConv {
//
// We loop over all pairs of lcio and edm4hep simcalo hits and add the contributions, by now MCParticle
// collection(s) should be converted!
for (auto& [lcio_sch, edm_sch] : collection_pairs.simcalohits) {
for (auto& [lcio_sch, edm_sch] : collection_pairs.simCaloHits) {
// add associated Contributions (MCParticles)
for (int i = 0; i < edm_sch.contributions_size(); ++i) {
const auto& contrib = edm_sch.getContributions(i);
Expand All @@ -795,7 +795,7 @@ namespace EDM4hep2LCIOConv {
if (edm_contrib_mcp.isAvailable()) {
// if we have the MCParticle we look for its partner
lcio_mcp =
k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_contrib_mcp, collection_pairs.mcparticles).value_or(nullptr);
k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_contrib_mcp, collection_pairs.mcParticles).value_or(nullptr);
}
else { // edm mcp available
// std::cout << "WARNING: edm4hep contribution is not available!" << std::endl;
Expand All @@ -813,12 +813,12 @@ namespace EDM4hep2LCIOConv {
} // SimCaloHit

// Fill missing SimTrackerHit collections
for (auto& [lcio_strh, edm_strh] : collection_pairs.simtrackerhits) {
for (auto& [lcio_strh, edm_strh] : collection_pairs.simTrackerHits) {
const auto lcio_strh_mcp = lcio_strh->getMCParticle();
if (lcio_strh_mcp == nullptr) {
const auto edm_strh_mcp = edm_strh.getMCParticle();
if (
const auto lcio_mcp = k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_strh_mcp, collection_pairs.mcparticles)) {
const auto lcio_mcp = k4EDM4hep2LcioConv::detail::mapLookupFrom(edm_strh_mcp, collection_pairs.mcParticles)) {
lcio_strh->setMCParticle(lcio_mcp.value());
}
}
Expand Down

0 comments on commit 49dccf2

Please sign in to comment.