Ejemplo n.º 1
0
def customizeHLTforAll(process, _customInfo=None):

    if (_customInfo is not None):

        _maxEvents = _customInfo['maxEvents']
        _globalTag = _customInfo['globalTag']
        _inputFile = _customInfo['inputFile']
        _realData = _customInfo['realData']
        _fastSim = _customInfo['fastSim']

        import FWCore.ParameterSet.VarParsing as VarParsing
        cmsRunOptions = VarParsing.VarParsing('python')

        cmsRunOptions.maxEvents = _maxEvents
        cmsRunOptions.register('globalTag', _globalTag,
                               cmsRunOptions.multiplicity.singleton,
                               cmsRunOptions.varType.string, "GlobalTag")
        cmsRunOptions.inputFiles = _inputFile
        cmsRunOptions.register('realData', _realData,
                               cmsRunOptions.multiplicity.singleton,
                               cmsRunOptions.varType.bool, "Real Data?")
        cmsRunOptions.register('fastSim', _fastSim,
                               cmsRunOptions.multiplicity.singleton,
                               cmsRunOptions.varType.bool, "Fast Sim ?")

        cmsRunOptions.parseArguments()

        # report in log file
        print cmsRunOptions

        _maxEvents = cmsRunOptions.maxEvents
        _globalTag = cmsRunOptions.globalTag
        _inputFile = cmsRunOptions.inputFiles
        _realData = cmsRunOptions.realData
        _fastSim = cmsRunOptions.fastSim

        # maxEvents
        if _maxEvents != -2:
            _maxEvents = cms.untracked.int32(_maxEvents)
            if hasattr(process, 'maxEvents'):
                process.maxEvents.input = _maxEvents
            else:
                process.maxEvents = cms.untracked.PSet(input=_maxEvents)

# GlobalTag
        if _globalTag == "@":
            _globalTag = _customInfo['globalTags'][_realData]
        if _globalTag != "":
            if hasattr(process, 'GlobalTag'):
                from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
                process.GlobalTag = GlobalTag(process.GlobalTag, _globalTag,
                                              '')

# inputFile
        if _inputFile[0] == "@":
            _inputFile[0] = _customInfo['inputFiles'][_realData]
        if _inputFile != "":
            if hasattr(process, 'source'):
                process.source.fileNames = cms.untracked.vstring(_inputFile)

# MC customisation
        if not _realData:
            from HLTrigger.Configuration.customizeHLTforMC import customizeHLTforMC
            process = customizeHLTforMC(process, _fastSim)
            if _customInfo['menuType'] == "HIon":
                from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
                process = MassReplaceInputTag(process, "rawDataRepacker",
                                              "rawDataCollector")
    else:
        pass

# CMSSW version customisation
    from HLTrigger.Configuration.customizeHLTforCMSSW import customiseHLTforCMSSW
    process = customiseHLTforCMSSW(process)

    return process
Ejemplo n.º 2
0
def customizeHLTforAll(process, _customInfo = None):

    if (_customInfo is not None):

        _maxEvents = _customInfo['maxEvents']
        _globalTag = _customInfo['globalTag']
        _inputFile = _customInfo['inputFile']
        _realData  = _customInfo['realData']
        
        import FWCore.ParameterSet.VarParsing as VarParsing
        cmsRunOptions = VarParsing.VarParsing('python')

        cmsRunOptions.maxEvents  = _maxEvents
        cmsRunOptions.register('globalTag',_globalTag,cmsRunOptions.multiplicity.singleton,cmsRunOptions.varType.string,"GlobalTag")
        cmsRunOptions.inputFiles = _inputFile
        cmsRunOptions.register('realData',_realData,cmsRunOptions.multiplicity.singleton,cmsRunOptions.varType.bool,"Real Data?")

        cmsRunOptions.parseArguments()

# report in log file
#       print cmsRunOptions

        _maxEvents = cmsRunOptions.maxEvents
        _globalTag = cmsRunOptions.globalTag
        _inputFile = cmsRunOptions.inputFiles
        _realData  = cmsRunOptions.realData

# maxEvents
        if _maxEvents != -2:
            _maxEvents = cms.untracked.int32( _maxEvents )
            if hasattr(process,'maxEvents'):
                process.maxEvents.input = _maxEvents
            else:
                process.maxEvents = cms.untracked.PSet( input = _maxEvents )

