Skip to content

Commit faecee0

Browse files
committed
fix handling of negative visible length
1 parent c398dcd commit faecee0

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/graphnet/data/extractors/icecube/i3highesteparticleextractor.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -490,10 +490,17 @@ def highest_energy_starting(
490490
intersections = self.hull.surface.intersection(
491491
track.pos, track.dir
492492
)
493-
visible_length = max(
494-
visible_length,
495-
intersections.second - max(intersections.first, 0),
493+
494+
visible_length = intersections.second - max(
495+
intersections.first, 0
496496
)
497+
498+
# It can happen that both intersections are negative
499+
# in this case the particle never reaches the detector
500+
# and therefore should not be considered for the HEP
501+
if visible_length < 0:
502+
continue
503+
497504
# Check if we have a single topologically "real" track
498505
if not real_track:
499506
if not dataclasses.I3MCTree.parent(

0 commit comments

Comments
 (0)