File indexing completed on 2024-08-29 02:17:04
0001 import FWCore.ParameterSet.Config as cms
0002
0003
0004
0005 from RecoMET.METFilters.metFilters_cff import HBHENoiseFilterResultProducer, HBHENoiseFilter, HBHENoiseIsoFilter, hcalLaserEventFilter
0006 from RecoMET.METFilters.metFilters_cff import EcalDeadCellTriggerPrimitiveFilter, eeBadScFilter, ecalLaserCorrFilter, EcalDeadCellBoundaryEnergyFilter, ecalBadCalibFilter
0007 from RecoMET.METFilters.metFilters_cff import primaryVertexFilter, CSCTightHaloFilter, CSCTightHaloTrkMuUnvetoFilter, CSCTightHalo2015Filter, globalTightHalo2016Filter, globalSuperTightHalo2016Filter, HcalStripHaloFilter
0008 from RecoMET.METFilters.metFilters_cff import goodVertices, trackingFailureFilter, trkPOGFilters, manystripclus53X, toomanystripclus53X, logErrorTooManyClusters
0009 from RecoMET.METFilters.metFilters_cff import chargedHadronTrackResolutionFilter, muonBadTrackFilter
0010 from RecoMET.METFilters.metFilters_cff import BadChargedCandidateFilter, BadPFMuonFilter, BadPFMuonDzFilter
0011 from RecoMET.METFilters.metFilters_cff import BadChargedCandidateSummer16Filter, BadPFMuonSummer16Filter
0012 from RecoMET.METFilters.metFilters_cff import hfNoisyHitsFilter
0013
0014
0015 Flag_HBHENoiseFilter = cms.Path(HBHENoiseFilterResultProducer * HBHENoiseFilter)
0016 Flag_HBHENoiseIsoFilter = cms.Path(HBHENoiseFilterResultProducer * HBHENoiseIsoFilter)
0017 Flag_CSCTightHaloFilter = cms.Path(CSCTightHaloFilter)
0018 Flag_CSCTightHaloTrkMuUnvetoFilter = cms.Path(CSCTightHaloTrkMuUnvetoFilter)
0019 Flag_CSCTightHalo2015Filter = cms.Path(CSCTightHalo2015Filter)
0020 Flag_globalTightHalo2016Filter = cms.Path(globalTightHalo2016Filter)
0021 Flag_globalSuperTightHalo2016Filter = cms.Path(globalSuperTightHalo2016Filter)
0022 Flag_HcalStripHaloFilter = cms.Path(HcalStripHaloFilter)
0023 Flag_hcalLaserEventFilter = cms.Path(hcalLaserEventFilter)
0024 Flag_EcalDeadCellTriggerPrimitiveFilter = cms.Path(EcalDeadCellTriggerPrimitiveFilter)
0025 Flag_EcalDeadCellBoundaryEnergyFilter = cms.Path(EcalDeadCellBoundaryEnergyFilter)
0026 Flag_ecalBadCalibFilter = cms.Path()
0027 Flag_goodVertices = cms.Path(primaryVertexFilter)
0028 Flag_trackingFailureFilter = cms.Path(goodVertices + trackingFailureFilter)
0029 Flag_eeBadScFilter = cms.Path(eeBadScFilter)
0030 Flag_ecalLaserCorrFilter = cms.Path(ecalLaserCorrFilter)
0031 Flag_trkPOGFilters = cms.Path(trkPOGFilters)
0032 Flag_chargedHadronTrackResolutionFilter = cms.Path(chargedHadronTrackResolutionFilter)
0033 Flag_muonBadTrackFilter = cms.Path(muonBadTrackFilter)
0034 Flag_BadChargedCandidateFilter = cms.Path(BadChargedCandidateFilter)
0035 Flag_BadPFMuonFilter = cms.Path(BadPFMuonFilter)
0036 Flag_BadChargedCandidateSummer16Filter = cms.Path(BadChargedCandidateSummer16Filter)
0037 Flag_BadPFMuonSummer16Filter = cms.Path(BadPFMuonSummer16Filter)
0038 Flag_BadPFMuonDzFilter = cms.Path(BadPFMuonDzFilter)
0039 Flag_hfNoisyHitsFilter = cms.Path(hfNoisyHitsFilter)
0040
0041
0042 Flag_trkPOG_manystripclus53X = cms.Path(~manystripclus53X)
0043 Flag_trkPOG_toomanystripclus53X = cms.Path(~toomanystripclus53X)
0044 Flag_trkPOG_logErrorTooManyClusters = cms.Path(~logErrorTooManyClusters)
0045
0046
0047 allMetFilterPaths=['HBHENoiseFilter','HBHENoiseIsoFilter','CSCTightHaloFilter','CSCTightHaloTrkMuUnvetoFilter','CSCTightHalo2015Filter','globalTightHalo2016Filter','globalSuperTightHalo2016Filter','HcalStripHaloFilter','hcalLaserEventFilter','EcalDeadCellTriggerPrimitiveFilter','EcalDeadCellBoundaryEnergyFilter','ecalBadCalibFilter','goodVertices','eeBadScFilter',
0048 'ecalLaserCorrFilter','trkPOGFilters','chargedHadronTrackResolutionFilter','muonBadTrackFilter',
0049 'BadChargedCandidateFilter','BadPFMuonFilter', 'BadPFMuonDzFilter', 'hfNoisyHitsFilter', 'BadChargedCandidateSummer16Filter','BadPFMuonSummer16Filter',
0050 'trkPOG_manystripclus53X','trkPOG_toomanystripclus53X','trkPOG_logErrorTooManyClusters']
0051
0052
0053 def miniAOD_customizeMETFiltersFastSim(process):
0054 """Replace some MET filters that don't work in FastSim with trivial bools"""
0055 for X in 'CSCTightHaloFilter', 'CSCTightHaloTrkMuUnvetoFilter','CSCTightHalo2015Filter','globalTightHalo2016Filter','globalSuperTightHalo2016Filter','HcalStripHaloFilter':
0056 process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(True)))
0057 for X in 'manystripclus53X', 'toomanystripclus53X', 'logErrorTooManyClusters':
0058 process.globalReplace(X, cms.EDFilter("HLTBool", result=cms.bool(False)))
0059 return process
0060
0061 from Configuration.Eras.Modifier_phase2_common_cff import phase2_common
0062 phase2_common.toReplaceWith( Flag_trkPOG_manystripclus53X, cms.Path() )
0063 phase2_common.toReplaceWith( Flag_trkPOG_toomanystripclus53X, cms.Path() )
0064 phase2_common.toReplaceWith( Flag_trkPOGFilters, cms.Path(~logErrorTooManyClusters) )
0065
0066 from Configuration.Eras.Modifier_run2_common_cff import run2_common
0067 run2_common.toReplaceWith( Flag_ecalBadCalibFilter, cms.Path(ecalBadCalibFilter) )
0068
0069 from Configuration.Eras.Modifier_phase2_hgcal_cff import phase2_hgcal
0070 phase2_hgcal.toReplaceWith( Flag_HBHENoiseFilter, cms.Path() )
0071 phase2_hgcal.toReplaceWith( Flag_HBHENoiseIsoFilter, cms.Path() )
0072 phase2_hgcal.toReplaceWith( Flag_eeBadScFilter, cms.Path() )
0073
0074 metFilterPathsTask = cms.Task(
0075 HBHENoiseFilterResultProducer,
0076 HBHENoiseFilter,
0077 HBHENoiseIsoFilter,
0078 hcalLaserEventFilter,
0079 EcalDeadCellTriggerPrimitiveFilter,
0080 eeBadScFilter,
0081 ecalLaserCorrFilter,
0082 EcalDeadCellBoundaryEnergyFilter,
0083 ecalBadCalibFilter,
0084 primaryVertexFilter,
0085 CSCTightHaloFilter,
0086 CSCTightHaloTrkMuUnvetoFilter,
0087 CSCTightHalo2015Filter,
0088 globalTightHalo2016Filter,
0089 globalSuperTightHalo2016Filter,
0090 HcalStripHaloFilter,
0091 goodVertices,
0092 trackingFailureFilter,
0093 manystripclus53X,
0094 toomanystripclus53X,
0095 logErrorTooManyClusters,
0096 chargedHadronTrackResolutionFilter,
0097 muonBadTrackFilter,
0098 BadChargedCandidateFilter,
0099 BadPFMuonFilter,
0100 BadPFMuonDzFilter,
0101 hfNoisyHitsFilter,
0102 BadChargedCandidateSummer16Filter,
0103 BadPFMuonSummer16Filter
0104 )
0105 phase2_common.toReplaceWith( metFilterPathsTask, metFilterPathsTask.copyAndExclude( [ manystripclus53X, toomanystripclus53X ] ) )
0106 phase2_hgcal.toReplaceWith( metFilterPathsTask, metFilterPathsTask.copyAndExclude( [ HBHENoiseFilterResultProducer, HBHENoiseFilter, HBHENoiseIsoFilter, eeBadScFilter ] ) )