diff options
author | tlatorre <tlatorre@uchicago.edu> | 2019-09-09 11:12:42 -0500 |
---|---|---|
committer | tlatorre <tlatorre@uchicago.edu> | 2019-09-09 11:12:42 -0500 |
commit | cc0b56d8cb930ba386f59470160c1c460ab64eaf (patch) | |
tree | ae31e95ec26dedfc593ad8c4f7577c62d51835b6 /src | |
parent | 86de4bf17f7ed0ee7a70fd38770223fdde61f5a5 (diff) | |
download | sddm-cc0b56d8cb930ba386f59470160c1c460ab64eaf.tar.gz sddm-cc0b56d8cb930ba386f59470160c1c460ab64eaf.tar.bz2 sddm-cc0b56d8cb930ba386f59470160c1c460ab64eaf.zip |
uncalibrate MC times and charges in get_event()
This commit updates get_event() to fill in the uncalibrated charge and time
info from the calibrated charge and time. The ECA calibrated time and ECA + PCA
without walk correction times (ept and pt1) are just set to the calibrated
time. The uncalibrated charges are set by multiplying the calibrated charge by
the mean high-half point and adding a constant offset, and the ECA calibrated
charges are set by taking the uncalibrated charges and subtracting the offset.
The reason for filling these in is so that we can test the data cleaning cuts
on MC. Although it would be better if these were filled in by the MC, this is
better than nothing.
Diffstat (limited to 'src')
-rw-r--r-- | src/zdab_utils.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/zdab_utils.c b/src/zdab_utils.c index 2259676..41be1c6 100644 --- a/src/zdab_utils.c +++ b/src/zdab_utils.c @@ -27,6 +27,15 @@ char zdab_err[256]; +/* Mean of high-half point distribution. */ +static double MEAN_HIPT = 46.0; + +/* Average value for the QHS/QHL/QLX pedestal. + * + * Note: This is *not* actually accurate. I just need something roughly correct + * to "uncalibrate" the Monte Carlo. */ +static double MEAN_PEDESTAL = 600.0; + size_t get_nhit(event *ev) { /* Returns the number of PMT hits in event `ev`. @@ -131,6 +140,8 @@ 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; + ev->pmt_hits[id].ept = bpmt.pt; + ev->pmt_hits[id].pt1 = bpmt.pt; } else { /* Use the multiphoton PCA time since we are looking at high * energy events. */ @@ -194,6 +205,18 @@ int get_event(zebraFile *f, event *ev, zebraBank *bev) * * Therefore, we ignore it for MC. */ ev->pmt_hits[id].q = bpmt.phs; + + /* For the uncalibrated charges, multiply the charge by the + * mean high-half point and then add a constant offset. */ + ev->pmt_hits[id].qihl = fmax(fmin(bpmt.phl*MEAN_HIPT + MEAN_PEDESTAL,4095.0),0.0); + ev->pmt_hits[id].qihs = fmax(fmin(bpmt.phs*MEAN_HIPT + MEAN_PEDESTAL,4095.0),0.0); + ev->pmt_hits[id].qilx = fmax(fmin(bpmt.plx*MEAN_HIPT + MEAN_PEDESTAL,4095.0),0.0); + + /* For the ECA calibrated charges, just subtract the offset + * from the uncalibrated charges. */ + ev->pmt_hits[id].ehl = ev->pmt_hits[id].qihl - MEAN_PEDESTAL; + ev->pmt_hits[id].ehs = ev->pmt_hits[id].qihs - MEAN_PEDESTAL; + ev->pmt_hits[id].elx = ev->pmt_hits[id].qilx - MEAN_PEDESTAL; } else if (bpmt.pihs < 4095 && bpmt.pihs >= 300) { ev->pmt_hits[id].q = bpmt.phs; } else if (bpmt.pilx < 4095 && bpmt.pilx >= 300) { |