ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Functions
FileMerger Namespace Reference
Functions
MergeCalibFiles
(layers)
readFile
(name)
Function Documentation
◆
MergeCalibFiles()
MergeCalibFiles
(
layers
)
Definition at line
8
of file
FileMerger.py
.
8
def
MergeCalibFiles(layers):
9
if
(len(layers)==0):
10
print
(
"MergeCalibFiles - ERROR no layer provided."
)
11
return
1
12
mergedDict = {}
13
for
i
in
layers:
14
mergedDict.update(readFile((
"calibration_%s.txt"
% i)))
15
16
17
mergedDict = dict(sorted(mergedDict.items()))
18
f = open(
"calibration_merged.txt"
,
"w"
)
19
for
value
in
mergedDict.values():
20
f.write(value)
21
f.close()
22
23
return
0
24
25
26
# Function to read the calibration_XXXXX.txt file of each layer
if
if(pathvar)
Definition
SealSharedLib.cxx:168
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
◆
readFile()
readFile
(
name
)
Definition at line
27
of file
FileMerger.py
.
27
def
readFile(name):
28
mydict = {}
29
if
not
os.path.exists(name):
30
print
(
"MergeCalibFiles - ERROR File name %22s not found"
% name)
31
return
mydict
32
else
:
33
print
(
"MergeCalibFiles - Reading: %22s"
% name)
34
35
with
open(name)
as
fp:
36
lines = fp.readlines()
37
mod = -1
38
for
line
in
lines:
39
# Module names for Pixel layers starts with D or L
40
if
line.startswith(
"L"
)
or
line.startswith(
"D"
):
41
line = line.rstrip(
"\n"
)
42
splittedline = line.split(
" "
)
43
44
if
int(splittedline[1])
in
mydict.keys():
45
print
(
"MergeCalibFiles - ERROR Module key exists already - Contact pixel offline team"
)
46
exit(1)
47
else
:
48
mydict[int(splittedline[1])] = splittedline[0]+
' '
+splittedline[1]+
"\n"
49
mod = int(splittedline[1])
50
51
# Pixel frontends start with letter I
52
elif
line.startswith(
"I"
):
53
mydict[mod] = mydict[mod] + line
54
else
:
55
print
(
"MergeCalibFiles - ERROR Line is not a module or a frontend - Contact pixel offline team"
)
56
exit(1)
57
58
return
mydict
59
60
# Just used for testing - Experts only
Generated on
for ATLAS Offline Software by
1.17.0