aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/zdab_utils.c12
1 files changed, 12 insertions, 0 deletions
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]);