-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from coderdj/cuts_pr
Add some basic cuts
- Loading branch information
Showing
3 changed files
with
53 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
from . import common, plugins, pax_interface # noqa | ||
from . import common, plugins, cut_plugins, pax_interface # noqa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import numpy as np | ||
|
||
import strax | ||
export, __all__ = strax.exporter() | ||
|
||
|
||
class FiducialCylinder1T(strax.Plugin): | ||
"""Implementation of fiducial volume cylinder 1T, | ||
ported from lax.sciencerun0.py""" | ||
depends_on = ('event_positions',) | ||
provides = 'fiducial_cylinder_1t' | ||
dtype = [('cut_fiducial_cylinder', np.bool, 'One tonne fiducial cylinder')] | ||
|
||
def compute(self, events): | ||
arr = np.all([(-92.9 < events['z']), (-9 > events['z']), | ||
(36.94 > np.sqrt(events['x']**2 + events['y']**2))], axis=0) | ||
return dict(cut_fiducial_cylinder=arr) | ||
|
||
|
||
class S1MaxPMT(strax.LoopPlugin): | ||
"""Removes events where the largest hit in S1 is too large | ||
port from lax.sciencerun0.py""" | ||
depends_on = ('events', 'event_basics', 'peak_basics') | ||
dtype = [('cut_s1_max_pmt', np.bool, 'S1 max PMT cut')] | ||
|
||
def compute_loop(self, event, peaks): | ||
ret = dict(cut_s1_max_pmt=True) | ||
if not len(peaks) or np.isnan(event['s1_index']): | ||
return ret | ||
|
||
peak = peaks[event['s1_index']] | ||
max_channel = peak['max_pmt_area'] | ||
ret['cut_s1_max_pmt']=(max_channel < 0.052 * event['s1_area'] + 4.15) | ||
return ret | ||
|
||
|
||
class S1LowEnergyRange(strax.Plugin): | ||
"""Pass only events with cs1<200""" | ||
depends_on = ('events', 'corrected_areas') | ||
dtype = [('cut_s1_low_energy_range', np.bool, "Event under 200pe")] | ||
|
||
def compute(self, events): | ||
ret = np.all([events['cs1'] < 200], axis=0) | ||
return dict(cut_s1_low_energy_range=ret) | ||
|
||
class SR1Cuts(strax.MergeOnlyPlugin): | ||
depends_on = ['fiducial_cylinder_1t', 's1_max_pmt', 's1_low_energy_range' ] | ||
save_when = strax.SaveWhen.ALWAYS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters