Commit 7d5aeda0 authored by Moritz Huetten's avatar Moritz Huetten
Browse files

bugfix to find correct event numbers when single tel file is read

parent a3aa3551
Pipeline #68081 failed with stage
...@@ -980,14 +980,20 @@ class MarsRun: ...@@ -980,14 +980,20 @@ class MarsRun:
A list of pairs (M1_id, M2_id) corresponding to stereo events in the run. A list of pairs (M1_id, M2_id) corresponding to stereo events in the run.
""" """
if self.event_data['M1']['mars_meta'][0]['is_simulation'] == False: stereo_ids = []
n_m1_events = len(self.event_data['M1']['stereo_event_number'])
if n_m1_events == 0:
return stereo_ids
n_m2_events = len(self.event_data['M2']['stereo_event_number'])
if n_m2_events == 0:
return stereo_ids
if self.is_mc == False:
data_trigger_pattern = 128 data_trigger_pattern = 128
m2_data_condition = (self.event_data['M2']['trigger_pattern'] == data_trigger_pattern) m2_data_condition = (self.event_data['M2']['trigger_pattern'] == data_trigger_pattern)
stereo_ids = []
n_m1_events = len(self.event_data['M1']['stereo_event_number'])
for m1_id in range(0, n_m1_events): for m1_id in range(0, n_m1_events):
if self.event_data['M1']['trigger_pattern'][m1_id] == data_trigger_pattern: if self.event_data['M1']['trigger_pattern'][m1_id] == data_trigger_pattern:
m2_stereo_condition = (self.event_data['M2']['stereo_event_number'] == m2_stereo_condition = (self.event_data['M2']['stereo_event_number'] ==
...@@ -1003,9 +1009,6 @@ class MarsRun: ...@@ -1003,9 +1009,6 @@ class MarsRun:
m2_data_condition = (self.event_data['M2']['trigger_pattern'] == data_trigger_pattern) m2_data_condition = (self.event_data['M2']['trigger_pattern'] == data_trigger_pattern)
stereo_ids = []
n_m1_events = len(self.event_data['M1']['stereo_event_number'])
for m1_id in range(0, n_m1_events): for m1_id in range(0, n_m1_events):
if self.event_data['M1']['trigger_pattern'][m1_id] == data_trigger_pattern and self.event_data['M1']['stereo_event_number'][m1_id] != 0: if self.event_data['M1']['trigger_pattern'][m1_id] == data_trigger_pattern and self.event_data['M1']['stereo_event_number'][m1_id] != 0:
m2_stereo_condition = (self.event_data['M2']['stereo_event_number'] == m2_stereo_condition = (self.event_data['M2']['stereo_event_number'] ==
...@@ -1037,14 +1040,12 @@ class MarsRun: ...@@ -1037,14 +1040,12 @@ class MarsRun:
n_m1_events = len(self.event_data['M1']['stereo_event_number']) n_m1_events = len(self.event_data['M1']['stereo_event_number'])
n_m2_events = len(self.event_data['M2']['stereo_event_number']) n_m2_events = len(self.event_data['M2']['stereo_event_number'])
if self.event_data['M1']['mars_meta'][0]['is_simulation'] == False: if self.is_mc == False:
data_trigger_pattern = 128 data_trigger_pattern = 128
m1_data_condition = self.event_data['M1']['trigger_pattern'] == data_trigger_pattern m1_data_condition = self.event_data['M1']['trigger_pattern'] == data_trigger_pattern
m2_data_condition = self.event_data['M2']['trigger_pattern'] == data_trigger_pattern m2_data_condition = self.event_data['M2']['trigger_pattern'] == data_trigger_pattern
for m1_id in range(0, n_m1_events): for m1_id in range(0, n_m1_events):
if m1_data_condition[m1_id]: if m1_data_condition[m1_id]:
m2_stereo_condition = (self.event_data['M2']['stereo_event_number'] == m2_stereo_condition = (self.event_data['M2']['stereo_event_number'] ==
...@@ -1067,10 +1068,17 @@ class MarsRun: ...@@ -1067,10 +1068,17 @@ class MarsRun:
else: else:
data_trigger_pattern = 1 data_trigger_pattern = 1
m1_data_condition = self.event_data['M1']['trigger_pattern'] == data_trigger_pattern m1_data_condition = self.event_data['M1']['trigger_pattern'] == data_trigger_pattern
m2_data_condition = self.event_data['M2']['trigger_pattern'] == data_trigger_pattern m2_data_condition = self.event_data['M2']['trigger_pattern'] == data_trigger_pattern
# shortcut if only single file is loaded:
if n_m1_events == 0:
mono_ids['M2'] = np.arange(0,n_m2_events)[m2_data_condition]
return mono_ids
if n_m2_events == 0:
mono_ids['M1'] = np.arange(0,n_m1_events)[m1_data_condition]
return mono_ids
for m1_id in range(0, n_m1_events): for m1_id in range(0, n_m1_events):
if m1_data_condition[m1_id]: if m1_data_condition[m1_id]:
if self.event_data['M1']['stereo_event_number'][m1_id] == 0: if self.event_data['M1']['stereo_event_number'][m1_id] == 0:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment