diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-09-24 14:10:45 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-09-24 14:10:45 -0500 |
commit | 9c422dff8e8c06c1d14583274822f665391284ae (patch) | |
tree | 07405e79896b4292bad520b2c36a1ee83bf8b3b0 /src/dc.c | |
parent | 8fcc9a0b44ebde54a1ae3679c572833772823060 (diff) | |
download | sddm-9c422dff8e8c06c1d14583274822f665391284ae.tar.gz sddm-9c422dff8e8c06c1d14583274822f665391284ae.tar.bz2 sddm-9c422dff8e8c06c1d14583274822f665391284ae.zip |
update breakdown cut to include a cut on the number of calibrated PMT hits
This commit updates the breakdown cut to flag any event in which less than 70%
of the PMT hits have a good TAC value.
Diffstat (limited to 'src/dc.c')
-rw-r--r-- | src/dc.c | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -623,25 +623,42 @@ int is_breakdown(event *ev) int i; double tac[20][512]; int nhit[20] = {0}; + int nhit_cal[20] = {0}; + int nhit_cal_sum; double median_tac[20]; size_t index[20]; /* Breakdown event must have an nhit greater than 1000. */ if (ev->nhit < 1000) return 0; + nhit_cal_sum = 0; for (i = 0; i < MAX_PMTS; i++) { if (!ev->pmt_hits[i].hit || pmts[i].pmt_type != PMT_NORMAL) continue; - tac[i/512][nhit[i/512]++] = ev->pmt_hits[i].tac; + nhit[i/512] += 1; + + /* Sometimes during a breakdown, a lot of the channels have TAC values + * that are outside of the normal window. I'm not sure exactly what + * causes this, but we don't want to include these when calculating the + * median. */ + if (ev->pmt_hits[i].tac < 400) continue; + + tac[i/512][nhit_cal[i/512]++] = ev->pmt_hits[i].tac; + + nhit_cal_sum += 1; } + /* Tag any event in which less than 70% of the PMT hit times are calibrated + * correctly. */ + if (nhit_cal_sum < ev->nhit*BREAKDOWN_CAL_FRAC) return 1; + for (i = 0; i < 19; i++) { - if (nhit[i] <= MIN_NHIT_CRATE) { + if (nhit_cal[i] <= MIN_NHIT_CRATE) { median_tac[i] = 0.0; continue; } - gsl_sort(&tac[i][0],1,nhit[i]); - median_tac[i] = gsl_stats_median_from_sorted_data(&tac[i][0],1,nhit[i]); + gsl_sort(&tac[i][0],1,nhit_cal[i]); + median_tac[i] = gsl_stats_median_from_sorted_data(&tac[i][0],1,nhit_cal[i]); } fargsort(median_tac,19,index); |