Skip to content

Commit

Permalink
Merge pull request #631 from RasmusOrsoe/update-awtd-flag
Browse files Browse the repository at this point in the history
Update awtd and fadc parsing method
  • Loading branch information
RasmusOrsoe authored Nov 20, 2023
2 parents 1ba4a7a + f59d475 commit 3b9adc7
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions src/graphnet/data/extractors/i3featureextractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def __call__(self, frame: "icetray.I3Frame") -> Dict[str, List[Any]]:
"event_time": [],
"hlc": [],
"awtd": [],
"fadc": [],
"string": [],
"pmt_number": [],
"dom_number": [],
Expand Down Expand Up @@ -160,16 +159,15 @@ def __call__(self, frame: "icetray.I3Frame") -> Dict[str, List[Any]]:
output["is_saturated_dom"].append(is_saturated_dom)
output["is_errata_dom"].append(is_errata_dom)
output["event_time"].append(event_time)

# Pulse flags
flags = getattr(pulse, "flags", padding_value)
if flags == padding_value:
output["hlc"].append(padding_value) # bit 0
output["awtd"].append(padding_value) # bit 1
output["fadc"].append(padding_value) # bit 2
output["hlc"].append(padding_value)
output["awtd"].append(padding_value)
else:
output["hlc"].append((pulse.flags >> 0) & 0x1) # bit 0
output["awtd"].append((pulse.flags >> 1) & 0x1) # bit 1
output["fadc"].append((pulse.flags >> 2) & 0x1) # bit 2
output["awtd"].append(self._parse_awtd_flag(pulse))

return output

Expand All @@ -188,6 +186,27 @@ def _get_relative_dom_efficiency(
rde = padding_value
return rde

def _parse_awtd_flag(
self, pulse: Any, fadc_min_width_ns: float = 6.0
) -> bool:
"""Parse awtd flag from pulse width.
Returns True if the pulse was readout using the awtd digitizer.
Method by Tom Stuttard.
Notes from Tom:
Function to read the bits of the pulse flags and unpack them into
meaningful info Using pulse width rather than flags to separate FADC vs
ATWD pulses, due to a known issue.
https://github.com/icecube/icetray/issues/2721 Note that the issue
states to use 8ns, but I have found that actually 6ns is correct.
"""
# Use pulse width to check whether a pulse is
# (a) FADC-only, or
# includes ATWD (and probably also FADC)
return pulse.width < (fadc_min_width_ns * icetray.I3Units.ns)


class I3FeatureExtractorIceCubeDeepCore(I3FeatureExtractorIceCube86):
"""Class for extracting reconstructed features for IceCube-DeepCore."""
Expand Down

0 comments on commit 3b9adc7

Please sign in to comment.