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