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