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 alcaSkim(self, skims, **args):
94  """
95  _alcaSkim_
96 
97  AlcaReco processing & skims for proton collisions
98 
99  """
100 
101  step = ""
102  pclWflws = [x for x in skims if "PromptCalibProd" in x]
103  if len(pclWflws):
104  step = 'ALCA:'
105  for wfl in pclWflws:
106  step += wfl
107  skims.remove(wfl)
108 
109  if len( skims ) > 0:
110  if step != "":
111  step += ","
112  step += "ALCAOUTPUT:"+('+'.join(skims))
113 
114  options = Options()
115  options.__dict__.update(defaultOptions.__dict__)
116  options.scenario = self.cbSc
117  options.step = step
118  options.conditions = args['globaltag'] if 'globaltag' in args else 'None'
119  options.triggerResultsProcess = 'RECO'
120 
121  process = cms.Process('ALCA')
122  cb = ConfigBuilder(options, process = process)
123 
124  # Input source
125  process.source = cms.Source(
126  "PoolSource",
127  fileNames = cms.untracked.vstring()
128  )
129 
130  cb.prepare()
131 
132  # FIXME: dirty hack..any way around this?
133  # Tier0 needs the dataset used for ALCAHARVEST step to be a different data-tier
134  for wfl in pclWflws:
135  methodToCall = getattr(process, 'ALCARECOStream'+wfl)
136  methodToCall.dataset.dataTier = cms.untracked.string('ALCAPROMPT')
137 
138  return process
139 
140 
141  def dqmHarvesting(self, datasetName, runNumber, globalTag, **args):
142  """
143  _dqmHarvesting_
144 
145  Proton collisions data taking DQM Harvesting
146 
147  """
148  options = defaultOptions
149  options.scenario = self.cbSc
150  options.step = "HARVESTING"+dqmSeq(args,':dqmHarvesting')
151  options.name = "EDMtoMEConvert"
152  options.conditions = globalTag
153 
154  process = cms.Process("HARVESTING")
155  process.source = dqmIOSource(args)
156  configBuilder = ConfigBuilder(options, process = process)
157  configBuilder.prepare()
158 
159  harvestingMode(process,datasetName,args,rANDl=False)
160  return process
161 
162 
163  def alcaHarvesting(self, globalTag, datasetName, **args):
164  """
165  _alcaHarvesting_
166 
167  Proton collisions data taking AlCa Harvesting
168 
169  """
170  if not 'skims' in args: return None
171  options = defaultOptions
172  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
173  options.step = "ALCAHARVEST:"+('+'.join(args['skims']))
174  options.name = "ALCAHARVEST"
175  options.conditions = globalTag
176 
177  process = cms.Process("ALCAHARVEST")
178  process.source = cms.Source("PoolSource")
179  configBuilder = ConfigBuilder(options, process = process)
180  configBuilder.prepare()
181 
182  #
183  # customise process for particular job
184  #
185  process.source.processingMode = cms.untracked.string('RunsAndLumis')
186  process.source.fileNames = cms.untracked(cms.vstring())
187  process.maxEvents.input = -1
188  process.dqmSaver.workflow = datasetName
189 
190  return process
191 
192  def skimming(self, skims, globalTag,**options):
193  """
194  _skimming_
195 
196  skimming method overload for the prompt skiming
197 
198  """
199  options = defaultOptions
200  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
201  options.step = "SKIM:"+('+'.join(skims))
202  options.name = "SKIM"
203  options.conditions = globalTag
204  process = cms.Process("SKIM")
205  process.source = cms.Source("PoolSource")
206  configBuilder = ConfigBuilder(options, process = process)
207  configBuilder.prepare()
208 
209  return process
210 
211  """
212  def repack(self, **args):
213  options = defaultOptions
214  dictIO(options,args)
215  options.filein='file.dat'
216  options.filetype='DAT'
217  options.scenario = self.cbSc if hasattr(self,'cbSc') else self.__class__.__name__
218  process = cms.Process('REPACK')
219  cb = ConfigBuilder(options, process = process, with_output = True,with_input=True)
220  cb.prepare()
221  print cb.pythonCfgCode
222  return process
223  """
def alcaHarvesting
Definition: Reco.py:163
def dqmSeq
Definition: Utils.py:116
def stepALCAPRODUCER
Definition: Utils.py:9
def skimming
Definition: Reco.py:192
def addMonitoring
Definition: Utils.py:23
def __init__
Definition: Reco.py:18
def dqmHarvesting
Definition: Reco.py:141
def promptReco
Definition: Reco.py:29
def dqmIOSource
Definition: Utils.py:88
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:93
recoSeq
Definition: Reco.py:19
cbSc
Definition: Reco.py:20
def expressProcessing
Definition: Reco.py:59