-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathjob.py
129 lines (76 loc) · 2.96 KB
/
job.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/Usr-/bin/env python
import os,sys
from PhysicsTools.NanoAODTools.postprocessing.framework.postprocessor import *
def ensureDir(directory):
if not os.path.exists(directory):
os.makedirs(directory)
if len(sys.argv)>1:
infile = sys.argv[1].split(',')
else:
print '[warning] input file not specified'
# infile = ["root://cms-xrd-global.cern.ch//store/user/arizzi/Nano01_17Nov17/SingleMuon/RunII2017ReReco17Nov17-94X-Nano01/180205_181602/0000/test_data_94X_NANO_432.root"]
infile = ["root://cms-xrd-global.cern.ch//store/user/arizzi/Nano01Fall17/DY1JetsToLL_M-50_TuneCP5_13TeV-madgraphMLM-pythia8/RunIIFall17MiniAOD-94X-Nano01Fall17/180205_160029/0000/test94X_NANO_70.root"]
if len(sys.argv)>2:
outputDir = sys.argv[2]
else:
print '[warning] output directory name not specified'
outputDir = "test"
if len(sys.argv)>3:
name = sys.argv[3]
else:
print '[warning] output filename not specified'
name = "test"
if len(sys.argv)>4:
chunck = sys.argv[4]
else:
print '[warning] chunck not specified'
chunck = "test"
if len(sys.argv)>5:
channel = sys.argv[5]
else:
print '[warning] channel not specified'
channel = "mutau"
print '-'*80
print 'input file =', infile
print 'output directory = ', outputDir
print 'output filename = ', name
print 'output chunck = ', chunck
print 'channel = ', channel
print '-'*80
DataType = 'mc'
if infile[0].find("/SingleMuon/")!=-1 or infile[0].find("/Tau/")!=-1 or infile[0].find("/SingleElectron/")!=-1:
DataType = 'data'
json='/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/Final/Cert_294927-306462_13TeV_PromptReco_Collisions17_JSON.txt'
ensureDir(outputDir)
_postfix = outputDir + '/' + name + '_' + chunck + '_' + channel + '.root'
module2run = None
if channel == 'tautau':
from TauTauModule import *
# from TauTauModule_sync import *
module2run = lambda : TauTauProducer(_postfix, DataType)
elif channel == 'mutau':
from MuTauModule import *
# from MuTauModule_sync import *
module2run = lambda : MuTauProducer(_postfix, DataType)
elif channel == 'eletau':
from EleTauModule import *
# from EleTauModule_sync import *
module2run = lambda : EleTauProducer(_postfix, DataType)
elif channel == 'mumu':
from MuMuModule import *
module2run = lambda : MuMuProducer(_postfix, DataType)
elif channel == 'muele':
from MuEleModule import *
module2run = lambda : MuEleProducer(_postfix, DataType)
else:
print 'Unkonwn channel !!!!!!!'
sys.exit(0)
if DataType=='data':
p=PostProcessor(outputDir, infile, None, "keep_and_drop.txt", noOut=True,
modules=[module2run()],provenance=False,fwkJobReport=False,
jsonInput=json, postfix=_postfix)
else:
p=PostProcessor(outputDir, infile, None, "keep_and_drop.txt", noOut=True,
modules=[module2run()],provenance=False,fwkJobReport=False, postfix=_postfix)
p.run()
print "DONE"