649 def BadChan_CheckSavedDatabaseContent(self,dbName,dbSvc,dbFolderName,selectedTag):
653 dbase = dbSvc.openDatabase(dbName,
False)
654 except Exception
as e:
655 print (
'Problem opening database',e)
657 print (
"Opened database",dbName)
661 f = dbase.getFolder(dbFolderName)
662 print (
"Analysing Folder " +
str(dbFolderName))
664 print (
"Skipping " +
str(dbFolderName))
672 tags.push_back(
"notag")
679 bSavingProcessError=
False
688 f.countObjects( cool.ValidityKeyMin,cool.ValidityKeyMax,cool.ChannelSelection.all())
689 objs = f.browseObjects( cool.ValidityKeyMin,cool.ValidityKeyMax,cool.ChannelSelection.all())
691 while objs.hasNext():
693 print (
"Found object", i, end=
'')
694 print (
"since [r,l]: [", obj.since() >> 32,
',',obj.since()%0x100000000,
']', end=
'')
695 print (
"until [r,l]: [", obj.until() >> 32,
',',obj.until()%0x100000000,
']', end=
'')
696 print (
"payload", obj.payload(), end=
'')
697 print (
"chan",obj.channelId() )
700 payload=obj.payload()
701 channelSize=payload[
'ChannelSize']
702 statusWordSize=payload[
'StatusWordSize']
703 endianness=payload[
'Endianness']
704 version=payload[
'Version']
708 vect_BadChanEntry=self.nspace_LArBadChannelDBTools.
decodeBlob(blob,channelSize,statusWordSize,endianness,version,
712 sChannelDict,sChannelDict_Status=self.BadChan_TransformEntryIntoDictionnary(vect_BadChanEntry)
714 sChannelKey=obj.channelId()
716 for key
in sChannelDict.keys():
719 print (
" -> SQlite database content vs initial data : channel ", sChannelKey)
722 listHWidKeys=[x
for x
in sChannelDict.keys()]
723 for x
in self.dict_vectBadChanEntry_Status[sChannelKey].
keys():
724 if x
not in listHWidKeys:
725 listHWidKeys.append(x)
728 for keyHWid
in listHWidKeys:
731 sChanName,badChan_word,sValueInit=sChannelDict[keyHWid]
733 sChanName=
"UNDEFINED"
737 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_INIT:
738 if sChannelDict[keyHWid][1]!=self.dict_vectBadChanEntry_Init[sChannelKey][keyHWid][1]:
740 sSuffix=
" no modification was done"+keyHWid
741 bSavingProcessError=
True
744 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
746 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_REMOVED:
747 if keyHWid
in sChannelDict:
749 sSuffix=
" deletion not taken into accout"+keyHWid
750 bSavingProcessError=
True
752 sPrefix=STATUS_REMOVED
753 sChanName,badChan_word,sValue_Init=self.dict_vectBadChanEntry[sChannelKey][keyHWid]
754 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
756 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_NEW:
757 if sChannelDict[keyHWid][1]!=self.dict_vectBadChanEntry[sChannelKey][keyHWid][1]:
759 sSuffix=
" error while saving new status "+keyHWid
760 bSavingProcessError=
True
763 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
765 if self.dict_vectBadChanEntry_Status[sChannelKey][keyHWid]==STATUS_MODIFIED:
766 if sChannelDict[keyHWid][1]!=self.dict_vectBadChanEntry[sChannelKey][keyHWid][1]:
768 sSuffix=
" error while saving modified status "+keyHWid
769 bSavingProcessError=
True
771 sPrefix=STATUS_MODIFIED
772 self.BadChan_DisplayBadChanEntryLine(sPrefix,iChanCmpt,keyHWid,sChanName,badChan_word,sSuffix)
774 HWidChecked[keyHWid]=1
777 for key
in self.dict_vectBadChanEntry_Status[sChannelKey].
keys():
778 if key
not in HWidChecked
and self.dict_vectBadChanEntry_Status[sChannelKey][key]!=STATUS_REMOVED:
779 print (
"ERROR : initial ",key,
" has not been saved")
780 elif key
in HWidChecked
and HWidChecked[key]==0:
781 print (
"ERROR : ",key,
" has not been checked")
788 if bTagFound
is False:
789 print (
"ERROR : tag "+selectedTag+
" not found in saved SQlite file")
791 if bSavingProcessError
is True:
792 print (
"ERROR : found while making comparison between corrected and saved datas" )
795 dbase.closeDatabase()