Skip to content

Commit

Permalink
Correct elife for cs2_wo_timecorr (#1260)
Browse files Browse the repository at this point in the history
  • Loading branch information
dachengx committed Sep 7, 2023
1 parent 7e49677 commit a1eadc4
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions straxen/plugins/events/corrected_areas.py
Expand Up @@ -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']

Expand Down Expand Up @@ -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]) + ')'
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a1eadc4

Please sign in to comment.