3 from __future__
import print_function
8 if __name__ ==
'__main__':
11 parser = optparse.OptionParser(
'Usage: %prog lumi.csv')
13 (options, args) = parser.parse_args()
16 print(
"You must provide a CSV file\n")
20 sepRE = re.compile (
r'[\s,;:]+')
21 totDelivered = totRecorded = 0.
22 events = open (args[0],
'r') 26 pieces = sepRE.split (line.strip())
30 run, lumi = int ( pieces[0] ), int ( pieces[1] )
31 delivered, recorded =
float( pieces[2] ),
float( pieces[3] )
34 if not minRun
or run < minRun:
37 if run == minRun
and lumi < minLumi:
39 if not maxRun
or run > maxRun:
42 if run == maxRun
and lumi > maxLumi:
44 totDelivered += delivered
45 totRecorded += recorded
46 print(
"Runs (%d, %d) to (%d, %d)" % (minRun, minLumi, maxRun, maxLumi))
48 if totRecorded > 1000.:
52 if totRecorded > 1000.:
56 if totRecorded > 1000.:
60 print(
"Total Delivered %.1f 1/%s Total Recorded %.1f 1/%s" % \
61 (totDelivered, unit, totRecorded, unit))
S & print(S &os, JobReport::InputFile const &f)