File indexing completed on 2023-03-17 10:48:51
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 from __future__ import print_function
0008
0009 import os
0010
0011 def getDetIds(fileName, vType):
0012 return os.popen("cat "+fileName+" | grep \"detid\" | grep \""+vType+"\" | grep \"OFF\" | awk \'{print $2}\' ", "r")
0013
0014
0015 def compare(vType):
0016
0017 builderChild = getDetIds("SiStripDetVOffFakeBuilder.log", vType)
0018 builderOutput = builderChild.read()
0019
0020
0021 readerChild = getDetIds("SiStripDetVOffReader.log", vType)
0022 readerOutput = readerChild.read()
0023
0024 builderDetIds = builderOutput.split('\n')
0025 readerDetIds = readerOutput.split('\n')
0026
0027 builderDetIds = sorted(builderDetIds)
0028
0029
0030
0031 i = 0
0032 printNum = 5
0033 print("Checking", vType, ":")
0034 print("printing the first ", printNum, " for comparison")
0035 for detId in builderDetIds:
0036
0037
0038 builderDetId = detId
0039
0040 readerDetId = readerDetIds[i]
0041
0042 if( builderDetId ):
0043 readerDetId = readerDetIds[i]
0044
0045 if( readerDetId != builderDetId ):
0046 print("does not match: builder = ", detId, " reader = ", readerDetIds[i])
0047 if( i < printNum ):
0048 print("builder = ", detId)
0049 print("reader = ", readerDetIds[i])
0050 i += 1
0051 print()
0052
0053
0054 builderFile = open("SiStripDetVOffFakeBuilder.log")
0055 readerFile = open("SiStripDetVOffReader.log")
0056
0057 compare("HV")
0058 compare("LV")
0059 compare(" V")