Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:09:19

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 from __future__ import print_function
0014 import sys
0015 
0016 fileIN = open(sys.argv[1], "r")
0017 line = fileIN.readline()
0018 
0019 matchCount = 0
0020 
0021 while line:
0022     # print line.split()[2].strip(',')
0023     # print line.split()[5].strip(',')
0024 
0025     fileIN2 = open(sys.argv[2], "r")
0026     line2 = fileIN2.readline()
0027     detId = int(line.split()[2].strip(','))
0028     flag = int(line.split()[5])
0029     matching = 0
0030     while line2:
0031         if( detId == int(line2.split()[2].strip(',')) ):
0032             if( flag == int(line2.split()[5]) ):
0033                 print("matching:", end=' ')
0034                 print("detId1 = ", detId, " detId2 = ", line2.split()[2].strip(','), end=' ')
0035                 print("flag1 = ", flag, "flag2 = ", line2.split()[5])
0036                 matching = 1
0037                 matchCount += 1
0038                 break
0039         line2 = fileIN2.readline()
0040     if( matching == 0 ):
0041         print("no match found")
0042 
0043 
0044     line = fileIN.readline()
0045 
0046 print("MatchCount = ", matchCount)