CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Scenario.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 """
3 _Scenario_
4 
5 Standard cmsRun Process building interface used for data processing
6 for a particular data scenario.
7 A scenario is a macro-data-taking setting such as cosmic running,
8 beam halo running, or particular validation tests.
9 
10 This class defines the interfaces used by the Tier 0 and Tier 1
11 processing to wrap calls to ConfigBuilder in order to retrieve all the
12 configurations for the various types of job
13 
14 """
15 
16 import FWCore.ParameterSet.Config as cms
17 from Configuration.DataProcessing.Merge import mergeProcess
18 
20  """
21  _Scenario_
22 
23  """
24  def __init__(self):
25  pass
26 
27 
28  def promptReco(self, globalTag, writeTiers = ['RECO'], **options):
29  """
30  _installPromptReco_
31 
32  given a skeleton process object and references
33  to the output modules for the products it produces,
34  install the standard reco sequences and event content for this
35  scenario
36 
37  """
38  msg = "Scenario Implementation %s\n" % self.__class__.__name__
39  msg += "Does not contain an implementation for promptReco"
40  raise NotImplementedError, msg
41 
42 
43  def expressProcessing(self, globalTag, writeTiers = [], **options):
44  """
45  _expressProcessing_
46 
47  Build an express processing configuration for this scenario.
48 
49  Express processing runs conversion, reco and alca reco on each
50  streamer file in the express stream and writes out RAW, RECO and
51  a combined ALCA file that gets mergepacked in a later step
52 
53  writeTiers is list of tiers to write out, not including ALCA
54 
55  datasets is the list of datasets to split into for each tier
56  written out. Should always be one dataset
57 
58  alcaDataset - if set, this means the combined Alca file is written
59  out with no dataset splitting, it gets assigned straight to the datase
60  provided
61 
62  """
63  msg = "Scenario Implementation %s\n" % self.__class__.__name__
64  msg += "Does not contain an implementation for expressProcessing"
65  raise NotImplementedError, msg
66 
67 
68  def alcaSkim(self, skims, **options):
69  """
70  _alcaSkim_
71 
72  Given a skeleton process install the skim splitting for given skims
73 
74  """
75  msg = "Scenario Implementation %s\n" % self.__class__.__name__
76  msg += "Does not contain an implementation for alcaSkim"
77  raise NotImplementedError, msg
78 
79 
80  def alcaReco(self, *skims, **options):
81  """
82  _alcaSkim_
83 
84  Given a skeleton process install the skim production for given skims
85 
86  """
87  msg = "Scenario Implementation %s\n" % self.__class__.__name__
88  msg += "Does not contain an implementation for alcaReco"
89  raise NotImplementedError, msg
90 
91 
92  def dqmHarvesting(self, datasetName, runNumber, globalTag, **options):
93  """
94  _dqmHarvesting_
95 
96  build a DQM Harvesting configuration
97 
98  Arguments:
99 
100  datasetName - aka workflow name for DQMServer, this is the name of the
101  dataset containing the harvested run
102  runNumber - The run being harvested
103  globalTag - The global tag being used
104  inputFiles - The list of LFNs being harvested
105 
106  """
107  msg = "Scenario Implementation %s\n" % self.__class__.__name__
108  msg += "Does not contain an implementation for dqmHarvesting"
109  raise NotImplementedError, msg
110 
111 
112  def alcaHarvesting(self, globalTag, datasetName, **options):
113  """
114  _alcaHarvesting_
115 
116  build an AlCa Harvesting configuration
117 
118  Arguments:
119 
120  globalTag - The global tag being used
121  inputFiles - The list of LFNs being harvested
122 
123  """
124  msg = "Scenario Implementation %s\n" % self.__class__.__name__
125  msg += "Does not contain an implementation for alcaHarvesting"
126  raise NotImplementedError, msg
127 
128 
129  def skimming(self, skims, **options):
130  """
131  _skimming_
132 
133  Given a process install the sequences for Tier 1 skimming
134  and the appropriate output modules
135 
136  """
137  msg = "Scenario Implementation %s\n" % self.__class__.__name__
138  msg += "Does not contain an implementation for skimming"
139  raise NotImplementedError, msg
140 
141 
142  def merge(self, *inputFiles, **options):
143  """
144  _merge_
145 
146  builds a merge configuration
147 
148  """
149  msg = "Scenario Implementation %s\n" % self.__class__.__name__
150  return mergeProcess(*inputFiles, **options)
151 
152 
153  #
154  # helper methods
155  #
156 
157  def dropOutputModule(self, processRef, moduleName):
158  """
159  _dropOutputModule_
160 
161  Util to prune an unwanted output module
162 
163  """
164  del process._Process__outputmodules[moduleName]
165  return
166 
167 
168  def addExpressOutputModules(self, process, tiers, datasets):
169  """
170  _addExpressOutputModules_
171 
172  Util method to unpack and install the set of data tier
173  output modules corresponding to the list of tiers and datasets
174  provided
175 
176  """
177  for tier in tiers:
178  for dataset in datasets:
179  moduleName = "write%s%s" % (tier, dataset)
180  contentName = "%sEventContent" % tier
181  contentAttr = getattr(process, contentName)
182  setattr(process, moduleName,
183 
184  cms.OutputModule(
185  "PoolOutputModule",
186  fileName = cms.untracked.string('%s.root' % moduleName),
187  dataset = cms.untracked.PSet(
188  dataTier = cms.untracked.string(tier),
189  ),
190  eventContent = contentAttr
191  )
192 
193  )
194  return
195 
196 
def expressProcessing
Definition: Scenario.py:43
list object
Definition: dbtoconf.py:77
def addExpressOutputModules
Definition: Scenario.py:168
def mergeProcess
Definition: Merge.py:16