File indexing completed on 2024-11-25 02:29:25
0001
0002
0003 '''
0004 This script checks the outputs from SiStripDetVOffFakeBuilder and reader. It compares the status of all detIds
0005 both for low and high voltage and it checks that the values written in the database are correctly read back.
0006 '''
0007
0008 import os
0009
0010 def getDetIds(fileName, vType):
0011 return os.popen("cat "+fileName+" | grep \"detid\" | grep \""+vType+"\" | grep \"OFF\" | awk \'{print $2}\' ", "r")
0012
0013
0014 def compare(vType):
0015
0016 builderChild = getDetIds("SiStripDetVOffFakeBuilder.log", vType)
0017 builderOutput = builderChild.read()
0018
0019
0020 readerChild = getDetIds("SiStripDetVOffReader.log", vType)
0021 readerOutput = readerChild.read()
0022
0023 builderDetIds = builderOutput.split('\n')
0024 readerDetIds = readerOutput.split('\n')
0025
0026 builderDetIds = sorted(builderDetIds)
0027
0028
0029
0030 i = 0
0031 printNum = 5
0032 print("Checking", vType, ":")
0033 print("printing the first ", printNum, " for comparison")
0034 for detId in builderDetIds:
0035
0036
0037 builderDetId = detId
0038
0039 readerDetId = readerDetIds[i]
0040
0041 if( builderDetId ):
0042 readerDetId = readerDetIds[i]
0043
0044 if( readerDetId != builderDetId ):
0045 print("does not match: builder = ", detId, " reader = ", readerDetIds[i])
0046 if( i < printNum ):
0047 print("builder = ", detId)
0048 print("reader = ", readerDetIds[i])
0049 i += 1
0050 print()
0051
0052
0053 builderFile = open("SiStripDetVOffFakeBuilder.log")
0054 readerFile = open("SiStripDetVOffReader.log")
0055
0056 compare("HV")
0057 compare("LV")
0058 compare(" V")