From b19b1be310f11303c807bd4d250fc0a84c0e887d Mon Sep 17 00:00:00 2001 From: Fei Gao Date: Mon, 13 Nov 2017 15:28:50 -0500 Subject: [PATCH] saving per channel contribution to tight coincidence (#641) --- pax/datastructure.py | 3 +++ pax/plugins/peak_processing/BasicProperties.py | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/pax/datastructure.py b/pax/datastructure.py index 962b123e..e3019397 100644 --- a/pax/datastructure.py +++ b/pax/datastructure.py @@ -199,6 +199,9 @@ class Peak(StrictModel): #: Total areas of all hits per PMT (pe). area_per_channel = np.array([], dtype='float64') + # contribution to tight coincidence, 1 or 0 for each channel + coincidence_per_channel = np.array([], dtype=np.int16) + #: Total area of all hits across all PMTs (pes). #: In XerawdpImitation mode, rightmost sample is not included in area integral. area = 0.0 diff --git a/pax/plugins/peak_processing/BasicProperties.py b/pax/plugins/peak_processing/BasicProperties.py index 4ffc738a..207ff235 100644 --- a/pax/plugins/peak_processing/BasicProperties.py +++ b/pax/plugins/peak_processing/BasicProperties.py @@ -122,6 +122,13 @@ def transform_event(self, event): right = peak.index_of_maximum + self.tight_coincidence_samples peak.tight_coincidence = len(np.unique(peak.hits['channel'][(x >= left) & (x <= right)])) + # list of pmts that contribute to tight coincidence of the peak + peak.coincidence_per_channel = np.zeros_like(peak.hits_per_channel) + for hitt in peak.hits: + if hitt['index_of_maximum'] >= left and hitt['index_of_maximum'] <= right: + pmt_index = hitt['channel'] + peak.coincidence_per_channel[pmt_index] = 1 + # Store the waveform; for tpc also store the top waveform put_w_in_center_of_field(w, peak.sum_waveform, cog_idx) if peak.detector == 'tpc':