ATLAS Offline Software
TileCalorimeter
TileConditions
share
convertBadChannels.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
import
sys
3
4
5
#
6
#__________________________________________________________________
7
def
dec2hex
(n):
8
return
(
"0%X"
% n)[-2:]
9
10
11
#
12
#__________________________________________________________________
13
modToFrag = {
'LBA'
:
'0x1'
,
14
'LBC'
:
'0x2'
,
15
'EBA'
:
'0x3'
,
16
'EBC'
:
'0x4'
}
17
18
inFile = sys.argv[1]
19
20
buf =
""
21
22
lines =
open
(inFile,
"r"
).readlines()
23
for
line
in
lines:
24
field = line.split(
":"
)
25
if
not
len(field):
continue
26
module = field[0][:3]
27
modNum =
int
(field[0][3:]) - 1
28
chan =
int
(field[1])
29
type = field[2].strip()
30
31
hexModule = modToFrag[module] +
dec2hex
(modNum)
32
33
lhstat =
""
34
if
type==
"L"
: lhstat =
"1\t0"
35
elif
type==
"H"
: lhstat =
"0\t1"
36
elif
type==
"B"
: lhstat =
"1\t1"
37
else
:
38
raise(
"unkown type \"%s\""
%type)
39
40
buf = buf +
"Bch\t%s\t%s\t%s\n"
% (hexModule,chan,lhstat)
41
42
print
buf
43
44
bchFile =
open
(
"Tile2007.bch"
,
"w"
)
45
bchFile.write(buf)
46
bchFile.close()
CaloCellPos2Ntuple.int
int
Definition:
CaloCellPos2Ntuple.py:24
Trk::open
@ open
Definition:
BinningType.h:40
convertBadChannels.dec2hex
def dec2hex(n)
Definition:
convertBadChannels.py:7
Generated on Sun Dec 22 2024 21:08:36 for ATLAS Offline Software by
1.8.18