5 if iov.since.run
not in runends:
6 print(
'Missing run', iov.since.run,
'from EOR_Params')
8 rv =
filter(
None, [iov.intersect(runends[iov.since.run])
9 for iov
in iovs
if iov.since.run
in runends])
10 rv =
filter(
lambda x: not(x.until.lumi-x.since.lumi == 0),
15 from DQUtils.db
import fetch_iovs
16 from DQUtils.sugar
import RunLumi
18 with_channel=
False, what=[])
20 for iov
in eor_params:
21 if iov.since.lumi == 0: iov = iov._replace(since=
RunLumi(iov.since.run, 1))
22 runends[iov.since.run] = iov
29 while pos < len(iovs):
32 while pos < len(iovs):
34 if niov.since != tiov.until:
36 tiov = tiov._replace(until=niov.until)
41 if __name__ ==
'__main__':
44 parser = optparse.OptionParser()
45 parser.add_option(
'--defectdb', default=
'defectstest.db/COMP200',
46 help=
'Set defect database')
47 parser.add_option(
'--vfdb', default=
'LBSUMM',
48 help=
'Set DQ flag database (connection string format as in DQUtils.db.Databases)')
50 opts, args = parser.parse_args()
53 import VirtualFlags, DQUtils
54 from DQDefects
import DefectsDB
55 print(
'Getting virtual flag information...', end=
'')
56 vfdb = DQUtils.db.Databases.get_folder(opts.vfdb)
57 vff = VirtualFlags.VirtualFlagFolder(vfdb)
58 mapping = vff.get_flag_name_id_mapping()
61 print(
'Getting virtual defect information...', end=
'')
62 ddb = DefectsDB(opts.defectdb, read_only=
True)
63 defectids, defectnames, defectdict = ddb.get_virtual_channels()
66 print(
'Retrieving run ends...', end=
'')
71 if not isinstance(key, str):
continue
73 if key
not in defectdict
or key
in [
'IDPF',
'LCD',
'MET',
'IDBCM',
'TIGB']:
74 print(
'MISSING:', key)
77 vfiovs =
do_compact(vff.browseObjects((152166,0), (167845,0), [key],
'DetStatus-v03-repro05-01', selection=
lambda x: x.Code < 3))
79 d1 =
set([((x.since.run, x.since.lumi), (x.until.run, x.until.lumi))
for x
in truncate_iovs_to_runs(vfiovs, runends)
if x.since.run != 152220])
80 diovs =
do_compact(ddb.retrieve((152166,0), (167845,0), [key]))
81 d2 =
set([((x.since.run, x.since.lumi), (x.until.run, x.until.lumi))
for x
in truncate_iovs_to_runs(diovs, runends)
if x.since.run != 152220])
85 d1a = dict([(((x.since.run, x.since.lumi), (x.until.run, x.until.lumi)), x.Comment)
for x
in truncate_iovs_to_runs(vfiovs, runends)])
86 d2a = dict([(((x.since.run, x.since.lumi), (x.until.run, x.until.lumi)), x.comment)
for x
in truncate_iovs_to_runs(diovs, runends)])
88 print(
'In VF but not defects:', [(x, d1a[x])
for x
in d1-d2])
89 print(
'In defects but not VF:', [(x, d2a[x])
for x
in d2-d1])