ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MuJetAnalysis/AnalysisTools/scripts/countSuccessfulEvents.py
Revision: 1.4
Committed: Wed Oct 13 01:14:36 2010 UTC (14 years, 6 months ago) by pivarski
Content type: text/x-python
Branch: MAIN
CVS Tags: YP_2012-12-04_2011Data, V_2012_01_29_01, JP-2011-02-03, JP-2011-01-16-a, JP-2011-01-15-a, JP-2011-01-11-a, JP-2011-01-10-c, JP-2011-01-10-b, JP-2011-01-10-a, JP-2011-01-04-a, JP-2010-12-20-a, JP-2010-12-15-b, JP-2010-12-15-a, JP-2010-12-11-a, JP-2010-12-09-a, JP-2010-12-08-a, JP-2010-12-06-a, JP-2010-12-05-b, JP-2010-12-05-a, JP-2010-12-01-a, JP-2010-11-30-a, JP-2010-11-29-a, JP-2010-11-25-a, JP-2010-11-22-a, JP-2010-11-20-c, JP-2010-11-20-a, JP-2010-11-19-b, JP-2010-11-19-a, JP-2010-11-18-a, JP-2010-11-10-b, JP-2010-11-10-a, JP-2010-11-09-a, JP-2010-10-20-a, JP-2010-10-14-a, JP-2010-10-13-a, HEAD
Changes since 1.3: +2 -1 lines
Log Message:
data files from CASTOR

File Contents

# Content
1 import sys, re, glob
2
3 fileList, crabResDir = sys.argv[1:]
4 execfile(fileList)
5
6 fileNameRE = re.compile("output_([0-9]+).*root")
7 fileNameRE2 = re.compile("patified_([0-9]+).root")
8 lineRE = re.compile("\[E\( ([0-9]+) \)E\]")
9
10 indexes = {}
11 total_number_of_events = 0
12 for fileName in source.fileNames:
13 m = fileNameRE.search(fileName)
14 if m is None:
15 m = fileNameRE2.search(fileName)
16 if m is None:
17 raise Exception, "File \"%s\" is not of the right form." % fileName
18
19 index = int(m.group(1))
20 if index in indexes:
21 raise Exception, "Index %s appears for the second time in \"%s\"." % (m.group(0), fileName)
22 # indexes[index] = True
23
24 try:
25 f = open("%s/CMSSW_%d.stdout" % (crabResDir, index))
26 except IOError:
27 try:
28 f = open("%s/Submission_1/CMSSW_%d.stdout" % (crabResDir, index))
29 except IOError:
30 fname = glob.glob("%s/output_*_%d.stdout" % (crabResDir, index))
31 f = open(fname[0])
32
33 eventnumber = None
34 for line in f.xreadlines():
35 m2 = lineRE.search(line)
36 if m2 is not None:
37 e = int(m2.group(1))
38 if eventnumber is not None and e <= eventnumber:
39 raise Exception, "%s/CMSSW_%d.stdout has an out-of-order event (number %d)." % (crabResDir, index, e)
40 eventnumber = e
41
42 if eventnumber is not None:
43 total_number_of_events += eventnumber
44 print fileName, eventnumber
45
46 print "======================================================"
47 print "Total:", total_number_of_events