diff --git a/src/graphnet/data/dataconverter.py b/src/graphnet/data/dataconverter.py index 54cbbf418..616030ae1 100644 --- a/src/graphnet/data/dataconverter.py +++ b/src/graphnet/data/dataconverter.py @@ -580,19 +580,17 @@ def _filter_mask( frame: I3Frame to check. I3filters: List of I3Filters to check for pass. """ - if "FilterMask" in frame: - for filter in I3filters: - if filter in frame["FilterMask"]: - if frame["FilterMask"][filter].condition_passed is False: - return True - else: - self.warning_once( - f"Filter {filter} not found in frame. Skipping filter check." - ) - continue - else: + if "FilterMask" not in frame: self.warning_once( "FilterMask not found in frame. Skipping filter checks." ) return False + for filter in I3filters: + if filter not in frame["FilterMask"]: + self.warning_once( + f"Filter {filter} not found in frame. Skipping." + ) + continue + if frame["FilterMask"][filter].condition_passed is False: + return True return False