7 if __name__ ==
'__main__':
10 parser = optparse.OptionParser(
'Usage: %prog lumi.csv')
12 (options, args) = parser.parse_args()
15 print "You must provide a CSV file\n"
19 sepRE = re.compile (
r'[\s,;:]+')
20 totDelivered = totRecorded = 0.
21 events = open (args[0],
'r')
25 pieces = sepRE.split (line.strip())
29 run, lumi = int ( pieces[0] ), int ( pieces[1] )
30 delivered, recorded = float( pieces[2] ), float( pieces[3] )
33 if not minRun
or run < minRun:
36 if run == minRun
and lumi < minLumi:
38 if not maxRun
or run > maxRun:
41 if run == maxRun
and lumi > maxLumi:
43 totDelivered += delivered
44 totRecorded += recorded
45 print "Runs (%d, %d) to (%d, %d)" % (minRun, minLumi, maxRun, maxLumi)
47 if totRecorded > 1000.:
51 if totRecorded > 1000.:
55 if totRecorded > 1000.:
59 print "Total Delivered %.1f 1/%s Total Recorded %.1f 1/%s" % \
60 (totDelivered, unit, totRecorded, unit)