aboutsummaryrefslogtreecommitdiff
path: root/src/dc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/dc.c')
-rw-r--r--src/dc.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/dc.c b/src/dc.c
index 6d538b4..e8a3183 100644
--- a/src/dc.c
+++ b/src/dc.c
@@ -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);