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  self._checkRepackedFlag(options, **args)
182 
183  cb = ConfigBuilder(options, process = process, with_output = True, with_input = True)
184 
185  cb.prepare()
186 
187 
188 
189 
190  # FIXME: not sure abou this one...drop for the moment
191  # addMonitoring(process)
192 
193  return process
194 
195 
196 
197 
198  def alcaSkim(self, skims, **args):
199  """
200  _alcaSkim_
201 
202  AlcaReco processing & skims for proton collisions
203 
204  """
205 
206  step = ""
207  pclWflws = [x for x in skims if "PromptCalibProd" in x]
208  skims = filter(lambda x: x not in pclWflws, skims)
209 
210  if len(pclWflws):
211  step += 'ALCA:'+('+'.join(pclWflws))
212 
213  if len( skims ) > 0:
214  if step != "":
215  step += ","
216  step += "ALCAOUTPUT:"+('+'.join(skims))
217 
218  options = Options()
219  options.__dict__.update(defaultOptions.__dict__)
220  options.scenario = self.cbSc
221  options.step = step
222  options.conditions = args['globaltag'] if 'globaltag' in args else 'None'
223  if args.has_key('globalTagConnect') and args['globalTagConnect'] != '':
224  options.conditions += ','+args['globalTagConnect']
225 
226  options.triggerResultsProcess = 'RECO'
227 
228  if 'customs' in args:
229  options.customisation_file=args['customs']
230 
231  process = cms.Process('ALCA')
232  cb = ConfigBuilder(options, process = process)
233 
234  # Input source
235  process.source = cms.Source(
236  "PoolSource",
237  fileNames = cms.untracked.vstring()
238  )
239 
240  cb.prepare()
241 
242  # FIXME: dirty hack..any way around this?
243  # Tier0 needs the dataset used for ALCAHARVEST step to be a different data-tier
244  for wfl in pclWflws:
245  methodToCall = getattr(process, 'ALCARECOStream'+wfl)
246  methodToCall.dataset.dataTier = cms.untracked.string('ALCAPROMPT')
247 
248  return process
249 
250 
251  def dqmHarvesting(self, datasetName, runNumber, globalTag, **args):
252  """
253  _dqmHarvesting_
254 
255  Proton collisions data taking DQM Harvesting
256 
257  """
258  options = defaultOptions
259  options.scenario = self.cbSc
260  options.step = "HARVESTING"+dqmSeq(args,':dqmHarvesting')
261  options.name = "EDMtoMEConvert"
262  options.conditions = gtNameAndConnect(globalTag, args)
263 
264  process = cms.Process("HARVESTING")
265  process.source = dqmIOSource(args)
266 
267  if 'customs' in args:
268  options.customisation_file=args['customs']
269 
270  configBuilder = ConfigBuilder(options, process = process)
271  configBuilder.prepare()
272 
273  harvestingMode(process,datasetName,args,rANDl=False)
274  return process
275 
276 
277  def alcaHarvesting(self, globalTag, datasetName, **args):
278  """
279  _alcaHarvesting_
280 
281  Proton collisions data taking AlCa Harvesting
282 
283  """
284  skims = []
285  if 'skims' in args:
286  skims = args['skims']
287 
288 
289  if 'alcapromptdataset' in args:
290  skims.append('@'+args['alcapromptdataset'])
291 
292  if len(skims) == 0: return None
293  options = defaultOptions
294  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
295  options.step = "ALCAHARVEST:"+('+'.join(skims))
296  options.name = "ALCAHARVEST"
297  options.conditions = gtNameAndConnect(globalTag, args)
298 
299  process = cms.Process("ALCAHARVEST")
300  process.source = cms.Source("PoolSource")
301 
302  if 'customs' in args:
303  options.customisation_file=args['customs']
304 
305  configBuilder = ConfigBuilder(options, process = process)
306  configBuilder.prepare()
307 
308  #
309  # customise process for particular job
310  #
311  process.source.processingMode = cms.untracked.string('RunsAndLumis')
312  process.source.fileNames = cms.untracked(cms.vstring())
313  process.maxEvents.input = -1
314  process.dqmSaver.workflow = datasetName
315 
316  return process
317 
318  def skimming(self, skims, globalTag,**options):
319  """
320  _skimming_
321 
322  skimming method overload for the prompt skiming
323 
324  """
325  options = defaultOptions
326  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
327  options.step = "SKIM:"+('+'.join(skims))
328  options.name = "SKIM"
329  options.conditions = gtNameAndConnect(globalTag, args)
330  process = cms.Process("SKIM")
331  process.source = cms.Source("PoolSource")
332 
333  if 'customs' in args:
334  options.customisation_file=args['customs']
335 
336  configBuilder = ConfigBuilder(options, process = process)
337  configBuilder.prepare()
338 
339  return process
340 
341  """
342  def repack(self, **args):
343  options = defaultOptions
344  dictIO(options,args)
345  options.filein='file.dat'
346  options.filetype='DAT'
347  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
348  process = cms.Process('REPACK')
349  cb = ConfigBuilder(options, process = process, with_output = True,with_input=True)
350  cb.prepare()
351  print cb.pythonCfgCode
352  return process
353  """
def alcaHarvesting
Definition: Reco.py:277
def dqmSeq
Definition: Utils.py:130
def stepALCAPRODUCER
Definition: Utils.py:9
def skimming
Definition: Reco.py:318
def addMonitoring
Definition: Utils.py:38
def __init__
Definition: Reco.py:18
def dqmHarvesting
Definition: Reco.py:251
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:198
recoSeq
Definition: Reco.py:19
cbSc
Definition: Reco.py:20
def expressProcessing
Definition: Reco.py:96