Beispiel #1
0
def apply_event_filters(process, paths, runOnData=False, isPromptReco=False):
    """Configure the process to reject anomalous events.
    
    Apply filters to reject anomalous or otherwise problematic events as
    recommended for analyses involving MET.  Follow instructions
    provided in [1] except for the filtering on primary vertices.  The
    latter is applied in the main configuration (and in a slightly
    tighter version).
    
    Arguments:
        process: The process to which the filters are to be added.
        paths: A PathManager with all active paths.
        runOnData: Flag to distinguish processing of data and
            simulation.
        isPromptReco: Flag to distinguish PromptReco of data from
            ReReco.  Not used currently.
    
    Return value:
        None.
    
    [1] https://twiki.cern.ch/twiki/bin/viewauth/CMS/MissingETOptionalFiltersRun2?rev=103
    """

    # Decisions of most filters are stored in MiniAOD as trigger
    # results, which are true for good events.  It is sufficient to
    # simply check the corresponding bits.
    process.applyEmulatedMETFilters = cms.EDFilter(
        'HLTHighLevel',
        HLTPaths=cms.vstring('Flag_HBHENoiseFilter', 'Flag_HBHENoiseIsoFilter',
                             'Flag_globalTightHalo2016Filter',
                             'Flag_EcalDeadCellTriggerPrimitiveFilter',
                             'Flag_eeBadScFilter'),
        andOr=cms.bool(False),  # AND mode
        throw=cms.bool(True),
        TriggerResultsTag=cms.InputTag('TriggerResults', '', 'PAT'))

    paths.append(process.applyEmulatedMETFilters)

    # Filter for "bad" muons
    from RecoMET.METFilters.BadPFMuonFilter_cfi import BadPFMuonFilter
    process.badPFMuonFilter = BadPFMuonFilter.clone(
        muons=cms.InputTag('slimmedMuons'),
        PFCandidates=cms.InputTag('packedPFCandidates'))

    paths.append(process.badPFMuonFilter)

    # Filter for "bad" charged hadrons
    from RecoMET.METFilters.BadChargedCandidateFilter_cfi import BadChargedCandidateFilter
    process.badChargedCandidateFilter = BadChargedCandidateFilter.clone(
        muons=cms.InputTag('slimmedMuons'),
        PFCandidates=cms.InputTag('packedPFCandidates'))

    paths.append(process.badChargedCandidateFilter)
Beispiel #2
0
cloneGlobalMuonTagger = cloneGlobalMuonTaggerMAOD.clone(
    taggingMode = True
)

from RecoMET.METFilters.BadPFMuonFilter_cfi import BadPFMuonFilter
BadPFMuonTagger = BadPFMuonFilter.clone(
    PFCandidates = cms.InputTag("packedPFCandidates"),
    muons = cms.InputTag("slimmedMuons"),
    taggingMode = True,
)

# Bad charge hadron
from RecoMET.METFilters.BadChargedCandidateFilter_cfi import BadChargedCandidateFilter
BadChargedCandidateTagger = BadChargedCandidateFilter.clone(
    PFCandidates = cms.InputTag("packedPFCandidates"),
    muons = cms.InputTag("slimmedMuons"),
    taggingMode = True,
)

extraFlagsTable = cms.EDProducer("GlobalVariablesTableProducer",
    variables = cms.PSet(
        Flag_BadGlobalMuon = ExtVar(cms.InputTag("badGlobalMuonTagger:notBadEvent"), bool, doc = "Bad muon flag"),
        Flag_CloneGlobalMuon = ExtVar(cms.InputTag("cloneGlobalMuonTagger:notBadEvent"), bool, doc = "Clone muon flag"),
        Flag_BadPFMuonFilter = ExtVar(cms.InputTag("BadPFMuonTagger"), bool, doc = "Bad PF muon flag"),
        Flag_BadChargedCandidateFilter = ExtVar(cms.InputTag("BadChargedCandidateTagger"), bool, doc = "Bad charged hadron flag"),
    )
)

extraFlagsProducers = cms.Sequence(badGlobalMuonTagger + cloneGlobalMuonTagger + BadPFMuonTagger + BadChargedCandidateTagger)
Beispiel #3
0
    EEEnegyMIN=cms.double(10.0),
    taggingMode=cms.bool(True),  #updated wrt default
    Debug=cms.bool(False))

