Skip to content

Commit

Permalink
daq cuts for peaks
Browse files Browse the repository at this point in the history
  • Loading branch information
FaroutYLq committed Apr 6, 2024
1 parent 7aba74d commit 876d124
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion saltax/match/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import saltax
from scipy.stats import binomtest
import utilix
import strax
from glob import glob

ALL_CUTS = np.array([
Expand Down Expand Up @@ -949,4 +950,25 @@ def show_eff1d(events_simu, events_simu_matched_to_salt, mask_salt_cut=None,
plt.ylabel("Acceptance")
plt.title(title)
plt.show()



def apply_peaks_daq_cuts(st_data, runs, peaks, proximity_extension=int(0.25e6)):
"""
Analogy to DAQVeto in cutax: https://github.com/XENONnT/cutax/blob/fb9c23cea86b44c0402437189fc606399d4e134c/cutax/cuts/daq_veto.py#L8
Apply cuts based on veto_intervals, using strax.touching_windows
:param st_data: context for data in cutax
:param runs: ordered runs list
:param peaks: peaks level data with ordered times
:param proximity_extension: extension of the veto proximity cut, default to int(0.25e6)
:return: mask_daq_cut mask for veto cuts
"""
# Load veto_intervals
veto_intervals = st_data.get_array(runs, "veto_intervals")

mask_daq_cut = np.ones(len(peaks), dtype=bool)
# Once the peaks are in proximity of the veto intervals, they are cut
windows = strax.touching_windows(veto_intervals, peaks, window=proximity_extension)
windows_length = windows[:,1] - windows[:,0]
mask_daq_cut[windows_length>0] = False

return mask_daq_cut

0 comments on commit 876d124

Please sign in to comment.