From 2258a336bf0bfc0b51eae00200107bf7eaa3edf5 Mon Sep 17 00:00:00 2001 From: Dacheng Xu Date: Sat, 27 Apr 2024 11:08:45 -0400 Subject: [PATCH] Add `PairingExists` (#41) --- axidence/context.py | 2 ++ axidence/plugins/cuts/__init__.py | 3 +++ axidence/plugins/cuts/cut_pairing_exists.py | 18 ++++++++++++++++++ 3 files changed, 23 insertions(+) create mode 100644 axidence/plugins/cuts/cut_pairing_exists.py diff --git a/axidence/context.py b/axidence/context.py index 0ab7f59..f4a80ae 100644 --- a/axidence/context.py +++ b/axidence/context.py @@ -27,6 +27,7 @@ PeakProximityPaired, PeakPositionsPaired, EventInfosPaired, + PairingExists, ) export, __all__ = strax.exporter() @@ -172,6 +173,7 @@ def _pair_to_context(self): PeakProximityPaired, PeakPositionsPaired, EventInfosPaired, + PairingExists, ) ) diff --git a/axidence/plugins/cuts/__init__.py b/axidence/plugins/cuts/__init__.py index 078be0e..8854e48 100644 --- a/axidence/plugins/cuts/__init__.py +++ b/axidence/plugins/cuts/__init__.py @@ -6,3 +6,6 @@ from . import cut_isolated_s2 from .cut_isolated_s2 import * + +from . import cut_pairing_exists +from .cut_pairing_exists import * diff --git a/axidence/plugins/cuts/cut_pairing_exists.py b/axidence/plugins/cuts/cut_pairing_exists.py new file mode 100644 index 0000000..f59e30b --- /dev/null +++ b/axidence/plugins/cuts/cut_pairing_exists.py @@ -0,0 +1,18 @@ +import numpy as np +from strax import CutPlugin + + +class PairingExists(CutPlugin): + """Cut of successfully paired AC with AC-type(`event_type`)""" + + __version__ = "0.0.0" + depends_on = "event_infos_paired" + provides = "cut_pairing_exists" + cut_name = "cut_pairing_exists" + data_kind = "event_paired" + cut_description = ( + "Whether isolated S2 influenced by pairing, and whether the event is considered as AC event" + ) + + def cut_by(self, events_paired): + return np.isin(events_paired["event_type"], [1, 3])