#Rerunning EcalDeadCellBoundaryEnergyFilter
from RecoMET.METFilters.EcalDeadCellBoundaryEnergyFilter_cfi import EcalDeadCellBoundaryEnergyFilter
process.ecalDeadCellBoundaryEnergyFilterUpdate = EcalDeadCellBoundaryEnergyFilter.clone(
    recHitsEB=cms.InputTag("reducedEgamma:reducedEBRecHits"),
    recHitsEE=cms.InputTag("reducedEgamma:reducedEERecHits"),
    cutBoundEnergyDeadCellsEE=cms.untracked.double(10),
    taggingMode=cms.bool(True))

#Rerunning BadChargedCandidateFilter
from RecoMET.METFilters.BadChargedCandidateFilter_cfi import BadChargedCandidateFilter
process.BadChargedCandidateFilterUpdate = BadChargedCandidateFilter.clone(
    muons=cms.InputTag("slimmedMuons"),
    PFCandidates=cms.InputTag("packedPFCandidates"),
    taggingMode=cms.bool(True))

import FWCore.PythonUtilities.LumiList as LumiList
import FWCore.ParameterSet.Types as CfgTypes
process.source.lumisToProcess = CfgTypes.untracked(
    CfgTypes.VLuminosityBlockRange())
JSONfile = 'Cert_314472-325175_13TeV_PromptReco_Collisions18_JSON.txt'
myLumis = LumiList.LumiList(filename=JSONfile).getCMSSWString().split(',')
#process.source.lumisToProcess.extend(myLumis)

#Update JECs

from CondCore.DBCommon.CondDBSetup_cfi import CondDBSetup
process.jec = cms.ESSource(
    'PoolDBESSource',
Beispiel #4
0
cloneGlobalMuonTagger = cloneGlobalMuonTaggerMAOD.clone(taggingMode=True)

from RecoMET.METFilters.BadPFMuonFilter_cfi import BadPFMuonFilter
BadPFMuonTagger = BadPFMuonFilter.clone(
    PFCandidates=cms.InputTag("packedPFCandidates"),
    muons=cms.InputTag("slimmedMuons"),
    vtx=cms.InputTag("offlineSlimmedPrimaryVertices"),
    taggingMode=True,
)

# Bad charge hadron
from RecoMET.METFilters.BadChargedCandidateFilter_cfi import BadChargedCandidateFilter
BadChargedCandidateTagger = BadChargedCandidateFilter.clone(
    PFCandidates=cms.InputTag("packedPFCandidates"),
    muons=cms.InputTag("slimmedMuons"),
    vtx=cms.InputTag("offlineSlimmedPrimaryVertices"),
    taggingMode=True,
)

extraFlagsTable = cms.EDProducer(
    "GlobalVariablesTableProducer",
    variables=cms.PSet(
        Flag_BadGlobalMuon=ExtVar(
            cms.InputTag("badGlobalMuonTagger:notBadEvent"),
            bool,
            doc="Bad muon flag"),
        Flag_CloneGlobalMuon=ExtVar(
            cms.InputTag("cloneGlobalMuonTagger:notBadEvent"),
            bool,
            doc="Clone muon flag"),
        Flag_BadPFMuonFilter=ExtVar(cms.InputTag("BadPFMuonTagger"),
badGlobalMuonTagger = badGlobalMuonTaggerMAOD.clone(taggingMode=True)

cloneGlobalMuonTagger = cloneGlobalMuonTaggerMAOD.clone(taggingMode=True)

from RecoMET.METFilters.BadPFMuonFilter_cfi import BadPFMuonFilter
BadPFMuonTagger = BadPFMuonFilter.clone(
    PFCandidates=cms.InputTag("packedPFCandidates"),
    muons=cms.InputTag("slimmedMuons"),
    taggingMode=True,
)

# Bad charge hadron
from RecoMET.METFilters.BadChargedCandidateFilter_cfi import BadChargedCandidateFilter
BadChargedCandidateTagger = BadChargedCandidateFilter.clone(
    PFCandidates=cms.InputTag("packedPFCandidates"),
    muons=cms.InputTag("slimmedMuons"),
    taggingMode=True,
)

extraFlagsTable = cms.EDProducer(
    "GlobalVariablesTableProducer",
    variables=cms.PSet(
        Flag_BadGlobalMuon=ExtVar(
            cms.InputTag("badGlobalMuonTagger:notBadEvent"),
            bool,
            doc="Bad muon flag"),
        Flag_CloneGlobalMuon=ExtVar(
            cms.InputTag("cloneGlobalMuonTagger:notBadEvent"),
            bool,
            doc="Clone muon flag"),
        Flag_BadPFMuonFilter=ExtVar(cms.InputTag("BadPFMuonTagger"),