Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:18:23

0001 from __future__ import print_function
0002 ### assumes QCD_Pt-.../res/ folders are in current directory ###
0003 
0004 import glob, os, string
0005 
0006 folderList = glob.glob('QCD*')
0007 
0008 print('------------------------------------------------------------')
0009 print('directory')
0010 print('    total,', 'passed,', 'efficiency')
0011 print('------------------------------------------------------------')
0012 
0013 for folder in folderList:
0014     eventsTotalList = []
0015     eventsPassedList = []
0016     fileList = glob.glob(folder + '/res/*.stdout')
0017     #if fileList != []:
0018     for f in fileList:
0019         fileObj = open(f,'r')
0020         for line in fileObj:
0021             if line.count('TrigReport') != 0 and line.count('out') != 0:
0022                 # events total line.split()[4]
0023                 # events passed line.split()[7]
0024                 # events failed line.split()[10]                
0025                 eventsTotalList.append(int(line.split()[3]))
0026                 eventsPassedList.append(int(line.split()[4]))
0027     sumTotal = sum(eventsTotalList)
0028     sumPassed = sum(eventsPassedList)
0029     if (isinstance(sumTotal, int)) & (sumTotal > 0):
0030         print(os.path.basename(folder))
0031         print('    {0}, {1}, {2}'.format(sumTotal, sumPassed, sumPassed/float(sumTotal)))
0032     else:
0033         print(os.path.basename(folder))
0034         print('    no logs found')
0035 
0036 print('------------------------------------------------------------')