From 8e49f10451877c56f6cf1def481603198b840914 Mon Sep 17 00:00:00 2001 From: mmusich Date: Thu, 31 Oct 2024 15:11:42 +0100 Subject: [PATCH] TkAlMuonSelectors_cfi: replace MuonSelector that express the structure of the selection in C++ code - replace in 4 ALCARECO producers separated configuration with a common block: TkAlGoodIdMuonSelector+TkAlRelCombIsoMuonSelector --- .../python/ALCARECOTkAlDiMuonAndVertex_cff.py | 8 ++-- .../python/ALCARECOTkAlMuonIsolated_cff.py | 14 +++---- .../python/ALCARECOTkAlUpsilonMuMu_cff.py | 6 +-- .../python/ALCARECOTkAlZMuMuPA_cff.py | 4 +- .../python/ALCARECOTkAlZMuMu_cff.py | 15 +++---- .../python/TkAlMuonSelectors_cfi.py | 42 +++++++++++-------- .../ALCARECOSiPixelCalSingleMuonTight_cff.py | 11 ++--- 7 files changed, 47 insertions(+), 53 deletions(-) diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlDiMuonAndVertex_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlDiMuonAndVertex_cff.py index e1485c4fc2cab..0563367fe87df 100644 --- a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlDiMuonAndVertex_cff.py +++ b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlDiMuonAndVertex_cff.py @@ -3,13 +3,12 @@ ################################################################## # Exact same configuration as TkAlZMuMu: extract mumu pairs ################################################################# +from Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi import * import Alignment.CommonAlignmentProducer.ALCARECOTkAlZMuMu_cff as confALCARECOTkAlZMuMu ALCARECOTkAlDiMuonHLT = confALCARECOTkAlZMuMu.ALCARECOTkAlZMuMuHLT.clone() ALCARECOTkAlDiMuonDCSFilter = confALCARECOTkAlZMuMu.ALCARECOTkAlZMuMuDCSFilter.clone() -ALCARECOTkAlDiMuonGoodMuons = confALCARECOTkAlZMuMu.ALCARECOTkAlZMuMuGoodMuons.clone() -ALCARECOTkAlDiMuonRelCombIsoMuons = confALCARECOTkAlZMuMu.ALCARECOTkAlZMuMuRelCombIsoMuons.clone(src = 'ALCARECOTkAlDiMuonGoodMuons') ALCARECOTkAlDiMuon = confALCARECOTkAlZMuMu.ALCARECOTkAlZMuMu.clone() -ALCARECOTkAlDiMuon.GlobalSelector.muonSource = 'ALCARECOTkAlDiMuonRelCombIsoMuons' +ALCARECOTkAlDiMuon.GlobalSelector.muonSource = 'TkAlRelCombIsoMuonSelector' ################################################################## # Tracks from the selected vertex @@ -31,8 +30,7 @@ ################################################################# seqALCARECOTkAlDiMuonAndVertex = cms.Sequence(ALCARECOTkAlDiMuonHLT+ ALCARECOTkAlDiMuonDCSFilter+ - ALCARECOTkAlDiMuonGoodMuons+ - ALCARECOTkAlDiMuonRelCombIsoMuons+ + seqALCARECOTkAlRelCombIsoMuons+ ALCARECOTkAlDiMuon+ ALCARECOTkAlDiMuonVertexTracks+ TkAlDiMuonAndVertexGenMuonSelector) diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlMuonIsolated_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlMuonIsolated_cff.py index 4393f1431a1d1..e4aa7cdbe9e7a 100644 --- a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlMuonIsolated_cff.py +++ b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlMuonIsolated_cff.py @@ -21,11 +21,7 @@ DebugOn = cms.untracked.bool(False) ) -import Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi -ALCARECOTkAlMuonIsolatedGoodMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlGoodIdMuonSelector.clone() -ALCARECOTkAlMuonIsolatedRelCombIsoMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlRelCombIsoMuonSelector.clone( - src = 'ALCARECOTkAlMuonIsolatedGoodMuons' -) +from Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi import * import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi ALCARECOTkAlMuonIsolated = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone( @@ -37,7 +33,7 @@ nHitMin = 0 ) -ALCARECOTkAlMuonIsolated.GlobalSelector.muonSource = 'ALCARECOTkAlMuonIsolatedRelCombIsoMuons' +ALCARECOTkAlMuonIsolated.GlobalSelector.muonSource = 'TkAlRelCombIsoMuonSelector' # Isolation is shifted to the muon preselection, and then applied intrinsically if applyGlobalMuonFilter = True ALCARECOTkAlMuonIsolated.GlobalSelector.applyIsolationtest = False ALCARECOTkAlMuonIsolated.GlobalSelector.minJetDeltaR = 0.1 @@ -47,8 +43,10 @@ ALCARECOTkAlMuonIsolated.TwoBodyDecaySelector.applyChargeFilter = False ALCARECOTkAlMuonIsolated.TwoBodyDecaySelector.applyAcoplanarityFilter = False -seqALCARECOTkAlMuonIsolated = cms.Sequence(ALCARECOTkAlMuonIsolatedHLT+ALCARECOTkAlMuonIsolatedDCSFilter+ALCARECOTkAlMuonIsolatedGoodMuons+ALCARECOTkAlMuonIsolatedRelCombIsoMuons+ALCARECOTkAlMuonIsolated) - +seqALCARECOTkAlMuonIsolated = cms.Sequence(ALCARECOTkAlMuonIsolatedHLT+ + ALCARECOTkAlMuonIsolatedDCSFilter+ + seqALCARECOTkAlRelCombIsoMuons+ + ALCARECOTkAlMuonIsolated) ## customizations for the pp_on_AA eras from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017 diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlUpsilonMuMu_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlUpsilonMuMu_cff.py index 9bb702e7f42cc..173e86124bbc3 100644 --- a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlUpsilonMuMu_cff.py +++ b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlUpsilonMuMu_cff.py @@ -23,11 +23,7 @@ import Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi ALCARECOTkAlUpsilonMuMuGoodMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlGoodIdMuonSelector.clone() -ALCARECOTkAlUpsilonMuMuRelCombIsoMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlRelCombIsoMuonSelector.clone( - src = 'ALCARECOTkAlUpsilonMuMuGoodMuons', - cut = '(isolationR03().sumPt + isolationR03().emEt + isolationR03().hadEt)/pt < 0.3' - -) +ALCARECOTkAlUpsilonMuMuRelCombIsoMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlRelCombIsoMuonSelector.clone(src = 'ALCARECOTkAlUpsilonMuMuGoodMuons') import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi ALCARECOTkAlUpsilonMuMu = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone() diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMuPA_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMuPA_cff.py index 2f81e70a76848..87189ff5ebdb2 100644 --- a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMuPA_cff.py +++ b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMuPA_cff.py @@ -9,7 +9,7 @@ ALCARECOTkAlZMuMuPADCSFilter = ALCARECOTkAlZMuMuDCSFilter.clone() -ALCARECOTkAlZMuMuPAGoodMuons = ALCARECOTkAlZMuMuGoodMuons.clone() +ALCARECOTkAlZMuMuPAGoodMuons = TkAlGoodIdMuonSelector.clone() ALCARECOTkAlZMuMuPA = ALCARECOTkAlZMuMu.clone( src = 'generalTracks' @@ -18,6 +18,6 @@ seqALCARECOTkAlZMuMuPA = cms.Sequence(ALCARECOTkAlZMuMuPAHLT +ALCARECOTkAlZMuMuPADCSFilter - +ALCARECOTkAlZMuMuPAGoodMuons + +TkAlGoodIdMuonSelector +ALCARECOTkAlZMuMuPA ) diff --git a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMu_cff.py b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMu_cff.py index c421902c2e144..8be81d15c61c0 100644 --- a/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMu_cff.py +++ b/Alignment/CommonAlignmentProducer/python/ALCARECOTkAlZMuMu_cff.py @@ -21,11 +21,8 @@ DebugOn = cms.untracked.bool(False) ) -import Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi -ALCARECOTkAlZMuMuGoodMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlGoodIdMuonSelector.clone() -ALCARECOTkAlZMuMuRelCombIsoMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlRelCombIsoMuonSelector.clone( - src = 'ALCARECOTkAlZMuMuGoodMuons' -) +## standard muon selection +from Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi import * import Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi ALCARECOTkAlZMuMu = Alignment.CommonAlignmentProducer.AlignmentTrackSelector_cfi.AlignmentTrackSelector.clone() @@ -37,7 +34,7 @@ ALCARECOTkAlZMuMu.etaMax = 3.5 ALCARECOTkAlZMuMu.nHitMin = 0 -ALCARECOTkAlZMuMu.GlobalSelector.muonSource = 'ALCARECOTkAlZMuMuRelCombIsoMuons' +ALCARECOTkAlZMuMu.GlobalSelector.muonSource = 'TkAlRelCombIsoMuonSelector' # Isolation is shifted to the muon preselection, and then applied intrinsically if applyGlobalMuonFilter = True ALCARECOTkAlZMuMu.GlobalSelector.applyIsolationtest = False ALCARECOTkAlZMuMu.GlobalSelector.applyGlobalMuonFilter = True @@ -58,7 +55,11 @@ filter = cms.bool(False), throwOnMissing = cms.untracked.bool(False)) -seqALCARECOTkAlZMuMu = cms.Sequence(ALCARECOTkAlZMuMuHLT+ALCARECOTkAlZMuMuDCSFilter+ALCARECOTkAlZMuMuGoodMuons+ALCARECOTkAlZMuMuRelCombIsoMuons+ALCARECOTkAlZMuMu+TkAlZMuMuGenMuonSelector) +seqALCARECOTkAlZMuMu = cms.Sequence(ALCARECOTkAlZMuMuHLT+ + ALCARECOTkAlZMuMuDCSFilter+ + seqALCARECOTkAlRelCombIsoMuons+ + ALCARECOTkAlZMuMu+ + TkAlZMuMuGenMuonSelector) ## customizations for the pp_on_AA eras from Configuration.Eras.Modifier_pp_on_XeXe_2017_cff import pp_on_XeXe_2017 diff --git a/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py b/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py index 1999a479cb05b..d597319f083c9 100644 --- a/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py +++ b/Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py @@ -1,31 +1,37 @@ import FWCore.ParameterSet.Config as cms -TkAlGoodIdMuonSelector = cms.EDFilter("MuonSelector", - src = cms.InputTag('muons'), - cut = cms.string('isGlobalMuon &' - 'isTrackerMuon &' - 'numberOfMatches > 1 &' - 'globalTrack.hitPattern.numberOfValidMuonHits > 0 &' - 'abs(eta) < 2.5 &' - 'globalTrack.normalizedChi2 < 20.'), - filter = cms.bool(True) -) +from Alignment.CommonAlignmentProducer.alignmentGoodIdMuonSelector_cfi import alignmentGoodIdMuonSelector +TkAlGoodIdMuonSelector = alignmentGoodIdMuonSelector.clone(src = cms.InputTag('muons'), + requireGlobal = cms.bool(True), + requireTracker = cms.bool(True), + minMatches = cms.int32(1), + minMuonHits = cms.int32(0), + maxEta = cms.double(2.5), + maxChi2 = cms.double(20), + filter = cms.bool(True)) -TkAlRelCombIsoMuonSelector = cms.EDFilter("MuonSelector", - src = cms.InputTag(''), - cut = cms.string('(isolationR03().sumPt + isolationR03().emEt + isolationR03().hadEt)/pt < 0.15'), - filter = cms.bool(True) -) +from Alignment.CommonAlignmentProducer.alignmentRelCombIsoMuonSelector_cfi import alignmentRelCombIsoMuonSelector +TkAlRelCombIsoMuonSelector = alignmentRelCombIsoMuonSelector.clone(src = cms.InputTag('TkAlGoodIdMuonSelector'), + filter = cms.bool(True), + relCombIsoCut = cms.double(0.15), + useTrackerOnlyIsolation = cms.bool(False)) + +# Define a common sequence to be imported in ALCARECOs +seqALCARECOTkAlRelCombIsoMuons = cms.Sequence(TkAlGoodIdMuonSelector+TkAlRelCombIsoMuonSelector) ## FIXME: these are needed for ALCARECO production in CMSSW_14_0_X ## to avoid loosing in efficiency. To be reviewed after muon reco is fixed from Configuration.Eras.Modifier_phase2_common_cff import phase2_common phase2_common.toModify(TkAlGoodIdMuonSelector, - cut = '(abs(eta) < 2.5 & isGlobalMuon & isTrackerMuon & numberOfMatches > 1 & globalTrack.hitPattern.numberOfValidMuonHits > 0 & globalTrack.normalizedChi2 < 20.) ||' # regular selection - '(abs(eta) > 2.3 & abs(eta) < 3.0 & numberOfMatches >= 0 & isTrackerMuon)' # to recover GE0 tracks + useSecondarySelection = cms.bool(True), # to recover tracks passing through GE0 + secondaryEtaLow = cms.double(2.3), + secondaryEtaHigh = cms.double(3), + secondaryMinMatches = cms.int32(0), + secondaryRequireTracker = cms.bool(True) ) phase2_common.toModify(TkAlRelCombIsoMuonSelector, - cut = '(isolationR03().sumPt)/pt < 0.1' # only tracker isolation + relCombIsoCut = cms.double(0.10), + useTrackerOnlyIsolation = cms.bool(True) # only tracker isolation ) diff --git a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py index 88e76099e8a53..f911d45491772 100644 --- a/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py +++ b/Calibration/TkAlCaRecoProducers/python/ALCARECOSiPixelCalSingleMuonTight_cff.py @@ -24,11 +24,7 @@ ################################################################## # Isolated muons Track selector ################################################################## -import Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi -ALCARECOSiPixelCalSingleMuonTightGoodMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlGoodIdMuonSelector.clone() -ALCARECOSiPixelCalSingleMuonTightRelCombIsoMuons = Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi.TkAlRelCombIsoMuonSelector.clone( - src = 'ALCARECOSiPixelCalSingleMuonTightGoodMuons' -) +from Alignment.CommonAlignmentProducer.TkAlMuonSelectors_cfi import * ################################################################## # Basic Track selection @@ -46,7 +42,7 @@ ################################################################## # Muon selection ################################################################## -ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.muonSource = 'ALCARECOSiPixelCalSingleMuonTightRelCombIsoMuons' +ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.muonSource = 'TkAlRelCombIsoMuonSelector' # Isolation is shifted to the muon preselection, and then applied intrinsically if applyGlobalMuonFilter = True ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.applyIsolationtest = False ALCARECOSiPixelCalSingleMuonTight.GlobalSelector.minJetDeltaR = 0.1 @@ -91,8 +87,7 @@ seqALCARECOSiPixelCalSingleMuonTight = cms.Sequence(offlineBeamSpot+ ALCARECOSiPixelCalSingleMuonTightHLTFilter+ ALCARECOSiPixelCalSingleMuonTightDCSFilter+ - ALCARECOSiPixelCalSingleMuonTightGoodMuons+ - ALCARECOSiPixelCalSingleMuonTightRelCombIsoMuons+ + seqALCARECOTkAlRelCombIsoMuons+ ALCARECOSiPixelCalSingleMuonTight+ trackDistances + ALCARECOSiPixelCalSingleMuonTightOffTrackClusters)