Skip to content

Commit c131e85

Browse files
committed
Stop looking for calorimeter hit primaries if we enounter geometries like radiative photons from a primary electrons
1 parent be68024 commit c131e85

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/algorithms/calorimetry/SimCalorimeterHitProcessor.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,23 @@ template <> struct hash<std::tuple<edm4hep::MCParticle, uint64_t, int>> {
7070

7171
// unnamed namespace for internal utility
7272
namespace {
73-
// Lookup primary MCParticle @TODO this should be a shared utiliy function in the edm4xxx
73+
// Lookup primary MCParticle
74+
// we stop looking if we find the parent has status 1 but with only 2 daughters
75+
// so we don't merge radiative photons with the primary electron as this prevents us
76+
// from properly linking the clusters back to the event geometry
77+
// @TODO this should be a shared utiliy function in the edm4xxx
7478
// libraries
7579
edm4hep::MCParticle lookup_primary(const edm4hep::CaloHitContribution& contrib) {
7680
const auto contributor = contrib.getParticle();
7781

7882
edm4hep::MCParticle primary = contributor;
7983
while (primary.parents_size() > 0) {
80-
if (primary.getGeneratorStatus() != 0) {
84+
auto parent = primary.getParents(0);
85+
if (primary.getGeneratorStatus() != 0 ||
86+
(parent.getGeneratorStatus() != 0 && parent.daughters_size() == 2)) {
8187
break;
8288
}
83-
primary = primary.getParents(0);
89+
primary = parent;
8490
}
8591
return primary;
8692
}

0 commit comments

Comments
 (0)