diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dc.c | 25 | ||||
-rw-r--r-- | src/dc.h | 7 |
2 files changed, 26 insertions, 6 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); @@ -38,9 +38,12 @@ /* Minimum number of hits required for a crate to be considered the source of a * breakdown. */ #define MIN_NHIT_BREAKDOWN 256 -/* Minimum number of hits for a crate to calculate the median TAC in the - * breakdown cut. */ +/* Minimum number of calibrated hits for a crate to calculate the median TAC in + * the breakdown cut. */ #define MIN_NHIT_CRATE 20 +/* Fraction of PMT hits which must have a good TAC value in order to pass the + * cut. */ +#define BREAKDOWN_CAL_FRAC 0.7 /* Length of the sliding window used in the ITC cut (ns). */ #define ITC_TIME_WINDOW 93.0 |