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