diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/zdab_utils.c | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/zdab_utils.c b/src/zdab_utils.c index 911850e..b26dd78 100644 --- a/src/zdab_utils.c +++ b/src/zdab_utils.c @@ -157,10 +157,6 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) ev->pmt_hits[id].ptm = bpmt.ptm; if (is_mc(&ev_bank)) { - /* Use standard time if this is MC since the multiphoton time - * isn't calculated for MC. */ - ev->pmt_hits[id].t = bpmt.pt; - /* Do a *very* simple conversion between time and TAC by * assuming a linear relationship. Note: This ignores *lots* of * effects like the TAC curl, any non-linearities, PCA offsets, @@ -171,10 +167,6 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) * calibrated time are just equal to the calibrated time. */ ev->pmt_hits[id].ept = bpmt.pt; ev->pmt_hits[id].pt1 = bpmt.pt; - } else { - /* Use the multiphoton PCA time since we are looking at high - * energy events. */ - ev->pmt_hits[id].t = bpmt.ptm; } /* Clear the PMT_FLAG_DIS bit. */ @@ -266,6 +258,36 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) ev->pmt_hits[id].flags |= PMT_FLAG_CHARGE; } + /* Use the multiphoton PCA time since we are looking at high + * energy events. */ + ev->pmt_hits[id].t = bpmt.ptm; + + /* Set the PMT hit time we'll use in the likelihood function. */ + if (ev->pmt_hits[id].q < 1.5) { + /* If the charge is less than 1.5 PE we just use the standard + * PMT hit time with the time walk correction applied. */ + ev->pmt_hits[id].t = ev->pmt_hits[id].pt; + } else { + /* Otherwise, we use the PMT hit time without the time walk + * correction applied. + * + * Note: Previously I was using the multiphoton PCA hit time: + * + * ev->pmt_hits[id].t = bpmt.ptm; + * + * which is designed exactly for high energy events in which + * you expect multiple PE. However, after talking to Chris Kyba + * on the phone I realized that he calibrated the multiphoton + * hit time to represent the *expected* value of the hit times + * when multiple photons hit. However, in my likelihood + * function I currently assume the time is governed by the + * first order statistic of the time when multiple photons hit. + * + * Therefore, we just use the pt1 variable which represents the + * PMT hit time without the time walk correction applied. */ + ev->pmt_hits[id].t = ev->pmt_hits[id].pt1; + } + /* The following check prints out a warning on a handful of channels: * * 3/15/9 has PMT type NECK but expected OWL based on bank |