110 self.
msg.info(
'running execute...')
111 self.
msg.info(
'dumping [%s] content', self.
sg.name())
115 listOfFolders=[
"/LAR/BadChannels/BadChannels",
"/LAR/BadChannels/MissingFEBs"]
116 iSelectedFolder=LArBadChannelBrowserTools.ChooseOptionFromList(
"Folder list : ",
"",
"",listOfFolders,+1,
False,{})
118 if iSelectedFolder==1:
133 LArBadChannelDBTools=cppyy.makeNamespace(
'LArBadChannelDBTools')
160 iSelectedTag=LArBadChannelBrowserTools.ChooseOptionFromList(
"Tag list : ",
"",
"",listOfTags,+1,
False,{})
187 bEndOfCoolChannelModification=
False
188 while not bEndOfCoolChannelModification:
199 sDBName=os.environ[
"PWD"]+
"/MissingFebUpdate.db"
200 if os.path.isfile(sDBName):
202 dbstring=
"sqlite://;schema="+sDBName+
";dbname=BADCHAN"
211 sCoolChannelMenuDict=[(
"s",
"(summary)"),(
"a",
"(abort)"),(
"q",
"(save and quit)")]
215 repCoolChan=LArBadChannelBrowserTools.ChooseOptionFromList(
"Cool channel list : ",
"",
"",listCoolChannel,
216 0,
False,sCoolChannelMenuDict)
219 iAbortConfirmation=LArBadChannelBrowserTools.YesNoQuestion(
"Are you sure you want to quit ? ")
220 if iAbortConfirmation==1:
222 elif repCoolChan==
"q":
223 print (
" SAUVEGARDE FINALE")
225 sDBName=os.environ[
"PWD"]+
"/BadChannelUpdate.db"
226 if os.path.isfile(sDBName):
228 dbstring=
"sqlite://;schema="+sDBName+
";dbname=BADCHAN"
232 bEndOfCoolChannelModification=
True
233 elif repCoolChan==
"s":
239 coolChan=int(repCoolChan)
251 """ First database browsing => retrieve tag names, IOVs and number of channels """
255 f = self.
db.getFolder(folderName)
256 print (
"Analysing Folder " + str(folderName))
258 print (
"Skipping " + str(folderName))
268 f.countObjects( cool.ValidityKeyMin,
270 cool.ChannelSelection.all(),
273 objs = f.browseObjects( cool.ValidityKeyMin,
275 cool.ChannelSelection.all(),
277 while objs.hasNext():
280 if obj.channelId()>iMaxChannelNumber:
281 iMaxChannelNumber=obj.channelId()
284 if keyTag
not in sIOVBeginEnd:
285 sIOVBeginEnd[keyTag]={}
287 keyChan=obj.channelId()
288 if keyChan
not in sIOVBeginEnd[keyTag]:
289 sIOVBeginEnd[keyTag][keyChan]=[]
291 sIOVBeginEnd[keyTag][keyChan].append((obj.since()>>32%0x100000000,obj.until()>>32%0x100000000))
297 return (tags,sIOVBeginEnd,iMaxChannelNumber+1)
301 """ Second database browsing => read cool channel corresponding to selected tag """
307 f = self.
db.getFolder(folderName)
308 print (
"Analysing Folder " + str(folderName))
310 print (
"Skipping " + str(folderName))
321 print (
"-> tag : ",tag)
323 f.countObjects( cool.ValidityKeyMin,
325 cool.ChannelSelection.all(),
328 objs = f.browseObjects( cool.ValidityKeyMin,
330 cool.ChannelSelection.all(),
333 while objs.hasNext():
337 if (obj.since()>>32%0x100000000)==tagIOVNumber[obj.channelId()]:
339 print (
"Found object", iObjet, end=
'')
340 print (
"since [r,l]: [", obj.since() >> 32,
',',obj.since()%0x100000000,
']', end=
'')
341 print (
"until [r,l]: [", obj.until() >> 32,
',',obj.until()%0x100000000,
']', end=
'')
342 print (
"payload", obj.payload(), end=
'')
343 print (
"chan",obj.channelId())
345 payload=obj.payload()
348 sChannelKey=obj.channelId()
349 sChannelName=self.
dbBrowserBadChan.BadChan_SetBadChannelDataFromPayload(sChannelKey,payload)
351 sChannelKey=obj.channelId()
352 sChannelName=self.
dbBrowserMissingFeb.MissingFeb_SetBadChannelDataFromPayload(sChannelKey,payload)
354 print (sChannelKey,
" ",sChannelName)
355 channelNameDict[sChannelKey]=sChannelName
356 print (str(channelNameDict))
362 return channelNameDict
372 dbase = dbSvc.openDatabase(dbName,
False)
373 except Exception
as e:
374 print (
'Problem opening database',e)
376 print (
"Opened database",dbName)
379 folders = dbase.listAllNodes()
383 f = dbase.getFolder(ff)
384 print (
"Analysing Folder " + str(ff))
386 print (
"Skipping " + str(ff))
394 tags.push_back(
"notag")
404 nobjs = f.countObjects( cool.ValidityKeyMin,
406 cool.ChannelSelection.all())
408 print (
"number of objects", nobjs)
410 objs = f.browseObjects( cool.ValidityKeyMin,
412 cool.ChannelSelection.all())
414 while objs.hasNext():
416 print (
"Found object", i, end=
'')
417 print (
"since [r,l]: [", obj.since() >> 32,
',',obj.since()%0x100000000,
']', end=
'')
418 print (
"until [r,l]: [", obj.until() >> 32,
',',obj.until()%0x100000000,
']', end=
'')
419 print (
"payload", obj.payload(), end=
'')
420 print (
"chan",obj.channelId() )
427 dbase.closeDatabase()