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

Optimise the PosDiff Cut (v2) #127

Merged
merged 7 commits into from
Jan 5, 2018
Merged
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
21 changes: 10 additions & 11 deletions lax/lichens/sciencerun0.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,21 +851,20 @@ def _process(self, df):

class PosDiff(Lichen):
"""
Note: https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenon1t:analysis:sr1:pos_cut_v1
Note: https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenon1t:analysis:sr1:pos_cut_v3
This cut is defined for removing the events with large position difference between NN and TPF alogrithm,
which can partly remove wall leakage events due to the small size of S2.
Contact: Yuehuan Wei <ywei@physics.ucsd.edu>, Tianyu Zhu <tz2263@columbia.edu>
"""
version = 1
version = 3

def _process(self, df):
df.loc[:, self.name()] = True
mask = df.eval('s2 > 0')
df.loc[mask, 'temp'] = 0.152 * np.sin((df['r_observed_nn'] + 4.10) / 7.99 * 2 * np.pi) \
+ 0.633 - 0.00768 * df['r_observed_nn']
corrected_distance = '(((x_observed_nn - x_observed_tpf) ** 2 + (y_observed_nn - y_observed_tpf) ** 2) \
- 2 * (r_observed_nn - r_observed_tpf) * temp + temp**2) ** 0.5'
df.loc[mask, self.name()] = df.eval('{cdist} < 3.215 * exp(- s2 / 155) + 1.24 * exp( - s2 / 842) + 1.16'
.format(cdist=corrected_distance))

df.loc[:, self.name()] = ((df['r_observed_nn']**2 - df['r_observed_tpf']**2 > -100) &
(((np.sqrt((df['x_observed_nn'] - df['x_observed_tpf'])**2 +
(df['y_observed_nn'] - df['y_observed_tpf'])**2) < 3.076) &
(df['s2'] > 300)) |
((np.sqrt((df['x_observed_nn'] - df['x_observed_tpf'])**2 +
(df['y_observed_nn'] - df['y_observed_tpf'])**2) <
(13.719 * np.exp(-df['s2'] / 55.511) + 3.014)) &
(df['s2'] <= 300))))
return df