From b633b9fc657abc6889d8966b28e8cf5325dfa3a3 Mon Sep 17 00:00:00 2001 From: tlatorre Date: Fri, 14 Jun 2019 13:26:21 -0500 Subject: flag hits with bad or railed charge This commit updates the get_event() function to flag any hits which have a non-zero best charge status word. This essentially gets set when *both* QHS and QLX are either bad or railed. I also set this bit if *just* QHS is railed or below 300 since the current charge model was only set up for QHS. In the future, it would be nice to instead use the best charge (either QHS or QLX) in the likelihood function. To do that I need to double check how QLX is normalized and if the current charge model would work for QLX too. --- src/zdab_utils.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src') diff --git a/src/zdab_utils.c b/src/zdab_utils.c index 6dffe0f..b46ca1f 100644 --- a/src/zdab_utils.c +++ b/src/zdab_utils.c @@ -105,6 +105,18 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) if (bpmt.pf & KPF_DIS) ev->pmt_hits[id].flags |= PMT_FLAG_DIS; + if (bpmt.qms) + ev->pmt_hits[id].flags |= PMT_FLAG_CHARGE; + + /* Currently, the charge model only deals with QHS, so we flag any hits which have a bad or railed QHS value. + * + * FIXME: In the future, it would be nice to use the best charge + * word (either QHS or QLX) depending on the if QHS is railed or + * not, but I need to do more work to see how the QLX values are + * normalized and if the existing charge model is good enough. */ + if (bpmt.pihs >= 4095 || bpmt.pihs < 300) + ev->pmt_hits[id].flags |= PMT_FLAG_CHARGE; + if (pmts[id].pmt_type != pmt_types[i]) { get_pmt_type_string(pmts[id].pmt_type,pmt_type_string); fprintf(stderr, "%i/%i/%i has PMT type %s but expected %s based on bank\n", crate, card, channel, pmt_type_string, pmt_names[i]); -- cgit