aboutsummaryrefslogtreecommitdiff
path: root/src/zdab_utils.c
diff options
context:
space:
mode:
authortlatorre <tlatorre@uchicago.edu>2019-09-09 12:32:55 -0500
committertlatorre <tlatorre@uchicago.edu>2019-09-09 12:32:55 -0500
commite89a28cb4e7e6cbbe97709d6703f502e9107977a (patch)
tree5ebe3aad4e3ff999c2a58f8472bcfb676894f46f /src/zdab_utils.c
parent46c9f8922ecda142faa3a4813d82365cf9151b17 (diff)
downloadsddm-e89a28cb4e7e6cbbe97709d6703f502e9107977a.tar.gz
sddm-e89a28cb4e7e6cbbe97709d6703f502e9107977a.tar.bz2
sddm-e89a28cb4e7e6cbbe97709d6703f502e9107977a.zip
add a first draft of a data cleaning cut to detect breakdown events
Diffstat (limited to 'src/zdab_utils.c')
-rw-r--r--src/zdab_utils.c15
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 {