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
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 = globalTag
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 = globalTag
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 = globalTag
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  if len(pclWflws):
151  step = 'ALCA:'
152  for wfl in pclWflws:
153  step += wfl
154  skims.remove(wfl)
155 
156  if len( skims ) > 0:
157  if step != "":
158  step += ","
159  step += "ALCAOUTPUT:"+('+'.join(skims))
160 
161  options = Options()
162  options.__dict__.update(defaultOptions.__dict__)
163  options.scenario = self.cbSc
164  options.step = step
165  options.conditions = args['globaltag'] if 'globaltag' in args else 'None'
166  options.triggerResultsProcess = 'RECO'
167 
168  process = cms.Process('ALCA')
169  cb = ConfigBuilder(options, process = process)
170 
171  # Input source
172  process.source = cms.Source(
173  "PoolSource",
174  fileNames = cms.untracked.vstring()
175  )
176 
177  cb.prepare()
178 
179  # FIXME: dirty hack..any way around this?
180  # Tier0 needs the dataset used for ALCAHARVEST step to be a different data-tier
181  for wfl in pclWflws:
182  methodToCall = getattr(process, 'ALCARECOStream'+wfl)
183  methodToCall.dataset.dataTier = cms.untracked.string('ALCAPROMPT')
184 
185  return process
186 
187 
188  def dqmHarvesting(self, datasetName, runNumber, globalTag, **args):
189  """
190  _dqmHarvesting_
191 
192  Proton collisions data taking DQM Harvesting
193 
194  """
195  options = defaultOptions
196  options.scenario = self.cbSc
197  options.step = "HARVESTING"+dqmSeq(args,':dqmHarvesting')
198  options.name = "EDMtoMEConvert"
199  options.conditions = globalTag
200 
201  process = cms.Process("HARVESTING")
202  process.source = dqmIOSource(args)
203  configBuilder = ConfigBuilder(options, process = process)
204  configBuilder.prepare()
205 
206  harvestingMode(process,datasetName,args,rANDl=False)
207  return process
208 
209 
210  def alcaHarvesting(self, globalTag, datasetName, **args):
211  """
212  _alcaHarvesting_
213 
214  Proton collisions data taking AlCa Harvesting
215 
216  """
217  if not 'skims' in args: return None
218  options = defaultOptions
219  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
220  options.step = "ALCAHARVEST:"+('+'.join(args['skims']))
221  options.name = "ALCAHARVEST"
222  options.conditions = globalTag
223 
224  process = cms.Process("ALCAHARVEST")
225  process.source = cms.Source("PoolSource")
226  configBuilder = ConfigBuilder(options, process = process)
227  configBuilder.prepare()
228 
229  #
230  # customise process for particular job
231  #
232  process.source.processingMode = cms.untracked.string('RunsAndLumis')
233  process.source.fileNames = cms.untracked(cms.vstring())
234  process.maxEvents.input = -1
235  process.dqmSaver.workflow = datasetName
236 
237  return process
238 
239  def skimming(self, skims, globalTag,**options):
240  """
241  _skimming_
242 
243  skimming method overload for the prompt skiming
244 
245  """
246  options = defaultOptions
247  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
248  options.step = "SKIM:"+('+'.join(skims))
249  options.name = "SKIM"
250  options.conditions = globalTag
251  process = cms.Process("SKIM")
252  process.source = cms.Source("PoolSource")
253  configBuilder = ConfigBuilder(options, process = process)
254  configBuilder.prepare()
255 
256  return process
257 
258  """
259  def repack(self, **args):
260  options = defaultOptions
261  dictIO(options,args)
262  options.filein='file.dat'
263  options.filetype='DAT'
264  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
265  process = cms.Process('REPACK')
266  cb = ConfigBuilder(options, process = process, with_output = True,with_input=True)
267  cb.prepare()
268  print cb.pythonCfgCode
269  return process
270  """
def alcaHarvesting
Definition: Reco.py:210
def dqmSeq
Definition: Utils.py:116
def stepALCAPRODUCER
Definition: Utils.py:9
def skimming
Definition: Reco.py:239
def addMonitoring
Definition: Utils.py:23
def __init__
Definition: Reco.py:18
def dqmHarvesting
Definition: Reco.py:188
def promptReco
Definition: Reco.py:29
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