Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kr83mcut #168

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions lax/lichens/postsr1.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,33 +143,3 @@ def pre(self, df):
return df


class MisIdS1SingleScatter(Lichen):
"""Cut to target the shoulder on Kr83m data due to mis-identified krypton events.

This cut is defined in the space of cs1 and largest_s2_before_main_s2_area.
It's possible for one of the conversion electrons of the Kr83m decay to be mis-classified as an S2,
leading to an S2 that occurs in time before the main S2 that is larger than typical single-electrons.
Requires Extended minitrees.

Note: xenon:shockley:misids1singlescatter
Contact: Evan Shockley <[email protected]>
"""

version = 1.1

pars = [60, 1.04, 4] # from a fit to target only mis-Id Kr83m events
s1_thresh = 155 # cs1 PE. Up to this value the cut will be a straight line
cutval = 125 # straight line part of the cut
min_s1 = 25 # smallest S1 to consider cutting


def _cutline(self, x):
return self.pars[0] + (self.pars[1] / 1e6) * (x - 220) ** self.pars[2]

def cutline(self, x):
return np.nan_to_num(self.cutval * (x < self.s1_thresh)) + np.nan_to_num((x >= self.s1_thresh) * self._cutline(x))

def _process(self, df):
df.loc[:, self.name()] = (np.nan_to_num(df.largest_s2_before_main_s2_area) < self.cutline(df.cs1)) | \
(df.cs1 < self.min_s1)
return df
41 changes: 41 additions & 0 deletions lax/lichens/sciencerun0.py
Original file line number Diff line number Diff line change
Expand Up @@ -924,6 +924,47 @@ class MuonVetoOn(StringLichen):
string = "nearest_muon_veto_trigger > -2e10 & nearest_muon_veto_trigger < 2e10"


class MisIdS1SingleScatter(Lichen):
"""Cut to target the shoulder on Kr83m data due to mis-identified krypton events.
This cut is defined in the space of cs1 and largest_s2_before_main_s2_area*s1_correction.
It's possible for one of the conversion electrons of the Kr83m decay to be mis-classified as an S2,
leading to an S2 that occurs in time before the main S2 that is larger than typical single-electrons.
Requires Extended and Corrections minitrees.
Note: xenon:shockley:lower:misids1singlescatter:sr2_misid
Contact: Evan Shockley <[email protected]>
"""

version = 2.0

pars = [87.30, # peak of the 9 keV gaussian in correction*largest_s2_before_main_s2_area space
3.65, # standard deviations to remove --> defines the half-ellipse to remove the shoulder
11.50, # sigma_y
249.20, # mu_x
21.49, # sigma_x
]
s1_thresh = 170.7 # cs1 PE. Up to this value the cut will be a straight line
cutval = 125 # straight line part of the cut
s1_range = (0, 327.7) # range of cs1 to apply the cut

def pre(self, df):
df['temp'] = df.largest_s2_before_main_s2_area * df.s1_xyz_correction_fdc_3d_nn_tf
return df

def _cutline(self, x):
pars = self.pars
return pars[0] - pars[1] * pars[2] * np.sqrt(1 - ((x - pars[3]) / (pars[1] * pars[4])) ** 2)

def cutline(self, x):
return np.nan_to_num(self.cutval * (x < self.s1_thresh)) + np.nan_to_num(
(x >= self.s1_thresh) * self._cutline(x))

def _process(self, df):
df.loc[:, self.name()] = (np.nan_to_num(df.temp) < self.cutline(df.cs1)) | \
(df.cs1 < self.s1_range[0]) | \
(df.cs1 > self.s1_range[1])
return df


class KryptonMisIdS1(StringLichen):
"""Remove events where the 32 keV S1 of Kr83m decay is identified as an S2.
These events appear above the ER band since the S1 is from the 9 keV decay
Expand Down
6 changes: 4 additions & 2 deletions lax/lichens/sciencerun1.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,6 @@ class S1SingleScatter(sciencerun0.S1SingleScatter):

PreS2Junk = sciencerun0.PreS2Junk

KryptonMisIdS1 = sciencerun0.KryptonMisIdS1

Flash = sciencerun0.Flash

PosDiff = sciencerun0.PosDiff
Expand All @@ -294,3 +292,7 @@ class S1SingleScatter(sciencerun0.S1SingleScatter):
S1AreaLowerInjectionFraction = sciencerun0.S1AreaLowerInjectionFraction

SingleElectronS2s = sciencerun0.SingleElectronS2s

MisIdS1SingleScatter = sciencerun0.MisIdS1SingleScatter

KryptonMisIdS1 = MisIdS1SingleScatter
3 changes: 2 additions & 1 deletion lax/lichens/sciencerun2.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,8 @@ def _process(self, df):

# KryptonMisIdS1
# Contact: Evan
KryptonMisIdS1 = sr0.KryptonMisIdS1
MisIdS1SingleScatter = sr0.MisIdS1SingleScatter
KryptonMisIdS1 = MisIdS1SingleScatter

# Remove S1s that are actually misidentified single electrons
# Contact: Fei
Expand Down