Skip to content

Commit 265b63a

Browse files
alessandromontanariAlessandro MONTANARI
andauthored
DQM add timestamps and event ids to trigget statistics output (#313)
* feat(src/nectarchain/dqm): - trigger_statistics.py: add arrays of event timestamps to get_results(), to be written into the database * refactor(src/nectarchain/dqm): - trigger_statistics.py: convert event timestamps in output directly to arrays * feat(src/nectarchain/dqm): - trigger_statistics.py: add arrays of event ids to get_results(), to be written into the database * refactor(src/nectarchain/dqm): - trigger_statistics.py: refactor get_results to not include empty arrays, and remove event_wrong_id * add event_wrong_times in TRIGGER-EVENT-TIMESTAMPS if array is non-empty * fix results dictionaries in trigger_statistics --------- Co-authored-by: Alessandro MONTANARI <montanari@llr.in2p3.fr>
1 parent 4c46f5e commit 265b63a

1 file changed

Lines changed: 32 additions & 14 deletions

File tree

src/nectarchain/dqm/trigger_statistics.py

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,19 @@ def finish_run(self):
7272

7373
self.event_ped_times = self.event_times[self.event_type == pedestal_num]
7474
self.event_phy_times = self.event_times[self.event_type == physical_num]
75+
7576
mask = (self.event_type != physical_num) & (self.event_type != pedestal_num)
7677
self.event_other_times = self.event_times[mask]
7778

7879
self.event_ped_id = self.event_id[self.event_type == pedestal_num]
7980
self.event_phy_id = self.event_id[self.event_type == physical_num]
80-
mask = (self.event_type != physical_num) & (self.event_type != pedestal_num)
8181
self.event_other_id = self.event_id[mask]
8282

83+
self.event_ped_id = self.event_ped_id[self.event_ped_times > self.run_start]
84+
self.event_phy_id = self.event_phy_id[self.event_phy_times > self.run_start]
85+
self.event_other_id = self.event_other_id[
86+
self.event_other_times > self.run_start
87+
]
8388
self.event_ped_times = self.event_ped_times[
8489
self.event_ped_times > self.run_start
8590
]
@@ -90,6 +95,8 @@ def finish_run(self):
9095
self.event_other_times > self.run_start
9196
]
9297
self.event_wrong_times = self.event_times[self.event_times < self.run_start]
98+
99+
self.event_id = self.event_id[self.event_times > self.run_start]
93100
self.event_times = self.event_times[self.event_times > self.run_start]
94101

95102
def get_results(self):
@@ -101,20 +108,31 @@ def get_results(self):
101108
"Others": [len(self.event_other_times)],
102109
"Wrong times": [len(self.event_wrong_times)],
103110
}
104-
self.TriggerStat_Results_Dict["TRIGGER-EVENT-TIMESTAMPS"] = {
105-
"All": np.array(self.event_times),
106-
"Physical": np.array(self.event_phy_times),
107-
"Pedestals": np.array(self.event_ped_times),
108-
"Others": np.array(self.event_other_times),
109-
"Wrong times": np.array(self.event_wrong_times),
110-
}
111-
self.TriggerStat_Results_Dict["TRIGGER-EVENT-IDS"] = {
112-
"All": np.array(self.event_id),
113-
"Physical": np.array(self.event_phy_id),
114-
"Pedestals": np.array(self.event_ped_id),
115-
"Others": np.array(self.event_other_id),
116-
"Wrong times": np.array(self.event_wrong_id),
111+
112+
self.TriggerStat_Results_Dict["TRIGGER-EVENTS-ALL"] = {
113+
"Timestamps": self.event_times,
114+
"IDs": self.event_id,
117115
}
116+
if len(self.event_phy_times) > 0:
117+
self.TriggerStat_Results_Dict["TRIGGER-EVENTS-PHY"] = {
118+
"Timestamps": self.event_phy_times,
119+
"IDs": self.event_phy_id,
120+
}
121+
if len(self.event_ped_times) > 0:
122+
self.TriggerStat_Results_Dict["TRIGGER-EVENTS-PED"] = {
123+
"Timestamps": self.event_ped_times,
124+
"IDs": self.event_ped_id,
125+
}
126+
if len(self.event_other_times) > 0:
127+
self.TriggerStat_Results_Dict["TRIGGER-EVENTS-OTHERS"] = {
128+
"Timestamps": self.event_other_times,
129+
"IDs": self.event_other_id,
130+
}
131+
if len(self.event_wrong_times) > 0:
132+
self.TriggerStat_Results_Dict["TRIGGER-EVENTS-WRONG"] = {
133+
"Timestamps": self.event_wrong_times,
134+
}
135+
118136
self.TriggerStat_Results_Dict["START-TIMES"] = {
119137
"Run start time": [self.run_start1],
120138
"First event": [self.run_start],

0 commit comments

Comments
 (0)