-
Notifications
You must be signed in to change notification settings - Fork 0
/
unpackRx_2.py
36 lines (33 loc) · 1018 Bytes
/
unpackRx_2.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
import math
import numpy
ptLSB = 0.25
etaLSB = 1#0.0043633231
phiLSB = 1#0.0043633231
data = []
zeros = '0000000000000000'
frameIt = -1
wCount = -1
with open("ttBarPacked.dat", "r") as inFile:
for line in inFile:
if('1v' in line):
frameIt += 1
linkData = line.split('1v')
frameData = []
if zeros not in linkData[1]:
wCount +=1
else:
wCount = 0
for wordIt in xrange(1,25):
word = linkData[wordIt].replace(' ','')
frameData.append(word) if int(word, 16) & 0xffff else 0
#frameData.append(word) if word not in zeros else 0
data.append(frameData) if frameData else 0
data.append('\n') if (not (frameIt-1)%13 and frameIt > 1) else 0
for region in data:
if '\n' in region:
print(' ')
continue
for pfCand in region:
print(str((int(pfCand, 16) & 0xffff) * ptLSB)[:6] +
'\t' + str(((int(pfCand, 16) >> 26) & 0x3ff) * etaLSB)[:4] +
'\t' + str(((int(pfCand, 16) >> 16) & 0x3ff) * phiLSB)[:4] )