From 96ac7faf825f94791042da139b65e91ea4bf2c4e Mon Sep 17 00:00:00 2001 From: tlatorre Date: Sun, 16 Jun 2019 13:54:39 -0500 Subject: check the KPF_NO_CAL and KPF_BAD_CAL bits in get_event() --- src/zdab_utils.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/zdab_utils.c b/src/zdab_utils.c index 5c1ef9f..df1cef8 100644 --- a/src/zdab_utils.c +++ b/src/zdab_utils.c @@ -105,7 +105,20 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) /* Clear the PMT_FLAG_DIS bit. */ ev->pmt_hits[id].flags &= ~PMT_FLAG_DIS; - if (bpmt.pf & KPF_DIS) + /* Make sure we have good calibrations. Technically, we should only + * have to check the KPF_DIS bit since according to the SNOMAN + * docs: + * + * The discard bit KPF_DIS of the 1-bit flags KPMT_PF is also + * set if any other failure bit, such as KPF_NO_CAL or + * KPF_BAD_CAL is set. So only this bit need be tested for PMT + * rejection. + * + * But this isn't true! In run 10,000 GTID 140730 channel 11/6/17 + * has the KPF_BAD_CAL bit set but not the KPF_DIS bit set. I also + * looked at the SNOMAN code and confirmed that this isn't the + * case. */ + if (bpmt.pf & (KPF_DIS | KPF_NO_CAL | KPF_BAD_CAL)) ev->pmt_hits[id].flags |= PMT_FLAG_DIS; if (bpmt.qms) -- cgit