From 75431530618e2d4f45d0f3c3cefc279872819ce6 Mon Sep 17 00:00:00 2001 From: Yuehuan Wei Date: Thu, 4 Jan 2018 18:29:39 -0800 Subject: [PATCH 1/6] Optimise the PosDiff Cut (v2) Optimise the PosDiff cut: https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenon1t:analysis:sr1:pos_cut_v3 1) S2 < 300 with D < fun(s2), while for S2 > 300 with D < fixed-values. 2) delta R^2 > -100. note: D is the position difference between NN and TPF. delta R^2 is square_R_nn - square_R_tpf. --- lax/lichens/sciencerun0.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/lax/lichens/sciencerun0.py b/lax/lichens/sciencerun0.py index d97ba1d..eaaef1c 100644 --- a/lax/lichens/sciencerun0.py +++ b/lax/lichens/sciencerun0.py @@ -820,21 +820,18 @@ 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 , Tianyu Zhu """ - version = 1 + version = 2 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 From 4dc04e58c2a073621a5def86341fc3c6e8d30e98 Mon Sep 17 00:00:00 2001 From: Yuehuan Wei Date: Thu, 4 Jan 2018 18:38:24 -0800 Subject: [PATCH 2/6] Update sciencerun0.py --- lax/lichens/sciencerun0.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lax/lichens/sciencerun0.py b/lax/lichens/sciencerun0.py index eaaef1c..d9dcf07 100644 --- a/lax/lichens/sciencerun0.py +++ b/lax/lichens/sciencerun0.py @@ -829,9 +829,9 @@ class PosDiff(Lichen): def _process(self, df): 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 + + (((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) < + ((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 From 9f0b6526ec8ddee937d1f04ab5ae641d3d1f9b82 Mon Sep 17 00:00:00 2001 From: Yuehuan Wei Date: Thu, 4 Jan 2018 18:45:12 -0800 Subject: [PATCH 3/6] Update sciencerun0.py --- lax/lichens/sciencerun0.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lax/lichens/sciencerun0.py b/lax/lichens/sciencerun0.py index d9dcf07..c3f21ed 100644 --- a/lax/lichens/sciencerun0.py +++ b/lax/lichens/sciencerun0.py @@ -830,7 +830,7 @@ class PosDiff(Lichen): def _process(self, df): 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)) | + (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)))) From 4d166abf066cbd6af8e5099d6b8fef127654073a Mon Sep 17 00:00:00 2001 From: Patrick de Perio Date: Fri, 5 Jan 2018 13:35:21 -0500 Subject: [PATCH 4/6] lint fixes and <= to ensure continuous boundary --- lax/lichens/sciencerun0.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lax/lichens/sciencerun0.py b/lax/lichens/sciencerun0.py index c3f21ed..d71d464 100644 --- a/lax/lichens/sciencerun0.py +++ b/lax/lichens/sciencerun0.py @@ -830,8 +830,8 @@ class PosDiff(Lichen): def _process(self, df): 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)) | + (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)))) + (13.719 * np.exp(-df['s2'] / 55.511) + 3.014)) & (df['s2'] <= 300)))) return df From 8b9aef252184af60bf38e0a2cdbaffbffe8a2469 Mon Sep 17 00:00:00 2001 From: Patrick de Perio Date: Fri, 5 Jan 2018 13:37:00 -0500 Subject: [PATCH 5/6] Up version number to correspond to Wiki note --- lax/lichens/sciencerun0.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lax/lichens/sciencerun0.py b/lax/lichens/sciencerun0.py index d71d464..173e321 100644 --- a/lax/lichens/sciencerun0.py +++ b/lax/lichens/sciencerun0.py @@ -825,7 +825,7 @@ class PosDiff(Lichen): which can partly remove wall leakage events due to the small size of S2. Contact: Yuehuan Wei , Tianyu Zhu """ - version = 2 + version = 3 def _process(self, df): df.loc[:, self.name()] = ((df['r_observed_nn']**2 - df['r_observed_tpf']**2 > -100) & From ae20723f688ab0c64c2b8eeeff1f189c05e5d4df Mon Sep 17 00:00:00 2001 From: Patrick de Perio Date: Fri, 5 Jan 2018 14:34:23 -0500 Subject: [PATCH 6/6] lint fix (shorten line) --- lax/lichens/sciencerun0.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lax/lichens/sciencerun0.py b/lax/lichens/sciencerun0.py index e48f875..c321798 100644 --- a/lax/lichens/sciencerun0.py +++ b/lax/lichens/sciencerun0.py @@ -861,8 +861,10 @@ class PosDiff(Lichen): def _process(self, df): 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)) | + (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)))) + (13.719 * np.exp(-df['s2'] / 55.511) + 3.014)) & + (df['s2'] <= 300)))) return df