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