diff options
Diffstat (limited to 'src/zdab_utils.c')
-rw-r--r-- | src/zdab_utils.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/zdab_utils.c b/src/zdab_utils.c index acb2fd9..9238d9d 100644 --- a/src/zdab_utils.c +++ b/src/zdab_utils.c @@ -37,6 +37,11 @@ static double MEAN_HIPT = 46.0; * to "uncalibrate" the Monte Carlo. */ static double MEAN_PEDESTAL = 600.0; +/* Average value for the slope of the TAC slope. */ +static double TAC_PER_NS = 8.9; +/* Average y offset of the TAC slope. */ +static double TAC_OFFSET = 300.0; + size_t get_nhit(event *ev) { /* Returns the number of PMT hits in event `ev`. @@ -123,6 +128,7 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) } ev->pmt_hits[id].hit = 1; + ev->pmt_hits[id].tac = bpmt.pit; ev->pmt_hits[id].ept = bpmt.ept; ev->pmt_hits[id].qihl = bpmt.pihl; ev->pmt_hits[id].qihs = bpmt.pihs; @@ -142,6 +148,15 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) /* 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, + * charge walk, etc. */ + ev->pmt_hits[id].tac = fmax(fmin(bpmt.pt*TAC_PER_NS + TAC_OFFSET,4095.0),0.0); + + /* Assume the ECA calibrated time and the ECA + PCA no walk + * calibrated time are just equal to the calibrated time. */ ev->pmt_hits[id].ept = bpmt.pt; ev->pmt_hits[id].pt1 = bpmt.pt; } else { |