Skip to content
Snippets Groups Projects
Commit 1bb5e3a8 authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Table prototype

parent 229caa86
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,7 @@ import numpy as np ...@@ -33,6 +33,7 @@ import numpy as np
import km3pipe as kp import km3pipe as kp
from km3pipe.io.daq import is_3dmuon, is_3dshower, is_mxshower from km3pipe.io.daq import is_3dmuon, is_3dshower, is_mxshower
from km3modules.common import LocalDBService
from km3modules.hits import count_multiplicities from km3modules.hits import count_multiplicities
from km3modules.plot import ztplot from km3modules.plot import ztplot
import km3pipe.style import km3pipe.style
...@@ -58,6 +59,17 @@ class ZTPlot(kp.Module): ...@@ -58,6 +59,17 @@ class ZTPlot(kp.Module):
self.index = 0 self.index = 0
if not self.services["LocalDBService"].table_exists("nice_events"):
self.services["LocalDBService"].create_table(
"nice_events", [
"overlays", "n_hits", "n_triggered_hits", "n_dus",
"filename", "run_id", "det_id", "frame_index",
"trigger_counter", "utc_timestamp"
], [
"INT", "INT", "INT", "INT", "TEXT", "INT", "INT", "INT",
"INT", "INT"
])
self._update_calibration() self._update_calibration()
self.run = True self.run = True
...@@ -87,10 +99,8 @@ class ZTPlot(kp.Module): ...@@ -87,10 +99,8 @@ class ZTPlot(kp.Module):
n_triggered_dus = len(np.unique(hits[hits.triggered == True].du)) n_triggered_dus = len(np.unique(hits[hits.triggered == True].du))
n_triggered_doms = len(np.unique(hits[hits.triggered == True].dom_id)) n_triggered_doms = len(np.unique(hits[hits.triggered == True].dom_id))
if n_triggered_dus < self.min_dus or n_triggered_doms < self.min_doms: if n_triggered_dus < self.min_dus or n_triggered_doms < self.min_doms:
print( print(f"Skipping event with {n_triggered_dus} DUs "
f"Skipping event with {n_triggered_dus} DUs " f"and {n_triggered_doms} DOMs.")
f"and {n_triggered_doms} DOMs."
)
return blob return blob
print("OK") print("OK")
...@@ -120,9 +130,9 @@ class ZTPlot(kp.Module): ...@@ -120,9 +130,9 @@ class ZTPlot(kp.Module):
& (self.calib.detector.pmts.channel_id == 0)] & (self.calib.detector.pmts.channel_id == 0)]
trigger_params = ' '.join([ trigger_params = ' '.join([
trig for trig, trig_check in (("MX", trig
is_mxshower), ("3DM", is_3dmuon), for trig, trig_check in (("MX", is_mxshower), ("3DM", is_3dmuon),
("3DS", is_3dshower)) ("3DS", is_3dshower))
if trig_check(int(event_info.trigger_mask[0])) if trig_check(int(event_info.trigger_mask[0]))
]) ])
...@@ -133,17 +143,13 @@ class ZTPlot(kp.Module): ...@@ -133,17 +143,13 @@ class ZTPlot(kp.Module):
event_info.det_id[0], self.t0set, event_info.run_id[0], event_info.det_id[0], self.t0set, event_info.run_id[0],
event_info.frame_index[0], event_info.trigger_counter[0], event_info.frame_index[0], event_info.trigger_counter[0],
event_info.overlays[0], trigger_params, event_info.overlays[0], trigger_params,
datetime.utcfromtimestamp(event_info.utc_seconds) datetime.utcfromtimestamp(event_info.utc_seconds)))[0]
)
)[0] fig = ztplot(hits,
title,
fig = ztplot( max_z=self.max_z,
hits, ytick_distance=self.ytick_distance,
title, grid_lines=grid_lines)
max_z=self.max_z,
ytick_distance=self.ytick_distance,
grid_lines=grid_lines
)
filename = 'ztplot' filename = 'ztplot'
f = os.path.join(self.plots_path, filename + '.png') f = os.path.join(self.plots_path, filename + '.png')
...@@ -168,14 +174,13 @@ def main(): ...@@ -168,14 +174,13 @@ def main():
ligier_port = int(args['-p']) ligier_port = int(args['-p'])
pipe = kp.Pipeline() pipe = kp.Pipeline()
pipe.attach( pipe.attach(LocalDBService)
kp.io.ch.CHPump, pipe.attach(kp.io.ch.CHPump,
host=ligier_ip, host=ligier_ip,
port=ligier_port, port=ligier_port,
tags='IO_EVT, IO_SUM', tags='IO_EVT, IO_SUM',
timeout=60 * 60 * 24 * 7, timeout=60 * 60 * 24 * 7,
max_queue=2000 max_queue=2000)
)
pipe.attach(kp.io.daq.DAQProcessor) pipe.attach(kp.io.daq.DAQProcessor)
pipe.attach(ZTPlot, det_id=det_id, plots_path=plots_path) pipe.attach(ZTPlot, det_id=det_id, plots_path=plots_path)
pipe.drain() pipe.drain()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment