-
Notifications
You must be signed in to change notification settings - Fork 107
Description
Describe the bug
This bug happens when using the I3Calorimetry Extractor. This extractor counts all energies that are present within a hull around the detector with a specified padding value. The core functionality of this extractor is the get_energies function, which recursively calculates the energy left in this hull.
The problem is the treatment of tracks entering this detector hull from outside (e.g. throughgoing_tracks, etc.).
The following if clause determines the treatment of tracks:
| if particle.is_track & (particle.id in track_lookup): |
The if statement checks if the event is a track and if it is in the track_lookup, which is a dictionary created by looping through the MMCTrackList and harvesting the tracks with MuonGun. See:
graphnet/src/graphnet/data/extractors/icecube/i3calorimetry.py
Lines 92 to 114 in 401f28b
| MMCTrackList = frame[self.mmctracklist] | |
| # Filter tracks that are not daughters of the desired | |
| if self.daughters: | |
| temp_MMCTrackList = [] | |
| for track in MMCTrackList: | |
| for p in primaries: | |
| if frame[self.mctree].is_in_subtree( | |
| p.id, track.GetI3Particle().id | |
| ): | |
| temp_MMCTrackList.append(track) | |
| break | |
| MMCTrackList = temp_MMCTrackList | |
| # Create a lookup dict for the tracks | |
| track_lookup = {} | |
| for track in MuonGun.Track.harvest( | |
| frame[self.mctree], MMCTrackList | |
| ): | |
| track_lookup[track.id] = track | |
| e_cascade, e_dep_track, e_ent_track = self.get_energies( | |
| frame, primaries, track_lookup | |
| ) |
If an event is a track that is not in the track_lookup, we only consider its daughters, here:
graphnet/src/graphnet/data/extractors/icecube/i3calorimetry.py
Lines 307 to 323 in 401f28b
| else: | |
| ( | |
| e_cascade, | |
| e_dep_track, | |
| e_ent_track, | |
| ) = tuple( | |
| np.add( | |
| (e_cascade, e_dep_track, e_ent_track), | |
| self.get_energies( | |
| frame, | |
| dataclasses.I3MCTree.get_daughters( | |
| frame[self.mctree], particle | |
| ), | |
| track_lookup, | |
| ), | |
| ) | |
| ) |
This can happen, e.g. if a track is very far away from the detector. In this case, the track mostly does not cross the boundary of the hull, and it is fine to just look at the daughters.
The problem, however, arises when a track crosses the boundary of the hull but is NOT in the track_lookup. In this case, we cannot get the necessary information that we need--the energy of the track at the entry of the hull--to calculate the desired energy, because the track is not stored in the MMCTrackList or harvestable by MuonGun.
In this case, we should return Nans to mark that for this event, we cannot calculate the correct energy proxies. But currently, we just ignore this and continue on to the children of this track.