3 from __future__
import print_function
4 from contentValuesLib
import *
7 """ Option parser class """ 9 optparse.OptionParser.__init__(self, usage=
"%prog [options] root_file ...", version=
"%prog 0.0.1", conflict_handler=
"resolve")
10 self.add_option(
"--silent",
"-s", action=
"store_true", dest=
"silent", default=
False, help=
"silent mode: specify return code and exit")
11 self.add_option(
"--subsystem",
"-c", action=
"store", type=
"string", dest=
"subsystem", default=
None, help=
"Specify test subsystem")
13 if __name__ ==
"__main__":
17 (opts, args) = optManager.parse_args()
22 print(
"At least one ROOT file must be priovided, use --help for hit")
30 print(
"File [", rfile,
"] not exists or is not accessible?")
33 ss = opts[
'subsystem']
38 (run_number, values) =
getSummaryValues(file_name = rfile, shift_type =
None, translate =
False, filters =
None)
40 if values ==
None or len(values) == 0:
41 print(
"No content summary values found. Skipping file: %s" % rfile)
45 for sub
in SUBSYSTEMS.keys():
47 if not ss ==
None and not sub == ss:
51 messages.append(
"%s: missing subsystem!" % sub)
57 for folder
in FOLDERS.keys():
59 if folder
not in values[sub]:
60 messages.append(
"%s: missing folder EventInfo/%s" % (sub, folder))
63 if len(values[sub][folder]) == 0:
64 messages.append(
"%s: empty folder EventInfo/%s" % (sub, FOLDERS[folder][1]))
67 sfolders.append(folder)
69 if 'Summary' not in values[sub][folder]:
70 messages.append(
"%s: missing summary value EventInfo/%s" % (sub, FOLDERS[folder][1]))
72 for key
in values[sub][folder].
keys():
81 for folder
in sfolders:
82 if skeys[key].
count(folder) == 0: nfound.append(folder)
84 messages.append(
"%s: value (%s)/%s not found in (%s)" % (sub,
','.
join(skeys[key]), key,
','.
join(nfound)))
86 if not opts[
'silent']:
87 for message
in sorted(messages):
print(message)
88 print(
"%d errors found" % len(messages))
90 if len(messages) > 0: sys.exit(1)
def getSummaryValues(file_name, translate, filters=None)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)
static std::string join(char **cmd)