# GlobalTag
        if _globalTag == "@":
            _globalTag = _customInfo['globalTags'][_realData]
        if _globalTag != "":
            if hasattr(process,'GlobalTag'):
                from Configuration.AlCa.GlobalTag_condDBv2 import GlobalTag
                process.GlobalTag = GlobalTag(process.GlobalTag, _globalTag, '')
                process.GlobalTag.snapshotTime = cms.string("9999-12-31 23:59:59.000")

# inputFile
        if _inputFile[0] == "@":
            _inputFile[0] = _customInfo['inputFiles'][_realData]
        if _inputFile != "":
            if hasattr(process,'source'):
                process.source.fileNames = cms.untracked.vstring( _inputFile )
                    
# MC customisation
        if not _realData:
            from HLTrigger.Configuration.customizeHLTforMC import customizeHLTforMC
            process = customizeHLTforMC(process)
            if _customInfo['menuType'] == "HIon":
                from HLTrigger.Configuration.CustomConfigs import MassReplaceInputTag
                process = MassReplaceInputTag(process,"rawDataRepacker","rawDataCollector")
    else:
        pass

# CMSSW version customisation
    from HLTrigger.Configuration.customizeHLTforCMSSW import customiseHLTforCMSSW
    process = customiseHLTforCMSSW(process)

    return process
Ejemplo n.º 3
0
      process.HLTriggerFinalPath, process.AOutput, process.DQMOutput))

process.source = cms.Source("PoolSource",
                            fileNames=cms.untracked.vstring(
                                'file:RelVal_Raw_Fake_MC.root', ),
                            inputCommands=cms.untracked.vstring('keep *'))

# customise the HLT menu for running on MC
from HLTrigger.Configuration.customizeHLTforMC import customizeHLTforMC

process = customizeHLTforMC(process)

# add release-specific customizations
from HLTrigger.Configuration.customizeHLTforCMSSW import customiseHLTforCMSSW

process = customiseHLTforCMSSW(process, menuType="Fake", fastSim=False)

# adapt HLT modules to the correct process name
if 'hltTrigReport' in process.__dict__:
    process.hltTrigReport.HLTriggerResults = cms.InputTag(
        'TriggerResults', '', 'HLTFake')

if 'hltPreExpressCosmicsOutputSmart' in process.__dict__:
    process.hltPreExpressCosmicsOutputSmart.hltResults = cms.InputTag(
        'TriggerResults', '', 'HLTFake')

if 'hltPreExpressOutputSmart' in process.__dict__:
    process.hltPreExpressOutputSmart.hltResults = cms.InputTag(
        'TriggerResults', '', 'HLTFake')

if 'hltPreDQMForHIOutputSmart' in process.__dict__:
Ejemplo n.º 4
0
                                   fragment.HLTEndSequence)
fragment.HLT_Random_v1 = cms.Path(fragment.hltRandomEventsFilter +
                                  fragment.hltGtDigis + fragment.hltPreRandom +
                                  fragment.HLTEndSequence)
fragment.HLT_ZeroBias_v1 = cms.Path(fragment.HLTBeginSequence +
                                    fragment.hltL1sL1ZeroBias +
                                    fragment.hltPreZeroBias +
                                    fragment.HLTEndSequence)
fragment.HLTriggerFinalPath = cms.Path(fragment.hltGtDigis +
                                       fragment.hltScalersRawToDigi +
                                       fragment.hltFEDSelector +
                                       fragment.hltTriggerSummaryAOD +
                                       fragment.hltTriggerSummaryRAW)

fragment.HLTSchedule = cms.Schedule(*(fragment.HLTriggerFirstPath,
                                      fragment.HLT_Physics_v1,
                                      fragment.HLT_Random_v1,
                                      fragment.HLT_ZeroBias_v1,
                                      fragment.HLTriggerFinalPath))

# add release-specific customizations
from HLTrigger.Configuration.customizeHLTforCMSSW import customiseHLTforCMSSW
fragment = customiseHLTforCMSSW(fragment, menuType="Fake", fastSim=False)

# dummyfy hltGetConditions in cff's
if 'hltGetConditions' in fragment.__dict__ and 'HLTriggerFirstPath' in fragment.__dict__:
    fragment.hltDummyConditions = cms.EDFilter("HLTBool",
                                               result=cms.bool(True))
    fragment.HLTriggerFirstPath.replace(fragment.hltGetConditions,
                                        fragment.hltDummyConditions)