2 from __future__
import print_function
7 from collections
import defaultdict
9 parser = argparse.ArgumentParser(description=
"Show which runs and lumisections are contained in a DQMIO file.")
11 parser.add_argument(
'filename', help=
'Name of local root file. For remote files, use edmCopyUtil first: `edmCopyUtil root://cms-xrd-global.cern.ch/<FILEPATH> .`')
13 args = parser.parse_args()
15 f = uproot.open(args.filename)
17 if 'Indices;1' in things:
18 indices = f[
'Indices']
21 firstindex = indices[
'FirstIndex'].
array()
22 lastindex = indices[
'LastIndex'].
array()
25 counts = defaultdict(
lambda: 0)
26 for run, lumi, first, last, type
in zip(runs, lumis, firstindex, lastindex, types):
31 counts[(run, lumi)] += n
34 currentrun, currentcount = 0, 0
35 minlumi, maxlumi = 0, 0
39 if (minlumi, maxlumi) == (0, 0):
40 print(
"Run %d, %d MEs" % (currentrun, currentcount))
42 print(
"Run %d, Lumi %d-%d, %d MEs" % (currentrun, minlumi, maxlumi, currentcount))
44 for ((run, lumi), count)
in sorted(counts.items()):
45 if (currentrun, currentcount) != (run, count)
or (lumi != maxlumi+1):
47 minlumi, maxlumi = lumi, lumi
48 currentrun, currentcount = run, count
53 print(
"Total: %d runs, %d lumisections." % (len([run
for run, lumi
in counts
if lumi == 0]), len([lumi
for run, lumi
in counts
if lumi != 0])))
56 print(
"This does not look like DQMIO data.")
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)