CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
confdb.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import sys
4 import re
5 import os
6 import urllib, urllib2
7 from pipe import pipe as _pipe
8 from options import globalTag
9 from itertools import islice
10 
11 def splitter(iterator, n):
12  i = iterator.__iter__()
13  while True:
14  l = list(islice(i, n))
15  if l:
16  yield l
17  else:
18  break
19 
20 
22  # paths not supported by FastSim
23  fastsimUnsupportedPaths = (
24 
25  # paths for which a recovery is not foreseen/possible
26  "AlCa_*_v*",
27  "DQM_*_v*",
28  "HLT_*Calibration_v*",
29  "HLT_DTErrors_v*",
30  "HLT_Random_v*",
31  "HLT_HcalNZS_v*",
32  "HLT_HcalPhiSym_v*",
33  "HLT_Activity_Ecal*_v*",
34  "HLT_IsoTrackHB_v*",
35  "HLT_IsoTrackHE_v*",
36  "HLT_L1SingleMuOpen_AntiBPTX_v*",
37  "HLT_JetE*_NoBPTX*_v*",
38  "HLT_L2Mu*_NoVertex_NoBPTX*_v*",
39  "HLT_L2Mu20_NoVertex_2Cha_NoBPTX3BX_NoHalo_v*",
40  "HLT_L2Mu30_NoVertex_2Cha_NoBPTX3BX_NoHalo_v*",
41  "HLT_PixelTracks_Multiplicity70_v*",
42  "HLT_PixelTracks_Multiplicity80_v*",
43  "HLT_PixelTracks_Multiplicity90_v*",
44  "HLT_Beam*_v*",
45 # "HLT_L1Tech_*_v*",
46  "HLT_GlobalRunHPDNoise_v*",
47  "HLT_L1TrackerCosmics_v*",
48  "HLT_HcalUTCA_v*",
49 
50 # TODO: paths not supported by FastSim, but for which a recovery should be attempted
51 
52  "HLT_DoubleMediumIsoPFTau30_Trk1_eta2p1_Reg_Jet30_v*",
53  "HLT_DoubleMediumIsoPFTau30_Trk1_eta2p1_Reg_v*",
54  "HLT_DoubleMediumIsoPFTau35_Trk1_eta2p1_Prong1_Reg_v*",
55  "HLT_DoubleMediumIsoPFTau35_Trk1_eta2p1_Reg_v*",
56  "HLT_IsoMu18_eta2p1_MediumIsoPFTau25_Trk1_eta2p1_Reg_v*",
57 # (not really needed for the five above, because the corresponding paths without regional
58 # tracking are already in the HLT menu)
59  "HLT_DoubleMediumIsoPFTau45_Trk1_eta2p1_Reg_Jet30_v*",
60  "HLT_DoubleMediumIsoPFTau50_Trk1_eta2p1_Prong1_Reg_v*",
61  "HLT_IsoMu26_eta2p1_MediumIsoPFTau30_Trk1_eta2p1_Reg_v*",
62 
63  )
64 
65  def __init__(self, configuration):
66  self.config = configuration
67  self.data = None
68  self.source = None
69  self.parent = None
70 
71  self.options = {
72  'essources' : [],
73  'esmodules' : [],
74  'modules' : [],
75  'sequences' : [],
76  'services' : [],
77  'paths' : [],
78  'psets' : [],
79  'blocks' : [],
80  }
81 
82  self.labels = {}
83  if self.config.fragment:
84  self.labels['process'] = ''
85  self.labels['dict'] = 'locals()'
86  else:
87  self.labels['process'] = 'process.'
88  self.labels['dict'] = 'process.__dict__'
89 
90  if self.config.online:
91  self.labels['connect'] = 'frontier://(proxyurl=http://localhost:3128)(serverurl=http://localhost:8000/FrontierOnProd)(serverurl=http://localhost:8000/FrontierOnProd)(retrieve-ziplevel=0)'
92  else:
93  self.labels['connect'] = 'frontier://FrontierProd'
94 
95  # get the configuration from ConfdB
96  self.buildPathList()
97  self.buildOptions()
99  self.customize()
100 
101 
103  url = 'http://j2eeps.cern.ch/cms-project-confdb-hltdev/get.jsp'
104  postdata = dict([ (key, ','.join(vals)) for key, vals in self.options.iteritems() if vals ])
105  postdata['noedsources'] = ''
106  if self.config.fragment:
107  postdata['cff'] = ''
108  if self.config.menu.run:
109  postdata['runNumber'] = self.config.menu.run
110  else:
111  postdata['dbName'] = self.config.menu.db
112  postdata['configName']= self.config.menu.name
113 
114  data = urllib2.urlopen(url, urllib.urlencode(postdata)).read()
115  if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
116  raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
117  self.data = data
118 
119 
120  def getPathList(self):
121  url = 'http://j2eeps.cern.ch/cms-project-confdb-hltdev/get.jsp'
122  postdata = {
123  'noedsources': '',
124  'noes': '',
125  'noservices': '',
126  'nosequences': '',
127  'nomodules' : '',
128  'cff': '',
129  }
130  if self.config.menu.run:
131  postdata['runNumber'] = self.config.menu.run
132  else:
133  postdata['dbName'] = self.config.menu.db
134  postdata['configName']= self.config.menu.name
135 
136  data = urllib2.urlopen(url, urllib.urlencode(postdata)).read()
137  if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
138  raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
139  filter = re.compile(r' *= *cms.(End)?Path.*')
140  paths = [ filter.sub('', line) for line in data.splitlines() if filter.search(line) ]
141  return paths
142 
143 
144  @staticmethod
145  def expandWildcards(globs, collection):
146  # expand a list of unix-style wildcards matching a given collection
147  # wildcards with no matches are silently discarded
148  matches = []
149  for glob in globs:
150  negate = ''
151  if glob[0] == '-':
152  negate = '-'
153  glob = glob[1:]
154  # translate a unix-style glob expression into a regular expression
155  filter = re.compile(r'^' + glob.replace('?', '.').replace('*', '.*').replace('[!', '[^') + r'$')
156  matches.extend( negate + element for element in collection if filter.match(element) )
157  return matches
158 
159 
160  @staticmethod
161  def consolidateNegativeList(elements):
162  # consolidate a list of path exclusions and re-inclusions
163  # the result is the list of paths to be removed from the dump
164  result = set()
165  for element in elements:
166  if element[0] == '-':
167  result.add( element )
168  else:
169  result.discard( '-' + element )
170  return sorted( element for element in result )
171 
172  @staticmethod
173  def consolidatePositiveList(elements):
174  # consolidate a list of path selection and re-exclusions
175  # the result is the list of paths to be included in the dump
176  result = set()
177  for element in elements:
178  if element[0] == '-':
179  result.discard( element[1:] )
180  else:
181  result.add( element )
182  return sorted( element for element in result )
183 
184 
185  # dump the final configuration
186  def dump(self):
187  return self.data % self.labels
188 
189 
190  # add release-specific customizations
192  # version specific customizations
193  self.data += """
194 # CMSSW version specific customizations
195 import os
196 cmsswVersion = os.environ['CMSSW_VERSION']
197 
198 # customization for 6_2_X
199 
200 # none for now
201 
202 """
203 
204  # customize the configuration according to the options
205  def customize(self):
206 
207  # adapt the source to the current scenario
208  if not self.config.fragment:
209  self.build_source()
210 
211  # manual override some parameters
212  if self.config.type in ('GRun', ):
213  self.data += """
214 # Enable HF Noise filters in GRun menu
215 if 'hltHfreco' in %(dict)s:
216  %(process)shltHfreco.setNoiseFlags = cms.bool( True )
217 """
218  if self.config.type in ('HIon', ):
219  self.data += """
220 # Disable HF Noise filters in HIon menu
221 if 'hltHfreco' in %(dict)s:
222  %(process)shltHfreco.setNoiseFlags = cms.bool( False )
223 """
224 
225 # self.data += """
226 ## untracked parameters with NO default in the code
227 #if 'hltHcalDataIntegrityMonitor' in %(dict)s:
228 # %(process)shltHcalDataIntegrityMonitor.RawDataLabel = cms.untracked.InputTag("rawDataCollector")
229 #if 'hltDt4DSegments' in %(dict)s:
230 # %(process)shltDt4DSegments.debug = cms.untracked.bool( False )
231 #"""
232 
233  # if requested, override the L1 self from the GlobalTag (Xml)
234  self.overrideL1MenuXml()
235 
236  # if running on MC, adapt the configuration accordingly
237  self.fixForMC()
238 
239  # if requested, remove the HLT prescales
240  self.fixPrescales()
241 
242  # if requested, override all ED/HLTfilters to always pass ("open" mode)
243  self.instrumentOpenMode()
244 
245  # if requested, change all HLTTriggerTypeFilter EDFilters to accept only error events (SelectedTriggerType = 0)
246  self.instrumentErrorEventType()
247 
248  # if requested, instrument the self with the modules and EndPath needed for timing studies
249  self.instrumentTiming()
250 
251  # add version-specific customisations
253 
254  if self.config.fragment:
255 
256 # self.data += """
257 ## dummyfy hltGetConditions in cff's
258 #if 'hltGetConditions' in %(dict)s and 'HLTriggerFirstPath' in %(dict)s :
259 # %(process)shltDummyConditions = cms.EDFilter( "HLTBool",
260 # result = cms.bool( True )
261 # )
262 # %(process)sHLTriggerFirstPath.replace(%(process)shltGetConditions,%(process)shltDummyConditions)
263 #"""
264 
265  # if requested, adapt the configuration for FastSim
266  self.fixForFastSim()
267 
268  else:
269 
270  # override the process name and adapt the relevant filters
271  self.overrideProcessName()
272 
273  # override the output modules to output root files
274  self.overrideOutput()
275 
276  # add global options
277  self.addGlobalOptions()
278 
279  # if requested or necessary, override the GlobalTag and connection strings (incl. L1!)
280  self.overrideGlobalTag()
281 
282  # if requested, run (part of) the L1 emulator
283  self.runL1Emulator()
284 
285  # request summary informations from the MessageLogger
286  self.updateMessageLogger()
287 
288  # load 5.2.x JECs, until they are in the GlobalTag
289 # self.loadAdditionalConditions('load 5.2.x JECs',
290 # {
291 # 'record' : 'JetCorrectionsRecord',
292 # 'tag' : 'JetCorrectorParametersCollection_AK5Calo_2012_V8_hlt_mc',
293 # 'label' : 'AK5CaloHLT',
294 # 'connect' : '%(connect)s/CMS_COND_31X_PHYSICSTOOLS'
295 # }, {
296 # 'record' : 'JetCorrectionsRecord',
297 # 'tag' : 'JetCorrectorParametersCollection_AK5PF_2012_V8_hlt_mc',
298 # 'label' : 'AK5PFHLT',
299 # 'connect' : '%(connect)s/CMS_COND_31X_PHYSICSTOOLS'
300 # }, {
301 # 'record' : 'JetCorrectionsRecord',
302 # 'tag' : 'JetCorrectorParametersCollection_AK5PFchs_2012_V8_hlt_mc',
303 # 'label' : 'AK5PFchsHLT',
304 # 'connect' : '%(connect)s/CMS_COND_31X_PHYSICSTOOLS'
305 # }
306 # )
307 
308 
309  def addGlobalOptions(self):
310  # add global options
311  self.data += """
312 # limit the number of events to be processed
313 %%(process)smaxEvents = cms.untracked.PSet(
314  input = cms.untracked.int32( %d )
315 )
316 """ % self.config.events
317 
318  if not self.config.profiling:
319  self.data += """
320 # enable the TrigReport and TimeReport
321 %(process)soptions = cms.untracked.PSet(
322  wantSummary = cms.untracked.bool( True )
323 )
324 """
325 
326 
327  def _fix_parameter(self, **args):
328  """arguments:
329  name: parameter name (optional)
330  type: parameter type (look for tracked and untracked variants)
331  value: original value
332  replace: replacement value
333  """
334  if 'name' in args:
335  self.data = re.sub(
336  r'%(name)s = cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
337  r'%(name)s = cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
338  self.data)
339  else:
340  self.data = re.sub(
341  r'cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
342  r'cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
343  self.data)
344 
345 
346  def fixForMC(self):
347  if not self.config.data:
348  # customise the HLT menu for running on MC
349  if not self.config.fragment:
350  self.data += """
351 # customise the HLT menu for running on MC
352 from HLTrigger.Configuration.customizeHLTforMC import customizeHLTforMC
353 process = customizeHLTforMC(process)
354 """
355 
356 
357  def fixForFastSim(self):
358  if self.config.fastsim:
359  # adapt the hle configuration (fragment) to run under fastsim
360  self.data = re.sub( r'import FWCore.ParameterSet.Config as cms', r'\g<0>\nfrom FastSimulation.HighLevelTrigger.HLTSetup_cff import *', self.data)
361 
362  # remove the definition of streams and datasets
363  self.data = re.compile( r'^streams.*\n(.*\n)*?^\)\s*\n', re.MULTILINE ).sub( '', self.data )
364  self.data = re.compile( r'^datasets.*\n(.*\n)*?^\)\s*\n', re.MULTILINE ).sub( '', self.data )
365 
366  # fix the definition of module
367  # FIXME: this should be updated to take into accout the --l1-emulator option
368  self._fix_parameter( type = 'InputTag', value = 'hltL1extraParticles', replace = 'l1extraParticles')
369  self._fix_parameter(name = 'GMTReadoutCollection', type = 'InputTag', value = 'hltGtDigis', replace = 'gmtDigis')
370  self._fix_parameter( type = 'InputTag', value = 'hltGtDigis', replace = 'gtDigis')
371  self._fix_parameter( type = 'InputTag', value = 'hltL1GtObjectMap', replace = 'gtDigis')
372  self._fix_parameter(name = 'initialSeeds', type = 'InputTag', value = 'noSeedsHere', replace = 'globalPixelSeeds:GlobalPixel')
373  self._fix_parameter(name = 'preFilteredSeeds', type = 'bool', value = 'True', replace = 'False')
374  self._fix_parameter( type = 'InputTag', value = 'hltOfflineBeamSpot', replace = 'offlineBeamSpot')
375  self._fix_parameter( type = 'InputTag', value = 'hltOnlineBeamSpot', replace = 'offlineBeamSpot')
376  self._fix_parameter( type = 'InputTag', value = 'hltMuonCSCDigis', replace = 'simMuonCSCDigis')
377  self._fix_parameter( type = 'InputTag', value = 'hltMuonDTDigis', replace = 'simMuonDTDigis')
378  self._fix_parameter( type = 'InputTag', value = 'hltMuonRPCDigis', replace = 'simMuonRPCDigis')
379  self._fix_parameter( type = 'InputTag', value = 'hltRegionalTracksForL3MuonIsolation', replace = 'hltPixelTracks')
380  self._fix_parameter(name = 'src', type = 'InputTag', value = 'hltHcalTowerNoiseCleaner', replace = 'hltTowerMakerForAll')
381  self._fix_parameter(name = 'src', type = 'InputTag', value = 'hltIter4Tau3MuMerged', replace = 'hltIter4Merged')
382 
383  # MeasurementTrackerEvent
384  self._fix_parameter( type = 'InputTag', value = 'hltSiStripClusters', replace = 'MeasurementTrackerEvent')
385 
386  # fix the definition of sequences and paths
387  self.data = re.sub( r'hltMuonCSCDigis', r'cms.SequencePlaceholder( "simMuonCSCDigis" )', self.data )
388  self.data = re.sub( r'hltMuonDTDigis', r'cms.SequencePlaceholder( "simMuonDTDigis" )', self.data )
389  self.data = re.sub( r'hltMuonRPCDigis', r'cms.SequencePlaceholder( "simMuonRPCDigis" )', self.data )
390  self.data = re.sub( r'HLTEndSequence', r'cms.SequencePlaceholder( "HLTEndSequence" )', self.data )
391  self.data = re.sub( r'hltGtDigis', r'HLTBeginSequence', self.data )
392 
393 
394  def fixPrescales(self):
395  # update the PrescaleService to match the new list of paths
396  if self.options['paths']:
397  if self.options['paths'][0][0] == '-':
398  # drop requested paths
399  for minuspath in self.options['paths']:
400  path = minuspath[1:]
401  self.data = re.sub(r' cms.PSet\( pathName = cms.string\( "%s" \),\n prescales = cms.vuint32\( .* \)\n \),?\n' % path, '', self.data)
402  else:
403  # keep requested paths
404  for path in self.all_paths:
405  if path not in self.options['paths']:
406  self.data = re.sub(r' cms.PSet\( pathName = cms.string\( "%s" \),\n prescales = cms.vuint32\( .* \)\n \),?\n' % path, '', self.data)
407 
408  if self.config.unprescale:
409  self.data += """
410 # remove the HLT prescales
411 if 'PrescaleService' in %(dict)s:
412  %(process)sPrescaleService.lvl1DefaultLabel = cms.string( '0' )
413  %(process)sPrescaleService.lvl1Labels = cms.vstring( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' )
414  %(process)sPrescaleService.prescaleTable = cms.VPSet( )
415 """
416 
417 
419  if self.config.open:
420  # find all EDfilters
421  filters = [ match[1] for match in re.findall(r'(process\.)?\b(\w+) = cms.EDFilter', self.data) ]
422  re_sequence = re.compile( r'cms\.(Path|Sequence)\((.*)\)' )
423  # remove existing 'cms.ingore' and '~' modifiers
424  self.data = re_sequence.sub( lambda line: re.sub( r'cms\.ignore *\( *((process\.)?\b(\w+)) *\)', r'\1', line.group(0) ), self.data )
425  self.data = re_sequence.sub( lambda line: re.sub( r'~', '', line.group(0) ), self.data )
426  # wrap all EDfilters with "cms.ignore( ... )", 1000 at a time (python 2.6 complains for too-big regular expressions)
427  for some in splitter(filters, 1000):
428  re_filters = re.compile( r'\b((process\.)?(' + r'|'.join(some) + r'))\b' )
429  self.data = re_sequence.sub( lambda line: re_filters.sub( r'cms.ignore( \1 )', line.group(0) ), self.data )
430 
431 
433  if self.config.errortype:
434  # change all HLTTriggerTypeFilter EDFilters to accept only error events (SelectedTriggerType = 0)
435  self._fix_parameter(name = 'SelectedTriggerType', type ='int32', value = '1', replace = '0')
436  self._fix_parameter(name = 'SelectedTriggerType', type ='int32', value = '2', replace = '0')
437  self._fix_parameter(name = 'SelectedTriggerType', type ='int32', value = '3', replace = '0')
438 
439 
440  def overrideGlobalTag(self):
441  # overwrite GlobalTag
442  # the logic is:
443  # - always set the correct connection string and pfnPrefix
444  # - if a GlobalTag is specified on the command line:
445  # - override the global tag
446  # - if the GT is "auto:...", insert the code to read it from Configuration.AlCa.autoCond
447  # - if a GlobalTag is NOT specified on the command line:
448  # - when running on data, do nothing, and keep the global tag in the menu
449  # - when running on mc, take the GT from the configuration.type
450 
451  # override the GlobalTag connection string and pfnPrefix
452  text = """
453 # override the GlobalTag, connection string and pfnPrefix
454 if 'GlobalTag' in %(dict)s:
455 """
456 
457  # when running on MC, override the global tag even if not specified on the command line
458  if not self.config.data and not self.config.globaltag:
459  if self.config.type in globalTag:
460  self.config.globaltag = globalTag[self.config.type]
461  else:
462  self.config.globaltag = globalTag['GRun']
463 
464  # if requested, override the L1 menu from the GlobalTag (using the same connect as the GlobalTag itself)
465  if self.config.l1.override:
466  self.config.l1.record = 'L1GtTriggerMenuRcd'
467  self.config.l1.label = ''
468  self.config.l1.tag = self.config.l1.override
469  if not self.config.l1.connect:
470  self.config.l1.connect = '%(connect)s/CMS_COND_31X_L1T'
471  self.config.l1cond = '%(tag)s,%(record)s,%(connect)s' % self.config.l1.__dict__
472  else:
473  self.config.l1cond = None
474 
475  if self.config.globaltag or self.config.l1cond:
476  text += " from Configuration.AlCa.GlobalTag import GlobalTag as customiseGlobalTag\n"
477  text += " %(process)sGlobalTag = customiseGlobalTag(%(process)sGlobalTag"
478  if self.config.globaltag:
479  text += ", globaltag = %s" % repr(self.config.globaltag)
480  if self.config.l1cond:
481  text += ", conditions = %s" % repr(self.config.l1cond)
482  text += ")\n"
483 
484  text += """ %(process)sGlobalTag.connect = '%(connect)s/CMS_COND_31X_GLOBALTAG'
485  %(process)sGlobalTag.pfnPrefix = cms.untracked.string('%(connect)s/')
486  for pset in process.GlobalTag.toGet.value():
487  pset.connect = pset.connect.value().replace('frontier://FrontierProd/', '%(connect)s/')
488 # Fix for multi-run processing:
489  %(process)sGlobalTag.RefreshEachRun = cms.untracked.bool( False )
490  %(process)sGlobalTag.ReconnectEachRun = cms.untracked.bool( False )
491 #
492 """
493  self.data += text
494 
495  def overrideL1MenuXml(self):
496  # if requested, override the L1 menu from the GlobalTag (Xml file)
497  if self.config.l1Xml.XmlFile:
498  text = """
499 # override the L1 menu from an Xml file
500 %%(process)sl1GtTriggerMenuXml = cms.ESProducer("L1GtTriggerMenuXmlProducer",
501  TriggerMenuLuminosity = cms.string('%(LumiDir)s'),
502  DefXmlFile = cms.string('%(XmlFile)s'),
503  VmeXmlFile = cms.string('')
504 )
505 %%(process)sL1GtTriggerMenuRcdSource = cms.ESSource("EmptyESSource",
506  recordName = cms.string('L1GtTriggerMenuRcd'),
507  iovIsRunNotTime = cms.bool(True),
508  firstValid = cms.vuint32(1)
509 )
510 %%(process)ses_prefer_l1GtParameters = cms.ESPrefer('L1GtTriggerMenuXmlProducer','l1GtTriggerMenuXml')
511 """
512  self.data += text % self.config.l1Xml.__dict__
513 
514  def runL1EmulatorGT(self):
515  # if requested, run (part of) the L1 emulator, then repack the data into a new RAW collection, to be used by the HLT
516  if not self.config.emulator:
517  return
518 
519  if self.config.emulator != 'gt':
520  # only the GT emulator is currently supported
521  return
522 
523  # run the L1 GT emulator, then repack the data into a new RAW collection, to be used by the HLT
524  text = """
525 # run the L1 GT emulator, then repack the data into a new RAW collection, to be used by the HLT
526 """
527  if self.config.fragment:
528  # FIXME in a cff, should also update the HLTSchedule
529  text += "import Configuration.StandardSequences.SimL1EmulatorRepack_GT_cff\n"
530  else:
531  text += "process.load( 'Configuration.StandardSequences.SimL1EmulatorRepack_GT_cff' )\n"
532 
533  if not 'hltBoolFalse' in self.data:
534  # add hltBoolFalse
535  text += """
536 %(process)shltBoolFalse = cms.EDFilter( "HLTBool",
537  result = cms.bool( False )
538 )
539 """
540  text += "process.L1Emulator = cms.Path( process.SimL1Emulator + process.hltBoolFalse )\n\n"
541 
542  self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
543 
544 
545  def runL1Emulator(self):
546  # if requested, run (part of) the L1 emulator
547  if self.config.emulator:
548  # FIXME this fragment used "process" explicitly
549  emulator = {
550  'RawToDigi': '',
551  'CustomL1T': '',
552  'CustomHLT': ''
553  }
554 
555  if self.config.data:
556  emulator['RawToDigi'] = 'RawToDigi_Data_cff'
557  else:
558  emulator['RawToDigi'] = 'RawToDigi_cff'
559 
560  if self.config.emulator == 'gt':
561  emulator['CustomL1T'] = 'customiseL1GtEmulatorFromRaw'
562  emulator['CustomHLT'] = 'switchToSimGtDigis'
563  elif self.config.emulator == 'gct,gt':
564  emulator['CustomL1T'] = 'customiseL1CaloAndGtEmulatorsFromRaw'
565  emulator['CustomHLT'] = 'switchToSimGctGtDigis'
566  elif self.config.emulator == 'gmt,gt':
567  # XXX currently unsupported
568  emulator['CustomL1T'] = 'customiseL1MuonAndGtEmulatorsFromRaw'
569  emulator['CustomHLT'] = 'switchToSimGmtGtDigis'
570  elif self.config.emulator in ('gmt,gct,gt', 'gct,gmt,gt', 'all'):
571  emulator['CustomL1T'] = 'customiseL1EmulatorFromRaw'
572  emulator['CustomHLT'] = 'switchToSimGmtGctGtDigis'
573  else:
574  # unsupported argument, default to running the whole emulator
575  emulator['CustomL1T'] = 'customiseL1EmulatorFromRaw'
576  emulator['CustomHLT'] = 'switchToSimGmtGctGtDigis'
577 
578  self.data += """
579 # customize the L1 emulator to run %(CustomL1T)s with HLT to %(CustomHLT)s
580 process.load( 'Configuration.StandardSequences.%(RawToDigi)s' )
581 process.load( 'Configuration.StandardSequences.SimL1Emulator_cff' )
582 import L1Trigger.Configuration.L1Trigger_custom
583 process = L1Trigger.Configuration.L1Trigger_custom.%(CustomL1T)s( process )
584 process = L1Trigger.Configuration.L1Trigger_custom.customiseResetPrescalesAndMasks( process )
585 
586 # customize the HLT to use the emulated results
587 import HLTrigger.Configuration.customizeHLTforL1Emulator
588 process = HLTrigger.Configuration.customizeHLTforL1Emulator.switchToL1Emulator( process )
589 process = HLTrigger.Configuration.customizeHLTforL1Emulator.%(CustomHLT)s( process )
590 """ % emulator
591 
592 
593  def overrideOutput(self):
594  # override the "online" ShmStreamConsumer output modules with "offline" PoolOutputModule's
595  self.data = re.sub(
596  r'\b(process\.)?hltOutput(\w+) *= *cms\.OutputModule\( *"ShmStreamConsumer" *,',
597  r'%(process)shltOutput\2 = cms.OutputModule( "PoolOutputModule",\n fileName = cms.untracked.string( "output\2.root" ),\n fastCloning = cms.untracked.bool( False ),\n dataset = cms.untracked.PSet(\n filterName = cms.untracked.string( "" ),\n dataTier = cms.untracked.string( "RAW" )\n ),',
598  self.data
599  )
600 
601  if not self.config.fragment and self.config.output == 'full':
602  # add a single "keep *" output
603  self.data += """
604 # add a single "keep *" output
605 %(process)shltOutputFULL = cms.OutputModule( "PoolOutputModule",
606  fileName = cms.untracked.string( "outputFULL.root" ),
607  fastCloning = cms.untracked.bool( False ),
608  dataset = cms.untracked.PSet(
609  dataTier = cms.untracked.string( 'RECO' ),
610  filterName = cms.untracked.string( '' )
611  ),
612  outputCommands = cms.untracked.vstring( 'keep *' )
613 )
614 %(process)sFULLOutput = cms.EndPath( %(process)shltOutputFULL )
615 """
616 
617 
618  # override the process name and adapt the relevant filters
620  if self.config.name is None:
621  return
622 
623  # override the process name
624  quote = '[\'\"]'
625  self.data = re.compile(r'^(process\s*=\s*cms\.Process\(\s*' + quote + r')\w+(' + quote + r'\s*\).*)$', re.MULTILINE).sub(r'\1%s\2' % self.config.name, self.data, 1)
626 
627  # the following was stolen and adapted from HLTrigger.Configuration.customL1THLT_Options
628  self.data += """
629 # adapt HLT modules to the correct process name
630 if 'hltTrigReport' in %%(dict)s:
631  %%(process)shltTrigReport.HLTriggerResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
632 
633 if 'hltPreExpressCosmicsOutputSmart' in %%(dict)s:
634  %%(process)shltPreExpressCosmicsOutputSmart.hltResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
635 
636 if 'hltPreExpressOutputSmart' in %%(dict)s:
637  %%(process)shltPreExpressOutputSmart.hltResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
638 
639 if 'hltPreDQMForHIOutputSmart' in %%(dict)s:
640  %%(process)shltPreDQMForHIOutputSmart.hltResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
641 
642 if 'hltPreDQMForPPOutputSmart' in %%(dict)s:
643  %%(process)shltPreDQMForPPOutputSmart.hltResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
644 
645 if 'hltPreHLTDQMResultsOutputSmart' in %%(dict)s:
646  %%(process)shltPreHLTDQMResultsOutputSmart.hltResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
647 
648 if 'hltPreHLTDQMOutputSmart' in %%(dict)s:
649  %%(process)shltPreHLTDQMOutputSmart.hltResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
650 
651 if 'hltPreHLTMONOutputSmart' in %%(dict)s:
652  %%(process)shltPreHLTMONOutputSmart.hltResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
653 
654 if 'hltDQMHLTScalers' in %%(dict)s:
655  %%(process)shltDQMHLTScalers.triggerResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
656  %%(process)shltDQMHLTScalers.processname = '%(name)s'
657 
658 if 'hltDQML1SeedLogicScalers' in %%(dict)s:
659  %%(process)shltDQML1SeedLogicScalers.processname = '%(name)s'
660 """ % self.config.__dict__
661 
662 
664  # request summary informations from the MessageLogger
665  self.data += """
666 if 'MessageLogger' in %(dict)s:
667  %(process)sMessageLogger.categories.append('TriggerSummaryProducerAOD')
668  %(process)sMessageLogger.categories.append('L1GtTrigReport')
669  %(process)sMessageLogger.categories.append('HLTrigReport')
670  %(process)sMessageLogger.categories.append('FastReport')
671 """
672 
673 
674  def loadAdditionalConditions(self, comment, *conditions):
675  # load additional conditions
676  self.data += """
677 # %s
678 if 'GlobalTag' in %%(dict)s:
679 """ % comment
680  for condition in conditions:
681  self.data += """ %%(process)sGlobalTag.toGet.append(
682  cms.PSet(
683  record = cms.string( '%(record)s' ),
684  tag = cms.string( '%(tag)s' ),
685  label = cms.untracked.string( '%(label)s' ),
686  connect = cms.untracked.string( '%(connect)s' )
687  )
688  )
689 """ % condition
690 
691 
692  def loadCff(self, module):
693  # load a cfi or cff module
694  if self.config.fragment:
695  self.data += 'from %s import *\n' % module
696  else:
697  self.data += 'process.load( "%s" )\n' % module
698 
699 
700  def overrideParameters(self, module, parameters):
701  # override a module's parameter if the module is present in the configuration
702  self.data += "if '%s' in %%(dict)s:\n" % module
703  for (parameter, value) in parameters:
704  self.data += " %%(process)s%s.%s = %s\n" % (module, parameter, value)
705  self.data += "\n"
706 
707 
708  def instrumentTiming(self):
709  if self.config.profiling:
710  # instrument the menu for profiling: remove the HLTAnalyzerEndpath, add/override the HLTriggerFirstPath, with hltGetRaw and hltGetConditions
711  text = ''
712 
713  if not 'hltGetRaw' in self.data:
714  # add hltGetRaw
715  text += """
716 %(process)shltGetRaw = cms.EDAnalyzer( "HLTGetRaw",
717  RawDataCollection = cms.InputTag( "rawDataCollector" )
718 )
719 """
720 
721  if not 'hltGetConditions' in self.data:
722  # add hltGetConditions
723  text += """
724 %(process)shltGetConditions = cms.EDAnalyzer( 'EventSetupRecordDataGetter',
725  verbose = cms.untracked.bool( False ),
726  toGet = cms.VPSet( )
727 )
728 """
729 
730  if not 'hltBoolFalse' in self.data:
731  # add hltBoolFalse
732  text += """
733 %(process)shltBoolFalse = cms.EDFilter( "HLTBool",
734  result = cms.bool( False )
735 )
736 """
737 
738  # add the definition of HLTriggerFirstPath
739  # FIXME in a cff, should also update the HLTSchedule
740  text += """
741 %(process)sHLTriggerFirstPath = cms.Path( %(process)shltGetRaw + %(process)shltGetConditions + %(process)shltBoolFalse )
742 """
743  self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
744 
745 
746  # instrument the menu with the Service, EDProducer and EndPath needed for timing studies
747  # FIXME in a cff, should also update the HLTSchedule
748  if self.config.timing:
749  self.data += """
750 # instrument the menu with the modules and EndPath needed for timing studies
751 """
752 
753  hasFST = False
754  if 'FastTimerService' in self.data:
755  hasFST = True
756 
757  self.data += '\n# configure the FastTimerService\n'
758  if not hasFST:
759  self.loadCff('HLTrigger.Timer.FastTimerService_cfi')
760  self.data += """%(process)sFastTimerService.useRealTimeClock = False
761 %(process)sFastTimerService.enableTimingPaths = True
762 %(process)sFastTimerService.enableTimingModules = True
763 %(process)sFastTimerService.enableTimingExclusive = True
764 %(process)sFastTimerService.enableTimingSummary = True
765 %(process)sFastTimerService.skipFirstPath = True
766 %(process)sFastTimerService.enableDQM = True
767 %(process)sFastTimerService.enableDQMbyPathActive = True
768 %(process)sFastTimerService.enableDQMbyPathTotal = True
769 %(process)sFastTimerService.enableDQMbyPathOverhead = True
770 %(process)sFastTimerService.enableDQMbyPathDetails = True
771 %(process)sFastTimerService.enableDQMbyPathCounters = True
772 %(process)sFastTimerService.enableDQMbyPathExclusive = True
773 %(process)sFastTimerService.enableDQMbyModule = True
774 %(process)sFastTimerService.enableDQMbyModuleType = True
775 %(process)sFastTimerService.enableDQMSummary = True
776 %(process)sFastTimerService.enableDQMbyLuminosity = True
777 %(process)sFastTimerService.enableDQMbyLumiSection = True
778 %(process)sFastTimerService.enableDQMbyProcesses = False
779 %(process)sFastTimerService.dqmTimeRange = 1000.
780 %(process)sFastTimerService.dqmTimeResolution = 5.
781 %(process)sFastTimerService.dqmPathTimeRange = 100.
782 %(process)sFastTimerService.dqmPathTimeResolution = 0.5
783 %(process)sFastTimerService.dqmModuleTimeRange = 40.
784 %(process)sFastTimerService.dqmModuleTimeResolution = 0.2
785 %(process)sFastTimerService.dqmLuminosityRange = 1e+34
786 %(process)sFastTimerService.dqmLuminosityResolution = 1e+31
787 %(process)sFastTimerService.dqmLumiSectionsRange = 2500
788 %(process)sFastTimerService.dqmPath = 'HLT/TimerService'
789 %(process)sFastTimerService.luminosityProduct = cms.untracked.InputTag( 'hltScalersRawToDigi' )
790 %(process)sFastTimerService.supportedProcesses = cms.untracked.vuint32( )
791 """
792 
793  self.data += """
794 # FastTimerServiceClient
795 %(process)sfastTimerServiceClient = cms.EDAnalyzer( "FastTimerServiceClient",
796  dqmPath = cms.untracked.string( "HLT/TimerService" )
797 )
798 
799 # DQM file saver
800 %(process)sdqmFileSaver = cms.EDAnalyzer( "DQMFileSaver",
801  convention = cms.untracked.string( "Offline" ),
802  workflow = cms.untracked.string( "/HLT/FastTimerService/All" ),
803  dirName = cms.untracked.string( "." ),
804  saveByRun = cms.untracked.int32(1),
805  saveByLumiSection = cms.untracked.int32(-1),
806  saveByEvent = cms.untracked.int32(-1),
807  saveByTime = cms.untracked.int32(-1),
808  saveByMinute = cms.untracked.int32(-1),
809  saveAtJobEnd = cms.untracked.bool(False),
810  forceRunNumber = cms.untracked.int32(-1),
811 )
812 
813 %(process)sTimingOutput = cms.EndPath( %(process)sfastTimerServiceClient + %(process)sdqmFileSaver )
814 """
815 
816  @staticmethod
817  def dumppaths(paths):
818  sys.stderr.write('Path selection:\n')
819  for path in paths:
820  sys.stderr.write('\t%s\n' % path)
821  sys.stderr.write('\n\n')
822 
823  def buildPathList(self):
824  self.all_paths = self.getPathList()
825 
826  if self.config.paths:
827  # no path list was requested, dump the full table, minus unsupported / unwanted paths
828  paths = self.config.paths.split(',')
829  else:
830  # dump only the requested paths, plus the eventual output endpaths
831  paths = []
832 
833  if self.config.fragment or self.config.output in ('none', 'full'):
834  # 'full' removes all outputs (same as 'none') and then adds a single "keep *" output (see the overrideOutput method)
835  if self.config.paths:
836  # paths are removed by default
837  pass
838  else:
839  # drop all output endpaths
840  paths.append( "-*Output" )
841  elif self.config.output == 'minimal':
842  # drop all output endpaths but HLTDQMResultsOutput
843  if self.config.paths:
844  paths.append( "HLTDQMResultsOutput" )
845  else:
846  paths.append( "-*Output" )
847  paths.append( "HLTDQMResultsOutput" )
848  else:
849  # keep / add back all output endpaths
850  if self.config.paths:
851  paths.append( "*Output" )
852  else:
853  pass # paths are kepy by default
854 
855  # drop paths unsupported by fastsim
856  if self.config.fastsim:
857  paths.extend( "-%s" % path for path in self.fastsimUnsupportedPaths )
858 
859  # drop unwanted paths for profiling (and timing studies)
860  if self.config.profiling:
861  paths.append( "-HLTriggerFirstPath" )
862  paths.append( "-HLTAnalyzerEndpath" )
863 
864  # this should never be in any dump (nor online menu)
865  paths.append( "-OfflineOutput" )
866 
867  # expand all wildcards
868  paths = self.expandWildcards(paths, self.all_paths)
869 
870  if self.config.paths:
871  # do an "additive" consolidation
872  self.options['paths'] = self.consolidatePositiveList(paths)
873  if not self.options['paths']:
874  raise RuntimeError('Error: option "--paths %s" does not select any valid paths' % self.config.paths)
875  else:
876  # do a "subtractive" consolidation
877  self.options['paths'] = self.consolidateNegativeList(paths)
878 
879 
880  def buildOptions(self):
881  # common configuration for all scenarios
882  self.options['services'].append( "-FUShmDQMOutputService" )
883 
884  if self.config.fragment:
885  # extract a configuration file fragment
886  self.options['essources'].append( "-GlobalTag" )
887  self.options['essources'].append( "-HepPDTESSource" )
888  self.options['essources'].append( "-XMLIdealGeometryESSource" )
889  self.options['essources'].append( "-eegeom" )
890  self.options['essources'].append( "-es_hardcode" )
891  self.options['essources'].append( "-magfield" )
892 
893  self.options['esmodules'].append( "-AutoMagneticFieldESProducer" )
894  self.options['esmodules'].append( "-SlaveField0" )
895  self.options['esmodules'].append( "-SlaveField20" )
896  self.options['esmodules'].append( "-SlaveField30" )
897  self.options['esmodules'].append( "-SlaveField35" )
898  self.options['esmodules'].append( "-SlaveField38" )
899  self.options['esmodules'].append( "-SlaveField40" )
900  self.options['esmodules'].append( "-VBF0" )
901  self.options['esmodules'].append( "-VBF20" )
902  self.options['esmodules'].append( "-VBF30" )
903  self.options['esmodules'].append( "-VBF35" )
904  self.options['esmodules'].append( "-VBF38" )
905  self.options['esmodules'].append( "-VBF40" )
906  self.options['esmodules'].append( "-CSCGeometryESModule" )
907  self.options['esmodules'].append( "-CaloGeometryBuilder" )
908  self.options['esmodules'].append( "-CaloTowerHardcodeGeometryEP" )
909  self.options['esmodules'].append( "-CastorHardcodeGeometryEP" )
910  self.options['esmodules'].append( "-DTGeometryESModule" )
911  self.options['esmodules'].append( "-EcalBarrelGeometryEP" )
912  self.options['esmodules'].append( "-EcalElectronicsMappingBuilder" )
913  self.options['esmodules'].append( "-EcalEndcapGeometryEP" )
914  self.options['esmodules'].append( "-EcalLaserCorrectionService" )
915  self.options['esmodules'].append( "-EcalPreshowerGeometryEP" )
916  self.options['esmodules'].append( "-HcalHardcodeGeometryEP" )
917  self.options['esmodules'].append( "-HcalTopologyIdealEP" )
918  self.options['esmodules'].append( "-MuonNumberingInitialization" )
919  self.options['esmodules'].append( "-ParametrizedMagneticFieldProducer" )
920  self.options['esmodules'].append( "-RPCGeometryESModule" )
921  self.options['esmodules'].append( "-SiStripGainESProducer" )
922  self.options['esmodules'].append( "-SiStripRecHitMatcherESProducer" )
923  self.options['esmodules'].append( "-SiStripQualityESProducer" )
924  self.options['esmodules'].append( "-StripCPEfromTrackAngleESProducer" )
925  self.options['esmodules'].append( "-TrackerDigiGeometryESModule" )
926  self.options['esmodules'].append( "-TrackerGeometricDetESModule" )
927  self.options['esmodules'].append( "-VolumeBasedMagneticFieldESProducer" )
928  self.options['esmodules'].append( "-ZdcHardcodeGeometryEP" )
929  self.options['esmodules'].append( "-hcal_db_producer" )
930  self.options['esmodules'].append( "-L1GtTriggerMaskAlgoTrigTrivialProducer" )
931  self.options['esmodules'].append( "-L1GtTriggerMaskTechTrigTrivialProducer" )
932  self.options['esmodules'].append( "-hltESPEcalTrigTowerConstituentsMapBuilder" )
933  self.options['esmodules'].append( "-hltESPGlobalTrackingGeometryESProducer" )
934  self.options['esmodules'].append( "-hltESPMuonDetLayerGeometryESProducer" )
935  self.options['esmodules'].append( "-hltESPTrackerRecoGeometryESProducer" )
936  if not self.config.fastsim:
937  self.options['esmodules'].append( "-CaloTowerGeometryFromDBEP" )
938  self.options['esmodules'].append( "-CastorGeometryFromDBEP" )
939  self.options['esmodules'].append( "-EcalBarrelGeometryFromDBEP" )
940  self.options['esmodules'].append( "-EcalEndcapGeometryFromDBEP" )
941  self.options['esmodules'].append( "-EcalPreshowerGeometryFromDBEP" )
942  self.options['esmodules'].append( "-HcalGeometryFromDBEP" )
943  self.options['esmodules'].append( "-ZdcGeometryFromDBEP" )
944  self.options['esmodules'].append( "-XMLFromDBSource" )
945  self.options['esmodules'].append( "-sistripconn" )
946 
947  self.options['services'].append( "-PrescaleService" )
948  self.options['services'].append( "-MessageLogger" )
949  self.options['services'].append( "-DQM" )
950  self.options['services'].append( "-DQMStore" )
951  self.options['services'].append( "-MicroStateService" )
952  self.options['services'].append( "-ModuleWebRegistry" )
953  self.options['services'].append( "-TimeProfilerService" )
954  self.options['services'].append( "-FastTimerService" )
955 
956  self.options['psets'].append( "-maxEvents" )
957  self.options['psets'].append( "-options" )
958 
959  if self.config.fastsim:
960  # remove components not supported or needed by fastsim
961  self.options['esmodules'].append( "-navigationSchoolESProducer" )
962  self.options['esmodules'].append( "-TransientTrackBuilderESProducer" )
963  self.options['esmodules'].append( "-SteppingHelixPropagatorAny" )
964  self.options['esmodules'].append( "-OppositeMaterialPropagator" )
965  self.options['esmodules'].append( "-MaterialPropagator" )
966  self.options['esmodules'].append( "-CaloTowerConstituentsMapBuilder" )
967  self.options['esmodules'].append( "-CaloTopologyBuilder" )
968 
969  self.options['modules'].append( "hltL3MuonIsolations" )
970  self.options['modules'].append( "hltPixelVertices" )
971  self.options['modules'].append( "-hltCkfL1SeededTrackCandidates" )
972  self.options['modules'].append( "-hltCtfL1SeededithMaterialTracks" )
973  self.options['modules'].append( "-hltCkf3HitL1SeededTrackCandidates" )
974  self.options['modules'].append( "-hltCtf3HitL1SeededWithMaterialTracks" )
975  self.options['modules'].append( "-hltCkf3HitActivityTrackCandidates" )
976  self.options['modules'].append( "-hltCtf3HitActivityWithMaterialTracks" )
977  self.options['modules'].append( "-hltActivityCkfTrackCandidatesForGSF" )
978  self.options['modules'].append( "-hltL1SeededCkfTrackCandidatesForGSF" )
979  self.options['modules'].append( "-hltMuCkfTrackCandidates" )
980  self.options['modules'].append( "-hltMuCtfTracks" )
981  self.options['modules'].append( "-hltTau3MuCkfTrackCandidates" )
982  self.options['modules'].append( "-hltTau3MuCtfWithMaterialTracks" )
983  self.options['modules'].append( "-hltMuTrackJpsiCkfTrackCandidates" )
984  self.options['modules'].append( "-hltMuTrackJpsiCtfTracks" )
985  self.options['modules'].append( "-hltMuTrackJpsiEffCkfTrackCandidates" )
986  self.options['modules'].append( "-hltMuTrackJpsiEffCtfTracks" )
987  self.options['modules'].append( "-hltJpsiTkPixelSeedFromL3Candidate" )
988  self.options['modules'].append( "-hltCkfTrackCandidatesJpsiTk" )
989  self.options['modules'].append( "-hltCtfWithMaterialTracksJpsiTk" )
990  self.options['modules'].append( "-hltMuTrackCkfTrackCandidatesOnia" )
991  self.options['modules'].append( "-hltMuTrackCtfTracksOnia" )
992 
993  self.options['modules'].append( "-hltESRegionalEgammaRecHit" )
994  self.options['modules'].append( "-hltEcalRegionalJetsFEDs" )
995  self.options['modules'].append( "-hltEcalRegionalMuonsFEDs" )
996  self.options['modules'].append( "-hltEcalRegionalEgammaFEDs" )
997  self.options['modules'].append( "-hltFEDSelector" )
998  self.options['modules'].append( "-hltL3TrajSeedOIHit" )
999  self.options['modules'].append( "-hltL3TrajSeedIOHit" )
1000  self.options['modules'].append( "-hltL3TrackCandidateFromL2OIState" )
1001  self.options['modules'].append( "-hltL3TrackCandidateFromL2OIHit" )
1002  self.options['modules'].append( "-hltL3TrackCandidateFromL2IOHit" )
1003  self.options['modules'].append( "-hltL3TrackCandidateFromL2NoVtx" )
1004  self.options['modules'].append( "-hltHcalDigis" )
1005  self.options['modules'].append( "-hltHoreco" )
1006  self.options['modules'].append( "-hltHfreco" )
1007  self.options['modules'].append( "-hltHbhereco" )
1008  self.options['modules'].append( "-hltEcalRegionalRestFEDs" )
1009  self.options['modules'].append( "-hltEcalRegionalESRestFEDs" )
1010  self.options['modules'].append( "-hltEcalRawToRecHitFacility" )
1011  self.options['modules'].append( "-hltESRawToRecHitFacility" )
1012  self.options['modules'].append( "-hltEcalRegionalJetsRecHit" )
1013  self.options['modules'].append( "-hltEcalRegionalMuonsRecHit" )
1014  self.options['modules'].append( "-hltEcalRegionalEgammaRecHit" )
1015  self.options['modules'].append( "-hltEcalRecHitAll" )
1016  self.options['modules'].append( "-hltESRecHitAll" )
1017  # === hltPF
1018  self.options['modules'].append( "-hltPFJetCkfTrackCandidates" )
1019  self.options['modules'].append( "-hltPFJetCtfWithMaterialTracks" )
1020  self.options['modules'].append( "-hltPFlowTrackSelectionHighPurity" )
1021  # === hltFastJet
1022  self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalPixelSeedGenerator" )
1023  self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalCkfTrackCandidates" )
1024  self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalCtfWithMaterialTracks" )
1025  self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalPixelSeedGenerator" )
1026  self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalCkfTrackCandidates" )
1027  self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalCtfWithMaterialTracks" )
1028  self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhiL1FastJet" )
1029  self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhiL1FastJet" )
1030  self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhiL1FastJet" )
1031  self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorHbbVBF" )
1032  self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesHbbVBF" )
1033  self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksHbbVBF" )
1034  self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20HbbL1FastJet" )
1035  self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20HbbL1FastJet" )
1036  self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20HbbL1FastJet" )
1037  self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20HbbL1FastJet" )
1038  self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20HbbL1FastJet" )
1039  self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20HbbL1FastJet" )
1040  # === hltBLifetimeRegional
1041  self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorHbb" )
1042  self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesHbb" )
1043  self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksHbb" )
1044  self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhi" )
1045  self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhi" )
1046  self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhi" )
1047  self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20Hbb" )
1048  self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20Hbb" )
1049  self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20Hbb" )
1050  self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20Hbb" )
1051  self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20Hbb" )
1052  self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20Hbb" )
1053  self.options['modules'].append( "-hltBLifetimeFastRegionalPixelSeedGeneratorHbbVBF" )
1054  self.options['modules'].append( "-hltBLifetimeFastRegionalCkfTrackCandidatesHbbVBF" )
1055  self.options['modules'].append( "-hltBLifetimeFastRegionalCtfWithMaterialTracksHbbVBF" )
1056  self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhiL1FastJetFastPV" )
1057  self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhiL1FastJetFastPV" )
1058  self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhiL1FastJetFastPV" )
1059  self.options['modules'].append( "-hltFastPixelBLifetimeRegionalPixelSeedGeneratorHbb" )
1060  self.options['modules'].append( "-hltFastPixelBLifetimeRegionalCkfTrackCandidatesHbb" )
1061  self.options['modules'].append( "-hltFastPixelBLifetimeRegionalCtfWithMaterialTracksHbb" )
1062 
1063  self.options['modules'].append( "-hltPixelTracksForMinBias" )
1064  self.options['modules'].append( "-hltPixelTracksForHighMult" )
1065  self.options['modules'].append( "-hltRegionalPixelTracks" )
1066  self.options['modules'].append( "-hltPixelTracksReg" )
1067  self.options['modules'].append( "-hltIter4Merged" )
1068  self.options['modules'].append( "-hltFastPixelHitsVertex" )
1069  self.options['modules'].append( "-hltFastPixelTracks")
1070  self.options['modules'].append( "-hltFastPixelTracksRecover")
1071 
1072  self.options['modules'].append( "-hltPixelLayerPairs" )
1073  self.options['modules'].append( "-hltPixelLayerTriplets" )
1074  self.options['modules'].append( "-hltPixelLayerTripletsReg" )
1075  self.options['modules'].append( "-hltPixelLayerTripletsHITHB" )
1076  self.options['modules'].append( "-hltPixelLayerTripletsHITHE" )
1077  self.options['modules'].append( "-hltMixedLayerPairs" )
1078 
1079  self.options['modules'].append( "-hltFastPrimaryVertexbbPhi")
1080  self.options['modules'].append( "-hltPixelTracksFastPVbbPhi")
1081  self.options['modules'].append( "-hltPixelTracksRecoverbbPhi" )
1082  self.options['modules'].append( "-hltFastPixelHitsVertexVHbb" )
1083  self.options['modules'].append( "-hltFastPixelTracksVHbb" )
1084  self.options['modules'].append( "-hltFastPixelTracksRecoverVHbb" )
1085 
1086  self.options['modules'].append( "-hltFastPrimaryVertex")
1087  self.options['modules'].append( "-hltFastPVPixelTracks")
1088  self.options['modules'].append( "-hltFastPVPixelTracksRecover" )
1089 
1090  self.options['modules'].append( "-hltIter4Tau3MuMerged" )
1091  self.options['modules'].append( "hltPixelMatchElectronsActivity" )
1092 
1093  self.options['modules'].append( "-hltMuonCSCDigis" )
1094  self.options['modules'].append( "-hltMuonDTDigis" )
1095  self.options['modules'].append( "-hltMuonRPCDigis" )
1096  self.options['modules'].append( "-hltGtDigis" )
1097  self.options['modules'].append( "-hltL1GtTrigReport" )
1098  self.options['modules'].append( "hltCsc2DRecHits" )
1099  self.options['modules'].append( "hltDt1DRecHits" )
1100  self.options['modules'].append( "hltRpcRecHits" )
1101  self.options['modules'].append( "-hltScalersRawToDigi" )
1102 
1103  self.options['sequences'].append( "-HLTL1SeededEgammaRegionalRecoTrackerSequence" )
1104  self.options['sequences'].append( "-HLTEcalActivityEgammaRegionalRecoTrackerSequence" )
1105  self.options['sequences'].append( "-HLTPixelMatchElectronActivityTrackingSequence" )
1106  self.options['sequences'].append( "-HLTDoLocalStripSequence" )
1107  self.options['sequences'].append( "-HLTDoLocalPixelSequence" )
1108  self.options['sequences'].append( "-HLTDoLocalPixelSequenceRegL2Tau" )
1109  self.options['sequences'].append( "-hltSiPixelDigis" )
1110  self.options['sequences'].append( "-hltSiPixelClusters" )
1111  self.options['sequences'].append( "-hltSiPixelRecHits" )
1112  self.options['sequences'].append( "-HLTRecopixelvertexingSequence" )
1113  self.options['sequences'].append( "-HLTEndSequence" )
1114  self.options['sequences'].append( "-HLTBeginSequence" )
1115  self.options['sequences'].append( "-HLTBeginSequenceNZS" )
1116  self.options['sequences'].append( "-HLTBeginSequenceBPTX" )
1117  self.options['sequences'].append( "-HLTBeginSequenceAntiBPTX" )
1118  self.options['sequences'].append( "-HLTHBHENoiseSequence" )
1119  self.options['sequences'].append( "-HLTIterativeTracking" )
1120  self.options['sequences'].append( "-HLTIterativeTrackingTau3Mu" )
1121  self.options['sequences'].append( "-HLTRegionalCKFTracksForL3Isolation" )
1122  self.options['sequences'].append( "-HLTHBHENoiseCleanerSequence" )
1123 
1124  # remove HLTAnalyzerEndpath from fastsim cff's
1125  if self.config.fragment:
1126  self.options['paths'].append( "-HLTAnalyzerEndpath" )
1127 
1128 
1129  def build_source(self):
1130  if self.config.input:
1131  # if a dataset or a list of input files was given, use it
1132  if self.config.input[0:8] == 'dataset:':
1133  from dbsFileQuery import dbsFileQuery
1134  # extract the dataset name, and use DBS to fine the list of LFNs
1135  dataset = self.config.input[8:]
1136  query = 'find file where dataset=' + dataset
1137  files = dbsFileQuery(query)
1138  self.source = files
1139  else:
1140  # assume a list of input files
1141  self.source = self.config.input.split(',')
1142  elif self.config.online:
1143  # online we always run on data
1144  self.source = [ "file:/tmp/InputCollection.root" ]
1145  elif self.config.data:
1146  # offline we can run on data...
1147  self.source = [ "file:RelVal_Raw_%s_DATA.root" % self.config.type ]
1148  else:
1149  # ...or on mc
1150  self.source = [ "file:RelVal_Raw_%s_STARTUP.root" % self.config.type ]
1151 
1152  self.data += """
1153 %(process)ssource = cms.Source( "PoolSource",
1154  fileNames = cms.untracked.vstring(
1155 """
1156  if self.source:
1157  for line in self.source:
1158  self.data += " '%s',\n" % line
1159  self.data += """ ),
1160  secondaryFileNames = cms.untracked.vstring(
1161 """
1162  if self.parent:
1163  for line in self.parent:
1164  self.data += " '%s',\n" % line
1165  self.data += """ ),
1166  inputCommands = cms.untracked.vstring(
1167  'keep *'
1168  )
1169 )
1170 """
def _fix_parameter
Definition: confdb.py:327
def build_source
Definition: confdb.py:1129
def loadAdditionalConditions
Definition: confdb.py:674
def loadCff
Definition: confdb.py:692
def fixForMC
Definition: confdb.py:346
def buildPathList
Definition: confdb.py:823
def instrumentTiming
Definition: confdb.py:708
def runL1Emulator
Definition: confdb.py:545
def instrumentErrorEventType
Definition: confdb.py:432
def splitter
Definition: confdb.py:11
def overrideGlobalTag
Definition: confdb.py:440
def fixPrescales
Definition: confdb.py:394
def releaseSpecificCustomize
Definition: confdb.py:191
def consolidateNegativeList
Definition: confdb.py:161
def dumppaths
Definition: confdb.py:817
def runL1EmulatorGT
Definition: confdb.py:514
def consolidatePositiveList
Definition: confdb.py:173
def expandWildcards
Definition: confdb.py:145
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
def getRawConfigurationFromDB
Definition: confdb.py:102
def fixForFastSim
Definition: confdb.py:357
list object
Definition: dbtoconf.py:77
def buildOptions
Definition: confdb.py:880
def overrideProcessName
Definition: confdb.py:619
def overrideL1MenuXml
Definition: confdb.py:495
def addGlobalOptions
untracked parameters with NO default in the code if &#39;hltHcalDataIntegrityMonitor&#39; in %(dict)s: %(proc...
Definition: confdb.py:309
def instrumentOpenMode
Definition: confdb.py:418
def overrideOutput
Definition: confdb.py:593
def overrideParameters
Definition: confdb.py:700
def updateMessageLogger
Definition: confdb.py:663
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run