From bcf57e127f17b715cdf3ce39f44a45f82c2473fd Mon Sep 17 00:00:00 2001 From: tlatorre Date: Mon, 18 Nov 2019 11:03:06 -0600 Subject: clear any flags except for PMT_FLAG_DQXX in get_event() This commit updates get_event() to clear any PMT flags except for PMT_FLAG_DQXX from all PMT hits before loading the event. Although I *was* previously clearing the other flags for hit PMTs, I was not clearing flags for PMTs which were *not* hit. This was causing non deterministic behaviour, i.e. I was getting different results depending on if I ran the fitter over a whole file or just a single event. --- src/zdab_utils.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/zdab_utils.c b/src/zdab_utils.c index b26dd78..12514ef 100644 --- a/src/zdab_utils.c +++ b/src/zdab_utils.c @@ -98,6 +98,9 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) for (i = 0; i < MAX_PMTS; i++) { ev->pmt_hits[i].hit = 0; + + /* Clear any flags except for PMT_DQXX. */ + ev->pmt_hits[i].flags &= PMT_FLAG_DQXX; } unpack_ev(bev->data, &ev_bank); @@ -169,12 +172,6 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) ev->pmt_hits[id].pt1 = bpmt.pt; } - /* Clear the PMT_FLAG_DIS bit. */ - ev->pmt_hits[id].flags &= ~PMT_FLAG_DIS; - - /* Clear the PMT_FLAG_CHARGE bit. */ - ev->pmt_hits[id].flags &= ~PMT_FLAG_CHARGE; - /* Make sure we have good calibrations. Technically, we should only * have to check the KPF_DIS bit since according to the SNOMAN * docs: -- cgit