3 from DCSCalculator2.subdetectors
import LAr, Lucid, MDT, Pixels, RPC, SCT, TDQ, Tile, TGC, TRT
5 from DQUtils.general
import timer, kgrind_profile
7 from DQUtils.db
import fetch_iovs
8 from DQUtils.iov_arrangement
import inverse_lblb
9 from DQUtils.utils
import pprint_objects
10 from DQUtils.sugar
import RunLumi
12 from DQUtils.iov_differences
import emit_iov_differences
16 Sum the number of luminosity blocks spanned by a run
18 return sum(iov.until - iov.since
for iov
in iovs)
22 assert (before.since, before.until) == (after.since, after.until)
23 assert before._fields == after._fields
25 if not hasattr(
type(before),
"_is_empty"):
type(before)._is_empty =
False
26 if not hasattr(
type(after),
"_is_empty"):
type(after)._is_empty =
False
28 print " ", before.since, before.until,
31 print " Empty -> Filled"
33 print " Filled -> Empty"
35 for field, val_before, val_after
in zip(before._fields, before, after):
36 if val_before != val_after:
37 print field, val_before,
"->", val_after,
45 for output_channel
in sorted(
set(a.keys() + b.keys())):
49 diff = emit_iov_differences(A, B)
50 print " [BAD] diff iovs =", len(diff),
"lbs =",
sum_lbs(zip(*diff)[0])
51 print " First ten diffs:"
69 with timer(
"Read LBLB"):
70 lblb =
fetch_iovs(
"LBLB", since, until, with_channel=
False)
89 with timer(
"Calculate result for %s" % system):
90 result = system.run(lbtime)
96 print "Run range:", since,
"to", until
97 print "DCSC2 intervals of validity:"
101 output_channels = system.mapping.keys()
102 iovs =
fetch_iovs(
"DCSOFL", since, until, output_channels)
106 print "Original DCSC intervals of validity:"
117 if __name__ ==
"__main__":
119 from IPython.Shell
import IPShellEmbed
120 ipython_instance = IPShellEmbed([
"-pdb"], rc_override=dict(quiet=
True))
122 from DQUtils.logger
import init_logging