In [1]:
from xerawdp_helpers import *    # helper functions for retrieving xerawdp data
from Kr83m_Basic import * 

import numpy as np
import pandas as pd
import glob
%matplotlib inline
import matplotlib.pyplot as plt
from IPython.display import display, Image

import hax
hax.init(main_data_paths=['/project/lgrandi/xenon100/archive/root/merged/xenon100/run_14_pax4.1.2/',
                          '/project/lgrandi/tunnell/run_14/paxProcessed_kr83mDiffusion/'],
         raw_data_local_path='/project/lgrandi/tunnell/')

#hax.ipython.code_hider()


/project/lgrandi/anaconda3/envs/pax_head/lib/python3.4/site-packages/IPython/kernel/__init__.py:13: ShimWarning: The `IPython.kernel` package has been deprecated. You should import from ipykernel or jupyter_client instead.
  "You should import from ipykernel or jupyter_client instead.", ShimWarning)

In [ ]:
datasets_pax = ['xe100_150413_1839','xe100_150414_1535',
            'xe100_150419_1611','xe100_150420_0304',
            'xe100_150420_1809']
data = hax.minitrees.load(datasets_pax, treemakers=Kr83m_Basic)
print(len(data.values))

In [3]:
datasets_pax_new = ['xe100_150413_1839','xe100_150414_1535','xe100_150415_1749',
            'xe100_150416_1832','xe100_150419_1611','xe100_150420_0304',
            'xe100_150420_1809']
for i in range(len(datasets_pax_new)):
    datasets_pax_new[i] += '_pax4.9.1'
data = hax.minitrees.load(datasets_pax_new, treemakers=Kr83m_Basic)
print(len(data.values))


Found minitree at ./xe100_150413_1839_pax4.9.1_Kr83m_Basic.root
Found minitree at ./xe100_150414_1535_pax4.9.1_Kr83m_Basic.root
Found minitree at ./xe100_150415_1749_pax4.9.1_Kr83m_Basic.root
Found minitree at ./xe100_150416_1832_pax4.9.1_Kr83m_Basic.root
Found minitree at ./xe100_150419_1611_pax4.9.1_Kr83m_Basic.root
Found minitree at ./xe100_150420_0304_pax4.9.1_Kr83m_Basic.root
Found minitree at ./xe100_150420_1809_pax4.9.1_Kr83m_Basic.root
3255158

In [ ]:
# from 2015 Kr83m diffusion-mode data
datasets_xerawdp = ['xe100_150413_1839','xe100_150414_1535','xe100_150415_1749',
            'xe100_150416_1832','xe100_150419_1611','xe100_150420_0304',
            'xe100_150420_1809']

# xerawdp path
xerawdpPath = '/project/lgrandi/tunnell/run_14/NewNN/'

# get xerawdp tree, apply event restrictions, and retrieve desirable data
#  see xerawdp_helpers.py for details
xerawdpTree = load_xerawdp_tree(datasets_xerawdp, xerawdpPath)
print(xerawdpTree.GetEntries())

In [4]:
# from 2015 Kr83m diffusion-mode data
datasets_xerawdp = ['xe100_150413_1839','xe100_150414_1535','xe100_150415_1749',
            'xe100_150416_1832','xe100_150419_1611','xe100_150420_0304',
            'xe100_150420_1809']

# xerawdp path
xerawdpPath = '/project/lgrandi/tunnell/run_14/NewNN/'

# get xerawdp tree, apply event restrictions, and retrieve desirable data
#  see xerawdp_helpers.py for details
xerawdpTree = load_xerawdp_tree(datasets_xerawdp, xerawdpPath)
if 'xerawdp_krRestricted.pkl' not in glob.glob('*'):
    df_xerawdp = build_xerawdp_df(xerawdpTree)
    df_xerawdp.to_pickle('xerawdp_krRestricted.pkl')
else:
    df_xerawdp = pd.read_pickle('xerawdp_krRestricted.pkl')

In [5]:
n = 0
for i in range(xerawdpTree.GetEntries()):
    xerawdpTree.GetEntry(i)
    
    if xerawdpTree.NbS1Peaks < 2 or xerawdpTree.S1sTot[0] == 0 or xerawdpTree.NbS2Peaks < 1:
        continue
        
    if xerawdpTree.S1sCoin[0] < 2 or xerawdpTree.S1sCoin[1] < 2:
        continue
        
    if xerawdpTree.cS2sTot[0] < 150:
        continue
        
    if xerawdpTree.S1sLeftEdge[1]-xerawdpTree.S1sRightEdge[0] <= 0:
        continue
        
    dt_s1 = (xerawdpTree.S1sPeak[1]-xerawdpTree.S1sPeak[0])*10
    if dt_s1 < 400 or dt_s1 > 2000:
        continue
        
    if xerawdpTree.NbS2Peaks > 1 and xerawdpTree.cS2sTot[1] > 150:
        continue
        
    if xerawdpTree.S2sRightEdge[0]-xerawdpTree.S2sLeftEdge[0] < xerawdpTree.S1sRightEdge[1]-xerawdpTree.S1sLeftEdge[0]:
        continue
        
    if xerawdpTree.S1sTot[1]/xerawdpTree.S1sTot[0] < 0.1 or xerawdpTree.S1sTot[1]/xerawdpTree.S1sTot[0] > 1.0:
        continue
        
    n += 1

In [6]:
print(n)


342335

In [7]:
print(xerawdpTree.GetEntries())


5093213

203805/5093213 with xerawdpTree.S1sTot[0] <= 0, same for just xerawdpTree.S1sTot[0] == 0

342335/5093213 with dt in [400,2000] ns

Data

Data File Xerawdp Events Pax 4.1 Events Pax 4.9 Partial Events
xe100_150413_1839 961512 938512 561512
xe100_150414_1535 854036 820036 821036
xe100_150415_1749 1172055 N/A 585000
xe100_150416_1832 1148282 N/A 473282
xe100_150419_1611 500000 486000 358000
xe100_150420_0304 405328 389328 404328
xe100_150420_1809 52000 104000 52000
Total 5093213 2737876 3255158

In [ ]: