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