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