aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-07-16 11:19:34 -0500
committertlatorre <tlatorre@uchicago.edu>2019-07-16 11:19:34 -0500
commitebe279926c5c03ee054d520900715f0315dc5d0a (patch)
tree4cb051b07cc2dc07bce81aa736f6bc517e034341 /src
parentceb609472547935b056911643564860190a0a165 (diff)
downloadsddm-ebe279926c5c03ee054d520900715f0315dc5d0a.tar.gz
sddm-ebe279926c5c03ee054d520900715f0315dc5d0a.tar.bz2
sddm-ebe279926c5c03ee054d520900715f0315dc5d0a.zip
update neck tube cut to include time difference changes due to cable changes
Diffstat (limited to 'src')
-rw-r--r--src/dc.c19
-rw-r--r--src/dc.h1
-rw-r--r--src/event.h4
-rw-r--r--src/fit.c4
-rw-r--r--src/zdab-cat.c4
-rw-r--r--src/zdab_utils.c7
6 files changed, 30 insertions, 9 deletions
diff --git a/src/dc.c b/src/dc.c
index ff99f3f..7242617 100644
--- a/src/dc.c
+++ b/src/dc.c
@@ -453,6 +453,20 @@ int qvnhit(event *ev)
return qhl_ratio < QRATIO_THRESHOLD;
}
+/* Returns the time difference between the neck PMT hit and the average ECA
+ * time of the PSUP PMTs required to tag an event as a neck event.
+ *
+ * These values come from the neck tube cut table in prod/filter_flth.dat. */
+double get_neck_tube_cut_time_diff(event *ev)
+{
+ if (ev->dte < 19991216 || (ev->dte == 19991216 && ev->hmsc < 20370000))
+ return 70.0;
+ else if (ev->dte < 20040923 || (ev->dte < 20040923 && ev->hmsc < 100222))
+ return 15.0;
+ else
+ return -85.0;
+}
+
/* Returns 1 if the event is classified as a neck event. The definition of
* a neck event is a combination of the neck flag in the DAMN word:
*
@@ -480,6 +494,7 @@ int is_neck_event(event *ev)
int high_charge;
double avg_ept_psup;
int nhit, nhit_bottom;
+ double time_diff;
/* First, we compute the average ECA time for all the PSUP PMTs with z <= 0. */
@@ -501,6 +516,8 @@ int is_neck_event(event *ev)
avg_ept_psup /= nhit;
+ time_diff = get_neck_tube_cut_time_diff(ev);
+
/* Now, we check if two or more neck tubes fired *or* a single neck tube
* fired with a high charge and 70 ns before the average time of the normal
* PMTs. */
@@ -523,7 +540,7 @@ int is_neck_event(event *ev)
* of the PSUP PMTS with z les than 0." When does this change take
* place? */
if ((ev->pmt_hits[i].ehs > 70 || ev->pmt_hits[i].ehs < -110) &&
- (ev->pmt_hits[i].ept < avg_ept_psup - 70.0)) high_charge = 1;
+ (ev->pmt_hits[i].ept < avg_ept_psup - time_diff)) high_charge = 1;
break;
case PMT_NORMAL:
nhit += 1;
diff --git a/src/dc.h b/src/dc.h
index 102e47f..6569e0f 100644
--- a/src/dc.h
+++ b/src/dc.h
@@ -73,6 +73,7 @@ int is_muon(event *ev);
int junk_cut(zebraFile *f, zebraBank *bmast, zebraBank *bev);
int crate_isotropy(event *ev);
int qvnhit(event *ev);
+double get_neck_tube_cut_time_diff(event *ev);
int is_neck_event(event *ev);
int is_flasher(event *ev);
diff --git a/src/event.h b/src/event.h
index 1f669b4..4ebb14c 100644
--- a/src/event.h
+++ b/src/event.h
@@ -73,6 +73,10 @@ typedef struct event {
uint32_t gtid;
/* Trigger word. See trigger_mask_bits.inc. */
uint32_t trigger_type;
+ /* Date (format: yyyymmdd) */
+ uint32_t dte;
+ /* Time (format: hhmmsscc - cc is centisec). */
+ uint32_t hmsc;
pmt_hit pmt_hits[MAX_PMTS];
} event;
diff --git a/src/fit.c b/src/fit.c
index c0b9858..b0b3318 100644
--- a/src/fit.c
+++ b/src/fit.c
@@ -6160,10 +6160,6 @@ skip_mc:
while (1) {
unpack_ev(b.data, &bev);
- ev.run = bev.run;
- ev.gtid = bev.gtr_id;
- ev.trigger_type = bev.trg_type;
- ev.trigger_time = bev.gtr;
if (gtid > 0 && ev.gtid != gtid) goto skip_event;
diff --git a/src/zdab-cat.c b/src/zdab-cat.c
index 278236c..fa779e9 100644
--- a/src/zdab-cat.c
+++ b/src/zdab-cat.c
@@ -277,10 +277,6 @@ skip_mc:
while (1) {
unpack_ev(b.data, &bev);
- ev.run = bev.run;
- ev.gtid = bev.gtr_id;
- ev.trigger_type = bev.trg_type;
- ev.trigger_time = bev.gtr;
if (ev.run != last_run) {
fprintf(stderr, "loading DQXX file for run %010i\n", ev.run);
diff --git a/src/zdab_utils.c b/src/zdab_utils.c
index e91d31b..48ad9a1 100644
--- a/src/zdab_utils.c
+++ b/src/zdab_utils.c
@@ -77,6 +77,13 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev)
unpack_ev(bev->data, &ev_bank);
+ ev->run = ev_bank.run;
+ ev->gtid = ev_bank.gtr_id;
+ ev->trigger_type = ev_bank.trg_type;
+ ev->trigger_time = ev_bank.gtr;
+ ev->dte = ev_bank.dte;
+ ev->hmsc = ev_bank.hmsc;
+
for (i = 0; i < LEN(pmt_links); i++) {
if (bev->links[pmt_links[i]-1] == 0) continue;