CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Reco.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """
3 _pp_
4 
5 Scenario supporting proton collisions
6 
7 """
8 
9 import os
10 import sys
11 
13 from Configuration.DataProcessing.Utils import stepALCAPRODUCER,stepSKIMPRODUCER,addMonitoring,dictIO,dqmIOSource,harvestingMode,dqmSeq,gtNameAndConnect
14 import FWCore.ParameterSet.Config as cms
15 from Configuration.DataProcessing.RecoTLR import customisePrompt,customiseExpress
16 
17 class Reco(Scenario):
18  def __init__(self):
19  Scenario.__init__(self)
20  self.recoSeq=''
21  self.cbSc=self.__class__.__name__
22  """
23  _pp_
24 
25  Implement configuration building for data processing for proton
26  collision data taking
27 
28  """
29 
30 
31  def _checkRepackedFlag(self, options, **args):
32  if 'repacked' in args:
33  if args['repacked'] == True:
34  options.isRepacked = True
35  else:
36  options.isRepacked = False
37 
38 
39 
40  def promptReco(self, globalTag, **args):
41  """
42  _promptReco_
43 
44  Proton collision data taking prompt reco
45 
46  """
47  step = stepALCAPRODUCER(args['skims'])
48  PhysicsSkimStep = ''
49  if ("PhysicsSkims" in args) :
50  PhysicsSkimStep = stepSKIMPRODUCER(args['PhysicsSkims'])
51  dqmStep= dqmSeq(args,'')
52  options = Options()
53  options.__dict__.update(defaultOptions.__dict__)
54  options.scenario = self.cbSc
55 
56  miniAODStep=''
57 
58 # if miniAOD is asked for - then retrieve the miniaod config
59  if 'outputs' in args:
60  for a in args['outputs']:
61  if a['dataTier'] == 'MINIAOD':
62  miniAODStep=',PAT'
63 
64  """
65  Unscheduled for all
66  """
67  options.runUnscheduled=True
68 
69  self._checkRepackedFlag(options, **args)
70 
71  if 'customs' in args:
72  options.customisation_file=args['customs']
73 
74  eiStep=''
75  if self.cbSc == 'pp':
76  eiStep=',EI'
77 
78  options.step = 'RAW2DIGI,L1Reco,RECO'+self.recoSeq+eiStep+step+PhysicsSkimStep+miniAODStep+',DQM'+dqmStep+',ENDJOB'
79 
80 
81  dictIO(options,args)
82  options.conditions = gtNameAndConnect(globalTag, args)
83 
84  process = cms.Process('RECO', self.eras)
85  cb = ConfigBuilder(options, process = process, with_output = True)
86 
87  # Input source
88  process.source = cms.Source("PoolSource",
89  fileNames = cms.untracked.vstring()
90  )
91  cb.prepare()
92 
93  addMonitoring(process)
94 
95  return process
96 
97 
98  def expressProcessing(self, globalTag, **args):
99  """
100  _expressProcessing_
101 
102  Proton collision data taking express processing
103 
104  """
105  skims = args['skims']
106  # 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
107  pclWkflws = [x for x in skims if "PromptCalibProd" in x]
108  for wfl in pclWkflws:
109  skims.remove(wfl)
110 
111  step = stepALCAPRODUCER(skims)
112  dqmStep= dqmSeq(args,'')
113  options = Options()
114  options.__dict__.update(defaultOptions.__dict__)
115  options.scenario = self.cbSc
116 
117  eiStep=''
118  if self.cbSc == 'pp':
119  eiStep=',EI'
120 
121  options.step = 'RAW2DIGI,L1Reco,RECO'+eiStep+step+',DQM'+dqmStep+',ENDJOB'
122  dictIO(options,args)
123  options.conditions = gtNameAndConnect(globalTag, args)
124  options.filein = 'tobeoverwritten.xyz'
125  if 'inputSource' in args:
126  options.filetype = args['inputSource']
127  process = cms.Process('RECO', self.eras)
128 
129  if 'customs' in args:
130  options.customisation_file=args['customs']
131 
132  self._checkRepackedFlag(options,**args)
133 
134  cb = ConfigBuilder(options, process = process, with_output = True, with_input = True)
135 
136  cb.prepare()
137 
138  addMonitoring(process)
139 
140  return process
141 
142 
143  def visualizationProcessing(self, globalTag, **args):
144  """
145  _visualizationProcessing_
146 
147  """
148 
149  options = Options()
150  options.__dict__.update(defaultOptions.__dict__)
151  options.scenario = self.cbSc
152  # FIXME: do we need L1Reco here?
153  options.step =''
154  if 'preFilter' in args:
155  options.step +='FILTER:'+args['preFilter']+','
156 
157  eiStep=''
158  if self.cbSc == 'pp':
159  eiStep=',EI'
160 
161  options.step += 'RAW2DIGI,L1Reco,RECO'+eiStep+',ENDJOB'
162 
163 
164  dictIO(options,args)
165  options.conditions = gtNameAndConnect(globalTag, args)
166  options.timeoutOutput = True
167  # FIXME: maybe can go...maybe not
168  options.filein = 'tobeoverwritten.xyz'
169 
170  if 'inputSource' in args:
171  options.filetype = args['inputSource']
172  else:
173  # this is the default as this is what is needed on the OnlineCluster
174  options.filetype = 'DQMDAQ'
175 
176  print "Using %s source"%options.filetype
177 
178  process = cms.Process('RECO', self.eras)
179 
180  if 'customs' in args:
181  options.customisation_file=args['customs']
182 
183  self._checkRepackedFlag(options, **args)
184 
185  cb = ConfigBuilder(options, process = process, with_output = True, with_input = True)
186 
187  cb.prepare()
188 
189 
190 
191 
192  # FIXME: not sure abou this one...drop for the moment
193  # addMonitoring(process)
194 
195  return process
196 
197 
198 
199 
200  def alcaSkim(self, skims, **args):
201  """
202  _alcaSkim_
203 
204  AlcaReco processing & skims for proton collisions
205 
206  """
207 
208  step = ""
209  pclWflws = [x for x in skims if "PromptCalibProd" in x]
210  skims = filter(lambda x: x not in pclWflws, skims)
211 
212  if len(pclWflws):
213  step += 'ALCA:'+('+'.join(pclWflws))
214 
215  if len( skims ) > 0:
216  if step != "":
217  step += ","
218  step += "ALCAOUTPUT:"+('+'.join(skims))
219 
220  options = Options()
221  options.__dict__.update(defaultOptions.__dict__)
222  options.scenario = self.cbSc
223  options.step = step
224  options.conditions = args['globaltag'] if 'globaltag' in args else 'None'
225  if 'globalTagConnect' in args and args['globalTagConnect'] != '':
226  options.conditions += ','+args['globalTagConnect']
227 
228  options.triggerResultsProcess = 'RECO'
229 
230  if 'customs' in args:
231  options.customisation_file=args['customs']
232 
233  process = cms.Process('ALCA', self.eras)
234  cb = ConfigBuilder(options, process = process)
235 
236  # Input source
237  process.source = cms.Source(
238  "PoolSource",
239  fileNames = cms.untracked.vstring()
240  )
241 
242  cb.prepare()
243 
244  # FIXME: dirty hack..any way around this?
245  # Tier0 needs the dataset used for ALCAHARVEST step to be a different data-tier
246  for wfl in pclWflws:
247  methodToCall = getattr(process, 'ALCARECOStream'+wfl)
248  methodToCall.dataset.dataTier = cms.untracked.string('ALCAPROMPT')
249 
250  return process
251 
252 
253  def dqmHarvesting(self, datasetName, runNumber, globalTag, **args):
254  """
255  _dqmHarvesting_
256 
257  Proton collisions data taking DQM Harvesting
258 
259  """
260  options = defaultOptions
261  options.scenario = self.cbSc
262  options.step = "HARVESTING"+dqmSeq(args,':dqmHarvesting')
263  options.name = "EDMtoMEConvert"
264  options.conditions = gtNameAndConnect(globalTag, args)
265 
266  process = cms.Process("HARVESTING", self.eras)
267  process.source = dqmIOSource(args)
268 
269  if 'customs' in args:
270  options.customisation_file=args['customs']
271 
272  configBuilder = ConfigBuilder(options, process = process)
273  configBuilder.prepare()
274 
275  harvestingMode(process,datasetName,args,rANDl=False)
276  return process
277 
278 
279  def alcaHarvesting(self, globalTag, datasetName, **args):
280  """
281  _alcaHarvesting_
282 
283  Proton collisions data taking AlCa Harvesting
284 
285  """
286  skims = []
287  if 'skims' in args:
288  skims = args['skims']
289 
290 
291  if 'alcapromptdataset' in args:
292  skims.append('@'+args['alcapromptdataset'])
293 
294  if len(skims) == 0: return None
295  options = defaultOptions
296  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
297  options.step = "ALCAHARVEST:"+('+'.join(skims))
298  options.name = "ALCAHARVEST"
299  options.conditions = gtNameAndConnect(globalTag, args)
300 
301  process = cms.Process("ALCAHARVEST", self.eras)
302  process.source = cms.Source("PoolSource")
303 
304  if 'customs' in args:
305  options.customisation_file=args['customs']
306 
307  configBuilder = ConfigBuilder(options, process = process)
308  configBuilder.prepare()
309 
310  #
311  # customise process for particular job
312  #
313  process.source.processingMode = cms.untracked.string('RunsAndLumis')
314  process.source.fileNames = cms.untracked(cms.vstring())
315  process.maxEvents.input = -1
316  process.dqmSaver.workflow = datasetName
317 
318  return process
319 
320  def skimming(self, skims, globalTag,**options):
321  """
322  _skimming_
323 
324  skimming method overload for the prompt skiming
325 
326  """
327  options = defaultOptions
328  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
329  options.step = "SKIM:"+('+'.join(skims))
330  options.name = "SKIM"
331  options.conditions = gtNameAndConnect(globalTag, args)
332  process = cms.Process("SKIM", self.eras)
333  process.source = cms.Source("PoolSource")
334 
335  if 'customs' in args:
336  options.customisation_file=args['customs']
337 
338  configBuilder = ConfigBuilder(options, process = process)
339  configBuilder.prepare()
340 
341  return process
342 
343  """
344  def repack(self, **args):
345  options = defaultOptions
346  dictIO(options,args)
347  options.filein='file.dat'
348  options.filetype='DAT'
349  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
350  process = cms.Process('REPACK', self.eras)
351  cb = ConfigBuilder(options, process = process, with_output = True,with_input=True)
352  cb.prepare()
353  print cb.pythonCfgCode
354  return process
355  """
def alcaHarvesting
Definition: Reco.py:279
def dqmSeq
Definition: Utils.py:131
def stepALCAPRODUCER
Definition: Utils.py:9
def skimming
Definition: Reco.py:320
def addMonitoring
Definition: Utils.py:38
def __init__
Definition: Reco.py:18
def dqmHarvesting
Definition: Reco.py:253
def stepSKIMPRODUCER
Definition: Utils.py:24
def promptReco
Definition: Reco.py:40
def gtNameAndConnect
Definition: Utils.py:137
def dqmIOSource
Definition: Utils.py:103
def visualizationProcessing
Definition: Reco.py:143
def dictIO
Definition: Utils.py:123
def _checkRepackedFlag
Definition: Reco.py:31
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def harvestingMode
Definition: Utils.py:114
def alcaSkim
Definition: Reco.py:200
recoSeq
Definition: Reco.py:20
cbSc
Definition: Reco.py:21
def expressProcessing
Definition: Reco.py:98