1 |
< |
import sys, re |
1 |
> |
import sys, re, glob |
2 |
|
|
3 |
|
fileList, crabResDir = sys.argv[1:] |
4 |
|
execfile(fileList) |
5 |
|
|
6 |
|
fileNameRE = re.compile("output_([0-9]+)_.*") |
7 |
+ |
fileNameRE2 = re.compile("patified_([0-9]+).root") |
8 |
|
lineRE = re.compile("\[E\( ([0-9]+) \)E\]") |
9 |
|
|
10 |
|
indexes = {} |
12 |
|
for fileName in source.fileNames: |
13 |
|
m = fileNameRE.search(fileName) |
14 |
|
if m is None: |
15 |
< |
raise Exception, "File \"%s\" is not of the right form." % fileName |
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: |
23 |
|
try: |
24 |
|
f = open("%s/CMSSW_%d.stdout" % (crabResDir, index)) |
25 |
|
except IOError: |
26 |
< |
f = open("%s/Submission_1/CMSSW_%d.stdout" % (crabResDir, index)) |
26 |
> |
try: |
27 |
> |
f = open("%s/Submission_1/CMSSW_%d.stdout" % (crabResDir, index)) |
28 |
> |
except IOError: |
29 |
> |
fname = glob.glob("%s/output_*_%d.stdout" % (crabResDir, index)) |
30 |
> |
f = open(fname[0]) |
31 |
|
|
32 |
|
eventnumber = None |
33 |
|
for line in f.xreadlines(): |