Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-26 02:34:11

0001 #!/usr/bin/env python3
0002 
0003 # This script compares the writer output with the reader output.
0004 # - run the SiStripBadComponentsDQMService.py > logReader
0005 # - open the log and format it so that it only has lines of the form:
0006 # -- detid = INT, flag = INT
0007 # - run the SiStripBadStripReader_cfg.py > logReader
0008 # - again format the log file
0009 # Run this script passing the two log files as input parameters.
0010 # The output will be all the matching lines and a final count of them
0011 # The check is positive if the total number of lines matches the total number of detids in the log
0012 
0013 import sys
0014 
0015 fileIN = open(sys.argv[1], "r")
0016 line = fileIN.readline()
0017 
0018 matchCount = 0
0019 
0020 while line:
0021     # print line.split()[2].strip(',')
0022     # print line.split()[5].strip(',')
0023 
0024     fileIN2 = open(sys.argv[2], "r")
0025     line2 = fileIN2.readline()
0026     detId = int(line.split()[2].strip(','))
0027     flag = int(line.split()[5])
0028     matching = 0
0029     while line2:
0030         if( detId == int(line2.split()[2].strip(',')) ):
0031             if( flag == int(line2.split()[5]) ):
0032                 print("matching:", end=' ')
0033                 print("detId1 = ", detId, " detId2 = ", line2.split()[2].strip(','), end=' ')
0034                 print("flag1 = ", flag, "flag2 = ", line2.split()[5])
0035                 matching = 1
0036                 matchCount += 1
0037                 break
0038         line2 = fileIN2.readline()
0039     if( matching == 0 ):
0040         print("no match found")
0041 
0042 
0043     line = fileIN.readline()
0044 
0045 print("MatchCount = ", matchCount)