2 from __future__
import print_function
8 numpy.set_printoptions(threshold=sys.maxsize)
10 parser = argparse.ArgumentParser(description=
"Display in text format a single ME out of a DQM (legacy or DQMIO) file. " +
11 "If there is more than on copy, of one ME, all are shown.")
13 parser.add_argument(
'filename', help=
'Name of local root file. For remote files, use edmCopyUtil first: `edmCopyUtil root://cms-xrd-global.cern.ch/<FILEPATH> .`')
14 parser.add_argument(
'mepaths', metavar=
'ME', nargs=
'+', help=
'Path of ME to extract.')
16 args = parser.parse_args()
18 f = uproot.open(args.filename)
20 if 'Indices;1' in things:
37 trees = [{
"FullName": f[name][
"FullName"].
array(),
"Value": f[name][
"Value"].lazyarray()}
for name
in treenames]
41 if n <= 1:
return lower
42 mid =
int(n / 2) + lower
43 if a[mid] < key:
return binsearch(a, key, mid, upper)
44 else:
return binsearch(a, key, lower, mid)
46 for k
in range(lower, upper):
47 if a[k] == key:
return k
50 indices = f[
'Indices'].lazyarrays()
51 for idx
in range(len(indices[
"Run"])):
52 run = indices[
"Run"][idx]
53 lumi = indices[
"Lumi"][idx]
54 type = indices[
"Type"][idx]
55 first =
int(indices[
"FirstIndex"][idx])
56 last =
int(indices[
"LastIndex"][idx])
57 if type == 1000:
continue
58 names = trees[type][
"FullName"]
59 for me
in args.mepaths:
62 meobj = trees[type][
"Value"][k]
63 print(
"ME for run %d, lumi %d" % (run, lumi), meobj)
66 elif 'DQMData;1' in things:
67 basedir = f[
'DQMData']
68 for run
in basedir.keys():
69 if not run.startswith(
"Run "):
continue
71 print(
"MEs for %s" % run)
72 for me
in args.mepaths:
73 subsys, path = me.split(
'/', 1)
74 subsysdir = rundir[subsys]
76 for lumi
in subsysdir.keys():
77 print(
" MEs for %s" % lumi)
78 lumidir = subsysdir[lumi]