-
Notifications
You must be signed in to change notification settings - Fork 0
/
newmakecut.py
55 lines (49 loc) · 1.91 KB
/
newmakecut.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 6 22:19:33 2018
@author: jason
"""
import argparse
import os
import subprocess
import sys
import numpy as np
ANGRE_WIDTH = 0.05
FHIT_WIDTH = 0.1
ENERGY_WIDTH = 0.25
ENERGY_OFFSET = 2.50
ename="rec.logNNEnergy"
parser = argparse.ArgumentParser()
parser.add_argument('file', nargs='+', help='path to the file')
parser.add_argument('out', nargs='+', help='path to the outfile')
args_namespace = parser.parse_args()
args = vars(args_namespace)['file'][0]
out= vars(args_namespace)['out'][0]
result=np.loadtxt(args,delimiter=',')
#os.remove(out)
#fbin=np.append(np.insert(np.linspace(0.1, 0.9, num=9),0,0.05),1)
#ebin=np.linspace(2.5, 5.5, num=13)
fbin = list(range(10))
ebin = list(range(12))
t=0
for i in range(len(fbin)):
for j in range(len(ebin)):
#bins+=1
other_cut_string = str(t)+" \"{} * rec.nChAvail < rec.nHitSP20 && " \
"rec.nHitSP20 <= {} * rec.nChAvail && "\
"{} < {} && " \
"{} <= {} && " \
"rec.angleFitStatus == 0 && " \
"rec.angleFitStatus == 0 && " \
"rec.dec <= 0.41887902&& " \
"0.34906585 <=rec.dec && " \
"rec.ra <= 1.49225651 && " \
"1.42244334 <= rec.ra && " \
"rec.nChAvail >= 700 && " \
"rec.zenithAngle < 0.785 && " \
"rec.coreFiduScale <= 100.0&&" \
"{}<=rec.proba\"\n".format( FHIT_WIDTH * fbin[i], FHIT_WIDTH * (fbin[i] + 1), ENERGY_WIDTH * ebin[i] + ENERGY_OFFSET, ename, ename, ENERGY_WIDTH * (ebin[i] + 1) + ENERGY_OFFSET,result[t,2])
t+=1
with open(out,"a") as myfile:
myfile.write(other_cut_string)