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