3 from FWCore.PythonUtilities.LumiList
import LumiList
7 if __name__ ==
'__main__':
9 parser = optparse.OptionParser (
"Usage: %prog [--options] edm1.root [edm2.root...]",
10 description=
'Runs over input EDM files and prints out a list of contained lumi sections')
11 parser.add_option (
'--intLumi', dest=
'intLumi', action=
'store_true',
12 help=
'print out total recorded and delivered integrated luminosity')
13 parser.add_option (
'--output', dest=
'output', type=
'string',
14 help=
'save lumi sections output to file OUTPUT')
15 (options, args) = parser.parse_args()
18 from DataFormats.FWLite
import Lumis, Handle
20 raise RuntimeError,
"Must provide at least one input file"
24 handle = Handle (
'LumiSummary')
25 label = (
'lumiProducer')
27 handle, lable =
None,
None
31 delivered = recorded = 0
33 runList = runsLumisDict.setdefault (lum.aux().
run(), [])
34 runList.append( lum.aux().
id().luminosityBlock() )
37 lum.getByLabel (label, handle)
38 summary = handle.product()
39 delivered += summary.avgInsDelLumi()
40 recorded += summary.avgInsRecLumi()
43 jsonList = LumiList (runsAndLumis = runsLumisDict)
45 jsonList.writeJSON (options.output)
51 print "\nNote: These numbers should be considered approximate. For official numbers, please use lumiCalc.py"
52 print "delivered %.1f mb, recorded %.1f mb" % \