Back to home page

Project CMSSW displayed by LXR

 
 

    


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

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