3 from __future__
import print_function
4 from FWCore.PythonUtilities.LumiList
import LumiList
8 if __name__ ==
'__main__':
10 parser = optparse.OptionParser (
"Usage: %prog [--options] edm1.root [edm2.root...]",
11 description=
'Runs over input EDM files and prints out a list of contained lumi sections')
12 parser.add_option (
'--intLumi', dest=
'intLumi', action=
'store_true',
13 help=
'print out total recorded and delivered integrated luminosity')
14 parser.add_option (
'--output', dest=
'output', type=
'string',
15 help=
'save lumi sections output to file OUTPUT')
16 (options, args) = parser.parse_args()
19 from DataFormats.FWLite
import Lumis, Handle
21 raise RuntimeError(
"Must provide at least one input file")
25 handle = Handle (
'LumiSummary')
26 label = (
'lumiProducer')
28 handle, lable =
None,
None
32 delivered = recorded = 0
34 runList = runsLumisDict.setdefault (lum.aux().
run(), [])
35 runList.append( lum.aux().
id().luminosityBlock() )
38 lum.getByLabel (label, handle)
39 summary = handle.product()
40 delivered += summary.avgInsDelLumi()
41 recorded += summary.avgInsRecLumi()
44 jsonList = LumiList (runsAndLumis = runsLumisDict)
46 jsonList.writeJSON (options.output)
52 print(
"\nNote: These numbers should be considered approximate. For official numbers, please use lumiCalc.py")
53 print(
"delivered %.1f mb, recorded %.1f mb" % \
54 (delivered, recorded))
uint16_t *__restrict__ id
void print(TMatrixD &m, const char *label=nullptr, bool mathematicaFormat=false)