From 73bcd8a117e22eb13bb537f0d89b959d8df594f9 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Fri, 5 May 2023 16:35:45 +0200 Subject: [PATCH 01/18] Add trigger patterns for hardware stereo trigger. --- ctapipe_io_magic/constants.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ctapipe_io_magic/constants.py b/ctapipe_io_magic/constants.py index b5a93d1..9bb3e3d 100644 --- a/ctapipe_io_magic/constants.py +++ b/ctapipe_io_magic/constants.py @@ -9,3 +9,8 @@ MC_SUMT_TRIGGER_PATTERN = 32 # also for data taken in stereo with SumTrigger DATA_STEREO_TRIGGER_PATTERN = 128 +# additional trigger patterns for hardware stereo trigger +# topological trigger is one MAGIC and LST +DATA_TOPOLOGICAL_TRIGGER = 4 +# stereo + topological trigger is M1+M2+LST +DATA_MAGIC_LST_TRIGGER = 132 From c81ca72af4df8bedbd825979db1ed6ae9276596b Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Fri, 5 May 2023 16:36:58 +0200 Subject: [PATCH 02/18] First working version of recognizing events with the hardware stereo trigger. --- ctapipe_io_magic/__init__.py | 59 ++++++++++++++++++++++++++++++------ 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index 957bc74..e18feb4 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -53,6 +53,8 @@ DATA_MONO_SUMT_TRIGGER_PATTERN, PEDESTAL_TRIGGER_PATTERN, DATA_STEREO_TRIGGER_PATTERN, + DATA_TOPOLOGICAL_TRIGGER, + DATA_MAGIC_LST_TRIGGER, ) __all__ = ["MAGICEventSource", "MARSDataLevel", "__version__"] @@ -74,6 +76,8 @@ DATA_STEREO_TRIGGER_PATTERN: EventType.SUBARRAY, DATA_MONO_SUMT_TRIGGER_PATTERN: EventType.SUBARRAY, PEDESTAL_TRIGGER_PATTERN: EventType.SKY_PEDESTAL, + DATA_TOPOLOGICAL_TRIGGER: EventType.SUBARRAY, + DATA_MAGIC_LST_TRIGGER: EventType.SUBARRAY, } @@ -141,6 +145,10 @@ class MAGICEventSource(EventSource): help="Which focal length to use when constructing the SubarrayDescription.", ).tag(config=True) + use_hst = Bool( + default_value=False, help="Extract events with hardware stereo trigger." + ).tag(config=True) + def __init__(self, input_url=None, config=None, parent=None, **kwargs): """ Constructor @@ -1126,7 +1134,7 @@ def datalevels(self): def obs_ids(self): # ToCheck: will this be compatible in the future, e.g. with merged MC files return list(self.observation_blocks) - + def _get_badrmspixel_mask(self, event): """ Fetch bad RMS pixel mask for a given event. @@ -1241,6 +1249,7 @@ def _set_active_run(self, uproot_file): self.is_stereo, self.use_mc_mono_events, self.is_sumt, + self.use_hst, ) return run @@ -1277,7 +1286,6 @@ def _event_generator(self): event.index.obs_id = self.obs_ids[0] tel_id = self.telescope - event.trigger.tels_with_trigger = np.array([tel_id]) counter = 0 @@ -1380,6 +1388,14 @@ def _event_generator(self): # Loop over the events: for i_event in range(n_events): event.count = counter + + if event_data["trigger_pattern"][i_event] == DATA_STEREO_TRIGGER_PATTERN: + event.trigger.tels_with_trigger = np.array([1, 2]) + elif event_data["trigger_pattern"][i_event] == DATA_TOPOLOGICAL_TRIGGER: + event.trigger.tels_with_trigger = np.array([tel_id, 3]) + elif event_data["trigger_pattern"][i_event] == DATA_MAGIC_LST_TRIGGER: + event.trigger.tels_with_trigger = np.array([1, 2, 3]) + event.index.event_id = event_data["event_number"][i_event] event.trigger.event_type = MAGIC_TO_CTA_EVENT_TYPE.get( @@ -1491,6 +1507,7 @@ def __init__( is_stereo, use_mc_mono_events, use_sumt_events, + use_hst_events, n_cam_pixels=1039, ): """ @@ -1515,6 +1532,7 @@ def __init__( self.use_mc_mono_events = use_mc_mono_events self.use_sumt_events = use_sumt_events self.n_cam_pixels = n_cam_pixels + self.use_hst_events = use_hst_events # Load the input data: calib_data = self._load_data() @@ -1627,9 +1645,18 @@ def _load_data(self): data_trigger_pattern = DATA_MONO_SUMT_TRIGGER_PATTERN else: data_trigger_pattern = DATA_MONO_TRIGGER_PATTERN - events_cut[ - "cosmic_events" - ] = f"(MTriggerPattern.fPrescaled == {data_trigger_pattern})" + if self.use_hst_events: + events_cut[ + "cosmic_events" + ] = ( + f"(MTriggerPattern.fPrescaled == {data_trigger_pattern})" + f" | (MTriggerPattern.fPrescaled == {DATA_TOPOLOGICAL_TRIGGER})" + f" | (MTriggerPattern.fPrescaled == {DATA_MAGIC_LST_TRIGGER})" + ) + else: + events_cut[ + "cosmic_events" + ] = f"(MTriggerPattern.fPrescaled == {data_trigger_pattern})" # Only for cosmic events because MC data do not have pedestal events: events_cut[ "pedestal_events" @@ -1686,10 +1713,22 @@ def _load_data(self): ) logger.info("Using fDAQEvtNumber to generate event IDs.") else: - calib_data[event_type]["event_number"] = np.array( - common_info["MRawEvtHeader.fStereoEvtNumber"], dtype=int - ) - logger.info("Using fStereoEvtNumber to generate event IDs.") + if self.use_hst_events: + subrun_id = self.uproot_file["RunHeaders"][ + "MRawRunHeader.fSubRunIndex" + ].array(library="np")[0] + stereo_ids = common_info["MRawEvtHeader.fStereoEvtNumber"] + daq_ids = common_info["MRawEvtHeader.fDAQEvtNumber"] + calib_data[event_type]["event_number"] = np.array([ + f"{subrun_id}{daq_ids[event_idx]:07}" if common_info["MTriggerPattern.fPrescaled"][event_idx] == DATA_TOPOLOGICAL_TRIGGER + else stereo_ids[event_idx] for event_idx in range(common_info["MTriggerPattern.fPrescaled"].size)] + , dtype=int + ) + else: + calib_data[event_type]["event_number"] = np.array( + common_info["MRawEvtHeader.fStereoEvtNumber"], dtype=int + ) + logger.info("Using fStereoEvtNumber to generate event IDs.") # Set pixel-wise charge and peak time information. # The length of the pixel array is 1183, but here only the first part of the pixel @@ -1913,7 +1952,7 @@ def _load_data(self): stereo_event_number = calib_data["cosmic_events"][ "event_number" - ].astype(int) + ][calib_data["cosmic_events"]["trigger_pattern"] == DATA_STEREO_TRIGGER_PATTERN].astype(int) number_difference = np.diff(stereo_event_number) indices_flip = np.where(number_difference < 0)[0] From c975c7f9835341583a4eb2839db28fc3d010860d Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Fri, 5 May 2023 17:10:54 +0200 Subject: [PATCH 03/18] Run black. --- ctapipe_io_magic/__init__.py | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index e18feb4..f7c3ae0 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -1389,7 +1389,10 @@ def _event_generator(self): for i_event in range(n_events): event.count = counter - if event_data["trigger_pattern"][i_event] == DATA_STEREO_TRIGGER_PATTERN: + if ( + event_data["trigger_pattern"][i_event] + == DATA_STEREO_TRIGGER_PATTERN + ): event.trigger.tels_with_trigger = np.array([1, 2]) elif event_data["trigger_pattern"][i_event] == DATA_TOPOLOGICAL_TRIGGER: event.trigger.tels_with_trigger = np.array([tel_id, 3]) @@ -1646,9 +1649,7 @@ def _load_data(self): else: data_trigger_pattern = DATA_MONO_TRIGGER_PATTERN if self.use_hst_events: - events_cut[ - "cosmic_events" - ] = ( + events_cut["cosmic_events"] = ( f"(MTriggerPattern.fPrescaled == {data_trigger_pattern})" f" | (MTriggerPattern.fPrescaled == {DATA_TOPOLOGICAL_TRIGGER})" f" | (MTriggerPattern.fPrescaled == {DATA_MAGIC_LST_TRIGGER})" @@ -1719,10 +1720,17 @@ def _load_data(self): ].array(library="np")[0] stereo_ids = common_info["MRawEvtHeader.fStereoEvtNumber"] daq_ids = common_info["MRawEvtHeader.fDAQEvtNumber"] - calib_data[event_type]["event_number"] = np.array([ - f"{subrun_id}{daq_ids[event_idx]:07}" if common_info["MTriggerPattern.fPrescaled"][event_idx] == DATA_TOPOLOGICAL_TRIGGER - else stereo_ids[event_idx] for event_idx in range(common_info["MTriggerPattern.fPrescaled"].size)] - , dtype=int + calib_data[event_type]["event_number"] = np.array( + [ + f"{subrun_id}{daq_ids[event_idx]:07}" + if common_info["MTriggerPattern.fPrescaled"][event_idx] + == DATA_TOPOLOGICAL_TRIGGER + else stereo_ids[event_idx] + for event_idx in range( + common_info["MTriggerPattern.fPrescaled"].size + ) + ], + dtype=int, ) else: calib_data[event_type]["event_number"] = np.array( @@ -1950,9 +1958,10 @@ def _load_data(self): # Check for bit flips in the stereo event IDs: uplim_total_jumps = 100 - stereo_event_number = calib_data["cosmic_events"][ - "event_number" - ][calib_data["cosmic_events"]["trigger_pattern"] == DATA_STEREO_TRIGGER_PATTERN].astype(int) + stereo_event_number = calib_data["cosmic_events"]["event_number"][ + calib_data["cosmic_events"]["trigger_pattern"] + == DATA_STEREO_TRIGGER_PATTERN + ].astype(int) number_difference = np.diff(stereo_event_number) indices_flip = np.where(number_difference < 0)[0] From 84a6914c5f22e8acc9fa45f3807c017caa925573 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Fri, 5 May 2023 17:27:32 +0200 Subject: [PATCH 04/18] Fixes for tests. --- ctapipe_io_magic/__init__.py | 19 +++++++++++-------- .../tests/test_magic_event_source.py | 6 +++--- ctapipe_io_magic/tests/test_stage1.py | 1 - 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index f7c3ae0..e109ff5 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -1389,15 +1389,18 @@ def _event_generator(self): for i_event in range(n_events): event.count = counter - if ( - event_data["trigger_pattern"][i_event] - == DATA_STEREO_TRIGGER_PATTERN - ): + if not self.is_simulation: + if ( + event_data["trigger_pattern"][i_event] + == DATA_STEREO_TRIGGER_PATTERN + ): + event.trigger.tels_with_trigger = np.array([1, 2]) + elif event_data["trigger_pattern"][i_event] == DATA_TOPOLOGICAL_TRIGGER: + event.trigger.tels_with_trigger = np.array([tel_id, 3]) + elif event_data["trigger_pattern"][i_event] == DATA_MAGIC_LST_TRIGGER: + event.trigger.tels_with_trigger = np.array([1, 2, 3]) + else: event.trigger.tels_with_trigger = np.array([1, 2]) - elif event_data["trigger_pattern"][i_event] == DATA_TOPOLOGICAL_TRIGGER: - event.trigger.tels_with_trigger = np.array([tel_id, 3]) - elif event_data["trigger_pattern"][i_event] == DATA_MAGIC_LST_TRIGGER: - event.trigger.tels_with_trigger = np.array([1, 2, 3]) event.index.event_id = event_data["event_number"][i_event] diff --git a/ctapipe_io_magic/tests/test_magic_event_source.py b/ctapipe_io_magic/tests/test_magic_event_source.py index 5c07100..a7674d2 100644 --- a/ctapipe_io_magic/tests/test_magic_event_source.py +++ b/ctapipe_io_magic/tests/test_magic_event_source.py @@ -158,9 +158,9 @@ def test_loop(dataset): for i, event in enumerate(source): assert event.count == i if "_M1_" in dataset.name: - assert event.trigger.tels_with_trigger == [1] + assert 1 in event.trigger.tels_with_trigger if "_M2_" in dataset.name: - assert event.trigger.tels_with_trigger == [2] + assert 2 in event.trigger.tels_with_trigger assert (i + 1) == n_events @@ -241,7 +241,7 @@ def test_multiple_runs_real(): for i, event in enumerate(source): assert event.trigger.event_type == EventType.SUBARRAY assert event.count == i - assert event.trigger.tels_with_trigger == [source.telescope] + assert source.telescope in event.trigger.tels_with_trigger assert (i + 1) == n_events diff --git a/ctapipe_io_magic/tests/test_stage1.py b/ctapipe_io_magic/tests/test_stage1.py index cc18c42..b1c7613 100644 --- a/ctapipe_io_magic/tests/test_stage1.py +++ b/ctapipe_io_magic/tests/test_stage1.py @@ -62,7 +62,6 @@ def test_stage1_single_run(): f"--output={output}", f"--config={str(config)}", "--MAGICEventSource.process_run=false", - "--allowed-tels=1", "--camera-frame", ], ) From 6a8bf702f6ef0f572411475f87a4761239b8a83f Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 11 May 2023 16:57:50 +0200 Subject: [PATCH 05/18] Automatically detected data taken with hardware stereo trigger. --- ctapipe_io_magic/__init__.py | 46 +++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 14 deletions(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index e109ff5..982e0b1 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -145,10 +145,6 @@ class MAGICEventSource(EventSource): help="Which focal length to use when constructing the SubarrayDescription.", ).tag(config=True) - use_hst = Bool( - default_value=False, help="Extract events with hardware stereo trigger." - ).tag(config=True) - def __init__(self, input_url=None, config=None, parent=None, **kwargs): """ Constructor @@ -216,7 +212,7 @@ def __init__(self, input_url=None, config=None, parent=None, **kwargs): if self.is_simulation: self._simulation_config = self.parse_simulation_header() - self.is_stereo, self.is_sumt = self.parse_data_info() + self.is_stereo, self.is_sumt, self.is_hast = self.parse_data_info() if self.is_simulation and self.use_mc_mono_events and not self.is_stereo: logger.warning( @@ -523,11 +519,13 @@ def parse_data_info(self): is_stereo = [] is_sumt = [] + is_hast = [] if not self.is_simulation: prescaler_mono_nosumt = [1, 1, 0, 1, 0, 0, 0, 0] prescaler_mono_sumt = [0, 1, 0, 1, 0, 1, 0, 0] prescaler_stereo = [0, 1, 0, 1, 0, 0, 0, 1] + prescaler_hast = [0, 1, 1, 1, 0, 0, 0, 1] # L1_table_mono = "L1_4NN" # L1_table_stereo = "L1_3NN" @@ -551,7 +549,8 @@ def parse_data_info(self): ) stereo = True sumt = False - return stereo, sumt + hast = False + return stereo, sumt, hast prescaler_size = prescaler_array.size if prescaler_size > 1: @@ -564,10 +563,16 @@ def parse_data_info(self): or prescaler == prescaler_mono_sumt ): stereo = False + hast = False elif prescaler == prescaler_stereo: stereo = True + hast = False + elif prescaler == prescaler_hast: + stereo = True + hast = True else: stereo = True + hast = False sumt = False if stereo: @@ -595,6 +600,7 @@ def parse_data_info(self): is_stereo.append(stereo) is_sumt.append(sumt) + is_hast.append(hast) else: for rootf in self.files_: @@ -626,6 +632,7 @@ def parse_data_info(self): is_stereo = np.unique(is_stereo).tolist() is_sumt = np.unique(is_sumt).tolist() + is_hast = np.unique(is_hast).tolist() if len(is_stereo) > 1: raise ValueError( @@ -639,7 +646,13 @@ def parse_data_info(self): not an issue, check that this is what you really want to do." ) - return is_stereo[0], is_sumt[0] + if len(is_hast) > 1: + logger.warning( + "Found data with both stereo and hardware stereo trigger. While this is \ + not an issue, check that this is what you really want to do." + ) + + return is_stereo[0], is_sumt[0], is_hast[0] def prepare_subarray_info(self): """ @@ -1247,9 +1260,9 @@ def _set_active_run(self, uproot_file): uproot_file, self.is_simulation, self.is_stereo, + self.is_hast, self.use_mc_mono_events, self.is_sumt, - self.use_hst, ) return run @@ -1395,9 +1408,14 @@ def _event_generator(self): == DATA_STEREO_TRIGGER_PATTERN ): event.trigger.tels_with_trigger = np.array([1, 2]) - elif event_data["trigger_pattern"][i_event] == DATA_TOPOLOGICAL_TRIGGER: + elif ( + event_data["trigger_pattern"][i_event] + == DATA_TOPOLOGICAL_TRIGGER + ): event.trigger.tels_with_trigger = np.array([tel_id, 3]) - elif event_data["trigger_pattern"][i_event] == DATA_MAGIC_LST_TRIGGER: + elif ( + event_data["trigger_pattern"][i_event] == DATA_MAGIC_LST_TRIGGER + ): event.trigger.tels_with_trigger = np.array([1, 2, 3]) else: event.trigger.tels_with_trigger = np.array([1, 2]) @@ -1511,9 +1529,9 @@ def __init__( uproot_file, is_mc, is_stereo, + is_hast, use_mc_mono_events, use_sumt_events, - use_hst_events, n_cam_pixels=1039, ): """ @@ -1538,7 +1556,7 @@ def __init__( self.use_mc_mono_events = use_mc_mono_events self.use_sumt_events = use_sumt_events self.n_cam_pixels = n_cam_pixels - self.use_hst_events = use_hst_events + self.is_hast = is_hast # Load the input data: calib_data = self._load_data() @@ -1651,7 +1669,7 @@ def _load_data(self): data_trigger_pattern = DATA_MONO_SUMT_TRIGGER_PATTERN else: data_trigger_pattern = DATA_MONO_TRIGGER_PATTERN - if self.use_hst_events: + if self.is_hast: events_cut["cosmic_events"] = ( f"(MTriggerPattern.fPrescaled == {data_trigger_pattern})" f" | (MTriggerPattern.fPrescaled == {DATA_TOPOLOGICAL_TRIGGER})" @@ -1717,7 +1735,7 @@ def _load_data(self): ) logger.info("Using fDAQEvtNumber to generate event IDs.") else: - if self.use_hst_events: + if self.is_hast: subrun_id = self.uproot_file["RunHeaders"][ "MRawRunHeader.fSubRunIndex" ].array(library="np")[0] From 54f896aa3ddf601120112441b00fe2e74a4a378f Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 11 May 2023 17:05:52 +0200 Subject: [PATCH 06/18] Set is_hast to false for MAGIC MC data. --- ctapipe_io_magic/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index 982e0b1..c17e584 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -629,6 +629,7 @@ def parse_data_info(self): stereo = True is_stereo.append(stereo) + is_hast.append(False) is_stereo = np.unique(is_stereo).tolist() is_sumt = np.unique(is_sumt).tolist() From 6ec8a666ce1c357170373af9e93263b7858bdb61 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 11 May 2023 17:45:28 +0200 Subject: [PATCH 07/18] Accept events with HaST when getting the time difference. --- ctapipe_io_magic/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index c17e584..3e70115 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -1107,10 +1107,19 @@ def get_event_time_difference(self): time_diffs = np.array([]) + if self.is_hast: + event_cut = f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})" + f" | (MTriggerPattern.fPrescaled == {DATA_TOPOLOGICAL_TRIGGER})" + f" | (MTriggerPattern.fPrescaled == {DATA_MAGIC_LST_TRIGGER})" + else: + event_cut = ( + f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})", + ) + for uproot_file in self.files_: event_info = uproot_file["Events"].arrays( expressions=["MRawEvtHeader.fTimeDiff"], - cut=f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})", + cut=event_cut, library="np", ) From 798e21132cb3d0fd831048edc51f1593b59a979d Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 11 May 2023 18:03:37 +0200 Subject: [PATCH 08/18] Fix event cut. --- ctapipe_io_magic/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index 3e70115..c6df2f9 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -1108,9 +1108,11 @@ def get_event_time_difference(self): time_diffs = np.array([]) if self.is_hast: - event_cut = f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})" + event_cut = ( + f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})" f" | (MTriggerPattern.fPrescaled == {DATA_TOPOLOGICAL_TRIGGER})" f" | (MTriggerPattern.fPrescaled == {DATA_MAGIC_LST_TRIGGER})" + ) else: event_cut = ( f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})", From 5132e1c81279235a872edbd5a895dcef1df32a92 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Sun, 14 May 2023 16:46:08 +0200 Subject: [PATCH 09/18] Format README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c152538..dbeef1c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ conda activate ctapipe-io_magic pip install . ``` -### Test Data +#### Test Data To run the tests, a set of non-public files is needed. If you are a member of MAGIC, ask one of the project maintainers for the credentials and then run: From 4a510dbcbd03f7f3e26783f7b0bcad21a1075426 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Sun, 14 May 2023 17:03:02 +0200 Subject: [PATCH 10/18] Complete tels_with_trigger, use lists. --- ctapipe_io_magic/__init__.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index c6df2f9..51dbb85 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -1419,18 +1419,23 @@ def _event_generator(self): event_data["trigger_pattern"][i_event] == DATA_STEREO_TRIGGER_PATTERN ): - event.trigger.tels_with_trigger = np.array([1, 2]) + event.trigger.tels_with_trigger = [1, 2] elif ( event_data["trigger_pattern"][i_event] == DATA_TOPOLOGICAL_TRIGGER ): - event.trigger.tels_with_trigger = np.array([tel_id, 3]) + event.trigger.tels_with_trigger = [tel_id, 3] elif ( event_data["trigger_pattern"][i_event] == DATA_MAGIC_LST_TRIGGER ): - event.trigger.tels_with_trigger = np.array([1, 2, 3]) + event.trigger.tels_with_trigger = [1, 2, 3] + else: + event.trigger.tels_with_trigger = [tel_id] else: - event.trigger.tels_with_trigger = np.array([1, 2]) + if self.is_stereo and not self.use_mc_mono_events: + event.trigger.tels_with_trigger = [1, 2] + else: + event.trigger.tels_with_trigger = [tel_id] event.index.event_id = event_data["event_number"][i_event] From 62b7b21508491c4d092631f11368e160419902d3 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Sun, 14 May 2023 17:18:50 +0200 Subject: [PATCH 11/18] Intersect with allowed tels. --- ctapipe_io_magic/__init__.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index 51dbb85..b10eb01 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -1437,6 +1437,15 @@ def _event_generator(self): else: event.trigger.tels_with_trigger = [tel_id] + if self.allowed_tels: + tels_with_trigger = np.intersect1d( + event.trigger.tels_with_trigger, + self.subarray.tel_ids, + assume_unique=True, + ) + + event.trigger.tels_with_trigger = tels_with_trigger.tolist() + event.index.event_id = event_data["event_number"][i_event] event.trigger.event_type = MAGIC_TO_CTA_EVENT_TYPE.get( From 52c7cc8a78e3a1c91a1bb134d13d57881a1cb86b Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Sun, 14 May 2023 17:19:05 +0200 Subject: [PATCH 12/18] Update tests with allowed telescopes. --- ctapipe_io_magic/tests/test_magic_event_source.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ctapipe_io_magic/tests/test_magic_event_source.py b/ctapipe_io_magic/tests/test_magic_event_source.py index a7674d2..fb32438 100644 --- a/ctapipe_io_magic/tests/test_magic_event_source.py +++ b/ctapipe_io_magic/tests/test_magic_event_source.py @@ -141,10 +141,14 @@ def test_allowed_tels(): test_calibrated_real_dir / "20210314_M1_05095172.001_Y_CrabNebula-W0.40+035.root" ) + allowed_tels={1} with MAGICEventSource( - input_url=dataset, process_run=False, allowed_tels=[1] + input_url=dataset, process_run=False, allowed_tels=allowed_tels ) as source: - assert np.array_equal(source.subarray.tel_ids, np.array([1])) + assert not allowed_tels.symmetric_difference(source.subarray.tel_ids) + for event in source: + assert set(event.trigger.tels_with_trigger).issubset(allowed_tels) + assert set(event.pointing.tel).issubset(allowed_tels) @pytest.mark.parametrize("dataset", test_calibrated_all) @@ -159,8 +163,10 @@ def test_loop(dataset): assert event.count == i if "_M1_" in dataset.name: assert 1 in event.trigger.tels_with_trigger + assert event.trigger.tels_with_trigger == [1, 2] if "_M2_" in dataset.name: assert 2 in event.trigger.tels_with_trigger + assert event.trigger.tels_with_trigger == [1, 2] assert (i + 1) == n_events @@ -242,6 +248,7 @@ def test_multiple_runs_real(): assert event.trigger.event_type == EventType.SUBARRAY assert event.count == i assert source.telescope in event.trigger.tels_with_trigger + assert event.trigger.tels_with_trigger == [1, 2] assert (i + 1) == n_events From eb00ab3bf7edf6470d6cb5a8549d668ba3d179bb Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Sun, 14 May 2023 18:37:32 +0200 Subject: [PATCH 13/18] Update codecov action version. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5efee35..a5446de 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -69,4 +69,4 @@ jobs: run: | pytest --cov=ctapipe_io_magic --cov-report=xml - - uses: codecov/codecov-action@v1 + - uses: codecov/codecov-action@v3 From 4d3444e9a50e2d4d14d2f12eed9f9c53d3ed3dce Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 18 May 2023 19:09:34 +0200 Subject: [PATCH 14/18] Add HST subruns to download script. --- download_test_data.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/download_test_data.sh b/download_test_data.sh index da6dc6a..606a56e 100755 --- a/download_test_data.sh +++ b/download_test_data.sh @@ -6,6 +6,10 @@ echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M1_05095172.002_Y_CrabNebula-W0.40+035.root" >> test_data_real.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M2_05095172.001_Y_CrabNebula-W0.40+035.root" >> test_data_real.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M2_05095172.002_Y_CrabNebula-W0.40+035.root" >> test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/simulated/calibrated/GA_M1_za35to50_8_824318_Y_w0.root" > test_data_simulated.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/simulated/calibrated/GA_M1_za35to50_8_824319_Y_w0.root" >> test_data_simulated.txt From 3d46d4c0fc44a69e2c6076d5a23fa89b6c317092 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 18 May 2023 19:36:28 +0200 Subject: [PATCH 15/18] Fix download script. --- download_test_data.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/download_test_data.sh b/download_test_data.sh index 606a56e..88f5fb0 100755 --- a/download_test_data.sh +++ b/download_test_data.sh @@ -6,10 +6,10 @@ echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M1_05095172.002_Y_CrabNebula-W0.40+035.root" >> test_data_real.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M2_05095172.001_Y_CrabNebula-W0.40+035.root" >> test_data_real.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20210314_M2_05095172.002_Y_CrabNebula-W0.40+035.root" >> test_data_real.txt -echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt -echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt -echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt -echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root" > test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root" >> test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root" >> test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root" >> test_data_real.txt +echo "https://www.magic.iac.es/mcp-testdata/test_data/real/calibrated/20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root" >> test_data_real.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/simulated/calibrated/GA_M1_za35to50_8_824318_Y_w0.root" > test_data_simulated.txt echo "https://www.magic.iac.es/mcp-testdata/test_data/simulated/calibrated/GA_M1_za35to50_8_824319_Y_w0.root" >> test_data_simulated.txt From 90443328e7e19804419246ab72510564342a9085 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 18 May 2023 19:40:32 +0200 Subject: [PATCH 16/18] Add tests for data taken with HaST. --- .../tests/test_magic_event_source.py | 97 ++++++++++++++++++- 1 file changed, 93 insertions(+), 4 deletions(-) diff --git a/ctapipe_io_magic/tests/test_magic_event_source.py b/ctapipe_io_magic/tests/test_magic_event_source.py index fb32438..487e95a 100644 --- a/ctapipe_io_magic/tests/test_magic_event_source.py +++ b/ctapipe_io_magic/tests/test_magic_event_source.py @@ -13,6 +13,13 @@ test_calibrated_real_dir / "20210314_M2_05095172.002_Y_CrabNebula-W0.40+035.root", ] +test_calibrated_real_hast = [ + test_calibrated_real_dir / "20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root", + test_calibrated_real_dir / "20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root", + test_calibrated_real_dir / "20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root", + test_calibrated_real_dir / "20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root", +] + test_calibrated_simulated_dir = test_data / "simulated/calibrated" test_calibrated_simulated = [ test_calibrated_simulated_dir / "GA_M1_za35to50_8_824318_Y_w0.root", @@ -21,7 +28,9 @@ test_calibrated_simulated_dir / "GA_M2_za35to50_8_824319_Y_w0.root", ] -test_calibrated_all = test_calibrated_real + test_calibrated_simulated +test_calibrated_all = ( + test_calibrated_real + test_calibrated_simulated + test_calibrated_real_hast +) data_dict = dict() @@ -29,6 +38,10 @@ data_dict["20210314_M1_05095172.002_Y_CrabNebula-W0.40+035.root"] = dict() data_dict["20210314_M2_05095172.001_Y_CrabNebula-W0.40+035.root"] = dict() data_dict["20210314_M2_05095172.002_Y_CrabNebula-W0.40+035.root"] = dict() +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"] = dict() +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"] = dict() +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"] = dict() +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"] = dict() data_dict["GA_M1_za35to50_8_824318_Y_w0.root"] = dict() data_dict["GA_M1_za35to50_8_824319_Y_w0.root"] = dict() data_dict["GA_M2_za35to50_8_824318_Y_w0.root"] = dict() @@ -78,6 +91,70 @@ "n_events_mc_mono" ] = 0 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_tot" +] = 1000 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_stereo" +] = 855 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_3_tel" +] = 477 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_pedestal" +] = 142 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_mc_mono" +] = 0 + +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_tot" +] = 1000 +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_stereo" +] = 853 +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_3_tel" +] = 494 +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_pedestal" +] = 145 +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_mc_mono" +] = 0 + +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_tot" +] = 1000 +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_stereo" +] = 943 +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_3_tel" +] = 226 +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_pedestal" +] = 57 +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_mc_mono" +] = 0 + +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_tot" +] = 1000 +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_stereo" +] = 949 +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_3_tel" +] = 215 +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_pedestal" +] = 51 +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_mc_mono" +] = 0 + data_dict["GA_M1_za35to50_8_824318_Y_w0.root"]["n_events_tot"] = 99 data_dict["GA_M1_za35to50_8_824318_Y_w0.root"]["n_events_stereo"] = 67 data_dict["GA_M1_za35to50_8_824318_Y_w0.root"]["n_events_pedestal"] = 0 @@ -141,7 +218,7 @@ def test_allowed_tels(): test_calibrated_real_dir / "20210314_M1_05095172.001_Y_CrabNebula-W0.40+035.root" ) - allowed_tels={1} + allowed_tels = {1} with MAGICEventSource( input_url=dataset, process_run=False, allowed_tels=allowed_tels ) as source: @@ -163,10 +240,12 @@ def test_loop(dataset): assert event.count == i if "_M1_" in dataset.name: assert 1 in event.trigger.tels_with_trigger - assert event.trigger.tels_with_trigger == [1, 2] + if not source.is_hast: + assert event.trigger.tels_with_trigger == [1, 2] if "_M2_" in dataset.name: assert 2 in event.trigger.tels_with_trigger - assert event.trigger.tels_with_trigger == [1, 2] + if not source.is_hast: + assert event.trigger.tels_with_trigger == [1, 2] assert (i + 1) == n_events @@ -204,6 +283,14 @@ def test_number_of_events(dataset): == data_dict[source.input_url.name]["n_events_pedestal"] ) + if source.is_hast: + count_3_tel = 0 + for event in source: + if event.trigger.tels_with_trigger == [1, 2, 3]: + count_3_tel += 1 + + assert count_3_tel == data_dict[source.input_url.name]["n_events_3_tel"] + # if '_M1_' in dataset.name: # assert run['data'].n_cosmics_stereo_events_m1 == data_dict[source.input_url.name]['n_events_stereo'] # assert run['data'].n_pedestal_events_m1 == data_dict[source.input_url.name]['n_events_pedestal'] @@ -231,6 +318,8 @@ def test_run_info(dataset): assert datalevel == source.mars_datalevel assert source.is_stereo == True assert source.is_sumt == False + if "1ES0806" in dataset.name: + assert source.is_hast == True def test_multiple_runs_real(): From 77aa0c641ee5dafc37bb4469c2fbdff4929c6216 Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Thu, 18 May 2023 19:48:35 +0200 Subject: [PATCH 17/18] Add more tests for number of events. --- .../tests/test_magic_event_source.py | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/ctapipe_io_magic/tests/test_magic_event_source.py b/ctapipe_io_magic/tests/test_magic_event_source.py index 487e95a..154551a 100644 --- a/ctapipe_io_magic/tests/test_magic_event_source.py +++ b/ctapipe_io_magic/tests/test_magic_event_source.py @@ -100,6 +100,15 @@ data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ "n_events_3_tel" ] = 477 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_lst" +] = 37 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m2_lst" +] = 0 +data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_m2" +] = 341 data_dict["20230324_M1_05106879.001_Y_1ES0806+524-W0.40+000.root"][ "n_events_pedestal" ] = 142 @@ -116,6 +125,15 @@ data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ "n_events_3_tel" ] = 494 +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_lst" +] = 34 +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m2_lst" +] = 0 +data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_m2" +] = 325 data_dict["20230324_M1_05106879.002_Y_1ES0806+524-W0.40+000.root"][ "n_events_pedestal" ] = 145 @@ -132,6 +150,15 @@ data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ "n_events_3_tel" ] = 226 +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_lst" +] = 0 +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m2_lst" +] = 642 +data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_m2" +] = 75 data_dict["20230324_M2_05106879.001_Y_1ES0806+524-W0.40+000.root"][ "n_events_pedestal" ] = 57 @@ -148,6 +175,15 @@ data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ "n_events_3_tel" ] = 215 +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_lst" +] = 0 +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m2_lst" +] = 644 +data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ + "n_events_2_tel_m1_m2" +] = 90 data_dict["20230324_M2_05106879.002_Y_1ES0806+524-W0.40+000.root"][ "n_events_pedestal" ] = 51 @@ -285,11 +321,23 @@ def test_number_of_events(dataset): if source.is_hast: count_3_tel = 0 + count_2_tel_m1_lst = 0 + count_2_tel_m2_lst = 0 + count_2_tel_m1_m2 = 0 for event in source: if event.trigger.tels_with_trigger == [1, 2, 3]: count_3_tel += 1 + elif event.trigger.tels_with_trigger == [1, 3]: + count_2_tel_m1_lst += 1 + elif event.trigger.tels_with_trigger == [2, 3]: + count_2_tel_m2_lst += 1 + elif event.trigger.tels_with_trigger == [1, 2]: + count_2_tel_m1_m2 += 1 assert count_3_tel == data_dict[source.input_url.name]["n_events_3_tel"] + assert count_2_tel_m1_lst == data_dict[source.input_url.name]["n_events_2_tel_m1_lst"] + assert count_2_tel_m2_lst == data_dict[source.input_url.name]["n_events_2_tel_m2_lst"] + assert count_2_tel_m1_m2 == data_dict[source.input_url.name]["n_events_2_tel_m1_m2"] # if '_M1_' in dataset.name: # assert run['data'].n_cosmics_stereo_events_m1 == data_dict[source.input_url.name]['n_events_stereo'] From 4c00bfd7c7b547bece3e68f46c6deb619df3eaac Mon Sep 17 00:00:00 2001 From: Alessio Berti Date: Sun, 21 May 2023 21:46:50 +0200 Subject: [PATCH 18/18] Get correct timedifference also for mono events. --- ctapipe_io_magic/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ctapipe_io_magic/__init__.py b/ctapipe_io_magic/__init__.py index b10eb01..846c928 100644 --- a/ctapipe_io_magic/__init__.py +++ b/ctapipe_io_magic/__init__.py @@ -1107,15 +1107,21 @@ def get_event_time_difference(self): time_diffs = np.array([]) + data_trigger_pattern = DATA_STEREO_TRIGGER_PATTERN + if not self.is_stereo: + if self.is_sumt: + data_trigger_pattern = DATA_MONO_SUMT_TRIGGER_PATTERN + else: + data_trigger_pattern = DATA_MONO_TRIGGER_PATTERN if self.is_hast: event_cut = ( - f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})" + f"(MTriggerPattern.fPrescaled == {data_trigger_pattern})" f" | (MTriggerPattern.fPrescaled == {DATA_TOPOLOGICAL_TRIGGER})" f" | (MTriggerPattern.fPrescaled == {DATA_MAGIC_LST_TRIGGER})" ) else: event_cut = ( - f"(MTriggerPattern.fPrescaled == {DATA_STEREO_TRIGGER_PATTERN})", + f"(MTriggerPattern.fPrescaled == {data_trigger_pattern})", ) for uproot_file in self.files_: