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