Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:03:30

0001 #!/usr/bin/env python
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     #builderChild = os.popen("cat SiStripDetVOffFakeBuilder.log | grep \"detid\" | grep \"HV\" | awk \'{print $2}\' ", "r")
0017     builderChild = getDetIds("SiStripDetVOffFakeBuilder.log", vType)
0018     builderOutput = builderChild.read()
0019 
0020     #readerChild = os.popen("cat SiStripDetVOffReader.log | grep \"detid\" | grep \"HV\" | grep \"OFF\" | awk \'{print $2}\' ", "r")
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     #builderLine = popen
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         #if( i < 1000 ):
0037         # print "detId = ", detId
0038         builderDetId = detId
0039         #print "DetId = ", builderDetIds[i].split()
0040         readerDetId = readerDetIds[i]
0041         # print "builderDetId = ", readerDetId
0042         if( builderDetId ):
0043             readerDetId = readerDetIds[i]
0044             # builderDetId = builderDetIds[i].split()[0]           
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")