-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathproduceAndCompare.py
88 lines (68 loc) · 2.72 KB
/
produceAndCompare.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import os
import argparse
import subprocess
import pprint
import sys
from relValTools import addArguments
#import Validation.RecoTau.webplotting as webplotting
pp = pprint.PrettyPrinter(indent=4)
if __name__ == '__main__':
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
addArguments(parser, produce=True, compare=True)
args = parser.parse_args()
skipProduce = sys.argv[-1]
skipProduceTauValTree = False
if skipProduce == '--skip' :
skipProduceTauValTree = True
runtype = args.runtype
globalTags = args.globalTags
maxEvents = args.maxEvents
relVals = args.releases
useRecoJets = args.useRecoJets
storageSite = args.storageSite
tauCollection = args.tauCollection
onebin = args.onebin
debug = args.debug
globaldebug = args.debug
dryRun = args.dryRun
inputfiles = args.inputfiles
outputFileName = args.outputFileName
totalparts = args.totalparts
localdir = args.localdir
if len(localdir) > 1 and localdir[-1] != '/':
localdir += '/'
mvaidstr = ' --mvaid ' + ' '.join(args.mvaid)
scriptPath = os.path.realpath(__file__)[0:os.path.realpath(__file__).rfind('/') + 1]
dd = '--dryRun' if dryRun else ''
if debug:
dd += ' --debug'
if skipProduceTauValTree==False :
for i, relval in enumerate(relVals):
inputfile = ' --inputfile ' + inputfiles[i] if len(inputfiles) > 0 else ''
command = 'python3 ' + scriptPath + 'produceTauValTree.py --release ' + relval + \
' --globalTag ' + globalTags[i] + \
inputfile + \
' --runtype ' + runtype + \
' --maxEvents ' + str(maxEvents) + \
useRecoJets * ' -u ' + \
' -s ' + storageSite + \
' -l ' + localdir + \
' --tauCollection ' + tauCollection + mvaidstr + dd
+ (len(outputFileName) > 0) * (' --outputFileName ' + outputFileName)
print ('====================')
print (command)
print ('====================')
os.system(command)
onebin = ' -b' if onebin else ''
globalTagsstr = ' '.join(globalTags)
releases = ' '.join(relVals)
commands = []
for i in range(totalparts):
commands.append('python3 ' + scriptPath + 'compare.py --releases ' + releases + ' --globalTags ' + globalTagsstr + ' --runtype ' + str(runtype) + onebin + ' -p ' + str(i+1) + dd)
for command in commands:
print ('====================')
print (command)
print ('====================')
os.system(command)
#webplotting.webplotting(input_dir="./compare_{0}".format(runtype), recursive=True)
print ("FINISHED SUCCESSFULLY")