Skip to content

Commit

Permalink
TkAlMuonSelectors_cfi: replace MuonSelector that express the structur…
Browse files Browse the repository at this point in the history
…e of the selection in C++ code

- replace in 4 ALCARECO producers separated configuration with a common block: TkAlGoodIdMuonSelector+TkAlRelCombIsoMuonSelector
  • Loading branch information
mmusich committed Oct 31, 2024
1 parent 2d97abd commit 8e49f10
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,8 +30,7 @@
#################################################################
seqALCARECOTkAlDiMuonAndVertex = cms.Sequence(ALCARECOTkAlDiMuonHLT+
ALCARECOTkAlDiMuonDCSFilter+
ALCARECOTkAlDiMuonGoodMuons+
ALCARECOTkAlDiMuonRelCombIsoMuons+
seqALCARECOTkAlRelCombIsoMuons+
ALCARECOTkAlDiMuon+
ALCARECOTkAlDiMuonVertexTracks+
TkAlDiMuonAndVertexGenMuonSelector)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

ALCARECOTkAlZMuMuPADCSFilter = ALCARECOTkAlZMuMuDCSFilter.clone()

ALCARECOTkAlZMuMuPAGoodMuons = ALCARECOTkAlZMuMuGoodMuons.clone()
ALCARECOTkAlZMuMuPAGoodMuons = TkAlGoodIdMuonSelector.clone()

ALCARECOTkAlZMuMuPA = ALCARECOTkAlZMuMu.clone(
src = 'generalTracks'
Expand All @@ -18,6 +18,6 @@

seqALCARECOTkAlZMuMuPA = cms.Sequence(ALCARECOTkAlZMuMuPAHLT
+ALCARECOTkAlZMuMuPADCSFilter
+ALCARECOTkAlZMuMuPAGoodMuons
+TkAlGoodIdMuonSelector
+ALCARECOTkAlZMuMuPA
)
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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
Expand All @@ -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
Expand Down
42 changes: 24 additions & 18 deletions Alignment/CommonAlignmentProducer/python/TkAlMuonSelectors_cfi.py
Original file line number Diff line number Diff line change
@@ -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
)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -91,8 +87,7 @@
seqALCARECOSiPixelCalSingleMuonTight = cms.Sequence(offlineBeamSpot+
ALCARECOSiPixelCalSingleMuonTightHLTFilter+
ALCARECOSiPixelCalSingleMuonTightDCSFilter+
ALCARECOSiPixelCalSingleMuonTightGoodMuons+
ALCARECOSiPixelCalSingleMuonTightRelCombIsoMuons+
seqALCARECOTkAlRelCombIsoMuons+
ALCARECOSiPixelCalSingleMuonTight+
trackDistances +
ALCARECOSiPixelCalSingleMuonTightOffTrackClusters)
Expand Down

0 comments on commit 8e49f10

Please sign in to comment.