00001
00002
00003 import sys
00004 import re
00005 import os
00006 from pipe import pipe as _pipe
00007 from options import globalTag
00008 from itertools import islice
00009
00010 def splitter(iterator, n):
00011 i = iterator.__iter__()
00012 while True:
00013 l = list(islice(i, n))
00014 if l:
00015 yield l
00016 else:
00017 break
00018
00019
00020 class HLTProcess(object):
00021
00022 fastsimUnsupportedPaths = (
00023
00024
00025 "AlCa_EcalEta_v*",
00026 "AlCa_EcalPhiSym_v*",
00027 "AlCa_EcalPi0_v*",
00028 "AlCa_EcalPi0EBonly_v*",
00029 "AlCa_EcalPi0EEonly_v*",
00030 "AlCa_EcalEtaEBonly_v*",
00031 "AlCa_EcalEtaEEonly_v*",
00032 "AlCa_RPCMuonNoHits_v*",
00033 "AlCa_RPCMuonNoTriggers_v*",
00034 "AlCa_RPCMuonNormalisation_v*",
00035 "AlCa_LumiPixels_v*",
00036 "AlCa_LumiPixels_Random_v*",
00037 "AlCa_LumiPixels_ZeroBias_v*",
00038 "DQM_FEDIntegrity_v*",
00039 "DQM_HcalEmptyEvents_v*",
00040 "HLT_Calibration_v*",
00041 "HLT_EcalCalibration_v*",
00042 "HLT_HcalCalibration_v*",
00043 "HLT_TrackerCalibration_v*",
00044 "HLT_DTErrors_v*",
00045 "HLT_DTCalibration_v*",
00046 "HLT_Random_v*",
00047 "HLT_HcalNZS_v*",
00048 "HLT_HcalPhiSym_v*",
00049 "HLT_IsoTrackHB_v*",
00050 "HLT_IsoTrackHE_v*",
00051 "HLT_L1SingleMuOpen_AntiBPTX_v*",
00052 "HLT_JetE30_NoBPTX*_v*",
00053 "HLT_JetE50_NoBPTX*_v*",
00054 "HLT_JetE50_NoBPTX3BX_NoHalo_v*",
00055 "HLT_JetE70_NoBPTX3BX_NoHalo_v*",
00056 "HLT_L2Mu10_NoVertex_NoBPTX3BX_NoHalo_v*",
00057 "HLT_L2Mu20_NoVertex_NoBPTX3BX_NoHalo_v*",
00058 "HLT_L2Mu30_NoVertex_NoBPTX3BX_NoHalo_v*",
00059 "HLT_JetE30_NoBPTX3BX_v*",
00060 "HLT_JetE50_NoBPTX3BX_v*",
00061 "HLT_JetE70_NoBPTX3BX_v*",
00062 "HLT_L2Mu10_NoVertex_NoBPTX3BX_v*",
00063 "HLT_L2Mu10_NoVertex_NoBPTX3BX_v*",
00064 "HLT_L2Mu10_NoVertex_NoBPTX3BX_v*",
00065 "HLT_L2Mu20_NoVertex_NoBPTX3BX_v*",
00066 "HLT_L2Mu30_NoVertex_NoBPTX3BX_v*",
00067 "HLT_L2Mu20_NoVertex_2Cha_NoBPTX3BX_NoHalo_v*",
00068 "HLT_L2Mu30_NoVertex_2Cha_NoBPTX3BX_NoHalo_v*",
00069 "HLT_PixelTracks_Multiplicity70_v*",
00070 "HLT_PixelTracks_Multiplicity80_v*",
00071 "HLT_PixelTracks_Multiplicity90_v*",
00072 "HLT_BeamGas_HF_Beam1_v*",
00073 "HLT_BeamGas_HF_Beam2_v*",
00074 "HLT_BeamHalo_v*",
00075 "HLT_L1Tech_CASTOR_HaloMuon_v*",
00076 "HLT_L1Tech_DT_GlobalOR_v*",
00077 "HLT_GlobalRunHPDNoise_v*",
00078 "HLT_L1Tech_HBHEHO_totalOR_v*",
00079 "HLT_L1Tech_HCAL_HF_single_channel_v*",
00080 "HLT_L1TrackerCosmics_v*",
00081 "HLT_HcalUTCA_v*",
00082
00083
00084
00085 "HLT_DoubleMediumIsoPFTau30_Trk1_eta2p1_Reg_Jet30_v*",
00086 "HLT_DoubleMediumIsoPFTau30_Trk1_eta2p1_Reg_v*",
00087 "HLT_DoubleMediumIsoPFTau35_Trk1_eta2p1_Prong1_Reg_v*",
00088 "HLT_DoubleMediumIsoPFTau35_Trk1_eta2p1_Reg_v*",
00089 "HLT_IsoMu18_eta2p1_MediumIsoPFTau25_Trk1_eta2p1_Reg_v*",
00090
00091
00092
00093 )
00094
00095 def __init__(self, configuration):
00096 self.config = configuration
00097 self.data = None
00098 self.source = None
00099 self.parent = None
00100
00101 self.options = {
00102 'essources' : [],
00103 'esmodules' : [],
00104 'modules' : [],
00105 'sequences' : [],
00106 'services' : [],
00107 'paths' : [],
00108 'psets' : [],
00109 'blocks' : [],
00110 }
00111
00112 self.labels = {}
00113 if self.config.fragment:
00114 self.labels['process'] = ''
00115 self.labels['dict'] = 'locals()'
00116 else:
00117 self.labels['process'] = 'process.'
00118 self.labels['dict'] = 'process.__dict__'
00119
00120 if self.config.online:
00121 self.labels['connect'] = 'frontier://(proxyurl=http://localhost:3128)(serverurl=http://localhost:8000/FrontierOnProd)(serverurl=http://localhost:8000/FrontierOnProd)(retrieve-ziplevel=0)'
00122 else:
00123 self.labels['connect'] = 'frontier://FrontierProd'
00124
00125
00126 self.buildPathList()
00127 self.buildOptions()
00128 self.getRawConfigurationFromDB()
00129 self.customize()
00130
00131
00132 def _build_query(self):
00133 if self.config.menu.run:
00134 return '--runNumber %s' % self.config.menu.run
00135 else:
00136 return '--%s --configName %s' % (self.config.menu.db, self.config.menu.name)
00137
00138 def _build_options(self):
00139 return ' '.join(['--%s %s' % (key, ','.join(vals)) for key, vals in self.options.iteritems() if vals])
00140
00141 def _build_cmdline(self):
00142 if not self.config.fragment:
00143 return 'edmConfigFromDB %s --noedsources %s' % (self._build_query(), self._build_options())
00144 else:
00145 return 'edmConfigFromDB --cff %s --noedsources %s' % (self._build_query(), self._build_options())
00146
00147
00148 def getRawConfigurationFromDB(self):
00149 cmdline = self._build_cmdline()
00150 data = _pipe(cmdline)
00151 if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00152 raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00153 self.data = data
00154
00155
00156 def getPathList(self):
00157 cmdline = 'edmConfigFromDB --cff %s --noedsources --noes --noservices --nosequences --nomodules' % self._build_query()
00158 data = _pipe(cmdline)
00159 if 'Exhausted Resultset' in data or 'CONFIG_NOT_FOUND' in data:
00160 raise ImportError('%s is not a valid HLT menu' % self.config.menuConfig.value)
00161 filter = re.compile(r' *= *cms.(End)?Path.*')
00162 paths = [ filter.sub('', line) for line in data.splitlines() if filter.search(line) ]
00163 return paths
00164
00165
00166 @staticmethod
00167 def expandWildcards(globs, collection):
00168
00169
00170 matches = []
00171 for glob in globs:
00172 negate = ''
00173 if glob[0] == '-':
00174 negate = '-'
00175 glob = glob[1:]
00176
00177 filter = re.compile(r'^' + glob.replace('?', '.').replace('*', '.*').replace('[!', '[^') + r'$')
00178 matches.extend( negate + element for element in collection if filter.match(element) )
00179 return matches
00180
00181
00182 @staticmethod
00183 def consolidateNegativeList(elements):
00184
00185
00186 result = set()
00187 for element in elements:
00188 if element[0] == '-':
00189 result.add( element )
00190 else:
00191 result.discard( '-' + element )
00192 return sorted( element for element in result )
00193
00194 @staticmethod
00195 def consolidatePositiveList(elements):
00196
00197
00198 result = set()
00199 for element in elements:
00200 if element[0] == '-':
00201 result.discard( element[1:] )
00202 else:
00203 result.add( element )
00204 return sorted( element for element in result )
00205
00206
00207
00208 def dump(self):
00209 return self.data % self.labels
00210
00211
00212
00213 def releaseSpecificCustomize(self):
00214
00215 self.data += """
00216 # CMSSW version specific customizations
00217 import os
00218 cmsswVersion = os.environ['CMSSW_VERSION']
00219
00220 # customization for CMSSW_5_2_X
00221 if cmsswVersion.startswith('CMSSW_5_2_'):
00222
00223 # force the use of the correct calo jet energy corrections
00224 if 'hltESPL1FastJetCorrectionESProducer' in %(dict)s:
00225 %(process)shltESPL1FastJetCorrectionESProducer.algorithm = "AK5CaloHLT"
00226
00227 if 'hltESPL2RelativeCorrectionESProducer' in %(dict)s:
00228 %(process)shltESPL2RelativeCorrectionESProducer.algorithm = "AK5CaloHLT"
00229
00230 if 'hltESPL3AbsoluteCorrectionESProducer' in %(dict)s:
00231 %(process)shltESPL3AbsoluteCorrectionESProducer.algorithm = "AK5CaloHLT"
00232
00233
00234 # customization for CMSSW_5_3_X
00235 if cmsswVersion.startswith('CMSSW_5_3_'):
00236
00237 # do not override the calo jet energy corrections in 5.3.x for consistency with the current MC samples
00238 pass
00239
00240
00241 # customization for CMSSW_6_1_X and 6_2_X
00242 if cmsswVersion.startswith('CMSSW_6_1_') or cmsswVersion.startswith('CMSSW_6_2_'):
00243
00244 # force the use of the correct calo jet energy corrections
00245 if 'hltESPL1FastJetCorrectionESProducer' in %(dict)s:
00246 %(process)shltESPL1FastJetCorrectionESProducer.algorithm = "AK5CaloHLT"
00247
00248 if 'hltESPL2RelativeCorrectionESProducer' in %(dict)s:
00249 %(process)shltESPL2RelativeCorrectionESProducer.algorithm = "AK5CaloHLT"
00250
00251 if 'hltESPL3AbsoluteCorrectionESProducer' in %(dict)s:
00252 %(process)shltESPL3AbsoluteCorrectionESProducer.algorithm = "AK5CaloHLT"
00253
00254 # adapt the HLT menu to the "prototype for Event Interpretation" development
00255 if 'hltPFPileUp' in %(dict)s:
00256 # define new PFCandidateFwdPtrProducer module
00257 %(process)shltParticleFlowPtrs = cms.EDProducer("PFCandidateFwdPtrProducer",
00258 src = cms.InputTag('hltParticleFlow')
00259 )
00260 # add the new module before the hltPFPileUp module
00261 _sequence = None
00262 for _sequence in [ _sequence for _sequence in %(dict)s.itervalues() if isinstance(_sequence, cms._ModuleSequenceType)]:
00263 try:
00264 _sequence.insert( _sequence.index(%(process)shltPFPileUp), %(process)shltParticleFlowPtrs )
00265 except ValueError:
00266 pass
00267 # reconfigure hltPFPileUp and hltPFNoPileUp to use the new module
00268 %(process)shltPFPileUp.PFCandidates = cms.InputTag( "hltParticleFlowPtrs" )
00269 %(process)shltPFNoPileUp.bottomCollection = cms.InputTag( "hltParticleFlowPtrs" )
00270
00271 # postLS1 muon extension
00272 # /CalibMuon/CSCCalibration/python/CSCIndexer_cfi.py
00273 %(process)sCSCIndexerESSource = cms.ESSource("EmptyESSource",
00274 recordName = cms.string("CSCIndexerRecord"),
00275 firstValid = cms.vuint32(1),
00276 iovIsRunNotTime = cms.bool(True)
00277 )
00278 %(process)sCSCIndexerESProducer = cms.ESProducer("CSCIndexerESProducer",
00279 AlgoName = cms.string("CSCIndexerStartup")
00280 )
00281 # /CalibMuon/CSCCalibration/python/CSCChannelMapper_cfi.py
00282 %(process)sCSCChannelMapperESSource = cms.ESSource("EmptyESSource",
00283 recordName = cms.string("CSCChannelMapperRecord"),
00284 firstValid = cms.vuint32(1),
00285 iovIsRunNotTime = cms.bool(True)
00286 )
00287 %(process)sCSCChannelMapperESProducer = cms.ESProducer("CSCChannelMapperESProducer",
00288 AlgoName = cms.string("CSCChannelMapperStartup")
00289 )
00290
00291 # customization for CMSSW_6_2_X only
00292 if cmsswVersion.startswith('CMSSW_6_2_'):
00293 # /Geometry/TrackerNumberingBuilder/trackerTopologyConstants_cfi.py
00294 %(process)strackerTopologyConstants = cms.ESProducer('TrackerTopologyEP',
00295 pxb_layerStartBit = cms.uint32(16),
00296 pxb_ladderStartBit = cms.uint32(8),
00297 pxb_moduleStartBit = cms.uint32(2),
00298 pxb_layerMask = cms.uint32(15),
00299 pxb_ladderMask = cms.uint32(255),
00300 pxb_moduleMask = cms.uint32(63),
00301 pxf_sideStartBit = cms.uint32(23),
00302 pxf_diskStartBit = cms.uint32(16),
00303 pxf_bladeStartBit = cms.uint32(10),
00304 pxf_panelStartBit = cms.uint32(8),
00305 pxf_moduleStartBit = cms.uint32(2),
00306 pxf_sideMask = cms.uint32(3),
00307 pxf_diskMask = cms.uint32(15),
00308 pxf_bladeMask = cms.uint32(63),
00309 pxf_panelMask = cms.uint32(3),
00310 pxf_moduleMask = cms.uint32(63),
00311 tec_sideStartBit = cms.uint32(18),
00312 tec_wheelStartBit = cms.uint32(14),
00313 tec_petal_fw_bwStartBit = cms.uint32(12),
00314 tec_petalStartBit = cms.uint32(8),
00315 tec_ringStartBit = cms.uint32(5),
00316 tec_moduleStartBit = cms.uint32(2),
00317 tec_sterStartBit = cms.uint32(0),
00318 tec_sideMask = cms.uint32(3),
00319 tec_wheelMask = cms.uint32(15),
00320 tec_petal_fw_bwMask = cms.uint32(3),
00321 tec_petalMask = cms.uint32(15),
00322 tec_ringMask = cms.uint32(7),
00323 tec_moduleMask = cms.uint32(7),
00324 tec_sterMask = cms.uint32(3),
00325 tib_layerStartBit = cms.uint32(14),
00326 tib_str_fw_bwStartBit = cms.uint32(12),
00327 tib_str_int_extStartBit = cms.uint32(10),
00328 tib_strStartBit = cms.uint32(4),
00329 tib_moduleStartBit = cms.uint32(2),
00330 tib_sterStartBit = cms.uint32(0),
00331 tib_layerMask = cms.uint32(7),
00332 tib_str_fw_bwMask = cms.uint32(3),
00333 tib_str_int_extMask = cms.uint32(3),
00334 tib_strMask = cms.uint32(63),
00335 tib_moduleMask = cms.uint32(3),
00336 tib_sterMask = cms.uint32(3),
00337 tid_sideStartBit = cms.uint32(13),
00338 tid_wheelStartBit = cms.uint32(11),
00339 tid_ringStartBit = cms.uint32(9),
00340 tid_module_fw_bwStartBit = cms.uint32(7),
00341 tid_moduleStartBit = cms.uint32(2),
00342 tid_sterStartBit = cms.uint32(0),
00343 tid_sideMask = cms.uint32(3),
00344 tid_wheelMask = cms.uint32(3),
00345 tid_ringMask = cms.uint32(3),
00346 tid_module_fw_bwMask = cms.uint32(3),
00347 tid_moduleMask = cms.uint32(31),
00348 tid_sterMask = cms.uint32(3),
00349 tob_layerStartBit = cms.uint32(14),
00350 tob_rod_fw_bwStartBit = cms.uint32(12),
00351 tob_rodStartBit = cms.uint32(5),
00352 tob_moduleStartBit = cms.uint32(2),
00353 tob_sterStartBit = cms.uint32(0),
00354 tob_layerMask = cms.uint32(7),
00355 tob_rod_fw_bwMask = cms.uint32(3),
00356 tob_rodMask = cms.uint32(127),
00357 tob_moduleMask = cms.uint32(7),
00358 tob_sterMask = cms.uint32(3),
00359 appendToDataLabel = cms.string('')
00360 )
00361
00362 """
00363
00364
00365 def customize(self):
00366
00367
00368 if not self.config.fragment:
00369 self.build_source()
00370
00371
00372 if self.config.type in ('GRun', ):
00373 self.data += """
00374 # Enable HF Noise filters in GRun menu
00375 if 'hltHfreco' in %(dict)s:
00376 %(process)shltHfreco.setNoiseFlags = cms.bool( True )
00377 """
00378 if self.config.type in ('HIon', ):
00379 self.data += """
00380 # Disable HF Noise filters in HIon menu
00381 if 'hltHfreco' in %(dict)s:
00382 %(process)shltHfreco.setNoiseFlags = cms.bool( False )
00383 """
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394 self.overrideL1MenuXml()
00395
00396
00397 self.fixForMC()
00398
00399
00400 self.fixPrescales()
00401
00402
00403 self.instrumentOpenMode()
00404
00405
00406 self.instrumentErrorEventType()
00407
00408
00409 self.instrumentTiming()
00410
00411
00412 self.releaseSpecificCustomize()
00413
00414 if self.config.fragment:
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426 self.fixForFastSim()
00427
00428 else:
00429
00430
00431 self.overrideProcessName()
00432
00433
00434 self.overrideOutput()
00435
00436
00437 self.addGlobalOptions()
00438
00439
00440 self.overrideGlobalTag()
00441
00442
00443 self.runL1Emulator()
00444
00445
00446 self.updateMessageLogger()
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
00465
00466
00467
00468
00469 def addGlobalOptions(self):
00470
00471 self.data += """
00472 # limit the number of events to be processed
00473 %%(process)smaxEvents = cms.untracked.PSet(
00474 input = cms.untracked.int32( %d )
00475 )
00476 """ % self.config.events
00477
00478 if not self.config.profiling:
00479 self.data += """
00480 # enable the TrigReport and TimeReport
00481 %(process)soptions = cms.untracked.PSet(
00482 wantSummary = cms.untracked.bool( True )
00483 )
00484 """
00485
00486
00487 def _fix_parameter(self, **args):
00488 """arguments:
00489 name: parameter name (optional)
00490 type: parameter type (look for tracked and untracked variants)
00491 value: original value
00492 replace: replacement value
00493 """
00494 if 'name' in args:
00495 self.data = re.sub(
00496 r'%(name)s = cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00497 r'%(name)s = cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00498 self.data)
00499 else:
00500 self.data = re.sub(
00501 r'cms(?P<tracked>(?:\.untracked)?)\.%(type)s\( (?P<quote>["\']?)%(value)s(?P=quote)' % args,
00502 r'cms\g<tracked>.%(type)s( \g<quote>%(replace)s\g<quote>' % args,
00503 self.data)
00504
00505
00506 def fixForMC(self):
00507 if not self.config.data:
00508
00509 if not self.config.fragment:
00510 self.data += """
00511 # customise the HLT menu for running on MC
00512 from HLTrigger.Configuration.customizeHLTforMC import customizeHLTforMC
00513 process = customizeHLTforMC(process)
00514 """
00515
00516
00517 def fixForFastSim(self):
00518 if self.config.fastsim:
00519
00520 self.data = re.sub( r'import FWCore.ParameterSet.Config as cms', r'\g<0>\nfrom FastSimulation.HighLevelTrigger.HLTSetup_cff import *', self.data)
00521
00522
00523 self.data = re.compile( r'^streams.*\n(.*\n)*?^\)\s*\n', re.MULTILINE ).sub( '', self.data )
00524 self.data = re.compile( r'^datasets.*\n(.*\n)*?^\)\s*\n', re.MULTILINE ).sub( '', self.data )
00525
00526
00527
00528 self._fix_parameter( type = 'InputTag', value = 'hltL1extraParticles', replace = 'l1extraParticles')
00529 self._fix_parameter(name = 'GMTReadoutCollection', type = 'InputTag', value = 'hltGtDigis', replace = 'gmtDigis')
00530 self._fix_parameter( type = 'InputTag', value = 'hltGtDigis', replace = 'gtDigis')
00531 self._fix_parameter( type = 'InputTag', value = 'hltL1GtObjectMap', replace = 'gtDigis')
00532 self._fix_parameter(name = 'initialSeeds', type = 'InputTag', value = 'noSeedsHere', replace = 'globalPixelSeeds:GlobalPixel')
00533 self._fix_parameter(name = 'preFilteredSeeds', type = 'bool', value = 'True', replace = 'False')
00534 self._fix_parameter( type = 'InputTag', value = 'hltOfflineBeamSpot', replace = 'offlineBeamSpot')
00535 self._fix_parameter( type = 'InputTag', value = 'hltOnlineBeamSpot', replace = 'offlineBeamSpot')
00536 self._fix_parameter( type = 'InputTag', value = 'hltMuonCSCDigis', replace = 'simMuonCSCDigis')
00537 self._fix_parameter( type = 'InputTag', value = 'hltMuonDTDigis', replace = 'simMuonDTDigis')
00538 self._fix_parameter( type = 'InputTag', value = 'hltMuonRPCDigis', replace = 'simMuonRPCDigis')
00539 self._fix_parameter( type = 'InputTag', value = 'hltRegionalTracksForL3MuonIsolation', replace = 'hltPixelTracks')
00540 self._fix_parameter(name = 'src', type = 'InputTag', value = 'hltHcalTowerNoiseCleaner', replace = 'hltTowerMakerForAll')
00541 self._fix_parameter(name = 'src', type = 'InputTag', value = 'hltIter4Tau3MuMerged', replace = 'hltIter4Merged')
00542
00543
00544 self.data = re.sub( r'hltMuonCSCDigis', r'cms.SequencePlaceholder( "simMuonCSCDigis" )', self.data )
00545 self.data = re.sub( r'hltMuonDTDigis', r'cms.SequencePlaceholder( "simMuonDTDigis" )', self.data )
00546 self.data = re.sub( r'hltMuonRPCDigis', r'cms.SequencePlaceholder( "simMuonRPCDigis" )', self.data )
00547 self.data = re.sub( r'HLTEndSequence', r'cms.SequencePlaceholder( "HLTEndSequence" )', self.data )
00548 self.data = re.sub( r'hltGtDigis', r'HLTBeginSequence', self.data )
00549
00550
00551 def fixPrescales(self):
00552
00553 if self.options['paths']:
00554 if self.options['paths'][0][0] == '-':
00555
00556 for minuspath in self.options['paths']:
00557 path = minuspath[1:]
00558 self.data = re.sub(r' cms.PSet\( pathName = cms.string\( "%s" \),\n prescales = cms.vuint32\( .* \)\n \),?\n' % path, '', self.data)
00559 else:
00560
00561 for path in self.all_paths:
00562 if path not in self.options['paths']:
00563 self.data = re.sub(r' cms.PSet\( pathName = cms.string\( "%s" \),\n prescales = cms.vuint32\( .* \)\n \),?\n' % path, '', self.data)
00564
00565 if self.config.unprescale:
00566 self.data += """
00567 # remove the HLT prescales
00568 if 'PrescaleService' in %(dict)s:
00569 %(process)sPrescaleService.lvl1DefaultLabel = cms.string( '0' )
00570 %(process)sPrescaleService.lvl1Labels = cms.vstring( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' )
00571 %(process)sPrescaleService.prescaleTable = cms.VPSet( )
00572 """
00573
00574
00575 def instrumentOpenMode(self):
00576 if self.config.open:
00577
00578 filters = [ match[1] for match in re.findall(r'(process\.)?\b(\w+) = cms.EDFilter', self.data) ]
00579 re_sequence = re.compile( r'cms\.(Path|Sequence)\((.*)\)' )
00580
00581 self.data = re_sequence.sub( lambda line: re.sub( r'cms\.ignore *\( *((process\.)?\b(\w+)) *\)', r'\1', line.group(0) ), self.data )
00582 self.data = re_sequence.sub( lambda line: re.sub( r'~', '', line.group(0) ), self.data )
00583
00584 for some in splitter(filters, 1000):
00585 re_filters = re.compile( r'\b((process\.)?(' + r'|'.join(some) + r'))\b' )
00586 self.data = re_sequence.sub( lambda line: re_filters.sub( r'cms.ignore( \1 )', line.group(0) ), self.data )
00587
00588
00589 def instrumentErrorEventType(self):
00590 if self.config.errortype:
00591
00592 self._fix_parameter(name = 'SelectedTriggerType', type ='int32', value = '1', replace = '0')
00593 self._fix_parameter(name = 'SelectedTriggerType', type ='int32', value = '2', replace = '0')
00594 self._fix_parameter(name = 'SelectedTriggerType', type ='int32', value = '3', replace = '0')
00595
00596
00597 def overrideGlobalTag(self):
00598
00599
00600
00601
00602
00603
00604
00605
00606
00607
00608
00609 text = """
00610 # override the GlobalTag, connection string and pfnPrefix
00611 if 'GlobalTag' in %(dict)s:
00612 %(process)sGlobalTag.connect = '%(connect)s/CMS_COND_31X_GLOBALTAG'
00613 %(process)sGlobalTag.pfnPrefix = cms.untracked.string('%(connect)s/')
00614 """
00615
00616
00617 if not self.config.data and not self.config.globaltag:
00618 if self.config.type in globalTag:
00619 self.config.globaltag = globalTag[self.config.type]
00620 else:
00621 self.config.globaltag = globalTag['GRun']
00622
00623
00624 if self.config.l1.override:
00625 self.config.l1.record = 'L1GtTriggerMenuRcd'
00626 self.config.l1.label = ''
00627 self.config.l1.tag = self.config.l1.override
00628 if not self.config.l1.connect:
00629 self.config.l1.connect = '%(connect)s/CMS_COND_31X_L1T'
00630 self.config.l1cond = '%(tag)s,%(record)s,%(connect)s' % self.config.l1.__dict__
00631 else:
00632 self.config.l1cond = None
00633
00634 if self.config.globaltag or self.config.l1cond:
00635 text += " from Configuration.AlCa.GlobalTag import GlobalTag as customiseGlobalTag\n"
00636 text += " %(process)sGlobalTag = customiseGlobalTag(%(process)sGlobalTag"
00637 if self.config.globaltag:
00638 text += ", globaltag = %s" % repr(self.config.globaltag)
00639 if self.config.l1cond:
00640 text += ", conditions = %s" % repr(self.config.l1cond)
00641 text += ")\n"
00642
00643 self.data += text
00644
00645 def overrideL1MenuXml(self):
00646
00647 if self.config.l1Xml.XmlFile:
00648 text = """
00649 # override the L1 menu from an Xml file
00650 %%(process)sl1GtTriggerMenuXml = cms.ESProducer("L1GtTriggerMenuXmlProducer",
00651 TriggerMenuLuminosity = cms.string('%(LumiDir)s'),
00652 DefXmlFile = cms.string('%(XmlFile)s'),
00653 VmeXmlFile = cms.string('')
00654 )
00655 %%(process)sL1GtTriggerMenuRcdSource = cms.ESSource("EmptyESSource",
00656 recordName = cms.string('L1GtTriggerMenuRcd'),
00657 iovIsRunNotTime = cms.bool(True),
00658 firstValid = cms.vuint32(1)
00659 )
00660 %%(process)ses_prefer_l1GtParameters = cms.ESPrefer('L1GtTriggerMenuXmlProducer','l1GtTriggerMenuXml')
00661 """
00662 self.data += text % self.config.l1Xml.__dict__
00663
00664 def runL1EmulatorGT(self):
00665
00666 if not self.config.emulator:
00667 return
00668
00669 if self.config.emulator != 'gt':
00670
00671 return
00672
00673
00674 text = """
00675 # run the L1 GT emulator, then repack the data into a new RAW collection, to be used by the HLT
00676 """
00677 if self.config.fragment:
00678
00679 text += "import Configuration.StandardSequences.SimL1EmulatorRepack_GT_cff\n"
00680 else:
00681 text += "process.load( 'Configuration.StandardSequences.SimL1EmulatorRepack_GT_cff' )\n"
00682
00683 if not 'hltBoolFalse' in self.data:
00684
00685 text += """
00686 %(process)shltBoolFalse = cms.EDFilter( "HLTBool",
00687 result = cms.bool( False )
00688 )
00689 """
00690 text += "process.L1Emulator = cms.Path( process.SimL1Emulator + process.hltBoolFalse )\n\n"
00691
00692 self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
00693
00694
00695 def runL1Emulator(self):
00696
00697 if self.config.emulator:
00698
00699 emulator = {
00700 'RawToDigi': '',
00701 'CustomL1T': '',
00702 'CustomHLT': ''
00703 }
00704
00705 if self.config.data:
00706 emulator['RawToDigi'] = 'RawToDigi_Data_cff'
00707 else:
00708 emulator['RawToDigi'] = 'RawToDigi_cff'
00709
00710 if self.config.emulator == 'gt':
00711 emulator['CustomL1T'] = 'customiseL1GtEmulatorFromRaw'
00712 emulator['CustomHLT'] = 'switchToSimGtDigis'
00713 elif self.config.emulator == 'gct,gt':
00714 emulator['CustomL1T'] = 'customiseL1CaloAndGtEmulatorsFromRaw'
00715 emulator['CustomHLT'] = 'switchToSimGctGtDigis'
00716 elif self.config.emulator == 'gmt,gt':
00717
00718 emulator['CustomL1T'] = 'customiseL1MuonAndGtEmulatorsFromRaw'
00719 emulator['CustomHLT'] = 'switchToSimGmtGtDigis'
00720 elif self.config.emulator in ('gmt,gct,gt', 'gct,gmt,gt', 'all'):
00721 emulator['CustomL1T'] = 'customiseL1EmulatorFromRaw'
00722 emulator['CustomHLT'] = 'switchToSimGmtGctGtDigis'
00723 else:
00724
00725 emulator['CustomL1T'] = 'customiseL1EmulatorFromRaw'
00726 emulator['CustomHLT'] = 'switchToSimGmtGctGtDigis'
00727
00728 self.data += """
00729 # customize the L1 emulator to run %(CustomL1T)s with HLT to %(CustomHLT)s
00730 process.load( 'Configuration.StandardSequences.%(RawToDigi)s' )
00731 process.load( 'Configuration.StandardSequences.SimL1Emulator_cff' )
00732 import L1Trigger.Configuration.L1Trigger_custom
00733 process = L1Trigger.Configuration.L1Trigger_custom.%(CustomL1T)s( process )
00734 process = L1Trigger.Configuration.L1Trigger_custom.customiseResetPrescalesAndMasks( process )
00735
00736 # customize the HLT to use the emulated results
00737 import HLTrigger.Configuration.customizeHLTforL1Emulator
00738 process = HLTrigger.Configuration.customizeHLTforL1Emulator.switchToL1Emulator( process )
00739 process = HLTrigger.Configuration.customizeHLTforL1Emulator.%(CustomHLT)s( process )
00740 """ % emulator
00741
00742
00743 def overrideOutput(self):
00744
00745 self.data = re.sub(
00746 r'\b(process\.)?hltOutput(\w+) *= *cms\.OutputModule\( *"ShmStreamConsumer" *,',
00747 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 ),',
00748 self.data
00749 )
00750
00751 if not self.config.fragment and self.config.output == 'full':
00752
00753 self.data += """
00754 # add a single "keep *" output
00755 %(process)shltOutputFULL = cms.OutputModule( "PoolOutputModule",
00756 fileName = cms.untracked.string( "outputFULL.root" ),
00757 fastCloning = cms.untracked.bool( False ),
00758 dataset = cms.untracked.PSet(
00759 dataTier = cms.untracked.string( 'RECO' ),
00760 filterName = cms.untracked.string( '' )
00761 ),
00762 outputCommands = cms.untracked.vstring( 'keep *' )
00763 )
00764 %(process)sFULLOutput = cms.EndPath( %(process)shltOutputFULL )
00765 """
00766
00767
00768
00769 def overrideProcessName(self):
00770 if self.config.name is None:
00771 return
00772
00773
00774 quote = '[\'\"]'
00775 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)
00776
00777
00778 self.data += """
00779 # adapt HLT modules to the correct process name
00780 if 'hltTrigReport' in %%(dict)s:
00781 %%(process)shltTrigReport.HLTriggerResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00782
00783 if 'hltPreExpressCosmicsOutputSmart' in %%(dict)s:
00784 %%(process)shltPreExpressCosmicsOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00785
00786 if 'hltPreExpressOutputSmart' in %%(dict)s:
00787 %%(process)shltPreExpressOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00788
00789 if 'hltPreDQMForHIOutputSmart' in %%(dict)s:
00790 %%(process)shltPreDQMForHIOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00791
00792 if 'hltPreDQMForPPOutputSmart' in %%(dict)s:
00793 %%(process)shltPreDQMForPPOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00794
00795 if 'hltPreHLTDQMResultsOutputSmart' in %%(dict)s:
00796 %%(process)shltPreHLTDQMResultsOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00797
00798 if 'hltPreHLTDQMOutputSmart' in %%(dict)s:
00799 %%(process)shltPreHLTDQMOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00800
00801 if 'hltPreHLTMONOutputSmart' in %%(dict)s:
00802 %%(process)shltPreHLTMONOutputSmart.TriggerResultsTag = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00803
00804 if 'hltDQMHLTScalers' in %%(dict)s:
00805 %%(process)shltDQMHLTScalers.triggerResults = cms.InputTag( 'TriggerResults', '', '%(name)s' )
00806 %%(process)shltDQMHLTScalers.processname = '%(name)s'
00807
00808 if 'hltDQML1SeedLogicScalers' in %%(dict)s:
00809 %%(process)shltDQML1SeedLogicScalers.processname = '%(name)s'
00810 """ % self.config.__dict__
00811
00812
00813 def updateMessageLogger(self):
00814
00815 self.data += """
00816 if 'MessageLogger' in %(dict)s:
00817 %(process)sMessageLogger.categories.append('TriggerSummaryProducerAOD')
00818 %(process)sMessageLogger.categories.append('L1GtTrigReport')
00819 %(process)sMessageLogger.categories.append('HLTrigReport')
00820 %(process)sMessageLogger.categories.append('FastReport')
00821 """
00822
00823
00824 def loadAdditionalConditions(self, comment, *conditions):
00825
00826 self.data += """
00827 # %s
00828 if 'GlobalTag' in %%(dict)s:
00829 """ % comment
00830 for condition in conditions:
00831 self.data += """ %%(process)sGlobalTag.toGet.append(
00832 cms.PSet(
00833 record = cms.string( '%(record)s' ),
00834 tag = cms.string( '%(tag)s' ),
00835 label = cms.untracked.string( '%(label)s' ),
00836 connect = cms.untracked.string( '%(connect)s' )
00837 )
00838 )
00839 """ % condition
00840
00841
00842 def loadCff(self, module):
00843
00844 if self.config.fragment:
00845 self.data += 'from %s import *\n' % module
00846 else:
00847 self.data += 'process.load( "%s" )\n' % module
00848
00849
00850 def overrideParameters(self, module, parameters):
00851
00852 self.data += "if '%s' in %%(dict)s:\n" % module
00853 for (parameter, value) in parameters:
00854 self.data += " %%(process)s%s.%s = %s\n" % (module, parameter, value)
00855 self.data += "\n"
00856
00857
00858 def instrumentTiming(self):
00859 if self.config.profiling:
00860
00861 text = ''
00862
00863 if not 'hltGetRaw' in self.data:
00864
00865 text += """
00866 %(process)shltGetRaw = cms.EDAnalyzer( "HLTGetRaw",
00867 RawDataCollection = cms.InputTag( "rawDataCollector" )
00868 )
00869 """
00870
00871 if not 'hltGetConditions' in self.data:
00872
00873 text += """
00874 %(process)shltGetConditions = cms.EDAnalyzer( 'EventSetupRecordDataGetter',
00875 verbose = cms.untracked.bool( False ),
00876 toGet = cms.VPSet( )
00877 )
00878 """
00879
00880 if not 'hltBoolFalse' in self.data:
00881
00882 text += """
00883 %(process)shltBoolFalse = cms.EDFilter( "HLTBool",
00884 result = cms.bool( False )
00885 )
00886 """
00887
00888
00889
00890 text += """
00891 %(process)sHLTriggerFirstPath = cms.Path( %(process)shltGetRaw + %(process)shltGetConditions + %(process)shltBoolFalse )
00892 """
00893 self.data = re.sub(r'.*cms\.(End)?Path.*', text + r'\g<0>', self.data, 1)
00894
00895
00896
00897
00898 if self.config.timing:
00899 self.data += """
00900 # instrument the menu with the modules and EndPath needed for timing studies
00901 """
00902
00903 hasFST = False
00904 if 'FastTimerService' in self.data:
00905 hasFST = True
00906
00907 self.data += '\n# configure the FastTimerService\n'
00908 if not hasFST:
00909 self.loadCff('HLTrigger.Timer.FastTimerService_cfi')
00910 self.data += """%(process)sFastTimerService.useRealTimeClock = False
00911 %(process)sFastTimerService.enableTimingPaths = True
00912 %(process)sFastTimerService.enableTimingModules = True
00913 %(process)sFastTimerService.enableTimingExclusive = True
00914 %(process)sFastTimerService.enableTimingSummary = True
00915 %(process)sFastTimerService.skipFirstPath = True
00916 %(process)sFastTimerService.enableDQM = True
00917 %(process)sFastTimerService.enableDQMbyPathActive = True
00918 %(process)sFastTimerService.enableDQMbyPathTotal = True
00919 %(process)sFastTimerService.enableDQMbyPathOverhead = True
00920 %(process)sFastTimerService.enableDQMbyPathDetails = True
00921 %(process)sFastTimerService.enableDQMbyPathCounters = True
00922 %(process)sFastTimerService.enableDQMbyPathExclusive = True
00923 %(process)sFastTimerService.enableDQMbyModule = True
00924 %(process)sFastTimerService.enableDQMSummary = True
00925 %(process)sFastTimerService.enableDQMbyLuminosity = True
00926 %(process)sFastTimerService.enableDQMbyLumiSection = True
00927 %(process)sFastTimerService.enableDQMbyProcesses = False
00928 %(process)sFastTimerService.dqmTimeRange = 1000.
00929 %(process)sFastTimerService.dqmTimeResolution = 5.
00930 %(process)sFastTimerService.dqmPathTimeRange = 100.
00931 %(process)sFastTimerService.dqmPathTimeResolution = 0.5
00932 %(process)sFastTimerService.dqmModuleTimeRange = 40.
00933 %(process)sFastTimerService.dqmModuleTimeResolution = 0.2
00934 %(process)sFastTimerService.dqmLuminosityRange = 1e+34
00935 %(process)sFastTimerService.dqmLuminosityResolution = 1e+31
00936 %(process)sFastTimerService.dqmLumiSectionsRange = 2500
00937 %(process)sFastTimerService.dqmPath = 'HLT/TimerService'
00938 %(process)sFastTimerService.luminosityProduct = cms.untracked.InputTag( 'hltScalersRawToDigi' )
00939 %(process)sFastTimerService.supportedProcesses = cms.untracked.vuint32( )
00940 """
00941
00942 self.data += """
00943 # FastTimerServiceClient
00944 %(process)sfastTimerServiceClient = cms.EDAnalyzer( "FastTimerServiceClient",
00945 dqmPath = cms.untracked.string( "HLT/TimerService" )
00946 )
00947
00948 # DQM file saver
00949 %(process)sdqmFileSaver = cms.EDAnalyzer( "DQMFileSaver",
00950 convention = cms.untracked.string( "Offline" ),
00951 workflow = cms.untracked.string( "/HLT/FastTimerService/All" ),
00952 dirName = cms.untracked.string( "." ),
00953 saveByRun = cms.untracked.int32(1),
00954 saveByLumiSection = cms.untracked.int32(-1),
00955 saveByEvent = cms.untracked.int32(-1),
00956 saveByTime = cms.untracked.int32(-1),
00957 saveByMinute = cms.untracked.int32(-1),
00958 saveAtJobEnd = cms.untracked.bool(False),
00959 forceRunNumber = cms.untracked.int32(-1),
00960 )
00961
00962 %(process)sTimingOutput = cms.EndPath( %(process)sfastTimerServiceClient + %(process)sdqmFileSaver )
00963 """
00964
00965 @staticmethod
00966 def dumppaths(paths):
00967 sys.stderr.write('Path selection:\n')
00968 for path in paths:
00969 sys.stderr.write('\t%s\n' % path)
00970 sys.stderr.write('\n\n')
00971
00972 def buildPathList(self):
00973 self.all_paths = self.getPathList()
00974
00975 if self.config.paths:
00976
00977 paths = self.config.paths.split(',')
00978 else:
00979
00980 paths = []
00981
00982 if self.config.fragment or self.config.output in ('none', 'full'):
00983
00984 if self.config.paths:
00985
00986 pass
00987 else:
00988
00989 paths.append( "-*Output" )
00990 elif self.config.output == 'minimal':
00991
00992 if self.config.paths:
00993 paths.append( "HLTDQMResultsOutput" )
00994 else:
00995 paths.append( "-*Output" )
00996 paths.append( "HLTDQMResultsOutput" )
00997 else:
00998
00999 if self.config.paths:
01000 paths.append( "*Output" )
01001 else:
01002 pass
01003
01004
01005 if self.config.fastsim:
01006 paths.extend( "-%s" % path for path in self.fastsimUnsupportedPaths )
01007
01008
01009 if self.config.profiling:
01010 paths.append( "-HLTriggerFirstPath" )
01011 paths.append( "-HLTAnalyzerEndpath" )
01012
01013
01014 paths.append( "-OfflineOutput" )
01015
01016
01017 paths = self.expandWildcards(paths, self.all_paths)
01018
01019 if self.config.paths:
01020
01021 self.options['paths'] = self.consolidatePositiveList(paths)
01022 if not self.options['paths']:
01023 raise RuntimeError('Error: option "--paths %s" does not select any valid paths' % self.config.paths)
01024 else:
01025
01026 self.options['paths'] = self.consolidateNegativeList(paths)
01027
01028
01029 def buildOptions(self):
01030
01031 self.options['services'].append( "-FUShmDQMOutputService" )
01032
01033 if self.config.fragment:
01034
01035 self.options['essources'].append( "-GlobalTag" )
01036 self.options['essources'].append( "-HepPDTESSource" )
01037 self.options['essources'].append( "-XMLIdealGeometryESSource" )
01038 self.options['essources'].append( "-eegeom" )
01039 self.options['essources'].append( "-es_hardcode" )
01040 self.options['essources'].append( "-magfield" )
01041
01042 self.options['esmodules'].append( "-AutoMagneticFieldESProducer" )
01043 self.options['esmodules'].append( "-SlaveField0" )
01044 self.options['esmodules'].append( "-SlaveField20" )
01045 self.options['esmodules'].append( "-SlaveField30" )
01046 self.options['esmodules'].append( "-SlaveField35" )
01047 self.options['esmodules'].append( "-SlaveField38" )
01048 self.options['esmodules'].append( "-SlaveField40" )
01049 self.options['esmodules'].append( "-VBF0" )
01050 self.options['esmodules'].append( "-VBF20" )
01051 self.options['esmodules'].append( "-VBF30" )
01052 self.options['esmodules'].append( "-VBF35" )
01053 self.options['esmodules'].append( "-VBF38" )
01054 self.options['esmodules'].append( "-VBF40" )
01055 self.options['esmodules'].append( "-CSCGeometryESModule" )
01056 self.options['esmodules'].append( "-CaloGeometryBuilder" )
01057 self.options['esmodules'].append( "-CaloTowerHardcodeGeometryEP" )
01058 self.options['esmodules'].append( "-CastorHardcodeGeometryEP" )
01059 self.options['esmodules'].append( "-DTGeometryESModule" )
01060 self.options['esmodules'].append( "-EcalBarrelGeometryEP" )
01061 self.options['esmodules'].append( "-EcalElectronicsMappingBuilder" )
01062 self.options['esmodules'].append( "-EcalEndcapGeometryEP" )
01063 self.options['esmodules'].append( "-EcalLaserCorrectionService" )
01064 self.options['esmodules'].append( "-EcalPreshowerGeometryEP" )
01065 self.options['esmodules'].append( "-HcalHardcodeGeometryEP" )
01066 self.options['esmodules'].append( "-HcalTopologyIdealEP" )
01067 self.options['esmodules'].append( "-MuonNumberingInitialization" )
01068 self.options['esmodules'].append( "-ParametrizedMagneticFieldProducer" )
01069 self.options['esmodules'].append( "-RPCGeometryESModule" )
01070 self.options['esmodules'].append( "-SiStripGainESProducer" )
01071 self.options['esmodules'].append( "-SiStripRecHitMatcherESProducer" )
01072 self.options['esmodules'].append( "-SiStripQualityESProducer" )
01073 self.options['esmodules'].append( "-StripCPEfromTrackAngleESProducer" )
01074 self.options['esmodules'].append( "-TrackerDigiGeometryESModule" )
01075 self.options['esmodules'].append( "-TrackerGeometricDetESModule" )
01076 self.options['esmodules'].append( "-VolumeBasedMagneticFieldESProducer" )
01077 self.options['esmodules'].append( "-ZdcHardcodeGeometryEP" )
01078 self.options['esmodules'].append( "-hcal_db_producer" )
01079 self.options['esmodules'].append( "-L1GtTriggerMaskAlgoTrigTrivialProducer" )
01080 self.options['esmodules'].append( "-L1GtTriggerMaskTechTrigTrivialProducer" )
01081 self.options['esmodules'].append( "-hltESPEcalTrigTowerConstituentsMapBuilder" )
01082 self.options['esmodules'].append( "-hltESPGlobalTrackingGeometryESProducer" )
01083 self.options['esmodules'].append( "-hltESPMuonDetLayerGeometryESProducer" )
01084 self.options['esmodules'].append( "-hltESPTrackerRecoGeometryESProducer" )
01085 if not self.config.fastsim:
01086 self.options['esmodules'].append( "-CaloTowerGeometryFromDBEP" )
01087 self.options['esmodules'].append( "-CastorGeometryFromDBEP" )
01088 self.options['esmodules'].append( "-EcalBarrelGeometryFromDBEP" )
01089 self.options['esmodules'].append( "-EcalEndcapGeometryFromDBEP" )
01090 self.options['esmodules'].append( "-EcalPreshowerGeometryFromDBEP" )
01091 self.options['esmodules'].append( "-HcalGeometryFromDBEP" )
01092 self.options['esmodules'].append( "-ZdcGeometryFromDBEP" )
01093 self.options['esmodules'].append( "-XMLFromDBSource" )
01094 self.options['esmodules'].append( "-sistripconn" )
01095
01096 self.options['services'].append( "-PrescaleService" )
01097 self.options['services'].append( "-MessageLogger" )
01098 self.options['services'].append( "-DQM" )
01099 self.options['services'].append( "-DQMStore" )
01100 self.options['services'].append( "-MicroStateService" )
01101 self.options['services'].append( "-ModuleWebRegistry" )
01102 self.options['services'].append( "-TimeProfilerService" )
01103 self.options['services'].append( "-FastTimerService" )
01104
01105 self.options['psets'].append( "-maxEvents" )
01106 self.options['psets'].append( "-options" )
01107
01108 if self.config.fastsim:
01109
01110 self.options['esmodules'].append( "-navigationSchoolESProducer" )
01111 self.options['esmodules'].append( "-TransientTrackBuilderESProducer" )
01112 self.options['esmodules'].append( "-SteppingHelixPropagatorAny" )
01113 self.options['esmodules'].append( "-OppositeMaterialPropagator" )
01114 self.options['esmodules'].append( "-MaterialPropagator" )
01115 self.options['esmodules'].append( "-CaloTowerConstituentsMapBuilder" )
01116 self.options['esmodules'].append( "-CaloTopologyBuilder" )
01117
01118 self.options['services'].append( "-UpdaterService" )
01119
01120 self.options['modules'].append( "hltL3MuonIsolations" )
01121 self.options['modules'].append( "hltPixelVertices" )
01122 self.options['modules'].append( "-hltCkfL1SeededTrackCandidates" )
01123 self.options['modules'].append( "-hltCtfL1SeededithMaterialTracks" )
01124 self.options['modules'].append( "-hltCkf3HitL1SeededTrackCandidates" )
01125 self.options['modules'].append( "-hltCtf3HitL1SeededWithMaterialTracks" )
01126 self.options['modules'].append( "-hltCkf3HitActivityTrackCandidates" )
01127 self.options['modules'].append( "-hltCtf3HitActivityWithMaterialTracks" )
01128 self.options['modules'].append( "-hltActivityCkfTrackCandidatesForGSF" )
01129 self.options['modules'].append( "-hltL1SeededCkfTrackCandidatesForGSF" )
01130 self.options['modules'].append( "-hltMuCkfTrackCandidates" )
01131 self.options['modules'].append( "-hltMuCtfTracks" )
01132 self.options['modules'].append( "-hltTau3MuCkfTrackCandidates" )
01133 self.options['modules'].append( "-hltTau3MuCtfWithMaterialTracks" )
01134 self.options['modules'].append( "-hltMuTrackJpsiCkfTrackCandidates" )
01135 self.options['modules'].append( "-hltMuTrackJpsiCtfTracks" )
01136 self.options['modules'].append( "-hltMuTrackJpsiEffCkfTrackCandidates" )
01137 self.options['modules'].append( "-hltMuTrackJpsiEffCtfTracks" )
01138 self.options['modules'].append( "-hltJpsiTkPixelSeedFromL3Candidate" )
01139 self.options['modules'].append( "-hltCkfTrackCandidatesJpsiTk" )
01140 self.options['modules'].append( "-hltCtfWithMaterialTracksJpsiTk" )
01141 self.options['modules'].append( "-hltMuTrackCkfTrackCandidatesOnia" )
01142 self.options['modules'].append( "-hltMuTrackCtfTracksOnia" )
01143
01144 self.options['modules'].append( "-hltESRegionalEgammaRecHit" )
01145 self.options['modules'].append( "-hltEcalRegionalJetsFEDs" )
01146 self.options['modules'].append( "-hltEcalRegionalMuonsFEDs" )
01147 self.options['modules'].append( "-hltEcalRegionalEgammaFEDs" )
01148 self.options['modules'].append( "-hltFEDSelector" )
01149 self.options['modules'].append( "-hltL3TrajSeedOIHit" )
01150 self.options['modules'].append( "-hltL3TrajSeedIOHit" )
01151 self.options['modules'].append( "-hltL3TrackCandidateFromL2OIState" )
01152 self.options['modules'].append( "-hltL3TrackCandidateFromL2OIHit" )
01153 self.options['modules'].append( "-hltL3TrackCandidateFromL2IOHit" )
01154 self.options['modules'].append( "-hltL3TrackCandidateFromL2NoVtx" )
01155 self.options['modules'].append( "-hltHcalDigis" )
01156 self.options['modules'].append( "-hltHoreco" )
01157 self.options['modules'].append( "-hltHfreco" )
01158 self.options['modules'].append( "-hltHbhereco" )
01159 self.options['modules'].append( "-hltEcalRegionalRestFEDs" )
01160 self.options['modules'].append( "-hltEcalRegionalESRestFEDs" )
01161 self.options['modules'].append( "-hltEcalRawToRecHitFacility" )
01162 self.options['modules'].append( "-hltESRawToRecHitFacility" )
01163 self.options['modules'].append( "-hltEcalRegionalJetsRecHit" )
01164 self.options['modules'].append( "-hltEcalRegionalMuonsRecHit" )
01165 self.options['modules'].append( "-hltEcalRegionalEgammaRecHit" )
01166 self.options['modules'].append( "-hltEcalRecHitAll" )
01167 self.options['modules'].append( "-hltESRecHitAll" )
01168
01169 self.options['modules'].append( "-hltPFJetCkfTrackCandidates" )
01170 self.options['modules'].append( "-hltPFJetCtfWithMaterialTracks" )
01171 self.options['modules'].append( "-hltPFlowTrackSelectionHighPurity" )
01172
01173 self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalPixelSeedGenerator" )
01174 self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalCkfTrackCandidates" )
01175 self.options['modules'].append( "-hltDisplacedHT250L1FastJetRegionalCtfWithMaterialTracks" )
01176 self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalPixelSeedGenerator" )
01177 self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalCkfTrackCandidates" )
01178 self.options['modules'].append( "-hltDisplacedHT300L1FastJetRegionalCtfWithMaterialTracks" )
01179 self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhiL1FastJet" )
01180 self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhiL1FastJet" )
01181 self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhiL1FastJet" )
01182 self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorHbbVBF" )
01183 self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesHbbVBF" )
01184 self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksHbbVBF" )
01185 self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20HbbL1FastJet" )
01186 self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20HbbL1FastJet" )
01187 self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20HbbL1FastJet" )
01188 self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20HbbL1FastJet" )
01189 self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20HbbL1FastJet" )
01190 self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20HbbL1FastJet" )
01191
01192 self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorHbb" )
01193 self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesHbb" )
01194 self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksHbb" )
01195 self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhi" )
01196 self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhi" )
01197 self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhi" )
01198 self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20Hbb" )
01199 self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20Hbb" )
01200 self.options['modules'].append( "-hltBLifetimeBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20Hbb" )
01201 self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalPixelSeedGeneratorJet20Hbb" )
01202 self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCkfTrackCandidatesJet20Hbb" )
01203 self.options['modules'].append( "-hltBLifetimeDiBTagIP3D1stTrkRegionalCtfWithMaterialTracksJet20Hbb" )
01204 self.options['modules'].append( "-hltBLifetimeFastRegionalPixelSeedGeneratorHbbVBF" )
01205 self.options['modules'].append( "-hltBLifetimeFastRegionalCkfTrackCandidatesHbbVBF" )
01206 self.options['modules'].append( "-hltBLifetimeFastRegionalCtfWithMaterialTracksHbbVBF" )
01207 self.options['modules'].append( "-hltBLifetimeRegionalPixelSeedGeneratorbbPhiL1FastJetFastPV" )
01208 self.options['modules'].append( "-hltBLifetimeRegionalCkfTrackCandidatesbbPhiL1FastJetFastPV" )
01209 self.options['modules'].append( "-hltBLifetimeRegionalCtfWithMaterialTracksbbPhiL1FastJetFastPV" )
01210 self.options['modules'].append( "-hltFastPixelBLifetimeRegionalPixelSeedGeneratorHbb" )
01211 self.options['modules'].append( "-hltFastPixelBLifetimeRegionalCkfTrackCandidatesHbb" )
01212 self.options['modules'].append( "-hltFastPixelBLifetimeRegionalCtfWithMaterialTracksHbb" )
01213
01214 self.options['modules'].append( "-hltPixelTracksForMinBias" )
01215 self.options['modules'].append( "-hltPixelTracksForHighMult" )
01216 self.options['modules'].append( "-hltRegionalPixelTracks" )
01217 self.options['modules'].append( "-hltPixelTracksReg" )
01218 self.options['modules'].append( "-hltIter4Merged" )
01219 self.options['modules'].append( "-hltFastPixelHitsVertex" )
01220 self.options['modules'].append( "-hltFastPixelTracks")
01221 self.options['modules'].append( "-hltFastPixelTracksRecover")
01222
01223 self.options['modules'].append( "-hltFastPrimaryVertexbbPhi")
01224 self.options['modules'].append( "-hltPixelTracksFastPVbbPhi")
01225 self.options['modules'].append( "-hltPixelTracksRecoverbbPhi" )
01226 self.options['modules'].append( "-hltFastPixelHitsVertexVHbb" )
01227 self.options['modules'].append( "-hltFastPixelTracksVHbb" )
01228 self.options['modules'].append( "-hltFastPixelTracksRecoverVHbb" )
01229
01230 self.options['modules'].append( "-hltFastPrimaryVertex")
01231 self.options['modules'].append( "-hltFastPVPixelTracks")
01232 self.options['modules'].append( "-hltFastPVPixelTracksRecover" )
01233
01234 self.options['modules'].append( "-hltIter4Tau3MuMerged" )
01235 self.options['modules'].append( "hltPixelMatchElectronsActivity" )
01236
01237 self.options['modules'].append( "-hltMuonCSCDigis" )
01238 self.options['modules'].append( "-hltMuonDTDigis" )
01239 self.options['modules'].append( "-hltMuonRPCDigis" )
01240 self.options['modules'].append( "-hltGtDigis" )
01241 self.options['modules'].append( "-hltL1GtTrigReport" )
01242 self.options['modules'].append( "hltCsc2DRecHits" )
01243 self.options['modules'].append( "hltDt1DRecHits" )
01244 self.options['modules'].append( "hltRpcRecHits" )
01245 self.options['modules'].append( "-hltScalersRawToDigi" )
01246
01247 self.options['sequences'].append( "-HLTL1SeededEgammaRegionalRecoTrackerSequence" )
01248 self.options['sequences'].append( "-HLTEcalActivityEgammaRegionalRecoTrackerSequence" )
01249 self.options['sequences'].append( "-HLTPixelMatchElectronActivityTrackingSequence" )
01250 self.options['sequences'].append( "-HLTDoLocalStripSequence" )
01251 self.options['sequences'].append( "-HLTDoLocalPixelSequence" )
01252 self.options['sequences'].append( "-HLTDoLocalPixelSequenceRegL2Tau" )
01253 self.options['sequences'].append( "-hltSiPixelDigis" )
01254 self.options['sequences'].append( "-hltSiPixelClusters" )
01255 self.options['sequences'].append( "-hltSiPixelRecHits" )
01256 self.options['sequences'].append( "-HLTRecopixelvertexingSequence" )
01257 self.options['sequences'].append( "-HLTEndSequence" )
01258 self.options['sequences'].append( "-HLTBeginSequence" )
01259 self.options['sequences'].append( "-HLTBeginSequenceNZS" )
01260 self.options['sequences'].append( "-HLTBeginSequenceBPTX" )
01261 self.options['sequences'].append( "-HLTBeginSequenceAntiBPTX" )
01262 self.options['sequences'].append( "-HLTHBHENoiseSequence" )
01263 self.options['sequences'].append( "-HLTIterativeTracking" )
01264 self.options['sequences'].append( "-HLTIterativeTrackingTau3Mu" )
01265 self.options['sequences'].append( "-HLTRegionalCKFTracksForL3Isolation" )
01266 self.options['sequences'].append( "-HLTHBHENoiseCleanerSequence" )
01267
01268
01269 if self.config.fragment:
01270 self.options['paths'].append( "-HLTAnalyzerEndpath" )
01271
01272
01273 def build_source(self):
01274 if self.config.input:
01275
01276 if self.config.input[0:8] == 'dataset:':
01277 from dbsFileQuery import dbsFileQuery
01278
01279 dataset = self.config.input[8:]
01280 query = 'find file where dataset=' + dataset
01281 files = dbsFileQuery(query)
01282 self.source = files
01283 else:
01284
01285 self.source = self.config.input.split(',')
01286 elif self.config.online:
01287
01288 self.source = [ "file:/tmp/InputCollection.root" ]
01289 elif self.config.data:
01290
01291 self.source = [ "file:RelVal_Raw_%s_DATA.root" % self.config.type ]
01292 else:
01293
01294 self.source = [ "file:RelVal_Raw_%s_STARTUP.root" % self.config.type ]
01295
01296 self.data += """
01297 %(process)ssource = cms.Source( "PoolSource",
01298 fileNames = cms.untracked.vstring(
01299 """
01300 if self.source:
01301 for line in self.source:
01302 self.data += " '%s',\n" % line
01303 self.data += """ ),
01304 secondaryFileNames = cms.untracked.vstring(
01305 """
01306 if self.parent:
01307 for line in self.parent:
01308 self.data += " '%s',\n" % line
01309 self.data += """ ),
01310 inputCommands = cms.untracked.vstring(
01311 'keep *'
01312 )
01313 )
01314 """