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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
|
#!/usr/bin/env python3
"""
_pp_
Scenario supporting proton collisions
"""
import os
import sys
from Configuration.DataProcessing.Scenario import *
from Configuration.DataProcessing.Utils import stepALCAPRODUCER,stepSKIMPRODUCER,addMonitoring,dictIO,dqmIOSource,harvestingMode,dqmSeq,nanoFlavours,gtNameAndConnect
import FWCore.ParameterSet.Config as cms
from Configuration.DataProcessing.RecoTLR import customisePrompt,customiseExpress
class Reco(Scenario):
def __init__(self):
Scenario.__init__(self)
self.recoSeq=''
self.cbSc=self.__class__.__name__
self.promptModifiers = cms.ModifierChain()
self.expressModifiers = cms.ModifierChain()
self.visModifiers = cms.ModifierChain()
"""
_pp_
Implement configuration building for data processing for proton
collision data taking
"""
def _checkRepackedFlag(self, options, **args):
if 'repacked' in args:
if args['repacked'] == True:
options.isRepacked = True
else:
options.isRepacked = False
def promptReco(self, globalTag, **args):
"""
_promptReco_
Proton collision data taking prompt reco
"""
step = stepALCAPRODUCER(args['skims'])
PhysicsSkimStep = ''
if ("PhysicsSkims" in args) :
PhysicsSkimStep = stepSKIMPRODUCER(args['PhysicsSkims'])
dqmStep = dqmSeq(args,'')
options = Options()
options.__dict__.update(defaultOptions.__dict__)
options.scenario = self.cbSc
if ('nThreads' in args) :
options.nThreads=args['nThreads']
miniAODStep = ''
nanoAODStep = ''
if not 'customs' in args:
args['customs']= []
if 'outputs' in args:
print(args['outputs'])
for a in args['outputs']:
if a['dataTier'] == 'MINIAOD':
miniAODStep = ',PAT'
if a['dataTier'] in ['NANOAOD', 'NANOEDMAOD']:
if "nanoFlavours" in args:
nanoAODStep = ',NANO'+nanoFlavours(args['nanoFlavours'])
else:
nanoAODStep = ',NANO:@PHYS+@L1'
self._checkRepackedFlag(options, **args)
if 'customs' in args:
options.customisation_file=args['customs']
eiStep=''
options.step = 'RAW2DIGI,L1Reco,RECO'
options.step += self.recoSeq + eiStep + step + PhysicsSkimStep
options.step += miniAODStep + nanoAODStep
options.step += ',DQM' + dqmStep + ',ENDJOB'
dictIO(options,args)
options.conditions = gtNameAndConnect(globalTag, args)
process = cms.Process('RECO', cms.ModifierChain(self.eras, self.promptModifiers) )
cb = ConfigBuilder(options, process = process, with_output = True)
# Input source
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring()
)
cb.prepare()
addMonitoring(process)
return process
def expressProcessing(self, globalTag, **args):
"""
_expressProcessing_
Proton collision data taking express processing
"""
skims = args['skims']
# the AlCaReco skims for PCL should only run during AlCaSkimming step which uses the same configuration on the Tier0 side, for this reason we drop them here
pclWkflws = [x for x in skims if "PromptCalibProd" in x]
for wfl in pclWkflws:
skims.remove(wfl)
step = stepALCAPRODUCER(skims)
dqmStep= dqmSeq(args,'')
options = Options()
options.__dict__.update(defaultOptions.__dict__)
options.scenario = self.cbSc
if ('nThreads' in args) :
options.nThreads=args['nThreads']
eiStep=''
options.step = 'RAW2DIGI,L1Reco,RECO'+self.recoSeq+eiStep+step+',DQM'+dqmStep+',ENDJOB'
dictIO(options,args)
options.conditions = gtNameAndConnect(globalTag, args)
options.filein = 'tobeoverwritten.xyz'
if 'inputSource' in args:
options.filetype = args['inputSource']
process = cms.Process('RECO', cms.ModifierChain(self.eras, self.expressModifiers) )
if 'customs' in args:
options.customisation_file=args['customs']
self._checkRepackedFlag(options,**args)
cb = ConfigBuilder(options, process = process, with_output = True, with_input = True)
cb.prepare()
addMonitoring(process)
return process
def visualizationProcessing(self, globalTag, **args):
"""
_visualizationProcessing_
"""
options = Options()
options.__dict__.update(defaultOptions.__dict__)
options.scenario = self.cbSc
# FIXME: do we need L1Reco here?
options.step =''
if 'preFilter' in args:
options.step +='FILTER:'+args['preFilter']+','
eiStep=''
if 'beamSplashRun' in args:
options.step += 'RAW2DIGI,L1Reco,RECO'+args['beamSplashRun']+',ENDJOB'
print("Using RECO%s step in visualizationProcessing" % args['beamSplashRun'])
else :
options.step += 'RAW2DIGI,L1Reco,RECO'+eiStep+',ENDJOB'
dictIO(options,args)
options.conditions = gtNameAndConnect(globalTag, args)
options.timeoutOutput = True
# FIXME: maybe can go...maybe not
options.filein = 'tobeoverwritten.xyz'
if 'inputSource' in args:
options.filetype = args['inputSource']
else:
# this is the default as this is what is needed on the OnlineCluster
options.filetype = 'DQMDAQ'
print("Using %s source"%options.filetype)
process = cms.Process('RECO', cms.ModifierChain(self.eras, self.visModifiers) )
if 'customs' in args:
options.customisation_file=args['customs']
self._checkRepackedFlag(options, **args)
cb = ConfigBuilder(options, process = process, with_output = True, with_input = True)
cb.prepare()
# FIXME: not sure abou this one...drop for the moment
# addMonitoring(process)
return process
def alcaSkim(self, skims, **args):
"""
_alcaSkim_
AlcaReco processing & skims for proton collisions
"""
step = ""
pclWflws = [x for x in skims if "PromptCalibProd" in x]
skims = [x for x in skims if x not in pclWflws]
if len(pclWflws):
step += 'ALCA:'+('+'.join(pclWflws))
if len( skims ) > 0:
if step != "":
step += ","
step += "ALCAOUTPUT:"+('+'.join(skims))
options = Options()
options.__dict__.update(defaultOptions.__dict__)
options.scenario = self.cbSc
options.step = step
options.conditions = args['globaltag'] if 'globaltag' in args else 'None'
if 'globalTagConnect' in args and args['globalTagConnect'] != '':
options.conditions += ','+args['globalTagConnect']
options.triggerResultsProcess = 'RECO'
if 'customs' in args:
options.customisation_file=args['customs']
process = cms.Process('ALCA', self.eras)
cb = ConfigBuilder(options, process = process)
# Input source
process.source = cms.Source(
"PoolSource",
fileNames = cms.untracked.vstring()
)
cb.prepare()
# FIXME: dirty hack..any way around this?
# Tier0 needs the dataset used for ALCAHARVEST step to be a different data-tier
for wfl in pclWflws:
methodToCall = getattr(process, 'ALCARECOStream'+wfl)
methodToCall.dataset.dataTier = cms.untracked.string('ALCAPROMPT')
return process
def dqmHarvesting(self, datasetName, runNumber, globalTag, **args):
"""
_dqmHarvesting_
Proton collisions data taking DQM Harvesting
"""
options = defaultOptions
options.scenario = self.cbSc
options.step = "HARVESTING"+dqmSeq(args,':dqmHarvesting')
options.name = "EDMtoMEConvert"
options.conditions = gtNameAndConnect(globalTag, args)
process = cms.Process("HARVESTING", self.eras)
process.source = dqmIOSource(args)
if 'customs' in args:
options.customisation_file=args['customs']
configBuilder = ConfigBuilder(options, process = process)
configBuilder.prepare()
harvestingMode(process,datasetName,args,rANDl=False)
return process
def alcaHarvesting(self, globalTag, datasetName, **args):
"""
_alcaHarvesting_
Proton collisions data taking AlCa Harvesting
"""
skims = []
if 'skims' in args:
skims = args['skims']
if 'alcapromptdataset' in args:
skims.append('@'+args['alcapromptdataset'])
if len(skims) == 0: return None
options = defaultOptions
options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
options.step = "ALCAHARVEST:"+('+'.join(skims))
options.name = "ALCAHARVEST"
options.conditions = gtNameAndConnect(globalTag, args)
process = cms.Process("ALCAHARVEST", self.eras)
process.source = cms.Source("PoolSource")
if 'customs' in args:
options.customisation_file=args['customs']
configBuilder = ConfigBuilder(options, process = process)
configBuilder.prepare()
#
# customise process for particular job
#
process.source.processingMode = cms.untracked.string('RunsAndLumis')
process.source.fileNames = cms.untracked(cms.vstring())
process.maxEvents.input = -1
process.dqmSaver.workflow = datasetName
return process
def skimming(self, skims, globalTag,**options):
"""
_skimming_
skimming method overload for the prompt skiming
"""
options = defaultOptions
options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
options.step = "SKIM:"+('+'.join(skims))
options.name = "SKIM"
options.conditions = gtNameAndConnect(globalTag, args)
process = cms.Process("SKIM", self.eras)
process.source = cms.Source("PoolSource")
if 'customs' in args:
options.customisation_file=args['customs']
configBuilder = ConfigBuilder(options, process = process)
configBuilder.prepare()
return process
"""
def repack(self, **args):
options = defaultOptions
dictIO(options,args)
options.filein='file.dat'
options.filetype='DAT'
options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
process = cms.Process('REPACK', self.eras)
cb = ConfigBuilder(options, process = process, with_output = True,with_input=True)
cb.prepare()
print cb.pythonCfgCode
return process
"""
|