ATLAS Offline Software
Loading...
Searching...
No Matches
WriteBchToCool.py
Go to the documentation of this file.
1#!/bin/env python
2
3# Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4#
5# WriteBchToCool.py
6# Alexander Solodkov <Sanya.Solodkov@cern.ch>, 2014-09-09
7# change Yuri Smirnov <iouri.smirnov@cern.ch>, 2014-12-24
8
9import getopt,sys,os,bisect
10os.environ['TERM'] = 'linux'
11
12def usage():
13 print ("Usage: ", sys.argv[0]," [OPTION] ... ")
14 print ("Update TileCal bad channels in COOL")
15 print ("")
16 print ("-h, --help shows this help")
17 print ("-f, --folder= specify folder to use, default is /TILE/OFL02/STATUS/ADC")
18 print ("-t, --tag= specify tag to use, default is RUN2-HLT-UPD1-00")
19 print ("-r, --run= specify run number, default is 0")
20 print ("-N, --run1= specify run number at which new IOV should be ended")
21 print ("-l, --lumi= specify lumi block number, default is 0")
22 print ("-B, --lumi1= specify lumi block number at which new IOV should be eneded, default is 0")
23 print ("-b, --begin= specify run number of first iov in multi-iov mode, by default uses very first iov")
24 print ("-e, --end= specify run number of last iov in multi-iov mode, by default uses latest iov")
25 print ("-L, --endlumi= specify lumi block number for last iov in multi-iov mode, default is 0")
26 print ("-A, --adjust in multi-iov mode adjust iov boundaries to nearest iov available in DB, default is False")
27 print ("-M, --module= specify module to use in multi-IOV update, default is all")
28 print ("-m, --mode= specify update mode: 1 or 2; if not set - choosen automatically, depending on schema")
29 print ("-c, --comment= specify comment which should be written to DB, in multi-iov mode it is appended to old comment")
30 print ("-C, --Comment= specify comment which should be written to DB, in mutli-iov mode it overwrites old comment")
31 print ("-U, --user= specify username for comment")
32 print ("-x, --execfile= specify python file which should be executed, default is bch.py")
33 print ("-i, --inschema= specify the input schema to use, default is 'COOLOFL_TILE/CONDBR2'")
34 print ("-o, --outschema= specify the output schema to use, default is 'sqlite://;schema=tileSqlite.db;dbname=CONDBR2'")
35 print ("-n, --online write additional sqlite file with online bad channel status")
36 print ("-p, --upd4 write additional sqlite file with CURRENT UPD4 tag")
37 print ("-v, --verbose verbose mode")
38 print ("-s, --schema= specify input/output schema to use when both input and output schemas are the same")
39 print ("-S, --server= specify server - ORACLE or FRONTIER, default is FRONTIER")
40 print ("-u --update set this flag if output sqlite file should be updated, otherwise it'll be recreated")
41
42letters = "hr:l:N:B:b:e:L:AM:m:S:s:i:o:t:f:x:c:C:U:npvu"
43keywords = ["help","run=","lumi=","run1=","lumi1=","begin=","end=","endlumi=","adjust","module=","mode=","server=","schema=","inschema=","outschema=","tag=","folder=","execfile=","comment=","Comment=","user=","online","upd4","verbose","update"]
44
45try:
46 opts, extraparams = getopt.getopt(sys.argv[1:], letters, keywords)
47except getopt.GetoptError as err:
48 print (str(err))
49 usage()
50 sys.exit(2)
51
52# defaults
53run = -1
54lumi = 0
55run1 = -1
56lumi1 = 0
57mode = 0
58server = ''
59schema = 'sqlite://;schema=tileSqlite.db;dbname=CONDBR2'
60oraSchema = 'COOLOFL_TILE/CONDBR2'
61inSchema = oraSchema
62outSchema = schema
63folderPath = "/TILE/OFL02/STATUS/ADC"
64onlSuffix = ""
65curSuffix = ""
66tag = "UPD1"
67execFile = "bch.py"
68comment = ""
69Comment = None
70verbose = False
71update = False
72iov = False
73beg = 0
74end = 2147483647
75endlumi = 0
76moduleList = []
77adjust = False
78
79try:
80 user=os.getlogin()
81except Exception:
82 user="UnknownUser"
83
84for o, a in opts:
85 a = a.strip()
86 if o in ("-f","--folder"):
87 folderPath = a
88 elif o in ("-t","--tag"):
89 tag = a
90 elif o in ("-S","--server"):
91 server = a
92 elif o in ("-s","--schema"):
93 schema = a
94 inSchema = a
95 outSchema = a
96 elif o in ("-i","--inschema"):
97 inSchema = a
98 elif o in ("-o","--outschema"):
99 outSchema = a
100 elif o in ("-n","--online"):
101 onlSuffix = "_onl"
102 elif o in ("-p","--upd4"):
103 curSuffix = "_upd4"
104 elif o in ("-u","--update"):
105 update = True
106 elif o in ("-r","--run"):
107 run = int(a)
108 elif o in ("-l","--lumi"):
109 lumi = int(a)
110 elif o in ("-N","--run1"):
111 run1 = int(a)
112 elif o in ("-B","--lumi1"):
113 lumi1 = int(a)
114 elif o in ("-b","--begin"):
115 beg = int(a)
116 iov = True
117 elif o in ("-e","--end"):
118 end = int(a)
119 iov = True
120 elif o in ("-L","--endlumi"):
121 endlumi = int(a)
122 elif o in ("-A","--adjust"):
123 adjust = True
124 elif o in ("-M","--module"):
125 moduleList += a.split(",")
126 elif o in ("-m","--mode"):
127 mode = int(a)
128 elif o in ("-x","--execfile"):
129 execFile = a
130 elif o in ("-c","--comment"):
131 comment = a
132 elif o in ("-C","--Comment"):
133 Comment = a
134 comment = a
135 elif o in ("-U","--user"):
136 user = a
137 elif o in ("-v","--verbose"):
138 verbose = True
139 elif o in ("-h","--help"):
140 usage()
141 sys.exit(2)
142 else:
143 raise RuntimeError("unhandeled option")
144
145onl=("/TILE/ONL01" in folderPath)
146if onl:
147 if inSchema == oraSchema:
148 inSchema = inSchema.replace("COOLOFL","COOLONL")
149 oraSchema = oraSchema.replace("COOLOFL","COOLONL")
150if not len(outSchema):
151 outSchema = schema
152else:
153 schema = outSchema
154if not len(inSchema):
155 inSchema = schema
156update = update or (inSchema==outSchema)
157
158from TileCalibBlobPython import TileCalibTools
159from TileCalibBlobPython import TileBchTools
160from TileCalibBlobObjs.Classes import TileBchPrbs, TileBchDecoder, TileCalibUtils
161
162if iov and end >= TileCalibTools.MAXRUN:
163 end = TileCalibTools.MAXRUN
164 endlumi = TileCalibTools.MAXLBK
165until = (TileCalibTools.MAXRUN,TileCalibTools.MAXLBK)
166
167from TileCalibBlobPython.TileCalibLogger import getLogger
168log = getLogger("WriteBchToCool")
169import logging
170log.setLevel(logging.DEBUG)
171
172dbr = TileCalibTools.openDbConn(inSchema,server)
173folderTag = TileCalibTools.getFolderTag(dbr, folderPath, tag)
174log.info("Initializing bad channels from %s folder %s with tag %s", inSchema, folderPath, tag)
175
176iovList = []
177iovUntil = []
178iovListMOD = []
179iovListCMT = []
180iovUntilCMT = []
181blobReader = TileCalibTools.TileBlobReader(dbr,folderPath, folderTag)
182if iov:
183 #=== filling the iovList
184 log.info( "Looking for IOVs" )
185 if moduleList!=['CMT']:
186 for ros in range(1,5):
187 for mod in range(0,64):
189 if len(moduleList)>0 and modName not in moduleList and 'ALL' not in moduleList:
190 continue
191 iovList += blobReader.getIOVsWithinRange(ros,mod)
192 if 'CMT' in moduleList:
193 iovListMOD = iovList
194 iovListCMT = blobReader.getIOVsWithinRange(-1,1000)
195 if len(iovList)==0:
196 iovList = iovListCMT
197
198 import functools
199 def compare(item1,item2):
200 if item1[0]!=item2[0]:
201 return item1[0]-item2[0]
202 else:
203 return item1[1]-item2[1]
204 iovList=list(set(iovList))
205 iovList=sorted(iovList,key=functools.cmp_to_key(compare))
206 iovList+=[until]
207 iovListCMT+=[until]
208
209 since=(beg,lumi)
210 ib=bisect.bisect(iovList,since)-1
211 if ib<0:
212 ib=0
213 if iovList[ib] != since:
214 if adjust:
215 since = iovList[ib]
216 log.info( "Moving beginning of first IOV with new bad channels from (%d,%d) to (%d,%d)", beg,lumi,since[0],since[1])
217 else:
218 iovList[ib] = since
219 log.info( "Creating new IOV starting from (%d,%d) with new bad channels", beg,lumi)
220
221 if end<0:
222 ie=ib+1
223 if ie>=len(iovList):
224 ie=ib
225 until=iovList[ie]
226 log.info( "Next IOV without new bad channels starts from (%d,%d)", until[0],until[1])
227 else:
228 until=(end,endlumi)
229 ie=bisect.bisect_left(iovList,until)
230 if ie>=len(iovList):
231 ie=len(iovList)-1
232
233 if iovList[ie] != until:
234 if adjust:
235 until=iovList[ie]
236 log.info( "Moving end of last IOV from (%d,%d) to (%d,%d)", end,endlumi,until[0],until[1])
237 else:
238 log.info( "Keeping end of last IOV at (%d,%d) - new IOV is shorter than IOV in input DB", end,endlumi)
239 iovList[ie] = until
240
241
242 iovList = iovList[ib:ie]
243 iovUntil = iovList[1:] + [until]
244 begin = since
245 run = since[0]
246 lumi = since[1]
247 log.info( "IOVs: %s", str(iovList) )
248
249 if len(iovListMOD)>0 and len(iovListCMT)>0:
250 if Comment is None:
251 iovList += [until] # one more IOV for "UNDO" comment
252 iovUntil += [until] # one more IOV for "UNDO" comment
253 iovUntilCMT = []
254 for io,since in enumerate(iovList):
255 p = bisect.bisect(iovListCMT,since)
256 if p<len(iovListCMT):
257 iovUntilCMT += [iovListCMT[p]]
258 if iovUntil[io] != iovListCMT[p]:
259 log.info( "End of iov %s in comments record is %s", str(since),str(iovListCMT[p]))
260 else:
261 if since!=until:
262 iovUntilCMT += [since]
263 else:
264 iovList.pop(-1)
265 break
266 else:
267 iovUntilCMT = iovUntil
268
269 log.info( "%d IOVs in total, end of last IOV is %s", ie-ib,str(until))
270
271else:
272 #=== set run number
273 if run<0:
274 lumi=0
275 if "UPD4" in folderTag:
276 run=TileCalibTools.getPromptCalibRunNumber()
277 log.warning( "Run number is not specified, using minimal run number in calibration loop %d", run )
278 else:
279 run=TileCalibTools.getNextRunNumber()
280 log.warning( "Run number is not specified, using next run number %d", run )
281 if run<0:
282 log.error( "Bad run number" )
283 sys.exit(2)
284 if run1>run or (run1==run and lumi1>lumi):
285 until = (run1,lumi1)
286
287 since = (run, lumi)
288 iovList = [since]
289 iovUntil = [until]
290 iovUntilCMT = [until]
291 begin=since
292
293 log.info("Initializing for run %d, lumiblock %d", run,lumi)
294
295
296if mode == 0:
297 if inSchema == outSchema:
298 mode = 1
299 else:
300 mode = 2
301elif mode != 1 and mode != 2:
302 log.error( "Bad mode %d", mode )
303 sys.exit(2)
304
305#=== create bad channel manager
306log.info("")
307comments = []
308mgrWriters = []
309nvalUpdated = []
310commentsSplit = []
311for since in iovList:
312 comm=blobReader.getComment(since)
313 #log.info("Comment: %s", comm)
314 comments+=[comm]
315 nvalUpdated += [0]
316 commentsSplit+=[blobReader.getComment(since,True)]
317 mgr = TileBchTools.TileBchMgr()
318 mgr.setLogLvl(logging.DEBUG)
319 mgr.initialize(dbr, folderPath, folderTag, since, mode)
320 mgrWriters += [mgr]
321log.info("")
322
323#=== Tuples of empty channels
324emptyChannelLongBarrel = (30, 31, 43)
325emptyChannelExtendedBarrel = (18, 19, 24, 25, 26, 27, 28, 29, 33, 34, 42, 43, 44, 45, 46, 47)
326
327# remember: addAdcProblem(ros, module, channel, adc), where:
328# ros = 1 LBA
329# ros = 2 LBC
330# ros = 3 EBA
331# ros = 4 EBC
332# module = 0 - 63
333# channel = 0 - 47
334# adc: 0 = low gain, 1 = high gain.
335
336#=== print bad channels
337if verbose and not iov:
338 log.info("============================================================== ")
339 log.info("bad channels before update")
340 mgr.listBadAdcs()
341
342#=== Add problems with mgr.addAdcProblem(ros, drawer, channel, adc, problem)
343#=== Remove problems with mgr.delAdcProblem(ros, drawer, channel, adc, problem)
344
345
346if len(execFile):
347 log.info("Masking new bad channels, including file %s", execFile )
348 dbw = TileCalibTools.openDbConn(outSchema,('UPDATE' if update else 'RECREATE'))
349
350 #=== loop over all IOVs
351 for io,since in enumerate(iovList):
352
353 until=iovUntil[io]
354 untilCmt=iovUntilCMT[io]
355 if since==until and since==untilCmt:
356 continue # nothing to do
357
358 log.info( "Updating IOV %s", str(since) )
359 mgr = mgrWriters[io]
360
361 if since==until or (since in iovListCMT and since not in iovListMOD):
362 mList = ['CMT']
363 else:
364 mList = moduleList
365 try:
366 exec(compile(open(execFile).read(),execFile,'exec'))
367 if len(comment)==0:
368 log.error( "Comment string is not provided, please put comment='bla-bla-bla' line in %s", execFile )
369 sys.exit(2)
370 except Exception as e:
371 log.error( e )
372 log.error( "Problem reading include file %s", execFile )
373 sys.exit(2)
374
375 #=== print bad channels
376 if verbose:
377 log.info("============================================================== ")
378 log.info("bad channels after update")
379 mgr.listBadAdcs()
380
381 #====================== Write new bad channel list =================
382
383 #=== commit changes
384 if Comment is not None:
385 comment = Comment
386 author = user
387 else:
388 if comment=="None" or comment=="keep":
389 comment = comments[io]
390 elif (iov and comments[io] not in comment) or (not iov and adjust):
391 comment += " // " + comments[io]
392 if io>0 and since!=until and 'ALL' not in moduleList:
393 author=commentsSplit[io]
394 for m in moduleList:
395 if m in comments[io]:
396 author=user
397 break
398 else:
399 author=user
400 # UNDO comment in IOV after the "end"
401 if since==until and comment!=comments[io]:
402 comment = "UNDO " + comment
403 mgr.commitToDb(dbw, folderPath, folderTag, (TileBchDecoder.BitPat_onl01 if onl else TileBchDecoder.BitPat_ofl01), author, comment, since, until, untilCmt, mList)
404else:
405 dbw = None
406
407
408since = iovList[0]
409until = (TileCalibTools.MAXRUN,TileCalibTools.MAXLBK)
410
411if len(curSuffix) and not onl and "sqlite" in outSchema:
412
413 if len(comment) == 0:
414 reader = TileCalibTools.TileBlobReader(dbr, folderPath, folderTag)
415 comment=reader.getComment(since)
416 if comment.find("): ") > -1:
417 comment = comment[(comment.find("): ")) + 3:]
418
419 log.info("")
420 log.info("============================================================== ")
421 log.info("")
422 log.info("creating DB with CURRENT UPD4 tag")
423
424 folderTagUPD4 = TileCalibTools.getFolderTag(dbr, folderPath, "UPD4" )
425 if folderTagUPD4 == folderTag:
426 log.warning("CURRENT UPD4 tag %s is identical to the tag in DB which was created already", folderTagUPD4)
427 folderTagUPD4 = TileCalibTools.getFolderTag(dbr, folderPath, "UPD1" )
428 log.warning("Additional UPD1 DB with tag %s will be created instead", folderTagUPD4 )
429 curSchema = outSchema.replace(".db","_upd1.db")
430 else:
431 curSchema = outSchema.replace(".db",curSuffix+".db")
432
433 folder = dbr.getFolder(folderPath)
434 if folderTagUPD4 not in folder.listTags():
435 log.warning( "Tag %s not found in input schema, reading previous status from Oracle", folderTagUPD4)
436 dbR = TileCalibTools.openDbConn(oraSchema,server)
437 mgr.updateFromDb(dbR, folderPath, folderTagUPD4, since, 0, 2)
438 dbR.closeDatabase()
439 else:
440 mgr.updateFromDb(dbr, folderPath, folderTagUPD4, since, 0, 2)
441
442 #=== commit changes
443 dbW = TileCalibTools.openDbConn(curSchema,('UPDATE' if update else 'RECREATE'))
444 mgr.commitToDb(dbW, folderPath, folderTagUPD4, TileBchDecoder.BitPat_ofl01, user, comment, since, until)
445 dbW.closeDatabase()
446
447
448if len(onlSuffix) and not onl and "sqlite" in outSchema:
449
450 if len(comment)==0:
451 reader = TileCalibTools.TileBlobReader(dbr, folderPath, folderTag)
452 comment = reader.getComment(since)
453 if comment.find("): ") > -1:
454 comment = comment[(comment.find("): ")) + 3:]
455
456 log.info("")
457 log.info("============================================================== ")
458 log.info("")
459 log.info("creating DB with ONLINE status")
460
461 #if dbw:
462 # mgr.updateFromDb(dbw, folderPath, folderTag, since, -1)
463
464 #--- create online bad channel manager
465 folderOnl = "/TILE/ONL01/STATUS/ADC"
466 folderTagOnl = ""
467
468 inSchemaOnl = inSchema.replace("COOLOFL", "COOLONL")
469 if inSchemaOnl != inSchema:
470 dbr.closeDatabase()
471 dbr = TileCalibTools.openDbConn(inSchemaOnl, server)
472 else:
473 try:
474 reader = TileCalibTools.TileBlobReader(dbr, folderOnl, folderTagOnl)
475 except Exception:
476 log.warning( "No %s folder in %s, reading from Oracle", folderOnl, inSchema)
477 inSchemaOnl = oraSchema.replace("COOLOFL", "COOLONL")
478 dbr.closeDatabase()
479 dbr = TileCalibTools.openDbConn(inSchemaOnl, server)
480
481 mgrOnl = TileBchTools.TileBchMgr()
482 mgrOnl.setLogLvl(logging.DEBUG)
483 mgrOnl.initialize(dbr, folderOnl, folderTagOnl, since, 2)
484
485 #=== print online channel status
486 if verbose:
487 log.info("============================================================== ")
488 log.info("online channel status BEFORE update")
489 mgrOnl.listBadAdcs()
490
491 #=== synchronize
492 for ros in range(1, 5):
493 for mod in range(0, 64):
494 for chn in range(0, 48):
495 statlo = mgr.getAdcStatus(ros, mod, chn, 0)
496 stathi = mgr.getAdcStatus(ros, mod, chn, 1)
497
498 # remove all trigger problems first
499 for prb in [TileBchPrbs.TrigGeneralMask,
500 TileBchPrbs.TrigNoGain,
501 TileBchPrbs.TrigHalfGain,
502 TileBchPrbs.TrigNoisy]:
503 mgrOnl.delAdcProblem(ros, mod, chn, 0, prb)
504 mgrOnl.delAdcProblem(ros, mod, chn, 1, prb)
505 # and now set new trigger problems (if any)
506 if not statlo.isGood():
507 prbs = statlo.getPrbs()
508 for prb in prbs:
509 if prb in [TileBchPrbs.TrigGeneralMask,
510 TileBchPrbs.TrigNoGain,
511 TileBchPrbs.TrigHalfGain,
512 TileBchPrbs.TrigNoisy]:
513 mgrOnl.addAdcProblem(ros, mod, chn, 0, prb)
514 mgrOnl.addAdcProblem(ros, mod, chn, 1, prb)
515
516 #--- add IgnoreInHlt if either of the ADCs has isBad
517 #--- add OnlineGeneralMaskAdc if the ADCs has isBad
518 if statlo.isBad() and stathi.isBad():
519 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.IgnoredInHlt)
520 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineGeneralMaskAdc)
521 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.IgnoredInHlt)
522 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineGeneralMaskAdc)
523 elif statlo.isBad():
524 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.IgnoredInHlt)
525 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineGeneralMaskAdc)
526 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.IgnoredInHlt)
527 mgrOnl.delAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineGeneralMaskAdc)
528 elif stathi.isBad():
529 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.IgnoredInHlt)
530 mgrOnl.delAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineGeneralMaskAdc)
531 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.IgnoredInHlt)
532 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineGeneralMaskAdc)
533 else:
534 #--- delete IgnoreInHlt and OnlineGeneralMaskAdc if both ADCs are not Bad
535 mgrOnl.delAdcProblem(ros, mod, chn, 0, TileBchPrbs.IgnoredInHlt)
536 mgrOnl.delAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineGeneralMaskAdc)
537 mgrOnl.delAdcProblem(ros, mod, chn, 1, TileBchPrbs.IgnoredInHlt)
538 mgrOnl.delAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineGeneralMaskAdc)
539
540 #--- add OnlineBadTiming if either of the ADCs has isBadTiming
541 if statlo.isBadTiming() or stathi.isBadTiming():
542 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineBadTiming)
543 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineBadTiming)
544 else:
545 #--- delete OnlineBadTiming if the both ADCs has not isBadTiming
546 mgrOnl.delAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineBadTiming)
547 mgrOnl.delAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineBadTiming)
548
549 #--- add OnlineTimingDmuBcOffsetPos if either of the ADCs has isTimingDmuBcOffsetPos
550 if statlo.isTimingDmuBcOffsetPos() or stathi.isTimingDmuBcOffsetPos():
551 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineTimingDmuBcOffsetPos)
552 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineTimingDmuBcOffsetPos)
553 else:
554 #--- delete OnlineTimingDmuBcOffsetPos if the both ADCs has not isTimingDmuBcOffsetPos
555 mgrOnl.delAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineTimingDmuBcOffsetPos)
556 mgrOnl.delAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineTimingDmuBcOffsetPos)
557
558 #--- add OnlineTimingDmuBcOffsetNeg if either of the ADCs has isTimingDmuBcOffsetNeg
559 if statlo.isTimingDmuBcOffsetNeg() or stathi.isTimingDmuBcOffsetNeg():
560 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineTimingDmuBcOffsetNeg)
561 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineTimingDmuBcOffsetNeg)
562 else:
563 #--- delete OnlineTimingDmuBcOffsetNeg if the both ADCs has not isTimingDmuBcOffsetNeg
564 mgrOnl.delAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineTimingDmuBcOffsetNeg)
565 mgrOnl.delAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineTimingDmuBcOffsetNeg)
566
567 #--- add OnlineWrongBCID if either of the ADCs has isWrongBCID
568 if statlo.isWrongBCID() or stathi.isWrongBCID():
569 mgrOnl.addAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineWrongBCID)
570 mgrOnl.addAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineWrongBCID)
571 else:
572 #--- delete OnlineWrongBCID if the both ADCs has not isWrongBCID
573 mgrOnl.delAdcProblem(ros, mod, chn, 0, TileBchPrbs.OnlineWrongBCID)
574 mgrOnl.delAdcProblem(ros, mod, chn, 1, TileBchPrbs.OnlineWrongBCID)
575
576
577 #=== print online channel status
578 if verbose:
579 log.info("online channel status AFTER update")
580 mgrOnl.listBadAdcs()
581
582 #=== commit changes
583 onlSchema = outSchema.replace(".db", onlSuffix + ".db")
584 dbW = TileCalibTools.openDbConn(onlSchema,('UPDATE' if update else 'RECREATE'))
585 mgrOnl.commitToDb(dbW, folderOnl, folderTagOnl, TileBchDecoder.BitPat_onl01, user, comment, since, until)
586 dbW.closeDatabase()
587
588#=== close DB
589if dbr:
590 dbr.closeDatabase()
591if dbw:
592 dbw.closeDatabase()
static std::string getDrawerString(unsigned int ros, unsigned int drawer)
Return the drawer name, e.g.
STL class.
compare(item1, item2)
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)