Skip to content

Commit

Permalink
Add coincidence_per_channel
Browse files Browse the repository at this point in the history
Merging b19b1be
  • Loading branch information
pdeperio committed Aug 2, 2018
1 parent 9a32aeb commit 651170d
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions pax/datastructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions pax/plugins/io/ROOTClass.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ def _build_model_class(self, model):
for _fn, length in ((
('area_per_channel', n_channels),
('hits_per_channel', n_channels),
('coincidence_per_channel', n_channels),
('n_saturated_per_channel', n_channels),
('sum_waveform', n_waveform_samples),
('sum_waveform_top', n_waveform_samples),
Expand Down
19 changes: 13 additions & 6 deletions pax/plugins/peak_processing/BasicProperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,23 @@ def transform_event(self, event):

# Compute a tight coincidence count (useful for distinguishing S1s from junk)
x = peak.hits['index_of_maximum']
l = peak.index_of_maximum - self.tight_coincidence_samples
r = peak.index_of_maximum + self.tight_coincidence_samples
peak.tight_coincidence = len(np.unique(peak.hits['channel'][(x >= l) & (x <= r)]))
left = peak.index_of_maximum - self.tight_coincidence_samples
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

# varying tight coincidence intervals
peak.tight_coincidence_thresholds = np.zeros(5, dtype=np.int16)
for ip, window in enumerate([5, 4, 3, 2, 1]):
l = peak.index_of_maximum - window
r = peak.index_of_maximum + window
peak.tight_coincidence_thresholds[ip] = len(np.unique(peak.hits['channel'][(x >= l) & (x <= r)]))
left = peak.index_of_maximum - window
right = peak.index_of_maximum + window
peak.tight_coincidence_thresholds[ip] = len(np.unique(peak.hits['channel'][(x >= left) & (x <= right)]))

# Store the waveform; for tpc also store the top waveform
put_w_in_center_of_field(w, peak.sum_waveform, cog_idx)
Expand Down

0 comments on commit 651170d

Please sign in to comment.