CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_14/src/HLTrigger/Configuration/python/Tools/confdb.py

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