Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched to using subdetector_to_string and subsystem_to_string methods #43

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions scripts/hdf5_dump.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env python3

import daqdataformats
import detdataformats

import argparse
import datetime
import h5py
Expand All @@ -9,15 +12,6 @@


FILELAYOUT_VERSION = 4
# detdataformats/include/detdataformats/DetID.hpp
DETECTOR = {0: 'Unknown', 1: 'DAQ', 2: 'HD_PDS', 3: 'HD_TPC',
4: 'HD_CRT', 8: 'VD_CathodePDS', 9: 'VD_MembranePDS',
10: 'VD_BottomTPC', 11: 'VD_TopTPC',
32: 'ND_LAr', 33: 'ND_GAr'}

# daqdataformats/include/daqdataformats/SourceID.hpp
SUBSYSTEM = {0: 'Unknown', 1: 'DetectorReadout', 2: 'HwSignalsInterface',
3: 'Trigger', 4: 'TRBuilder'}

DATA_FORMAT = {
# daqdataformats/include/daqdataformats/TimeSliceHeader.hpp
Expand Down Expand Up @@ -221,9 +215,13 @@ def print_header_dict(hdict, clock_speed_hz):
elif 'Marker word' in ik:
print("{:<30}: {}".format(ik, hex(iv)))
elif ik == 'Detector':
print("{:<30}: {}".format(ik, DETECTOR[iv]))
subdet = detdataformats.DetID.Subdetector(iv)
det_name = detdataformats.DetID.subdetector_to_string(subdet)
print("{:<30}: {}".format(ik, det_name))
elif ik == 'Source ID subsystem' in ik:
print("{:<30}: {}".format(ik, SUBSYSTEM[iv]))
subsys = daqdataformats.SourceID.Subsystem(iv)
subsys_name = daqdataformats.SourceID.subsystem_to_string(subsys)
print("{:<30}: {}".format(ik, subsys_name))
else:
print("{:<30}: {}".format(ik, iv))
return
Expand Down