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

S2Width Warnings Fix #114

Merged
merged 8 commits into from
Dec 2, 2017
Merged
Show file tree
Hide file tree
Changes from 5 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
47 changes: 25 additions & 22 deletions lax/lichens/sciencerun0.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ class S2Width(Lichen):
https://xe1t-wiki.lngs.infn.it/doku.php?id=xenon:xenon1t:sim:notes:tzhu:width_cut_tuning#toy_fax_simulation
Contact: Tianyu <tz2263@columbia.edu>, Yuehuan <weiyh@physik.uzh.ch>, Jelle <jaalbers@nikhef.nl>
"""
version = 4
version = 5

diffusion_constant = 25.26 * ((units.cm)**2) / units.s
v_drift = 1.440 * (units.um) / units.ns
Expand All @@ -649,16 +649,19 @@ def s2_width_model(self, z_height):
return np.sqrt(- 2 * self.diffusion_constant * z_height / self.v_drift ** 3)

def _process(self, df):
df.loc[:, 'nElectron'] = np.clip(df['s2'], 0, 5000) / self.scg
df.loc[:, 'normWidth'] = (np.square(df['s2_range_50p_area'] / self.SigmaToR50) - np.square(self.scw)) / \
np.square(self.s2_width_model(df['z']))
df.loc[:, self.name()] = chi2.logpdf(df['normWidth'] * (df['nElectron'] - 1), df['nElectron']) > - 14
df.loc[:, self.name()] = True # Default is True
mask = df.eval('z < 0')
df.loc[mask, 'nElectron'] = np.clip(df.loc[mask, 's2'], 0, 5000) / self.scg
df.loc[mask, 'normWidth'] = (np.square(df.loc[mask, 's2_range_50p_area'] / self.SigmaToR50) -
np.square(self.scw)) / np.square(self.s2_width_model(df.loc[mask, 'z']))
df.loc[mask, self.name()] = chi2.logpdf(df.loc[mask, 'normWidth'] * (df.loc[mask, 'nElectron'] - 1),
df.loc[mask, 'nElectron']) > - 14
return df

def post(self, df):
for temp_column in ['nElectron', 'normWidth']:
if temp_column in df.columns:
return df.drop(temp_column, 1)
df.drop(temp_column, 1, inplace=True)
return df


Expand All @@ -684,14 +687,15 @@ class S1SingleScatter(Lichen):
s2width = S2Width

def _process(self, df):
df.loc[:, self.name()] = True # Default is True
mask = df.eval('alt_s1_interaction_z < 0')
alt_n_electron = np.clip(df.loc[mask, 's2'], 0, 5000) / self.s2width.scg
alt_rel_width = (np.square(df.loc[mask, 's2_range_50p_area'] / self.s2width.SigmaToR50) - np.square(self.s2width.scw)) / \
np.square(self.s2width.s2_width_model(self.s2width, df.loc[mask, 'alt_s1_interaction_z']))

alt_n_electron = np.clip(df['s2'], 0, 5000) / self.s2width.scg
alt_rel_width = (np.square(df['s2_range_50p_area'] / self.s2width.SigmaToR50) - np.square(self.s2width.scw)) / \
np.square(self.s2width.s2_width_model(self.s2width, df['alt_s1_interaction_z']))
alt_interaction_passes = chi2.logpdf(alt_rel_width * (alt_n_electron - 1), alt_n_electron) > - 20

alt_interaction_passes = chi2.logpdf(alt_rel_width * (alt_n_electron - 1), alt_n_electron) > - 14

df.loc[:, (self.name())] = True ^ alt_interaction_passes
df.loc[mask, (self.name())] = True ^ alt_interaction_passes
return df


Expand Down Expand Up @@ -818,7 +822,7 @@ class KryptonMisIdS1(StringLichen):
version = 0
string = "largest_other_s2 < 100 | largest_other_s2_delay_main_s1 < -3000 | largest_other_s2_delay_main_s1 > 0"


class Flash(Lichen):
"""Cuts events within a flash. This is defined as the width were the BUSY on channel is "high".
In addition an extended time-window around the flash is removed as well.
Expand All @@ -829,13 +833,12 @@ class Flash(Lichen):
"""

version = 0
def _process(self,df):
df.loc[:, self.name()]= ((df['inside_flash']== False) &
((df.nearest_flash != df.nearest_flash) |
(df['nearest_flash'] > 120e9) |
(df['nearest_flash'] < (-10e9 - df['flashing_width']*1e9))
)
)
return df


def _process(self, df):
df.loc[:, self.name()] = ((df['inside_flash'] is False) &
((df.nearest_flash != df.nearest_flash) |
(df['nearest_flash'] > 120e9) |
(df['nearest_flash'] < (-10e9 - df['flashing_width'] * 1e9))
)
)
return df
4 changes: 2 additions & 2 deletions lax/lichens/sciencerun1.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
# -*- coding: utf-8 -*-
import inspect
import os
import numpy as np
from pax import units

from lax.lichen import Lichen, ManyLichen, StringLichen
Expand Down Expand Up @@ -252,7 +253,7 @@ class S2Width(sciencerun0.S2Width):
"""S2 Width cut based on diffusion model with SR1 parameters
See sciencerun0.py for full implementation
"""
version = 4
version = 5
diffusion_constant = 29.35 * ((units.cm)**2) / units.s
v_drift = 1.335 * (units.um) / units.ns
scg = 21.3 # s2_secondary_sc_gain in pax config
Expand All @@ -268,7 +269,6 @@ class S1SingleScatter(sciencerun0.S1SingleScatter):
s2width = S2Width



MuonVeto = sciencerun0.MuonVeto

S1AreaFractionTop = sciencerun0.S1AreaFractionTop
Expand Down