2 from __future__
import print_function
7 from prettytable
import PrettyTable
8 from collections
import defaultdict
10 parser = argparse.ArgumentParser(description=
"Shows Indices table in a DQMIO file. Last column (ME count) is computed like this: lastIndex - firstIndex + 1")
12 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 args = parser.parse_args()
16 typeNames = [
'Ints',
'Floats',
'Strings',
'TH1Fs',
'TH1Ss',
'TH1Ds',
17 'TH2Fs',
'TH2Ss',
'TH2Ds',
'TH3Fs',
'TProfiles',
'TProfile2Ds']
19 f = uproot.open(args.filename)
21 if 'Indices;1' in things:
22 indices = f[
'Indices']
23 runs = indices.array(
'Run')
24 lumis = indices.array(
'Lumi')
25 firstindex = indices.array(
'FirstIndex')
26 lastindex = indices.array(
'LastIndex')
27 types = indices.array(
'Type')
30 table.field_names = [
'Run',
'Lumi',
'FirstIndex',
'LastIndex',
'Type',
'ME Count']
32 for run, lumi, first, last, type
in zip(runs, lumis, firstindex, lastindex, types):
34 if type < len(typeNames):
35 typeName = typeNames[type]
37 table.add_row([run, lumi, first, last,
'%s (%s)' % (type, typeName),
int(last - first + 1)])
41 print(
"This does not look like DQMIO data.")
OutputIterator zip(InputIterator1 first1, InputIterator1 last1, InputIterator2 first2, InputIterator2 last2, OutputIterator result, Compare comp)
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)