From a7f022dc25ed56b0cbbc3c7888f675d33ef2e743 Mon Sep 17 00:00:00 2001 From: tmadlener Date: Thu, 5 Sep 2024 15:40:05 +0200 Subject: [PATCH] Add subdetector holes and Nholes to tests --- tests/src/CompareEDM4hepEDM4hep.cc | 8 ++++++++ tests/src/CompareEDM4hepLCIO.cc | 4 ++++ tests/src/EDM4hep2LCIOUtilities.cc | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/tests/src/CompareEDM4hepEDM4hep.cc b/tests/src/CompareEDM4hepEDM4hep.cc index d6348ad..e501dd3 100644 --- a/tests/src/CompareEDM4hepEDM4hep.cc +++ b/tests/src/CompareEDM4hepEDM4hep.cc @@ -147,6 +147,14 @@ bool compare(const edm4hep::TrackCollection& origColl, const edm4hep::TrackColle REQUIRE_SAME(origTrack.getChi2(), track.getChi2(), "chi2 in track " << i); REQUIRE_SAME(origTrack.getNdf(), track.getNdf(), "chi2 in track " << i); + REQUIRE_SAME(origTrack.getNholes(), track.getNholes(), "Nholes in track " << i); + + const auto origSubDetHoles = origTrack.getSubdetectorHoleNumbers(); + const auto subDetHoles = track.getSubdetectorHoleNumbers(); + REQUIRE_SAME(origSubDetHoles.size(), subDetHoles.size(), "number of subdetector holes in track " << i); + for (size_t iSN = 0; iSN < origSubDetHoles.size(); ++iSN) { + REQUIRE_SAME(origSubDetHoles[iSN], subDetHoles[iSN], "subdetector hole numbers " << iSN << " in track " << i); + } const auto origSubDetHitNumbers = origTrack.getSubdetectorHitNumbers(); const auto subDetHitNumbers = track.getSubdetectorHitNumbers(); diff --git a/tests/src/CompareEDM4hepLCIO.cc b/tests/src/CompareEDM4hepLCIO.cc index bf00116..c83a032 100644 --- a/tests/src/CompareEDM4hepLCIO.cc +++ b/tests/src/CompareEDM4hepLCIO.cc @@ -316,6 +316,10 @@ bool compare(const EVENT::Track* lcioElem, const edm4hep::Track& edm4hepElem, co ASSERT_COMPARE(lcioElem, edm4hepElem, getType, "type in Track"); ASSERT_COMPARE(lcioElem, edm4hepElem, getChi2, "chi2 in Track"); ASSERT_COMPARE(lcioElem, edm4hepElem, getNdf, "ndf in Track"); + ASSERT_COMPARE(lcioElem, edm4hepElem, getNholes, "Nholes in Track"); + + ASSERT_COMPARE(lcioElem, edm4hepElem, getSubdetectorHitNumbers, "subdetectorHitNumbers"); + ASSERT_COMPARE(lcioElem, edm4hepElem, getSubdetectorHoleNumbers, "subdetectorHitNumbers"); // EDM4hep does not have the dEdx information inside the track, but rather // inside a RecDqdx object diff --git a/tests/src/EDM4hep2LCIOUtilities.cc b/tests/src/EDM4hep2LCIOUtilities.cc index e2e6c03..b527b64 100644 --- a/tests/src/EDM4hep2LCIOUtilities.cc +++ b/tests/src/EDM4hep2LCIOUtilities.cc @@ -182,6 +182,10 @@ edm4hep::TrackCollection createTracks(const int num_elements, const int subdetec for (int j = 0; j < subdetectorhitnumbers; ++j) { elem.addToSubdetectorHitNumbers(i + 10 * j); } + elem.setNholes(i + 3); + for (int j = 0; j < subdetectorhitnumbers; ++j) { + elem.addToSubdetectorHoleNumbers(j + 10 * i); + } for (auto& idx : link_trackerhit_idcs) { elem.addToTrackerHits(trackerHits[idx]);