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():
70 print(
"MEs for %s" % run)
71 for me
in args.mepaths:
72 subsys, path = me.split(
'/', 1)
73 subsysdir = rundir[subsys]
75 for lumi
in subsysdir.keys():
76 print(
" MEs for %s" % lumi)
77 lumidir = subsysdir[lumi]
S & print(S &os, JobReport::InputFile const &f)
def binsearch(a, key, lower, upper)
def linsearch(a, key, lower, upper)