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