-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadNuisances.py
executable file
·41 lines (33 loc) · 1.06 KB
/
readNuisances.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
import re
file=open('test_nuisance.txt')
t=file.read()
z=t.split('\n')
name=[]
sf=[]
input_uncertainty = 0.2
for line in z:
values=[]
if line.find('SF') > 0: # the line contain information about SF
polished_line=re.sub(' * |,|!','#',line)
polished_list=polished_line.split('#')
for i in polished_list: # in order are: background dx/sigma_in sigma_out/sigma_in ; signal dx/sigma_in sigma_out/sigma_in ; rho
try:
l=eval(i)
values.append(i)
# print l
except:
if( i != '' ):
name.append(i)
else:
continue
# print i + str(" is a string")
if( len(values) > 0 ):
sf.append(values)
print values
print name
print sf
for i in range(0,len(name)):
sf_i = 1+eval(sf[i][0])*input_uncertainty
sf_e = eval(sf[i][1])*input_uncertainty
print str(name[i]) + " associated with " + str(sf[i])
print str(name[i]) + " associated with " + str(sf_i) + " pm " + str(sf_e)