aboutsummaryrefslogtreecommitdiff
path: root/src/zdab_utils.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-07-12 15:39:50 -0500
committertlatorre <tlatorre@uchicago.edu>2019-07-12 15:39:50 -0500
commitfd1956298e8562504dde4a493240895fc8c6fa08 (patch)
tree0d9e3bf2ef78be5ed13d10997f1e33eb4b462cff /src/zdab_utils.c
parent7913069ca1313fb6d4e7c25289910406508d5f73 (diff)
downloadsddm-fd1956298e8562504dde4a493240895fc8c6fa08.tar.gz
sddm-fd1956298e8562504dde4a493240895fc8c6fa08.tar.bz2
sddm-fd1956298e8562504dde4a493240895fc8c6fa08.zip
don't flag PMT hits based on the uncalibrated QHS for MC
Diffstat (limited to 'src/zdab_utils.c')
-rw-r--r--src/zdab_utils.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/zdab_utils.c b/src/zdab_utils.c
index 416bd79..6d05d96 100644
--- a/src/zdab_utils.c
+++ b/src/zdab_utils.c
@@ -45,6 +45,17 @@ size_t get_nhit(event *ev)
return nhit;
}
+/* Returns 1 if the EV is produced by MC, otherwise zero.
+ *
+ * Data type = 10*(1=real, 2=MC)
+ * + 1*(1=SNO, 2=miniSNO)
+ *
+ * See id_data_types in the SNOMAN companion. */
+int is_mc(EVBank *ev)
+{
+ return ev->dtp/10 == 2;
+}
+
int get_event(zebraFile *f, event *ev, zebraBank *bev)
{
/* Read all the PMT banks from the zebra file and update `ev`.
@@ -58,11 +69,14 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev)
static int pmt_types[] = {PMT_NORMAL,PMT_OWL,PMT_LG,PMT_CALIBRATION,PMT_BUTT,PMT_NECK};
static char *pmt_names[] = {"PMT","OWL","LG","FECD","BUTT","NECK"};
char pmt_type_string[256];
+ EVBank ev_bank;
for (i = 0; i < MAX_PMTS; i++) {
ev->pmt_hits[i].hit = 0;
}
+ unpack_ev(bev->data, &ev_bank);
+
for (i = 0; i < LEN(pmt_links); i++) {
if (bev->links[pmt_links[i]-1] == 0) continue;
@@ -126,13 +140,31 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev)
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.
+ /* 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)
+ if (is_mc(&ev_bank))
+ /* Skip uncalibrated charge check if this is MC. The reason is
+ * that for some reason the uncalibrator in SNOMAN needs the
+ * QSLP tables which aren't available for most runs. According
+ * to Chris Kyba:
+ *
+ * > From summer 2000 on, we never ran charge slopes. I'm not
+ * > sure if we did at the very start in 1999, because I didn't
+ * > always understand what was going on when I was an undergrad
+ * > :-)
+ *
+ * > I never looked at the charge slope data. My best
+ * > recollection of the uncalibrator was everyone saying "it
+ * > doesn't work, don't try to use it".
+ *
+ * Therefore, we ignore it for MC. */
+ ;
+ else if(bpmt.pihs >= 4095 || bpmt.pihs < 300)
ev->pmt_hits[id].flags |= PMT_FLAG_CHARGE;
if (pmts[id].pmt_type != pmt_types[i]) {