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