ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tools
PROCTools
python
evaluateDiffRoot.py
Go to the documentation of this file.
1
#!/usr/bin/env python
2
3
# Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
4
5
6
from
optparse
import
OptionParser
7
8
9
"""
10
after a list of tests is extracted from the infile
11
add differences to the dicts
12
"""
13
def
getResults
(infile, test_dict):
14
for
test
in
test_dict.keys():
15
for
ftype
in
[
'ESD'
,
'AOD'
]:
16
linenr = 0
17
f = open(infile,
'r'
)
18
doRead =
False
19
for
line
in
f:
20
linenr += 1
21
if
line.startswith(
'Py:diff-root INFO old:'
)
and
test
in
line
and
ftype
in
line:
22
doRead =
True
23
if
line.startswith(
'Py:Acmd'
):
24
doRead =
False
25
if
doRead
and
(
"leaves differ"
in
line
or
"WARNING"
in
line):
26
if
line.split(
'\n'
)[0]
not
in
test_dict[test][ftype]:
27
test_dict[test][ftype].append(line.split(
'\n'
)[0])
28
29
if
debugmode
and
doRead:
30
print
(
"DEBUG: %s: %s"
%(linenr,line.split(
'\n'
)[0]))
31
32
return
test_dict
33
34
"""
35
create initial dict including all tests which have been probed
36
"""
37
def
getTests
(infile, selected_test):
38
test_dict = {}
39
f = open(infile,
'r'
)
40
for
line
in
f:
41
if
"CHANGED"
in
line
or
"IDENTICAL"
in
line:
42
test = line.split()[0]
43
if
selected_test
and
test
not
in
selected_test:
44
continue
45
test_dict[test] = {
'ESD'
: [],
46
'AOD'
: [],
47
'status'
: line.split()[1]}
48
f.close()
49
return
test_dict
50
51
52
"""
53
prints sorted summary of tests
54
"""
55
def
reportOverview
(test_dict):
56
list_sorted = sorted(test_dict.keys())
57
for
test
in
list_sorted:
58
#print ("%20s %s" %(test, test_dict[test]['status']))
59
print
(
'{0:50} {1:10}'
.format(test, test_dict[test][
'status'
]))
60
61
62
"""
63
prints detailed diff on screen
64
"""
65
def
reportDiffs
(test_dict):
66
list_sorted = sorted(test_dict.keys())
67
for
test
in
list_sorted:
68
if
test_dict[test][
'status'
] ==
'IDENTICAL'
:
69
continue
70
print
(test, test_dict[test][
'status'
])
71
for
item
in
[
'ESD'
,
'AOD'
]:
72
print
(item)
73
for
line
in
test_dict[test][item]:
74
print
(line)
75
print
()
76
print
()
77
78
79
"""
80
print all
81
"""
82
def
printDict
(test_dict):
83
print
(
"Overview:"
)
84
print
(
"=========="
)
85
reportOverview
(test_dict)
86
print
()
87
print
()
88
print
()
89
print
(
"Details"
)
90
print
(
"========"
)
91
reportDiffs
(test_dict)
92
93
94
95
96
"""
97
Main function here
98
"""
99
if
__name__ ==
"__main__"
:
100
parser=OptionParser(usage=
"\n ./sstat \n"
)
101
parser.add_option(
"-f"
,
"--file"
,type=
"string"
,dest=
"infile"
,default=
"ESDTAGCOMM_comparison_diffroot_log"
,help=
"inputfile diff-root"
)
102
parser.add_option(
"-t"
,
"--test"
,type=
"string"
,dest=
"test"
,default=
None
,help=
"condensed output file"
)
103
#parser.add_option("-o","--outfile" ,type="string" ,dest="outfile" ,default="summary.txt" ,help="condensed output file")
104
parser.add_option(
"-d"
,
"--debug"
, action=
"store_true"
, dest=
"verbose"
, default=
False
, help=
"print extra DEBUG messages"
)
105
(options,args)=parser.parse_args()
106
107
debugmode = options.verbose
108
109
infile_name =
'ESDTAGCOMM_comparison_diffroot_log'
110
111
selected_tests =
None
112
if
options.test:
113
selected_tests = options.test.split(
","
)
114
115
# first create the dict of tests
116
test_dict =
getTests
(options.infile, selected_tests)
117
# then overwrite the format types with diff info
118
test_dict =
getResults
(options.infile,test_dict )
119
120
121
122
printDict
(test_dict)
print
void print(char *figname, TCanvas *c1)
Definition
TRTCalib_StrawStatusPlots.cxx:26
python.evaluateDiffRoot.reportDiffs
reportDiffs(test_dict)
Definition
evaluateDiffRoot.py:65
python.evaluateDiffRoot.reportOverview
reportOverview(test_dict)
Definition
evaluateDiffRoot.py:55
python.evaluateDiffRoot.printDict
printDict(test_dict)
Definition
evaluateDiffRoot.py:82
python.evaluateDiffRoot.getTests
getTests(infile, selected_test)
Definition
evaluateDiffRoot.py:37
python.evaluateDiffRoot.getResults
getResults(infile, test_dict)
Definition
evaluateDiffRoot.py:13
Generated on
for ATLAS Offline Software by
1.17.0