2 from __future__
import with_statement
4 from DCSCalculator2.subdetectors
import LAr, Lucid, MDT, Pixels, RPC, SCT, TDQ, Tile, TGC, TRT
6 from DQUtils.general
import timer, kgrind_profile
8 from DQUtils.db
import fetch_iovs
9 from DQUtils.iov_arrangement
import inverse_lblb
10 from DQUtils.utils
import pprint_objects
11 from DQUtils.sugar
import RunLumi
13 from DQUtils.iov_differences
import emit_iov_differences
17 Sum the number of luminosity blocks spanned by a run
19 return sum(iov.until - iov.since
for iov
in iovs)
23 assert (before.since, before.until) == (after.since, after.until)
24 assert before._fields == after._fields
26 if not hasattr(
type(before),
"_is_empty"):
type(before)._is_empty =
False
27 if not hasattr(
type(after),
"_is_empty"):
type(after)._is_empty =
False
29 print " ", before.since, before.until,
32 print " Empty -> Filled"
34 print " Filled -> Empty"
36 for field, val_before, val_after
in zip(before._fields, before, after):
37 if val_before != val_after:
38 print field, val_before,
"->", val_after,
46 for output_channel
in sorted(
set(a.keys() + b.keys())):
50 diff = emit_iov_differences(A, B)
51 print " [BAD] diff iovs =", len(diff),
"lbs =",
sum_lbs(zip(*diff)[0])
52 print " First ten diffs:"
70 with timer(
"Read LBLB"):
71 lblb =
fetch_iovs(
"LBLB", since, until, with_channel=
False)
90 with timer(
"Calculate result for %s" % system):
91 result = system.run(lbtime)
97 print "Run range:", since,
"to", until
98 print "DCSC2 intervals of validity:"
102 output_channels = system.mapping.keys()
103 iovs =
fetch_iovs(
"DCSOFL", since, until, output_channels)
107 print "Original DCSC intervals of validity:"
118 if __name__ ==
"__main__":
120 from IPython.Shell
import IPShellEmbed
121 ipython_instance = IPShellEmbed([
"-pdb"], rc_override=dict(quiet=
True))
123 from DQUtils.logger
import init_logging