Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-29 01:21:39

0001 import FWCore.ParameterSet.Config as cms
0002 from PhysicsTools.NanoAOD.common_cff import *
0003 from PhysicsTools.NanoAOD.nano_eras_cff import *
0004 
0005 # Bad/clone muon filters - tagging mode to keep the event
0006 from RecoMET.METFilters.badGlobalMuonTaggersMiniAOD_cff import badGlobalMuonTaggerMAOD, cloneGlobalMuonTaggerMAOD
0007 badGlobalMuonTagger = badGlobalMuonTaggerMAOD.clone(
0008     taggingMode = True
0009 )
0010 
0011 cloneGlobalMuonTagger = cloneGlobalMuonTaggerMAOD.clone(
0012     taggingMode = True
0013 )
0014 
0015 from RecoMET.METFilters.BadPFMuonFilter_cfi import BadPFMuonFilter
0016 BadPFMuonTagger = BadPFMuonFilter.clone(
0017     PFCandidates = cms.InputTag("packedPFCandidates"),
0018     muons = cms.InputTag("slimmedMuons"),
0019     vtx = cms.InputTag("offlineSlimmedPrimaryVertices"),
0020     taggingMode = True,
0021 )
0022 
0023 # Bad charge hadron
0024 from RecoMET.METFilters.BadChargedCandidateFilter_cfi import BadChargedCandidateFilter
0025 BadChargedCandidateTagger = BadChargedCandidateFilter.clone(
0026     PFCandidates = cms.InputTag("packedPFCandidates"),
0027     muons = cms.InputTag("slimmedMuons"),
0028     vtx = cms.InputTag("offlineSlimmedPrimaryVertices"),
0029     taggingMode = True,
0030 )
0031 
0032 extraFlagsTable = cms.EDProducer("GlobalVariablesTableProducer",
0033     variables = cms.PSet(
0034         Flag_BadGlobalMuon = ExtVar(cms.InputTag("badGlobalMuonTagger:notBadEvent"), bool, doc = "Bad muon flag"),
0035         Flag_CloneGlobalMuon = ExtVar(cms.InputTag("cloneGlobalMuonTagger:notBadEvent"), bool, doc = "Clone muon flag"),
0036         Flag_BadPFMuonFilter = ExtVar(cms.InputTag("BadPFMuonTagger"), bool, doc = "Bad PF muon flag"),
0037         Flag_BadChargedCandidateFilter = ExtVar(cms.InputTag("BadChargedCandidateTagger"), bool, doc = "Bad charged hadron flag"),
0038     )
0039 )
0040 
0041 from RecoMET.METFilters.ecalBadCalibFilter_cfi import *
0042 ecalBadCalibFilterNanoTagger = ecalBadCalibFilter.clone(
0043     taggingMode = cms.bool(True)
0044 )
0045 
0046 # modify extraFlagsTable to store ecalBadCalibFilter decision which is re-run with updated bad crystal list for 2017 and 2018 samples
0047 for modifier in run2_nanoAOD_94XMiniAODv1, run2_nanoAOD_94XMiniAODv2, run2_nanoAOD_102Xv1:
0048     modifier.toModify(extraFlagsTable, variables= cms.PSet())
0049     modifier.toModify(extraFlagsTable, variables = dict(Flag_ecalBadCalibFilterV2 = ExtVar(cms.InputTag("ecalBadCalibFilterNanoTagger"), bool, doc = "Bad ECAL calib flag (updatedxtal list)")))
0050 
0051 
0052 # empty task as default
0053 extraFlagsProducersTask = cms.Task()
0054 extraFlagsTableTask = cms.Task()
0055 
0056 ## those need to be added only for some specific eras
0057 extraFlagsProducersTask_80x = cms.Task(badGlobalMuonTagger,cloneGlobalMuonTagger,BadPFMuonTagger,BadChargedCandidateTagger)
0058 extraFlagsProducersTask_102x = cms.Task(ecalBadCalibFilterNanoTagger)
0059 
0060 run2_miniAOD_80XLegacy.toReplaceWith(extraFlagsProducersTask, extraFlagsProducersTask_80x)
0061 run2_miniAOD_80XLegacy.toReplaceWith(extraFlagsTableTask, cms.Task(extraFlagsTable))
0062 
0063 (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toReplaceWith(extraFlagsProducersTask, extraFlagsProducersTask_102x)
0064 (run2_nanoAOD_94XMiniAODv1 | run2_nanoAOD_94XMiniAODv2 | run2_nanoAOD_102Xv1).toReplaceWith(extraFlagsTableTask, cms.Task(extraFlagsTable))