648 def BadChan_CheckSavedDatabaseContent(self,dbName,dbSvc,dbFolderName,selectedTag):
652 dbase = dbSvc.openDatabase(dbName,
False)
653 except Exception
as e:
654 print (
'Problem opening database',e)
656 print (
"Opened database",dbName)
660 f = dbase.getFolder(dbFolderName)
661 print (
"Analysing Folder " +
str(dbFolderName))
663 print (
"Skipping " +
str(dbFolderName))
671 tags.push_back(
"notag")
678 bSavingProcessError=
False
687 f.countObjects( cool.ValidityKeyMin,cool.ValidityKeyMax,cool.ChannelSelection.all())
688 objs = f.browseObjects( cool.ValidityKeyMin,cool.ValidityKeyMax,cool.ChannelSelection.all())
690 while objs.hasNext():
692 print (
"Found object", i, end=
'')
693 print (
"since [r,l]: [", obj.since() >> 32,
',',obj.since()%0x100000000,
']', end=
'')
694 print (
"until [r,l]: [", obj.until() >> 32,
',',obj.until()%0x100000000,
']', end=
'')
695 print (
"payload", obj.payload(), end=
'')
696 print (
"chan",obj.channelId() )
699 payload=obj.payload()
700 channelSize=payload[
'ChannelSize']
701 statusWordSize=payload[
'StatusWordSize']
702 endianness=payload[
'Endianness']
703 version=payload[
'Version']
707 vect_BadChanEntry=self.nspace_LArBadChannelDBTools.
decodeBlob(blob,channelSize,statusWordSize,endianness,version,
711 sChannelDict,sChannelDict_Status=self.BadChan_TransformEntryIntoDictionnary(vect_BadChanEntry)
713 sChannelKey=obj.channelId()
715 for key
in sChannelDict.keys():
718 print (
" -> SQlite database content vs initial data : channel ", sChannelKey)
721 listHWidKeys=[x
for x
in sChannelDict.keys()]
722 for x
in self.dict_vectBadChanEntry_Status[sChannelKey].
keys():
723 if x
not in listHWidKeys:
724 listHWidKeys.append(x)
727 for keyHWid
in listHWidKeys:
730 sChanName,badChan_word,sValueInit=sChannelDict[keyHWid]
732 sChanName=
"UNDEFINED"
736 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_INIT:
737 if sChannelDict[keyHWid][1]!=self.dict_vectBadChanEntry_Init[sChannelKey][keyHWid][1]:
739 sSuffix=
" no modification was done"+keyHWid
740 bSavingProcessError=
True
743 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
745 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_REMOVED:
746 if keyHWid
in sChannelDict:
748 sSuffix=
" deletion not taken into accout"+keyHWid
749 bSavingProcessError=
True
751 sPrefix=STATUS_REMOVED
752 sChanName,badChan_word,sValue_Init=self.dict_vectBadChanEntry[sChannelKey][keyHWid]
753 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
755 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_NEW:
756 if sChannelDict[keyHWid][1]!=self.dict_vectBadChanEntry[sChannelKey][keyHWid][1]:
758 sSuffix=
" error while saving new status "+keyHWid
759 bSavingProcessError=
True
762 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
764 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_MODIFIED:
765 if sChannelDict[keyHWid][1]!=self.dict_vectBadChanEntry[sChannelKey][keyHWid][1]:
767 sSuffix=
" error while saving modified status "+keyHWid
768 bSavingProcessError=
True
770 sPrefix=STATUS_MODIFIED
771 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
773 HWidChecked[keyHWid]=1
776 for key
in self.dict_vectBadChanEntry_Status[sChannelKey].
keys():
777 if key
not in HWidChecked
and self.dict_vectBadChanEntry_Status[sChannelKey][key]!=STATUS_REMOVED:
778 print (
"ERROR : initial ",key,
" has not been saved")
779 elif key
in HWidChecked
and HWidChecked[key]==0:
780 print (
"ERROR : ",key,
" has not been checked")
787 if bTagFound
is False:
788 print (
"ERROR : tag "+selectedTag+
" not found in saved SQlite file")
790 if bSavingProcessError
is True:
791 print (
"ERROR : found while making comparison between corrected and saved datas" )
794 dbase.closeDatabase()