From d88e8b3bb6ab47f19932af514b541ac9c0410334 Mon Sep 17 00:00:00 2001 From: dachengx Date: Thu, 7 Sep 2023 14:46:29 -0500 Subject: [PATCH] Correct elife for cs2_wo_timecorr --- straxen/plugins/events/corrected_areas.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/straxen/plugins/events/corrected_areas.py b/straxen/plugins/events/corrected_areas.py index 4ee6545e0..2e052049f 100644 --- a/straxen/plugins/events/corrected_areas.py +++ b/straxen/plugins/events/corrected_areas.py @@ -21,7 +21,7 @@ class CorrectedAreas(strax.Plugin): cs2_top and cs2_bottom are corrected by the corresponding maps, and cs2 is the sum of the two. """ - __version__ = '0.5.0' + __version__ = '0.5.1' depends_on = ['event_basics', 'event_positions'] @@ -104,6 +104,11 @@ def infer_dtype(self): for i, name in enumerate(names): if i == len(names) - 1: description = '' + elif i == 0: + # special treatment for wo_timecorr, apply elife correction + description = ' (before ' + ' + '.join(descriptions[i + 1:-1]) + description += ', after ' + ' + '.join( + descriptions[:i + 1] + descriptions[-1:]) + ')' else: description = ' (before ' + ' + '.join(descriptions[i + 1:]) description += ', after ' + ' + '.join(descriptions[:i + 1]) + ')' @@ -219,9 +224,9 @@ def compute(self, events): seg_ee_corr[partition_mask] = seg[partition] / avg_seg[partition] * ee[partition] # apply S2 xy correction - result[f"{peak_type}cs2_wo_timecorr"] = cs2_top_xycorr + cs2_bottom_xycorr - result[f"{peak_type}cs2_area_fraction_top_wo_timecorr"] = ( - cs2_top_xycorr / result[f"{peak_type}cs2_wo_timecorr"]) + cs2_xycorr = cs2_top_xycorr + cs2_bottom_xycorr + result[f"{peak_type}cs2_wo_timecorr"] = cs2_xycorr * elife_correction + result[f"{peak_type}cs2_area_fraction_top_wo_timecorr"] = cs2_top_xycorr / cs2_xycorr # apply SEG and EE correction cs2_top_wo_picorr = cs2_top_xycorr / seg_ee_corr