From 9dd2e949a04e8d2f2565994e55c9bc712ca9e4f0 Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 5 Jul 2022 14:37:59 +0200 Subject: [PATCH 01/66] Jets from emulator 6/N --- .../HLT_75e33/modules/l1t1PFPuppiJet70offMaxEta2p4_cfi.py | 2 +- .../HLT_75e33/modules/l1t2PFPuppiJet55offMaxEta2p4_cfi.py | 2 +- .../HLT_75e33/modules/l1t4PFPuppiJet25OnlineMaxEta2p4_cfi.py | 2 +- .../HLT_75e33/modules/l1t4PFPuppiJet40offMaxEta2p4_cfi.py | 2 +- .../modules/l1tDoublePFPuppiJet112offMaxEta2p4_cfi.py | 2 +- .../modules/l1tDoublePFPuppiJets112offMaxDeta1p6_cfi.py | 4 ++-- .../python/HLT_75e33/modules/l1tPFPuppiHT_cfi.py | 2 +- .../python/HLT_75e33/modules/l1tSinglePFPuppiJet230off_cfi.py | 2 +- .../HLT_75e33/modules/l1tSlwPFPuppiJetsCorrected_cfi.py | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t1PFPuppiJet70offMaxEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t1PFPuppiJet70offMaxEta2p4_cfi.py index ff90d30e0d2c7..9a7a7bdb67b21 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t1PFPuppiJet70offMaxEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t1PFPuppiJet70offMaxEta2p4_cfi.py @@ -10,5 +10,5 @@ endcap = cms.vdouble(42.4039, 1.33052, 0), overlap = cms.vdouble(24.8375, 1.4152, 0) ), - inputTag = cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates") + inputTag = cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t2PFPuppiJet55offMaxEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t2PFPuppiJet55offMaxEta2p4_cfi.py index 46082b48b5a79..2c741a531f2c5 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t2PFPuppiJet55offMaxEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t2PFPuppiJet55offMaxEta2p4_cfi.py @@ -10,5 +10,5 @@ endcap = cms.vdouble(42.4039, 1.33052, 0), overlap = cms.vdouble(24.8375, 1.4152, 0) ), - inputTag = cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates") + inputTag = cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet25OnlineMaxEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet25OnlineMaxEta2p4_cfi.py index 35da7f1a8e994..c6ddea3b521af 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet25OnlineMaxEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet25OnlineMaxEta2p4_cfi.py @@ -5,5 +5,5 @@ MinEta = cms.double(-2.4), MinN = cms.int32(4), MinPt = cms.double(25.0), - inputTag = cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates") + inputTag = cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet40offMaxEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet40offMaxEta2p4_cfi.py index ddd15ad0d4465..fc72d7d58ba39 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet40offMaxEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1t4PFPuppiJet40offMaxEta2p4_cfi.py @@ -10,5 +10,5 @@ endcap = cms.vdouble(42.4039, 1.33052, 0), overlap = cms.vdouble(24.8375, 1.4152, 0) ), - inputTag = cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates") + inputTag = cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJet112offMaxEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJet112offMaxEta2p4_cfi.py index 2966a570500e4..f77d0d3f63c5b 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJet112offMaxEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJet112offMaxEta2p4_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(42.4039, 1.33052, 0), overlap = cms.vdouble(24.8375, 1.4152, 0) ), - inputTag = cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates"), + inputTag = cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJets112offMaxDeta1p6_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJets112offMaxDeta1p6_cfi.py index 7f102c9a2bb70..421ba21cbb501 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJets112offMaxDeta1p6_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tDoublePFPuppiJets112offMaxDeta1p6_cfi.py @@ -14,8 +14,8 @@ MinPt = cms.double(0.0), inputTag1 = cms.InputTag("l1tDoublePFPuppiJet112offMaxEta2p4"), inputTag2 = cms.InputTag("l1tDoublePFPuppiJet112offMaxEta2p4"), - originTag1 = cms.VInputTag(cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates")), - originTag2 = cms.VInputTag(cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates")), + originTag1 = cms.VInputTag(cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates")), + originTag2 = cms.VInputTag(cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates")), saveTags = cms.bool(True), triggerType1 = cms.int32(-116), triggerType2 = cms.int32(-116) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT_cfi.py index 0ddfb20e2f2d1..c4d9f7f815dd9 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT_cfi.py @@ -1,7 +1,7 @@ import FWCore.ParameterSet.Config as cms l1tPFPuppiHT = cms.EDProducer("HLTHtMhtProducer", - jetsLabel = cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates"), + jetsLabel = cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates"), maxEtaJetHt = cms.double(2.4), minPtJetHt = cms.double(30.0) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSinglePFPuppiJet230off_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSinglePFPuppiJet230off_cfi.py index eb7812dcd99b9..ac745f4f67fa0 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSinglePFPuppiJet230off_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSinglePFPuppiJet230off_cfi.py @@ -10,5 +10,5 @@ endcap = cms.vdouble(42.4039, 1.33052, 0), overlap = cms.vdouble(24.8375, 1.4152, 0) ), - inputTag = cms.InputTag("l1tSlwPFPuppiJetsCorrected","Phase1L1TJetFromPfCandidates") + inputTag = cms.InputTag("Phase1L1TJetCalibrator9x9","Phase1L1TJetFromPfCandidates") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSlwPFPuppiJetsCorrected_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSlwPFPuppiJetsCorrected_cfi.py index 4ae917d6b9fc3..a40b89082ec87 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSlwPFPuppiJetsCorrected_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tSlwPFPuppiJetsCorrected_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -l1tSlwPFPuppiJetsCorrected = cms.EDProducer("Phase1L1TJetCalibrator", +Phase1L1TJetCalibrator9x9 = cms.EDProducer("Phase1L1TJetCalibrator", absEtaBinning = cms.vdouble( 0, 0.435, 0.783, 1.131, 1.305, 1.479, 1.653, 1.83, 1.93, 2.043, From 4cbc1c6ba502612a3ef0e02579ed42efea5cb2c6 Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 5 Jul 2022 14:58:44 +0200 Subject: [PATCH 02/66] Removing L1PF reco, 7/N --- .../tasks/l1tReconstructionTask_cfi.py | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py index f66e98e8de267..326d6f95aaabd 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py @@ -3,26 +3,26 @@ from ..modules.L1EGammaClusterEmuProducer_cfi import * from ..modules.l1EGammaEEProducer_cfi import * from ..modules.l1NNTauProducerPuppi_cfi import * -from ..modules.l1pfCandidates_cfi import * +#from ..modules.l1pfCandidates_cfi import * from ..modules.l1PFMetPuppi_cfi import * -from ..modules.l1pfProducerBarrel_cfi import * -from ..modules.l1pfProducerHF_cfi import * -from ..modules.l1pfProducerHGCal_cfi import * -from ..modules.l1pfProducerHGCalNoTK_cfi import * +#from ..modules.l1pfProducerBarrel_cfi import * +#from ..modules.l1pfProducerHF_cfi import * +#from ..modules.l1pfProducerHGCal_cfi import * +#from ..modules.l1pfProducerHGCalNoTK_cfi import * from ..modules.hltL1TkElectronsEllipticMatchCrystal_cfi import * from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * -from ..modules.hltL1TkMuons_cfi import * +#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1TkPhotonsCrystal_cfi import * from ..modules.hltL1TkPhotonsHGC_cfi import * -from ..modules.L1TkPrimaryVertex_cfi import * -from ..modules.l1tSlwPFPuppiJets_cfi import * -from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * -from ..modules.pfClustersFromCombinedCaloHCal_cfi import * -from ..modules.pfClustersFromCombinedCaloHF_cfi import * -from ..modules.pfClustersFromHGC3DClusters_cfi import * -from ..modules.pfClustersFromL1EGClusters_cfi import * -from ..modules.pfTracksFromL1TracksBarrel_cfi import * -from ..modules.pfTracksFromL1TracksHGCal_cfi import * +#from ..modules.L1TkPrimaryVertex_cfi import * +#from ..modules.l1tSlwPFPuppiJets_cfi import * +#from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * +#from ..modules.pfClustersFromCombinedCaloHCal_cfi import * +#from ..modules.pfClustersFromCombinedCaloHF_cfi import * +#from ..modules.pfClustersFromHGC3DClusters_cfi import * +#from ..modules.pfClustersFromL1EGClusters_cfi import * +#from ..modules.pfTracksFromL1TracksBarrel_cfi import * +#from ..modules.pfTracksFromL1TracksHGCal_cfi import * from ..modules.simCaloStage2Layer1Digis_cfi import * from ..modules.simCscTriggerPrimitiveDigis_cfi import * from ..modules.simDtTriggerPrimitiveDigis_cfi import * @@ -40,26 +40,26 @@ L1EGammaClusterEmuProducer, hltL1TkElectronsEllipticMatchCrystal, hltL1TkElectronsEllipticMatchHGC, - hltL1TkMuons, + #hltL1TkMuons, hltL1TkPhotonsCrystal, hltL1TkPhotonsHGC, - L1TkPrimaryVertex, + #L1TkPrimaryVertex, l1EGammaEEProducer, l1NNTauProducerPuppi, l1PFMetPuppi, - l1pfCandidates, - l1pfProducerBarrel, - l1pfProducerHF, - l1pfProducerHGCal, - l1pfProducerHGCalNoTK, - l1tSlwPFPuppiJets, - l1tSlwPFPuppiJetsCorrected, - pfClustersFromCombinedCaloHCal, - pfClustersFromCombinedCaloHF, - pfClustersFromHGC3DClusters, - pfClustersFromL1EGClusters, - pfTracksFromL1TracksBarrel, - pfTracksFromL1TracksHGCal, + #l1pfCandidates, + #l1pfProducerBarrel, + #l1pfProducerHF, + #l1pfProducerHGCal, + #l1pfProducerHGCalNoTK, + #l1tSlwPFPuppiJets, + #l1tSlwPFPuppiJetsCorrected, + #pfClustersFromCombinedCaloHCal, + #pfClustersFromCombinedCaloHF, + #pfClustersFromHGC3DClusters, + #pfClustersFromL1EGClusters, + #pfTracksFromL1TracksBarrel, + #pfTracksFromL1TracksHGCal, simCaloStage2Layer1Digis, simCscTriggerPrimitiveDigis, simDtTriggerPrimitiveDigis, From bcd507b5b269964b0a37e4c5eb73d0f351037a97 Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 5 Jul 2022 16:00:32 +0200 Subject: [PATCH 03/66] MET from emulator 8/N --- .../python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py index cf3f594fc038b..04781ba4336a3 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py @@ -6,5 +6,5 @@ theScalings = cms.vdouble(54.2859, 1.39739, 0) ), TypeOfSum = cms.string('MET'), - inputTag = cms.InputTag("l1PFMetPuppi") + inputTag = cms.InputTag("l1PFMet") ) From d29fc587d7f2996ec4184dab5b35d8cac8b0114e Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 5 Jul 2022 17:13:47 +0200 Subject: [PATCH 04/66] HT from emulator 9/N --- .../python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py | 2 +- .../python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py index fcf6ea3c680a1..c4af8a782dee1 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py @@ -6,5 +6,5 @@ theScalings = cms.vdouble(50.0182, 1.0961, 0) ), TypeOfSum = cms.string('HT'), - inputTag = cms.InputTag("l1tPFPuppiHT") + inputTag = cms.InputTag("Phase1L1TJetSumsProducer9x9","Sums") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py index e504d9f08ced4..1e367ab1aaa64 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py @@ -6,5 +6,5 @@ theScalings = cms.vdouble(50.0182, 1.0961, 0) ), TypeOfSum = cms.string('HT'), - inputTag = cms.InputTag("l1tPFPuppiHT") + inputTag = cms.InputTag("Phase1L1TJetSumsProducer9x9","Sums") ) From 37ba1b629899f1ea2d5536a530096746c70766a6 Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 5 Jul 2022 17:27:14 +0200 Subject: [PATCH 05/66] Removing L1T MET and HT reco --- ...PFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py | 4 ++-- ...ppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py | 4 ++-- ...PFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py | 4 ++-- ...ppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py | 4 ++-- .../python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py | 4 ++-- .../L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py | 4 ++-- .../python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py | 4 ++-- .../python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py index a1d3d06065725..d6d89d7ef9137 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py @@ -11,7 +11,7 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -from ..modules.l1tPFPuppiHT_cfi import * +#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepCSVSequencePFPuppiModEta2p4_cfi import * @@ -20,7 +20,7 @@ HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4 = cms.Path( HLTBeginSequence + - l1tPFPuppiHT + +# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py index a27e796419a81..983c693953407 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py @@ -11,7 +11,7 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -from ..modules.l1tPFPuppiHT_cfi import * +#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepFlavourSequencePFPuppiModEta2p4_cfi import * @@ -20,7 +20,7 @@ HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4 = cms.Path( HLTBeginSequence + - l1tPFPuppiHT + +# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py index 691ba3ac634f7..b054d18f2ba41 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py @@ -13,7 +13,7 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -from ..modules.l1tPFPuppiHT_cfi import * +#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepCSVSequencePFPuppiModEta2p4_cfi import * @@ -22,7 +22,7 @@ HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4 = cms.Path( HLTBeginSequence + - l1tPFPuppiHT + +# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py index 0b0909f7a5518..f493c0cb163ac 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py @@ -13,7 +13,7 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -from ..modules.l1tPFPuppiHT_cfi import * +#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepFlavourSequencePFPuppiModEta2p4_cfi import * @@ -22,7 +22,7 @@ HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4 = cms.Path( HLTBeginSequence + - l1tPFPuppiHT + +# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py index cd1f393c6ee00..8cd4576ab20b0 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py @@ -2,7 +2,7 @@ from ..modules.hltPFPuppiHT_cfi import * from ..modules.hltPFPuppiHT1070_cfi import * -from ..modules.l1tPFPuppiHT_cfi import * +#from ..modules.l1tPFPuppiHT_cfi import * from ..modules.l1tPFPuppiHT450off_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * @@ -11,7 +11,7 @@ HLT_PFPuppiHT1070 = cms.Path( HLTBeginSequence + - l1tPFPuppiHT + +# l1tPFPuppiHT + l1tPFPuppiHT450off + HLTParticleFlowSequence + HLTAK4PFPuppiJetsReconstruction + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py index c35fc4ccb2205..934d59492ea05 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py @@ -5,13 +5,13 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -from ..modules.l1tPFPuppiHT_cfi import * +#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTEndSequence_cfi import * L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4 = cms.Path( HLTBeginSequence + - l1tPFPuppiHT + +# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py index 06d2dadc8ae8d..06d596d03fe94 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py @@ -1,13 +1,13 @@ import FWCore.ParameterSet.Config as cms -from ..modules.l1tPFPuppiHT_cfi import * +#from ..modules.l1tPFPuppiHT_cfi import * from ..modules.l1tPFPuppiHT450off_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTEndSequence_cfi import * L1T_PFPuppiHT450off = cms.Path( HLTBeginSequence + - l1tPFPuppiHT + +# l1tPFPuppiHT + l1tPFPuppiHT450off + HLTEndSequence ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py index 326d6f95aaabd..76cd1dc2f5171 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py @@ -4,7 +4,7 @@ from ..modules.l1EGammaEEProducer_cfi import * from ..modules.l1NNTauProducerPuppi_cfi import * #from ..modules.l1pfCandidates_cfi import * -from ..modules.l1PFMetPuppi_cfi import * +#from ..modules.l1PFMetPuppi_cfi import * #from ..modules.l1pfProducerBarrel_cfi import * #from ..modules.l1pfProducerHF_cfi import * #from ..modules.l1pfProducerHGCal_cfi import * @@ -46,7 +46,7 @@ #L1TkPrimaryVertex, l1EGammaEEProducer, l1NNTauProducerPuppi, - l1PFMetPuppi, + #l1PFMetPuppi, #l1pfCandidates, #l1pfProducerBarrel, #l1pfProducerHF, From 074cb8f101b6071bb159dc4021faf09d094ea343 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 20 Jun 2022 14:38:35 +0200 Subject: [PATCH 06/66] L1Trigger/Configuration/python/SimL1Emulator_cff.py --- .../python/L1Trigger_EventContent_cff.py | 40 +++++++------------ 1 file changed, 15 insertions(+), 25 deletions(-) diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 32419f6f71c19..faea19d14a457 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -176,51 +176,41 @@ def _appendPhase2Digis(obj): 'keep *_hgcalTowerMapProducer_*_*', 'keep *_hgcalTowerProducer_*_*', 'keep *_L1EGammaClusterEmuProducer_*_*', - 'keep *_l1EGammaEEProducer_*_*', + 'keep *_L1VertexFinder_*_*', + 'keep *_L1VertexFinderEmulator_*_*', 'keep *_L1TkPrimaryVertex_*_*', - 'keep *_L1TkElectronsCrystal_*_*', - 'keep *_L1TkElectronsLooseCrystal_*_*', - 'keep *_L1TkElectronsEllipticMatchCrystal_*_*', - 'keep *_L1TkIsoElectronsCrystal_*_*', - 'keep *_L1TkPhotonsCrystal_*_*', - 'keep *_L1TkElectronsHGC_*_*', - 'keep *_L1TkElectronsEllipticMatchHGC_*_*', - 'keep *_L1TkIsoElectronsHGC_*_*', - 'keep *_L1TkPhotonsHGC_*_*', - 'keep *_L1TkMuons_*_*', + 'keep *_L1TowerCalibration_*_*', + 'keep *_L1CaloJet_*_*', + 'keep *_L1CaloJetHTT_*_*', 'keep *_pfClustersFromL1EGClusters_*_*', 'keep *_pfClustersFromCombinedCaloHCal_*_*', 'keep *_pfClustersFromCombinedCaloHF_*_*', 'keep *_pfClustersFromHGC3DClusters_*_*', 'keep *_pfTracksFromL1TracksBarrel_*_*', - 'keep *_l1pfProducerBarrel_*_*', 'keep *_pfTracksFromL1TracksHGCal_*_*', - 'keep *_l1pfProducerHGCal_*_*', - 'keep *_l1pfProducerHGCalNoTK_*_*', - 'keep *_l1pfProducerHF_*_*', - 'keep *_l1pfCandidates_*_*', - 'keep *_ak4PFL1Calo_*_*', - 'keep *_ak4PFL1PF_*_*', - 'keep *_ak4PFL1Puppi_*_*', - 'keep *_ak4PFL1CaloCorrected_*_*', - 'keep *_ak4PFL1PFCorrected_*_*', - 'keep *_ak4PFL1PuppiCorrected_*_*', + 'keep *_scPFL1PF_*_*', + 'keep *_scPFL1Puppi_*_*', + 'keep *_scPFL1PuppiCorrectedEmulator_*_*', + 'keep *_scPFL1PuppiCorrectedEmulatorMHT_*_*', 'keep *_Phase1L1TJetProducer_*_*', 'keep *_Phase1L1TJetCalibrator_*_*', + 'keep *_Phase1L1TJetSumsProducer_*_*', 'keep *_l1ctLayer1Barrel_*_*', 'keep *_l1ctLayer1HGCal_*_*', 'keep *_l1ctLayer1HGCalNoTK_*_*', 'keep *_l1ctLayer1HF_*_*', 'keep *_l1ctLayer1_*_*', - 'keep *_l1PFMetCalo_*_*', - 'keep *_l1PFMetPF_*_*', - 'keep *_l1PFMetPuppi_*_*', + 'keep *_l1ctLayer1EG_*_*', + 'keep *_L1MetPfProducer_*_*', 'keep *_l1NNTauProducer_*_*', 'keep *_l1NNTauProducerPuppi_*_*', 'keep *_TTStubsFromPhase2TrackerDigis_*_*', 'keep *_TTClustersFromPhase2TrackerDigis_*_*', 'keep *_TTTracksFromExtendedTrackletEmulation_*_*', 'keep *_TTTracksFromTrackletEmulation_*_*', + 'keep *_L1TkStubsGmt_*_*', + 'keep *_L1TkMuonsGmt_*_*', + 'keep *_L1SAMuonsGmt_*_*', ] obj.outputCommands += l1Phase2Digis From 116e799ab154d06a4fb5c59c4dbb3f571d64fc82 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 20 Jun 2022 14:39:00 +0200 Subject: [PATCH 07/66] change event contnet --- .../Configuration/python/SimL1Emulator_cff.py | 135 +++++++++++++----- 1 file changed, 102 insertions(+), 33 deletions(-) diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index cb9198b37320e..b11653fde3701 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -71,6 +71,11 @@ # ######################################################################## # Phase-2 Trigger Primitives # ######################################################################## +from L1Trigger.DTTriggerPhase2.CalibratedDigis_cfi import * +CalibratedDigis.dtDigiTag = "simMuonDTDigis" +_phase2_siml1emulator.add(CalibratedDigis) +from L1Trigger.DTTriggerPhase2.dtTriggerPhase2PrimitiveDigis_cfi import * +_phase2_siml1emulator.add(dtTriggerPhase2PrimitiveDigis) # HGCAL TP # ######################################################################## @@ -87,68 +92,132 @@ from L1Trigger.L1CaloTrigger.L1EGammaCrystalsEmulatorProducer_cfi import * _phase2_siml1emulator.add(L1EGammaClusterEmuProducer) -from L1Trigger.L1CaloTrigger.l1EGammaEEProducer_cfi import * -_phase2_siml1emulator.add(l1EGammaEEProducer) +# Barrel and EndCap CaloJet/HT +# ######################################################################## +# ---- Produce the calibrated tower collection combining Barrel, HGCal, HF +from L1Trigger.L1CaloTrigger.L1TowerCalibrationProducer_cfi import * +L1TowerCalibration = L1TowerCalibrationProducer.clone( + L1HgcalTowersInputTag = ("hgcalTowerProducer","HGCalTowerProcessor",""), + l1CaloTowers = ("L1EGammaClusterEmuProducer","L1CaloTowerCollection","") +) +# ---- Produce the L1CaloJets +from L1Trigger.L1CaloTrigger.L1CaloJetProducer_cfi import * +L1CaloJet = L1CaloJetProducer.clone ( + l1CaloTowers = ("L1TowerCalibration","L1CaloTowerCalibratedCollection",""), + L1CrystalClustersInputTag = ("L1EGammaClusterEmuProducer", "","") +) +# ---- Produce the CaloJet HTT Sums +from L1Trigger.L1CaloTrigger.L1CaloJetHTTProducer_cfi import * +L1CaloJetHTT = L1CaloJetHTTProducer.clone( + BXVCaloJetsInputTag = ("L1CaloJet", "CaloJets") +) + + +_phase2_siml1emulator.add(L1TowerCalibration) +_phase2_siml1emulator.add(L1CaloJet) +_phase2_siml1emulator.add(L1CaloJetHTT) # ######################################################################## # Phase-2 L1T - TrackTrigger dependent modules # ######################################################################## +from L1Trigger.L1TTrackMatch.L1GTTInputProducer_cfi import * +from L1Trigger.VertexFinder.VertexProducer_cff import * +L1VertexFinder = VertexProducer.clone() +L1VertexFinderEmulator = VertexProducer.clone() +L1VertexFinderEmulator.VertexReconstruction.Algorithm = "fastHistoEmulation" +L1VertexFinderEmulator.l1TracksInputTag = ("L1GTTInputProducer","Level1TTTracksConverted") +_phase2_siml1emulator.add(L1VertexFinder) +_phase2_siml1emulator.add(L1GTTInputProducer) +_phase2_siml1emulator.add(L1GTTInputProducerExtended) +_phase2_siml1emulator.add(L1VertexFinderEmulator) # Tk + StandaloneObj, including L1TkPrimaryVertex # ######################################################################## from L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi import L1TkPrimaryVertex -from L1Trigger.L1TTrackMatch.L1TkElectronTrackProducer_cfi import L1TkElectronsCrystal, L1TkElectronsLooseCrystal, L1TkElectronsEllipticMatchCrystal, L1TkIsoElectronsCrystal, L1TkElectronsHGC, L1TkElectronsEllipticMatchHGC, L1TkIsoElectronsHGC -from L1Trigger.L1TTrackMatch.L1TkEmParticleProducer_cfi import L1TkPhotonsCrystal, L1TkPhotonsHGC -from L1Trigger.L1TTrackMatch.L1TkMuonProducer_cfi import L1TkMuons - _phase2_siml1emulator.add(L1TkPrimaryVertex) -_phase2_siml1emulator.add(L1TkElectronsCrystal) -_phase2_siml1emulator.add(L1TkElectronsLooseCrystal) -_phase2_siml1emulator.add(L1TkElectronsEllipticMatchCrystal) -_phase2_siml1emulator.add(L1TkIsoElectronsCrystal) -_phase2_siml1emulator.add(L1TkPhotonsCrystal) - -_phase2_siml1emulator.add(L1TkElectronsHGC) -_phase2_siml1emulator.add(L1TkElectronsEllipticMatchHGC) -_phase2_siml1emulator.add(L1TkIsoElectronsHGC) -_phase2_siml1emulator.add(L1TkPhotonsHGC) - -_phase2_siml1emulator.add( L1TkMuons ) +# Emulated GMT Muons (Tk + Stub, Tk + MuonTFT, StandaloneMuon) +# ######################################################################## +from L1Trigger.Phase2L1GMT.gmt_cfi import * +L1TkStubsGmt = gmtStubs.clone() +L1TkMuonsGmt = gmtMuons.clone( + srcStubs = 'L1TkStubsGmt' +) +L1SAMuonsGmt = standaloneMuons.clone() +_phase2_siml1emulator.add( L1TkStubsGmt ) +_phase2_siml1emulator.add( L1TkMuonsGmt ) +_phase2_siml1emulator.add( L1SAMuonsGmt ) + +# Tracker Objects +# ######################################################################## +from L1Trigger.L1TTrackMatch.L1TrackJetProducer_cfi import * +from L1Trigger.L1TTrackMatch.L1TrackFastJetProducer_cfi import * +from L1Trigger.L1TTrackMatch.L1TrackerEtMissProducer_cfi import * +from L1Trigger.L1TTrackMatch.L1TkHTMissProducer_cfi import * +# make the input tags consistent with the choice L1VertexFinder above +L1TrackJets.L1PVertexCollection = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) +L1TrackJetsExtended.L1PVertexCollection = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) +L1TrackerEtMiss.L1VertexInputTag = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) +L1TrackerEtMissExtended.L1VertexInputTag = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) +_phase2_siml1emulator.add(L1TrackJets) +_phase2_siml1emulator.add(L1TrackJetsExtended) +_phase2_siml1emulator.add(L1TrackFastJets) + +_phase2_siml1emulator.add(L1TrackerEtMiss) +_phase2_siml1emulator.add(L1TrackerHTMiss) + +#Emulated tracker objects +from L1Trigger.L1TTrackMatch.L1TrackJetEmulationProducer_cfi import * +_phase2_siml1emulator.add(L1TrackJetsEmulation) +_phase2_siml1emulator.add(L1TrackJetsExtendedEmulation) + +from L1Trigger.L1TTrackMatch.L1TrackerEtMissEmulatorProducer_cfi import * +L1TrackerEmuEtMiss.L1VertexInputTag = ("L1VertexFinderEmulator","l1verticesEmulation") +_phase2_siml1emulator.add(L1TrackerEmuEtMiss) + +from L1Trigger.L1TTrackMatch.L1TkHTMissEmulatorProducer_cfi import * +_phase2_siml1emulator.add(L1TrackerEmuHTMiss) +_phase2_siml1emulator.add(L1TrackerEmuHTMissExtended) # PF Candidates # ######################################################################## -from L1Trigger.Phase2L1ParticleFlow.l1ParticleFlow_cff import * -_phase2_siml1emulator.add(l1ParticleFlowTask) +from L1Trigger.Phase2L1ParticleFlow.l1ctLayer1_cff import * +from L1Trigger.Phase2L1ParticleFlow.l1ctLayer2EG_cff import * +_phase2_siml1emulator.add(l1ctLayer1TaskInputsTask, l1ctLayer1Task, l1ctLayer2EGTask) # PF Jet # ######################################################################## from L1Trigger.L1CaloTrigger.Phase1L1TJets_cff import * # Describe here l1PFJets_a_la_Phase1 Task # ############################### -l1PFJetsPhase1Task = cms.Task(Phase1L1TJetProducer , Phase1L1TJetCalibrator) +l1PFJetsPhase1Task = cms.Task(Phase1L1TJetProducer , Phase1L1TJetCalibrator, Phase1L1TJetSumsProducer) _phase2_siml1emulator.add(l1PFJetsPhase1Task) +from L1Trigger.Phase2L1Taus.HPSPFTauProducerPF_cfi import * +_phase2_siml1emulator.add(HPSPFTauProducerPF) + +from L1Trigger.Phase2L1Taus.HPSPFTauProducerPuppi_cfi import * +_phase2_siml1emulator.add(HPSPFTauProducerPuppi) + +from L1Trigger.L1CaloTrigger.Phase1L1TJets_9x9_cff import * +l1PFJetsPhase1Task_9x9 = cms.Task( Phase1L1TJetProducer9x9, Phase1L1TJetCalibrator9x9, Phase1L1TJetSumsProducer9x9) +_phase2_siml1emulator.add(l1PFJetsPhase1Task_9x9) + + # PF MET # ######################################################################## from L1Trigger.Phase2L1ParticleFlow.l1pfJetMet_cff import * -# Describe here l1PFMets Task -# ############################### -l1PFMetsTask = cms.Task(l1PFMetCalo , l1PFMetPF , l1PFMetPuppi) -_phase2_siml1emulator.add(l1PFMetsTask) +_phase2_siml1emulator.add(l1PFJetsTask) + +from L1Trigger.Phase2L1ParticleFlow.L1MetPfProducer_cfi import * +_phase2_siml1emulator.add(L1MetPfProducer) + # NNTaus # ######################################################################## from L1Trigger.Phase2L1ParticleFlow.L1NNTauProducer_cff import * -l1NNTauProducer = L1NNTauProducer.clone( - L1PFObjects = cms.InputTag("l1pfCandidates","PF") -) -l1NNTauProducerPuppi = L1NNTauProducerPuppi.clone( - L1PFObjects = cms.InputTag("l1pfCandidates","Puppi") -) -_phase2_siml1emulator.add(l1NNTauProducer) -_phase2_siml1emulator.add(l1NNTauProducerPuppi) +_phase2_siml1emulator.add(L1NNTauProducerPuppi) # --> add modules from Configuration.Eras.Modifier_phase2_trigger_cff import phase2_trigger From b3ffbca308c88748ab7d065b22b803a5f3cf4409 Mon Sep 17 00:00:00 2001 From: Santiago Date: Tue, 5 Apr 2022 09:48:12 +0200 Subject: [PATCH 08/66] first commit of the Phase-2 L1T Muon DQM validation (cherry picked from commit b89211d080e85d5b03b8bc5e808e366f23ea17b7) --- .../interface/L1TPhase2MuonOffline.h | 200 ++++++++ .../python/L1TPhase2MuonOffline_cfi.py | 62 +++ .../L1Trigger/python/L1TPhase2Offline_cfi.py | 6 +- .../L1Trigger/src/L1TPhase2MuonOffline.cc | 481 ++++++++++++++++++ 4 files changed, 747 insertions(+), 2 deletions(-) create mode 100644 DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h create mode 100644 DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py create mode 100644 DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h new file mode 100644 index 0000000000000..fff161030756b --- /dev/null +++ b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h @@ -0,0 +1,200 @@ +#ifndef DQMOFFLINE_L1TRIGGER_L1TPHASE2MUONOFFLINE_H +#define DQMOFFLINE_L1TRIGGER_L1TPHASE2MUONOFFLINE_H + +/** + * \file L1TPhase2MuonOffline.h + * + * \author S. Folgueras +* + */ + +// DataFormats +#include "DataFormats/L1Trigger/interface/Muon.h" +#include "DataFormats/L1TMuonPhase2/interface/SAMuon.h" +#include "DataFormats/L1TMuonPhase2/interface/MuonStub.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" +#include "DataFormats/Candidate/interface/Candidate.h" +#include "DataFormats/HepMCCandidate/interface/GenParticle.h" +#include "DataFormats/L1Trigger/interface/L1MuonParticleFwd.h" +#include "DataFormats/L1Trigger/interface/L1MuonParticle.h" +#include "DataFormats/Math/interface/deltaR.h" +#include "DataFormats/Math/interface/deltaPhi.h" + +// FWCore +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include "FWCore/Framework/interface/ESHandle.h" +#include "FWCore/Framework/interface/Event.h" +#include "FWCore/Framework/interface/LuminosityBlock.h" +#include "FWCore/Framework/interface/MakerMacros.h" +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Framework/interface/EDAnalyzer.h" +#include "FWCore/ServiceRegistry/interface/Service.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +// DQMServices +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/DQMEDAnalyzer.h" + +// HLTrigger +#include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" + +// Common tools +#include "MuonAnalysis/MuonAssociators/interface/PropagateToMuon.h" +#include "TrackingTools/TransientTrack/interface/TransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TrackTransientTrack.h" +#include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" +#include "TrackingTools/PatternTools/interface/Trajectory.h" +#include "TrackingTools/Records/interface/TransientTrackRecord.h" +#include "TrackingTools/TrajectoryState/interface/TrajectoryStateOnSurface.h" +#include "TrackingTools/TrajectoryState/interface/TrajectoryStateTransform.h" +#include "TrackingTools/Records/interface/TrackingComponentsRecord.h" +#include "TrackingTools/TrajectoryState/interface/FreeTrajectoryState.h" + +#include +#include "TRegexp.h" +#include "TString.h" +#include +#include + +class GenMuonGMTPair; + +// +// DQM class declaration +// + +class L1TPhase2MuonOffline : public DQMEDAnalyzer { + public: + L1TPhase2MuonOffline(const edm::ParameterSet& ps); + ~L1TPhase2MuonOffline() override; + + enum MuType { kSAMuon, kTkMuon, kNMuTypes }; + enum VarType { kPt, kEta, kPhi, kIso, kQual, kZ0, kD0, kNVarTypes }; + enum EffType { kEffPt, kEffPhi, kEffEta, kEffTypes }; + enum ResType { kResPt, kRes1OverPt, kResQOverPt, kResPhi, kResEta, kResCh, kNResTypes }; + enum EtaRegion { kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf, kEtaRegionOut, kNEtaRegions }; + enum QualLevel { kQualAll, kQualOpen, kQualDouble, kQualSingle, kNQualLevels }; + + protected: + void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override; + virtual void bookControlHistos(DQMStore::IBooker&, MuType type); + virtual void bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType type) {}; + virtual void bookResolutionHistos(DQMStore::IBooker& ibooker, MuType type) {}; + void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override; + void analyze(const edm::Event& e, const edm::EventSetup& c) override; + + //Fill Histos + void fillControlHistos(); + +private: + // Cut and Matching + void getMuonGmtPairs(edm::Handle& gmtCands); + + + // Handles and Tokens + edm::EDGetTokenT gmtMuonToken_; + edm::EDGetTokenT gmtTkMuonToken_; + edm::EDGetTokenT> genParticleToken_; + + edm::Handle gmtSAMuon_; + edm::Handle gmtTkMuon_; + edm::Handle> genparticles_; + + PropagateToMuon muonpropagator_; + + // vectors of enum values to loop over (and store quantities) + const std::vector muonTypes_; + const std::vector effTypes_; + const std::vector resTypes_; + const std::vector varTypes_; + const std::vector etaRegions_; + const std::vector qualLevels_; + + // maps with histogram name bits + std::map effNames_; + std::map effLabels_; + std::map resNames_; + std::map resLabels_; + std::map etaNames_; + std::map qualNames_; + std::map muonNames_; + + // config params + std::string histFolder_; + //std::vector cutsVPSet_; + + std::vector effVsPtBins_; + std::vector effVsPhiBins_; + std::vector effVsEtaBins_; + + bool useAtVtxCoord_; + bool isParticleGun_; + float maxGmtMuonDR_; + + // Helper methods + void matchMuonsToGen(std::vector genmus); + std::vector getHistBinsEff(EffType eff); + std::tuple getHistBinsRes(ResType res); + + // Keys for histogram maps + typedef std::tuple histoKeyResType_; + typedef std::tuple histoKeyEffType_; + typedef std::tuple histoKeyVarType_; + + // Histograms and histogram containers + // std::map, MonitorElement*> efficiencyHistos_; + // std::map, MonitorElement*> resolutionHistos_; + MonitorElement* controlHistos_[kNMuTypes][kNVarTypes]; + + // helper variables + std::vector gmtSAMuonPairs_; + std::vector gmtTkMuonPairs_; + //std::vector> cuts_; + + float lsb_pt ; + float lsb_phi; + float lsb_eta; + float lsb_z0 ; + float lsb_d0 ; +}; + +// +// helper class to manage GMT-GenMuon pairing +// +class GenMuonGMTPair { +public: + GenMuonGMTPair(const reco::GenParticle* mu, const l1t::L1Candidate* gmtmu, const PropagateToMuon& propagator); + GenMuonGMTPair(const GenMuonGMTPair& muongmtPair); + ~GenMuonGMTPair(){}; + + float dR(); + float pt() const { return mu_->pt(); }; + float eta() const { return mu_->eta(); }; + float phi() const { return mu_->phi(); }; + int charge() const { return mu_->charge(); }; + + // Now properties of the L1 candidate: + float gmtPt() const { return gmtmu_ ? gmtmu_->pt() : -1.; }; + float gmtEta() const { return gmtmu_ ? gmtEta_ : -5.; }; + float gmtPhi() const { return gmtmu_ ? gmtPhi_ : -5.; }; + int gmtCharge() const { return gmtmu_ ? gmtmu_->charge() : -5; }; + int gmtQual() const { return gmtmu_ ? gmtmu_->hwQual() : -1; }; + + L1TPhase2MuonOffline::EtaRegion etaRegion() const; + double getDeltaVar(const L1TPhase2MuonOffline::ResType) const; + double getVar(const L1TPhase2MuonOffline::EffType) const; + +private: + const reco::GenParticle* mu_; + const l1t::L1Candidate* gmtmu_; + + // L1T muon eta and phi coordinates to be used + // Can be the coordinates from the 2nd muon station or from the vertex + float gmtEta_; + float gmtPhi_; + + float muEta_; + float muPhi_; +}; + + +#endif diff --git a/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py new file mode 100644 index 0000000000000..015e4bb5d7767 --- /dev/null +++ b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py @@ -0,0 +1,62 @@ +from builtins import range +import FWCore.ParameterSet.Config as cms + +# define binning for efficiency plots +# pt +import itertools +effVsPtBins=list(itertools.chain(range(0, 30, 1), range(30, 50, 2), + range(50, 70, 5), range(70, 100, 10), + range(100, 200, 25), range(200, 300, 50), + range(300, 500, 100), range(500, 700, 200), + range(700, 1000, 300))) +effVsPtBins.append(1000) + +# phi +nPhiBins = 34 +phiMin = -3.4 +phiMax = 3.4 +effVsPhiBins = [i*(phiMax-phiMin)/nPhiBins + phiMin for i in range(nPhiBins+1)] + +# eta +nEtaBins = 50 +etaMin = -2.5 +etaMax = 2.5 +effVsEtaBins = [i*(etaMax-etaMin)/nEtaBins + etaMin for i in range(nEtaBins+1)] + +# vtx +effVsVtxBins = range(0, 101) + +# A list of pt cut + quality cut pairs for which efficiency plots should be made +ptQualCuts = [[22, 12], [15, 8], [7, 8], [3, 4]] +cutsPSets = [] +for ptQualCut in ptQualCuts: + cutsPSets.append(cms.untracked.PSet(ptCut = cms.untracked.int32(ptQualCut[0]), + qualCut = cms.untracked.int32(ptQualCut[1]))) + +from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer +l1tPhase2MuonOffline = DQMEDAnalyzer('L1TPhase2MuonOffline', + histFolder = cms.untracked.string('L1T/L1TObjects/L1TMuonPhase2/'), + cuts = cms.untracked.VPSet(cutsPSets), + useL1AtVtxCoord = cms.untracked.bool(False), + + genParticles = cms.untracked.InputTag("genParticles"), + gmtMuonToken = cms.untracked.InputTag("L1SAMuonsGmt", "promptSAMuons"), + gmtTkMuonToken = cms.untracked.InputTag("L1TkMuonsGmt",""), + + efficiencyVsPtBins = cms.untracked.vdouble(effVsPtBins), + efficiencyVsPhiBins = cms.untracked.vdouble(effVsPhiBins), + efficiencyVsEtaBins = cms.untracked.vdouble(effVsEtaBins), + efficiencyVsVtxBins = cms.untracked.vdouble(effVsVtxBins), + + # muon track extrapolation to 2nd station + muProp = cms.PSet( + useTrack = cms.string("tracker"), # 'none' to use Candidate P4; or 'tracker', 'muon', 'global' + useState = cms.string("atVertex"), # 'innermost' and 'outermost' require the TrackExtra + useSimpleGeometry = cms.bool(True), + useStation2 = cms.bool(True), + fallbackToME1 = cms.bool(False), + ), + +) + + diff --git a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py index ea17998d17ee3..8a406c3355ab5 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py @@ -131,10 +131,12 @@ xmax=cms.untracked.double(5.), ), ), - ) +from DQMOffline.L1Trigger.L1TPhase2Offline_cfi import * + l1tPhase2OfflineDQM = cms.Sequence( l1tPhase2CorrelatorOfflineDQM + - OuterTrackerTkMET + OuterTrackerTkMET + + l1tPhase2MuonOffline ) diff --git a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc new file mode 100644 index 0000000000000..85b1b191c8518 --- /dev/null +++ b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc @@ -0,0 +1,481 @@ +/** + * \file L1TPhase2MuonOffline.cc + * + * \author S. Folgueras + * + */ + +#include "DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h" + +// To convert from HW to Physical coordinates +#include "L1Trigger/Phase2L1GMT/interface/Constants.h" + +using namespace reco; +using namespace trigger; +using namespace edm; +using namespace std; +using namespace l1t; + +//__________RECO-GMT Muon Pair Helper Class____________________________ +GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candidate* gmtmu, + const PropagateToMuon& propagator) + : mu_(muon), gmtmu_(gmtmu) { + + if (gmtmu) { + gmtEta_ = gmtmu_->eta(); + gmtPhi_ = gmtmu_->phi(); + } else { + gmtEta_ = -5.; + gmtPhi_ = -5.; + } + if (mu_) { + TrajectoryStateOnSurface trajectory = propagator.extrapolate(*mu_); + if (trajectory.isValid()) { + muEta_ = trajectory.globalPosition().eta(); + muPhi_ = trajectory.globalPosition().phi(); + } else { + muEta_ = 999.; + muPhi_ = 999.; + } + } else { + muEta_ = 999.; + muPhi_ = 999.; + } +}; + +GenMuonGMTPair::GenMuonGMTPair(const GenMuonGMTPair& muonGmtPair) { + mu_ = muonGmtPair.mu_; + gmtmu_ = muonGmtPair.gmtmu_; + + gmtEta_ = muonGmtPair.gmtEta_; + gmtPhi_ = muonGmtPair.gmtPhi_; + + muEta_ = muonGmtPair.muEta_; + muPhi_ = muonGmtPair.muPhi_; +} + +float GenMuonGMTPair::dR() { + float dEta = gmtmu_ ? (gmtEta_ - muEta_) : 999.; + float dPhi = gmtmu_ ? reco::deltaPhi(gmtPhi_, muPhi_) : 999.; + return sqrt(dEta * dEta + dPhi * dPhi); +} + +L1TPhase2MuonOffline::EtaRegion GenMuonGMTPair::etaRegion() const { + if (std::abs(muEta_) < 0.83) + return L1TPhase2MuonOffline::kEtaRegionBmtf; + if (std::abs(muEta_) < 1.24) + return L1TPhase2MuonOffline::kEtaRegionOmtf; + if (std::abs(muEta_) < 2.4) + return L1TPhase2MuonOffline::kEtaRegionEmtf; + return L1TPhase2MuonOffline::kEtaRegionOut; +} + +double GenMuonGMTPair::getDeltaVar(const L1TPhase2MuonOffline::ResType type) const { + if (type == L1TPhase2MuonOffline::kResPt) + return (gmtPt() - pt()) / pt(); + if (type == L1TPhase2MuonOffline::kRes1OverPt) + return (pt() - gmtPt()) / gmtPt(); // (1/gmtPt - 1/pt) / (1/pt) + if (type == L1TPhase2MuonOffline::kResQOverPt) + return (gmtCharge() * charge() * pt() - gmtPt()) / + gmtPt(); // (gmtCharge/gmtPt - charge/pt) / (charge/pt) with gmtCharge/charge = gmtCharge*charge + if (type == L1TPhase2MuonOffline::kResPhi) + return reco::deltaPhi(gmtPhi(), muPhi_); + if (type == L1TPhase2MuonOffline::kResEta) + return gmtEta() - muEta_; + if (type == L1TPhase2MuonOffline::kResCh) + return gmtCharge() - charge(); + return -999.; +} + +double GenMuonGMTPair::getVar(const L1TPhase2MuonOffline::EffType type) const { + if (type == L1TPhase2MuonOffline::kEffPt) + return pt(); + if (type == L1TPhase2MuonOffline::kEffPhi) + return muPhi_; + if (type == L1TPhase2MuonOffline::kEffEta) + return muEta_; + return -999.; +} + +//__________DQM_base_class_______________________________________________ +L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : + gmtMuonToken_(consumes(ps.getParameter("gmtMuonToken"))), + gmtTkMuonToken_(consumes(ps.getParameter("gmtTkMuonToken"))), + genParticleToken_(consumes>(ps.getUntrackedParameter("genParticlesInputTag"))), + muonpropagator_(ps.getParameter("muProp"), consumesCollector()), + muonTypes_({kSAMuon, kTkMuon}), + effTypes_({kEffPt, kEffPhi, kEffEta}), + resTypes_({kResPt, kResQOverPt, kResPhi, kResEta}), + etaRegions_({kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf}), + resNames_({{kResPt, "pt"}, + {kRes1OverPt, "1overpt"}, + {kResQOverPt, "qoverpt"}, + {kResPhi, "phi"}, + {kResEta, "eta"}, + {kResCh, "charge"}}), + resLabels_({{kResPt, "(p_{T}^{L1} - p_{T}^{reco})/p_{T}^{reco}"}, + {kRes1OverPt, "(p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"}, + {kResQOverPt, "(q^{L1}*q^{reco}*p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"}, + {kResPhi, "#phi_{L1} - #phi_{reco}"}, + {kResEta, "#eta_{L1} - #eta_{reco}"}, + {kResCh, "charge^{L1} - charge^{reco}"}}), + etaNames_({{kEtaRegionAll, "etaMin0_etaMax2p4"}, + {kEtaRegionBmtf, "etaMin0_etaMax0p83"}, + {kEtaRegionOmtf, "etaMin0p83_etaMax1p24"}, + {kEtaRegionEmtf, "etaMin1p24_etaMax2p4"}}), + qualNames_({{kQualAll, "qualAll"}, + {kQualOpen, "qualOpen"}, + {kQualDouble, "qualDouble"}, + {kQualSingle, "qualSingle"}}), + muonNames_({{kSAMuon, "SAMuon"}, {kTkMuon, "TkMuon"}}), + histFolder_(ps.getUntrackedParameter("histFolder")), +// cutsVPSet_(ps.getUntrackedParameter>("cuts")), + effVsPtBins_(ps.getUntrackedParameter>("efficiencyVsPtBins")), + effVsPhiBins_(ps.getUntrackedParameter>("efficiencyVsPhiBins")), + effVsEtaBins_(ps.getUntrackedParameter>("efficiencyVsEtaBins")), + maxGmtMuonDR_(0.3){ + + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::L1TPhase2MuonOffline()" << endl; + + /* for (const auto& cutsPSet : cutsVPSet_) { + const auto qCut = cutsPSet.getUntrackedParameter("qualCut"); + QualLevel qLevel = kQualAll; + if (qCut > 11) { + qLevel = kQualSingle; + } else if (qCut > 7) { + qLevel = kQualDouble; + } else if (qCut > 3) { + qLevel = kQualOpen; + } + cuts_.emplace_back(std::make_pair(cutsPSet.getUntrackedParameter("ptCut"), qLevel)); + } + */ + // Get Muon constants + lsb_pt = Phase2L1GMT::LSBpt; + lsb_phi = Phase2L1GMT::LSBphi; + lsb_eta = Phase2L1GMT::LSBeta; + lsb_z0 = Phase2L1GMT::LSBSAz0; + lsb_d0 = Phase2L1GMT::LSBSAd0; +} + +//_____________________________________________________________________ +L1TPhase2MuonOffline::~L1TPhase2MuonOffline() {} +//---------------------------------------------------------------------- +void L1TPhase2MuonOffline::dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) { + edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::dqmBeginRun" << endl; +} + +//_____________________________________________________________________ +void L1TPhase2MuonOffline::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) { + edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::bookHistograms" << endl; + + //book histos + for (const auto mutype : muonTypes_) { + bookControlHistos(ibooker, mutype); + // bookEfficiencyHistos(ibooker, mutype); + // bookResolutionHistos(ibooker, mutype); + } +} + +//_____________________________________________________________________ +void L1TPhase2MuonOffline::analyze(const Event& iEvent, const EventSetup& eventSetup) { + // Initialise propagator (do we need this?) + muonpropagator_.init(eventSetup); + + // COLLECT GEN MUONS + iEvent.getByToken(genParticleToken_, genparticles_); + + std::vector genmus; + for (const reco::GenParticle& gen : *genparticles_) { + if (std::abs(gen.pdgId()) != 13) continue; + genmus.push_back(&gen); + } + + // Collect both muon collection: + iEvent.getByToken(gmtMuonToken_, gmtSAMuon_); + iEvent.getByToken(gmtTkMuonToken_, gmtTkMuon_); + + // Match each muon to a gen muon, if possible. + matchMuonsToGen(genmus); + + // Fill Control histograms + edm::LogInfo("L1TPhase2MuonOffline") << "Fill Control histograms for GMT Muons" << endl; + fillControlHistos(); + + + /* + + vector::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin(); + vector::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end(); + + // To fill once for global eta and once for TF eta region of the L1T muon. + // The second entry is a placeholder and will be replaced by the TF eta region of the L1T muon. + std::array regsToFill{{kEtaRegionAll, kEtaRegionAll}}; + + for (; muonGmtPairsIt != muonGmtPairsEnd; ++muonGmtPairsIt) { + // Fill the resolution histograms + if ((muonGmtPairsIt->etaRegion() != kEtaRegionOut) && (muonGmtPairsIt->gmtPt() > 0)) { + regsToFill[1] = muonGmtPairsIt->etaRegion(); + m_histoKeyResType histoKeyRes = {kResPt, kEtaRegionAll, kQualAll}; + for (const auto var : m_resTypes) { + const auto varToFill = muonGmtPairsIt->getDeltaVar(var); + std::get<0>(histoKeyRes) = var; + // Fill for the global eta and for TF eta region that the probe muon is in + for (const auto regToFill : regsToFill) { + std::get<1>(histoKeyRes) = regToFill; + for (const auto qualLevel : m_qualLevelsRes) { + // This assumes that the qualLevel enum has increasing qualities + // HW quality levels can be 0, 4, 8, or 12 + int qualCut = qualLevel * 4; + if (muonGmtPairsIt->gmtQual() >= qualCut) { + std::get<2>(histoKeyRes) = qualLevel; + m_ResolutionHistos[histoKeyRes]->Fill(varToFill); + } + } + } + } + } + + // Fill the efficiency numerator and denominator histograms + if (muonGmtPairsIt->etaRegion() != kEtaRegionOut) { + unsigned int cutsCounter = 0; + for (const auto& cut : m_cuts) { + const auto gmtPtCut = cut.first; + const auto qualLevel = cut.second; + const bool gmtAboveCut = (muonGmtPairsIt->gmtPt() > gmtPtCut); + + // default keys + m_histoKeyEffDenVarType histoKeyEffDenVar = {kEffPt, gmtPtCut, kEtaRegionAll}; + m_histoKeyEffNumVarType histoKeyEffNumVar = {kEffPt, gmtPtCut, kEtaRegionAll, qualLevel}; + + regsToFill[1] = muonGmtPairsIt->etaRegion(); + for (const auto var : m_effTypes) { + if (var != kEffPt) { + if (muonGmtPairsIt->pt() < m_recoToL1PtCutFactor * gmtPtCut) + break; // efficiency at plateau + } + double varToFill; + if (var == kEffVtx) { + varToFill = static_cast(nVtx); + } else { + varToFill = muonGmtPairsIt->getVar(var); + } + // Fill denominators + if (var == kEffEta) { + m_EfficiencyDenEtaHistos[gmtPtCut]->Fill(varToFill); + } else { + std::get<0>(histoKeyEffDenVar) = var; + // Fill for the global eta and for TF eta region that the probe muon is in + for (const auto regToFill : regsToFill) { + if (var == kEffPt) { + if (cutsCounter == 0) { + m_EfficiencyDenPtHistos[regToFill]->Fill(varToFill); + } + } else { + std::get<2>(histoKeyEffDenVar) = regToFill; + m_EfficiencyDenVarHistos[histoKeyEffDenVar]->Fill(varToFill); + } + } + } + // Fill numerators + std::get<0>(histoKeyEffNumVar) = var; + // This assumes that the qualLevel enum has increasing qualities + if (gmtAboveCut && muonGmtPairsIt->gmtQual() >= qualLevel * 4) { + if (var == kEffEta) { + m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel}; + m_EfficiencyNumEtaHistos[histoKeyEffNumEta]->Fill(varToFill); + } else { + std::get<3>(histoKeyEffNumVar) = qualLevel; + // Fill for the global eta and for TF eta region that the probe muon is in + for (const auto regToFill : regsToFill) { + std::get<2>(histoKeyEffNumVar) = regToFill; + m_EfficiencyNumVarHistos[histoKeyEffNumVar]->Fill(varToFill); + } + } + } + } + ++cutsCounter; + } + } + } + */ + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() Computation finished" << endl; +} + +//_____________________________________________________________________ +void L1TPhase2MuonOffline::bookControlHistos(DQMStore::IBooker& ibooker, MuType mutype) { + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookControlHistos()" << endl; + + ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/control_variables"); + + controlHistos_[mutype][kPt] = ibooker.book1D(muonNames_[mutype]+"Pt" , "MuonPt; p_{T}" , 50, 0., 100.); + controlHistos_[mutype][kPhi] = ibooker.book1D(muonNames_[mutype]+"Phi" , "MuonPhi; #phi" , 66, -3.3, 3.3); + controlHistos_[mutype][kEta] = ibooker.book1D(muonNames_[mutype]+"Eta" , "MuonEta; #eta" , 50, -2.5, 2.5); + controlHistos_[mutype][kIso] = ibooker.book1D(muonNames_[mutype]+"Iso" , "MuonIso; RelIso" , 50, 0, 1.0); + controlHistos_[mutype][kQual] = ibooker.book1D(muonNames_[mutype]+"Qual", "MuonQual; Quality", 15, 0.5, 15.5); + controlHistos_[mutype][kZ0] = ibooker.book1D(muonNames_[mutype]+"Z0" , "MuonZ0; Z_{0}" , 50, 0, 50.0); + controlHistos_[mutype][kD0] = ibooker.book1D(muonNames_[mutype]+"D0" , "MuonD0; D_{0}" , 50, 0, 200.); +} +/* +void L1TPhase2MuonOffline +//_____________________________________________________________________ +void L1TPhase2MuonOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType mutype) { + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl; + ibooker.setCurrentFolder(m_HistFolder + "/" + muonNames_[mutype] + "/efficiencies"); + + for (const auto var : effTypes_) { + auto histBins = getHistBinsEff(var); + + // histograms for eta variable get a special treatment + for (const auto& cut : m_cuts) { + const auto gmtPtCut = cut.first; + const auto qualLevel = cut.second; + + std::string name = "effDen_" + effNames_[var] + "_" + std::to_string(gmtPtCut); + + efficiencyHistos_[gmtPtCut] = + ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); + name = "effNum_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + m_qualStrings[qualLevel]; + m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel}; + m_EfficiencyNumEtaHistos[histoKeyEffNumEta] = + ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); + } + + else { + for (const auto etaReg : m_etaRegions) { + // denominator histograms for pt variable get a special treatment + if (var == kEffPt) { + std::string name = "effDen_" + m_effStrings[var] + "_" + m_etaStrings[etaReg]; + m_EfficiencyDenPtHistos[etaReg] = + ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); + } else { + for (const auto& cut : m_cuts) { + const int gmtPtCut = cut.first; + std::string name = + "effDen_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + m_etaStrings[etaReg]; + m_histoKeyEffDenVarType histoKeyEffDenVar = {var, gmtPtCut, etaReg}; + m_EfficiencyDenVarHistos[histoKeyEffDenVar] = + ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); + } + } + for (const auto& cut : m_cuts) { + const auto gmtPtCut = cut.first; + const auto qualLevel = cut.second; + std::string name = "effNum_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + + m_etaStrings[etaReg] + "_" + m_qualStrings[qualLevel]; + m_histoKeyEffNumVarType histoKeyEffNum = {var, gmtPtCut, etaReg, qualLevel}; + m_EfficiencyNumVarHistos[histoKeyEffNum] = + ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); + } + } + } + } +} + +void L1TPhase2MuonOffline::bookResolutionHistos(DQMStore::IBooker& ibooker, MuType mutype) { + edmLogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookResolutionHistos()" << endl; + + ibooker.setCurrentFolder(m_HistFolder + "/" + muonNames_[mutype] + "/resolution"); + + for (const auto var : m_resTypes) { + auto nbins = std::get<0>(getHistBinsRes(var)); + auto xmin = std::get<1>(getHistBinsRes(var)); + auto xmax = std::get<2>(getHistBinsRes(var)); + for (const auto etaReg : m_etaRegions) { + for (const auto qualLevel : m_qualLevelsRes) { + m_histoKeyResType histoKeyRes = {var, etaReg, qualLevel}; + std::string name = "resolution_" + m_resStrings[var] + "_" + m_etaStrings[etaReg] + "_" + m_qualStrings[qualLevel]; + m_ResolutionHistos[histoKeyRes] = ibooker.book1D(name, name + ";" + m_resLabelStrings[var], nbins, xmin, xmax); + } + } + } +} +*/ +//____________________________________________________________________ +void L1TPhase2MuonOffline::fillControlHistos(){ + + for (auto& muIt : *gmtSAMuon_) { + controlHistos_[kSAMuon][kPt] ->Fill(lsb_pt * muIt.hwPt()); + controlHistos_[kSAMuon][kPhi] ->Fill(lsb_phi * muIt.hwPhi()); + controlHistos_[kSAMuon][kEta] ->Fill(lsb_eta * muIt.hwEta()); + controlHistos_[kSAMuon][kIso] ->Fill(muIt.hwIso()); + controlHistos_[kSAMuon][kQual]->Fill(muIt.hwQual()); + controlHistos_[kSAMuon][kZ0] ->Fill(lsb_z0 * muIt.hwZ0()); + controlHistos_[kSAMuon][kD0] ->Fill(lsb_d0 * muIt.hwD0()); + } + + for (auto& muIt : *gmtTkMuon_) { + controlHistos_[kTkMuon][kPt] ->Fill(lsb_pt * muIt.hwPt()); + controlHistos_[kTkMuon][kPhi] ->Fill(lsb_phi * muIt.hwPhi()); + controlHistos_[kTkMuon][kEta] ->Fill(lsb_eta * muIt.hwEta()); + controlHistos_[kTkMuon][kIso] ->Fill(muIt.hwIso()); + controlHistos_[kTkMuon][kQual]->Fill(muIt.hwQual()); + controlHistos_[kTkMuon][kZ0] ->Fill(lsb_z0 * muIt.hwZ0()); + controlHistos_[kTkMuon][kD0] ->Fill(lsb_d0 * muIt.hwD0()); + } + +} + +//_____________________________________________________________________ +void L1TPhase2MuonOffline::matchMuonsToGen(std::vector genmus) { + gmtSAMuonPairs_.clear(); + gmtTkMuonPairs_.clear(); + + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() " << endl; + + for (const auto& gen : genmus){ + GenMuonGMTPair pairBestCand(&(*gen), nullptr, muonpropagator_); + for (auto& muIt : *gmtSAMuon_) { + GenMuonGMTPair pairTmpCand(&(*gen), &(muIt), muonpropagator_); + if ((pairTmpCand.dR() < maxGmtMuonDR_) && (pairTmpCand.dR() < pairBestCand.dR())) { + pairBestCand = pairTmpCand; + } + } + gmtSAMuonPairs_.emplace_back(pairBestCand); + + GenMuonGMTPair pairBestCand2(&(*gen), nullptr, muonpropagator_); + for (auto& tkmuIt : *gmtTkMuon_) { + GenMuonGMTPair pairTmpCand(&(*gen), &(tkmuIt), muonpropagator_); + if ((pairTmpCand.dR() < maxGmtMuonDR_) && (pairTmpCand.dR() < pairBestCand2.dR())) { + pairBestCand2 = pairTmpCand; + } + } + gmtTkMuonPairs_.emplace_back(pairBestCand2); + } +} + + +std::vector L1TPhase2MuonOffline::getHistBinsEff(EffType eff) { + if (eff == kEffPt) { + std::vector effVsPtBins(effVsPtBins_.begin(), effVsPtBins_.end()); + return effVsPtBins; + } + if (eff == kEffPhi) { + std::vector effVsPhiBins(effVsPhiBins_.begin(), effVsPhiBins_.end()); + return effVsPhiBins; + } + if (eff == kEffEta) { + std::vector effVsEtaBins(effVsEtaBins_.begin(), effVsEtaBins_.end()); + return effVsEtaBins; + } + return {0., 1.}; +} + +std::tuple L1TPhase2MuonOffline::getHistBinsRes(ResType res) { + if (res == kResPt) + return {50, -2., 2.}; + if (res == kRes1OverPt) + return {50, -2., 2.}; + if (res == kResQOverPt) + return {50, -2., 2.}; + if (res == kResPhi) + return {96, -0.2, 0.2}; + if (res == kResEta) + return {100, -0.1, 0.1}; + if (res == kResCh) + return {5, -2, 3}; + return {1, 0, 1}; +} + +//define this as a plug-in +DEFINE_FWK_MODULE(L1TPhase2MuonOffline); From 32791daf983d240dfc4b267a811da9cde0cab1c1 Mon Sep 17 00:00:00 2001 From: Santiago Date: Tue, 5 Apr 2022 18:29:16 +0200 Subject: [PATCH 09/66] fix bug on GenParticle matching to L1T (cherry picked from commit f0f5d91a80cc6d169255fd7c419d1aa2f204eedb) --- .../interface/L1TPhase2MuonOffline.h | 4 +- .../python/L1TPhase2MuonOffline_cfi.py | 6 +-- .../L1Trigger/python/L1TPhase2Offline_cfi.py | 2 +- .../L1Trigger/src/L1TPhase2MuonOffline.cc | 50 +++++++++++++------ 4 files changed, 41 insertions(+), 21 deletions(-) diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h index fff161030756b..12151bb76e9f7 100644 --- a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h @@ -77,8 +77,8 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { protected: void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override; virtual void bookControlHistos(DQMStore::IBooker&, MuType type); - virtual void bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType type) {}; - virtual void bookResolutionHistos(DQMStore::IBooker& ibooker, MuType type) {}; + virtual void bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType type); + virtual void bookResolutionHistos(DQMStore::IBooker& ibooker, MuType type); void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; diff --git a/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py index 015e4bb5d7767..f88c30ad0b534 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py @@ -39,9 +39,9 @@ cuts = cms.untracked.VPSet(cutsPSets), useL1AtVtxCoord = cms.untracked.bool(False), - genParticles = cms.untracked.InputTag("genParticles"), - gmtMuonToken = cms.untracked.InputTag("L1SAMuonsGmt", "promptSAMuons"), - gmtTkMuonToken = cms.untracked.InputTag("L1TkMuonsGmt",""), + genParticlesInputTag = cms.untracked.InputTag("genParticles"), + gmtMuonToken = cms.InputTag("L1SAMuonsGmt", "promptSAMuons"), + gmtTkMuonToken = cms.InputTag("L1TkMuonsGmt",""), efficiencyVsPtBins = cms.untracked.vdouble(effVsPtBins), efficiencyVsPhiBins = cms.untracked.vdouble(effVsPhiBins), diff --git a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py index 8a406c3355ab5..c4c4893d7b986 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py @@ -133,7 +133,7 @@ ), ) -from DQMOffline.L1Trigger.L1TPhase2Offline_cfi import * +from DQMOffline.L1Trigger.L1TPhase2MuonOffline_cfi import * l1tPhase2OfflineDQM = cms.Sequence( l1tPhase2CorrelatorOfflineDQM + diff --git a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc index 85b1b191c8518..993d33d8a1289 100644 --- a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc @@ -20,6 +20,12 @@ using namespace l1t; GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candidate* gmtmu, const PropagateToMuon& propagator) : mu_(muon), gmtmu_(gmtmu) { + + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair()" << endl; + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair() gmtmu " << + gmtmu << endl; + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair() gen " << + muon << endl; if (gmtmu) { gmtEta_ = gmtmu_->eta(); @@ -29,18 +35,13 @@ GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candi gmtPhi_ = -5.; } if (mu_) { - TrajectoryStateOnSurface trajectory = propagator.extrapolate(*mu_); - if (trajectory.isValid()) { - muEta_ = trajectory.globalPosition().eta(); - muPhi_ = trajectory.globalPosition().phi(); - } else { - muEta_ = 999.; - muPhi_ = 999.; - } + muEta_ = mu_->eta(); + muPhi_ = mu_->phi(); } else { muEta_ = 999.; muPhi_ = 999.; } + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair() END" << endl; }; GenMuonGMTPair::GenMuonGMTPair(const GenMuonGMTPair& muonGmtPair) { @@ -179,6 +180,7 @@ void L1TPhase2MuonOffline::bookHistograms(DQMStore::IBooker& ibooker, const edm: //_____________________________________________________________________ void L1TPhase2MuonOffline::analyze(const Event& iEvent, const EventSetup& eventSetup) { + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() " << endl; // Initialise propagator (do we need this?) muonpropagator_.init(eventSetup); @@ -190,18 +192,23 @@ void L1TPhase2MuonOffline::analyze(const Event& iEvent, const EventSetup& eventS if (std::abs(gen.pdgId()) != 13) continue; genmus.push_back(&gen); } - + edm::LogInfo("L1TPhase2MuonOffline") << + "L1TPhase2MuonOffline::analyze() N of genmus: "<< genmus.size() << endl; + // Collect both muon collection: iEvent.getByToken(gmtMuonToken_, gmtSAMuon_); iEvent.getByToken(gmtTkMuonToken_, gmtTkMuon_); - // Match each muon to a gen muon, if possible. - matchMuonsToGen(genmus); - + // Fill Control histograms edm::LogInfo("L1TPhase2MuonOffline") << "Fill Control histograms for GMT Muons" << endl; fillControlHistos(); + + // Match each muon to a gen muon, if possible. + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() calling matchMuonsToGen() "<< endl; + matchMuonsToGen(genmus); + /* @@ -316,11 +323,18 @@ void L1TPhase2MuonOffline::bookControlHistos(DQMStore::IBooker& ibooker, MuType controlHistos_[mutype][kZ0] = ibooker.book1D(muonNames_[mutype]+"Z0" , "MuonZ0; Z_{0}" , 50, 0, 50.0); controlHistos_[mutype][kD0] = ibooker.book1D(muonNames_[mutype]+"D0" , "MuonD0; D_{0}" , 50, 0, 200.); } +void L1TPhase2MuonOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType mutype) { + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl; +} +void L1TPhase2MuonOffline::bookResolutionHistos(DQMStore::IBooker& ibooker, MuType mutype) { + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookResolutionHistos()" << endl; +} + /* void L1TPhase2MuonOffline //_____________________________________________________________________ void L1TPhase2MuonOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType mutype) { - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl; + edm::LogInfo("L1tphase2muonoffline") << "L1tphase2muonoffline::bookEfficiencyHistos()" << endl; ibooker.setCurrentFolder(m_HistFolder + "/" + muonNames_[mutype] + "/efficiencies"); for (const auto var : effTypes_) { @@ -422,8 +436,10 @@ void L1TPhase2MuonOffline::matchMuonsToGen(std::vector gmtTkMuonPairs_.clear(); edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() " << endl; - - for (const auto& gen : genmus){ + + + for (const reco::GenParticle * gen : genmus){ + edm::LogInfo("L1TPhase2MuonOffline") << "Looping on genmus: "<< gen << endl; GenMuonGMTPair pairBestCand(&(*gen), nullptr, muonpropagator_); for (auto& muIt : *gmtSAMuon_) { GenMuonGMTPair pairTmpCand(&(*gen), &(muIt), muonpropagator_); @@ -441,7 +457,11 @@ void L1TPhase2MuonOffline::matchMuonsToGen(std::vector } } gmtTkMuonPairs_.emplace_back(pairBestCand2); + } + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtSAMuons: " << gmtSAMuonPairs_.size()<< endl; + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtTkMuons: " << gmtTkMuonPairs_.size()<< endl; + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() END " << endl; } From 170349d8badc9f595ba3d4724991b79ac00bf1fc Mon Sep 17 00:00:00 2001 From: Santiago Date: Thu, 7 Apr 2022 17:48:24 +0200 Subject: [PATCH 10/66] final commit of this first version (cherry picked from commit 22c4b9f083b8a0d51085f9e585884d076f131609) --- .../interface/L1TPhase2MuonOffline.h | 36 ++- .../L1Trigger/src/L1TPhase2MuonOffline.cc | 305 ++++++------------ 2 files changed, 127 insertions(+), 214 deletions(-) diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h index 12151bb76e9f7..f73b60a684d2d 100644 --- a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h @@ -39,7 +39,7 @@ #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" // Common tools -#include "MuonAnalysis/MuonAssociators/interface/PropagateToMuon.h" +//#include "MuonAnalysis/MuonAssociators/interface/PropagateToMuon.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/TransientTrack/interface/TrackTransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" @@ -52,7 +52,6 @@ #include #include "TRegexp.h" -#include "TString.h" #include #include @@ -71,20 +70,25 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { enum VarType { kPt, kEta, kPhi, kIso, kQual, kZ0, kD0, kNVarTypes }; enum EffType { kEffPt, kEffPhi, kEffEta, kEffTypes }; enum ResType { kResPt, kRes1OverPt, kResQOverPt, kResPhi, kResEta, kResCh, kNResTypes }; - enum EtaRegion { kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf, kEtaRegionOut, kNEtaRegions }; + enum EtaRegion { kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf, kNEtaRegions }; enum QualLevel { kQualAll, kQualOpen, kQualDouble, kQualSingle, kNQualLevels }; protected: void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override; - virtual void bookControlHistos(DQMStore::IBooker&, MuType type); - virtual void bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType type); - virtual void bookResolutionHistos(DQMStore::IBooker& ibooker, MuType type); - void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; + + void bookControlHistos(DQMStore::IBooker&, MuType type); + void bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType type); + void bookResolutionHistos(DQMStore::IBooker& ibooker, MuType type); + void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override; + //Fill Histos void fillControlHistos(); + void fillEfficiencyHistos(); + void fillResolutionHistos(); + private: // Cut and Matching void getMuonGmtPairs(edm::Handle& gmtCands); @@ -99,7 +103,7 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { edm::Handle gmtTkMuon_; edm::Handle> genparticles_; - PropagateToMuon muonpropagator_; + // PropagateToMuon muonpropagator_; // vectors of enum values to loop over (and store quantities) const std::vector muonTypes_; @@ -136,13 +140,19 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { std::tuple getHistBinsRes(ResType res); // Keys for histogram maps - typedef std::tuple histoKeyResType_; - typedef std::tuple histoKeyEffType_; - typedef std::tuple histoKeyVarType_; - + /*typedef std::tuple histoKeyResType_; + typedef std::tuple histoKeyEffType_; + typedef std::tuple histoKeyVarType_; + */ // Histograms and histogram containers // std::map, MonitorElement*> efficiencyHistos_; // std::map, MonitorElement*> resolutionHistos_; + // TH1F* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + // TH1F* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + + MonitorElement* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + MonitorElement* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + MonitorElement* resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]; MonitorElement* controlHistos_[kNMuTypes][kNVarTypes]; // helper variables @@ -162,7 +172,7 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { // class GenMuonGMTPair { public: - GenMuonGMTPair(const reco::GenParticle* mu, const l1t::L1Candidate* gmtmu, const PropagateToMuon& propagator); + GenMuonGMTPair(const reco::GenParticle* mu, const l1t::L1Candidate* gmtmu); GenMuonGMTPair(const GenMuonGMTPair& muongmtPair); ~GenMuonGMTPair(){}; diff --git a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc index 993d33d8a1289..2ccc9defc1ef7 100644 --- a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc @@ -17,16 +17,10 @@ using namespace std; using namespace l1t; //__________RECO-GMT Muon Pair Helper Class____________________________ -GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candidate* gmtmu, - const PropagateToMuon& propagator) +GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candidate* gmtmu) : mu_(muon), gmtmu_(gmtmu) { - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair()" << endl; - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair() gmtmu " << - gmtmu << endl; - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair() gen " << - muon << endl; - + if (gmtmu) { gmtEta_ = gmtmu_->eta(); gmtPhi_ = gmtmu_->phi(); @@ -41,7 +35,7 @@ GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candi muEta_ = 999.; muPhi_ = 999.; } - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline GenMuonGMTPair::GenMuonGMTPair() END" << endl; + }; GenMuonGMTPair::GenMuonGMTPair(const GenMuonGMTPair& muonGmtPair) { @@ -68,7 +62,7 @@ L1TPhase2MuonOffline::EtaRegion GenMuonGMTPair::etaRegion() const { return L1TPhase2MuonOffline::kEtaRegionOmtf; if (std::abs(muEta_) < 2.4) return L1TPhase2MuonOffline::kEtaRegionEmtf; - return L1TPhase2MuonOffline::kEtaRegionOut; + return L1TPhase2MuonOffline::kEtaRegionAll; } double GenMuonGMTPair::getDeltaVar(const L1TPhase2MuonOffline::ResType type) const { @@ -103,11 +97,11 @@ L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : gmtMuonToken_(consumes(ps.getParameter("gmtMuonToken"))), gmtTkMuonToken_(consumes(ps.getParameter("gmtTkMuonToken"))), genParticleToken_(consumes>(ps.getUntrackedParameter("genParticlesInputTag"))), - muonpropagator_(ps.getParameter("muProp"), consumesCollector()), muonTypes_({kSAMuon, kTkMuon}), effTypes_({kEffPt, kEffPhi, kEffEta}), resTypes_({kResPt, kResQOverPt, kResPhi, kResEta}), etaRegions_({kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf}), + qualLevels_({kQualAll, kQualOpen, kQualDouble, kQualSingle}), resNames_({{kResPt, "pt"}, {kRes1OverPt, "1overpt"}, {kResQOverPt, "qoverpt"}, @@ -137,20 +131,7 @@ L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : maxGmtMuonDR_(0.3){ edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::L1TPhase2MuonOffline()" << endl; - - /* for (const auto& cutsPSet : cutsVPSet_) { - const auto qCut = cutsPSet.getUntrackedParameter("qualCut"); - QualLevel qLevel = kQualAll; - if (qCut > 11) { - qLevel = kQualSingle; - } else if (qCut > 7) { - qLevel = kQualDouble; - } else if (qCut > 3) { - qLevel = kQualOpen; - } - cuts_.emplace_back(std::make_pair(cutsPSet.getUntrackedParameter("ptCut"), qLevel)); - } - */ + // Get Muon constants lsb_pt = Phase2L1GMT::LSBpt; lsb_phi = Phase2L1GMT::LSBphi; @@ -166,6 +147,7 @@ void L1TPhase2MuonOffline::dqmBeginRun(const edm::Run& run, const edm::EventSetu edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::dqmBeginRun" << endl; } + //_____________________________________________________________________ void L1TPhase2MuonOffline::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) { edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::bookHistograms" << endl; @@ -173,16 +155,14 @@ void L1TPhase2MuonOffline::bookHistograms(DQMStore::IBooker& ibooker, const edm: //book histos for (const auto mutype : muonTypes_) { bookControlHistos(ibooker, mutype); - // bookEfficiencyHistos(ibooker, mutype); - // bookResolutionHistos(ibooker, mutype); + bookEfficiencyHistos(ibooker, mutype); + bookResolutionHistos(ibooker, mutype); } } //_____________________________________________________________________ void L1TPhase2MuonOffline::analyze(const Event& iEvent, const EventSetup& eventSetup) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() " << endl; - // Initialise propagator (do we need this?) - muonpropagator_.init(eventSetup); // COLLECT GEN MUONS iEvent.getByToken(genParticleToken_, genparticles_); @@ -210,102 +190,9 @@ void L1TPhase2MuonOffline::analyze(const Event& iEvent, const EventSetup& eventS matchMuonsToGen(genmus); - /* - - vector::const_iterator muonGmtPairsIt = m_MuonGmtPairs.begin(); - vector::const_iterator muonGmtPairsEnd = m_MuonGmtPairs.end(); - - // To fill once for global eta and once for TF eta region of the L1T muon. - // The second entry is a placeholder and will be replaced by the TF eta region of the L1T muon. - std::array regsToFill{{kEtaRegionAll, kEtaRegionAll}}; - - for (; muonGmtPairsIt != muonGmtPairsEnd; ++muonGmtPairsIt) { - // Fill the resolution histograms - if ((muonGmtPairsIt->etaRegion() != kEtaRegionOut) && (muonGmtPairsIt->gmtPt() > 0)) { - regsToFill[1] = muonGmtPairsIt->etaRegion(); - m_histoKeyResType histoKeyRes = {kResPt, kEtaRegionAll, kQualAll}; - for (const auto var : m_resTypes) { - const auto varToFill = muonGmtPairsIt->getDeltaVar(var); - std::get<0>(histoKeyRes) = var; - // Fill for the global eta and for TF eta region that the probe muon is in - for (const auto regToFill : regsToFill) { - std::get<1>(histoKeyRes) = regToFill; - for (const auto qualLevel : m_qualLevelsRes) { - // This assumes that the qualLevel enum has increasing qualities - // HW quality levels can be 0, 4, 8, or 12 - int qualCut = qualLevel * 4; - if (muonGmtPairsIt->gmtQual() >= qualCut) { - std::get<2>(histoKeyRes) = qualLevel; - m_ResolutionHistos[histoKeyRes]->Fill(varToFill); - } - } - } - } - } - - // Fill the efficiency numerator and denominator histograms - if (muonGmtPairsIt->etaRegion() != kEtaRegionOut) { - unsigned int cutsCounter = 0; - for (const auto& cut : m_cuts) { - const auto gmtPtCut = cut.first; - const auto qualLevel = cut.second; - const bool gmtAboveCut = (muonGmtPairsIt->gmtPt() > gmtPtCut); - - // default keys - m_histoKeyEffDenVarType histoKeyEffDenVar = {kEffPt, gmtPtCut, kEtaRegionAll}; - m_histoKeyEffNumVarType histoKeyEffNumVar = {kEffPt, gmtPtCut, kEtaRegionAll, qualLevel}; - - regsToFill[1] = muonGmtPairsIt->etaRegion(); - for (const auto var : m_effTypes) { - if (var != kEffPt) { - if (muonGmtPairsIt->pt() < m_recoToL1PtCutFactor * gmtPtCut) - break; // efficiency at plateau - } - double varToFill; - if (var == kEffVtx) { - varToFill = static_cast(nVtx); - } else { - varToFill = muonGmtPairsIt->getVar(var); - } - // Fill denominators - if (var == kEffEta) { - m_EfficiencyDenEtaHistos[gmtPtCut]->Fill(varToFill); - } else { - std::get<0>(histoKeyEffDenVar) = var; - // Fill for the global eta and for TF eta region that the probe muon is in - for (const auto regToFill : regsToFill) { - if (var == kEffPt) { - if (cutsCounter == 0) { - m_EfficiencyDenPtHistos[regToFill]->Fill(varToFill); - } - } else { - std::get<2>(histoKeyEffDenVar) = regToFill; - m_EfficiencyDenVarHistos[histoKeyEffDenVar]->Fill(varToFill); - } - } - } - // Fill numerators - std::get<0>(histoKeyEffNumVar) = var; - // This assumes that the qualLevel enum has increasing qualities - if (gmtAboveCut && muonGmtPairsIt->gmtQual() >= qualLevel * 4) { - if (var == kEffEta) { - m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel}; - m_EfficiencyNumEtaHistos[histoKeyEffNumEta]->Fill(varToFill); - } else { - std::get<3>(histoKeyEffNumVar) = qualLevel; - // Fill for the global eta and for TF eta region that the probe muon is in - for (const auto regToFill : regsToFill) { - std::get<2>(histoKeyEffNumVar) = regToFill; - m_EfficiencyNumVarHistos[histoKeyEffNumVar]->Fill(varToFill); - } - } - } - } - ++cutsCounter; - } - } - } - */ + // Fill efficiency and resolution once, matching has been done... + fillEfficiencyHistos(); + fillResolutionHistos(); edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() Computation finished" << endl; } @@ -325,86 +212,45 @@ void L1TPhase2MuonOffline::bookControlHistos(DQMStore::IBooker& ibooker, MuType } void L1TPhase2MuonOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType mutype) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl; + + ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/efficiencies"); + + std::string histoname = ""; + for (const auto eta : etaRegions_) { + for (const auto q : qualLevels_) { + histoname = muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q]; + auto histBins = getHistBinsEff(kEffPt); + efficiencyNum_[mutype][eta][q][kEffPt] = ibooker.book1D(histoname + "_Pt_Num", "MuonPt; p_{T} ;", histBins.size()-1, &histBins[0]); + efficiencyDen_[mutype][eta][q][kEffPt] = ibooker.book1D(histoname + "_Pt_Den", "MuonPt; p_{T} ;", histBins.size()-1, &histBins[0]); + + histBins = getHistBinsEff(kEffEta); + efficiencyNum_[mutype][eta][q][kEffEta] = ibooker.book1D(histoname + "_Eta_Num", "MuonEta; #eta ;", histBins.size()-1, &histBins[0]); + efficiencyDen_[mutype][eta][q][kEffEta] = ibooker.book1D(histoname + "_Eta_Den", "MuonEta; #eta ;", histBins.size()-1, &histBins[0]); + + histBins = getHistBinsEff(kEffPhi); + efficiencyNum_[mutype][eta][q][kEffPhi] = ibooker.book1D(histoname + "_Phi_Num", "MuonPhi; #phi ;", histBins.size()-1, &histBins[0]); + efficiencyDen_[mutype][eta][q][kEffPhi] = ibooker.book1D(histoname + "_Phi_Den", "MuonPhi; #phi ;", histBins.size()-1, &histBins[0]); + } + } } void L1TPhase2MuonOffline::bookResolutionHistos(DQMStore::IBooker& ibooker, MuType mutype) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookResolutionHistos()" << endl; -} -/* -void L1TPhase2MuonOffline -//_____________________________________________________________________ -void L1TPhase2MuonOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType mutype) { - edm::LogInfo("L1tphase2muonoffline") << "L1tphase2muonoffline::bookEfficiencyHistos()" << endl; - ibooker.setCurrentFolder(m_HistFolder + "/" + muonNames_[mutype] + "/efficiencies"); - - for (const auto var : effTypes_) { - auto histBins = getHistBinsEff(var); - - // histograms for eta variable get a special treatment - for (const auto& cut : m_cuts) { - const auto gmtPtCut = cut.first; - const auto qualLevel = cut.second; - - std::string name = "effDen_" + effNames_[var] + "_" + std::to_string(gmtPtCut); - - efficiencyHistos_[gmtPtCut] = - ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); - name = "effNum_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + m_qualStrings[qualLevel]; - m_histoKeyEffNumEtaType histoKeyEffNumEta = {gmtPtCut, qualLevel}; - m_EfficiencyNumEtaHistos[histoKeyEffNumEta] = - ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); - } - - else { - for (const auto etaReg : m_etaRegions) { - // denominator histograms for pt variable get a special treatment - if (var == kEffPt) { - std::string name = "effDen_" + m_effStrings[var] + "_" + m_etaStrings[etaReg]; - m_EfficiencyDenPtHistos[etaReg] = - ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); - } else { - for (const auto& cut : m_cuts) { - const int gmtPtCut = cut.first; - std::string name = - "effDen_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + m_etaStrings[etaReg]; - m_histoKeyEffDenVarType histoKeyEffDenVar = {var, gmtPtCut, etaReg}; - m_EfficiencyDenVarHistos[histoKeyEffDenVar] = - ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); - } - } - for (const auto& cut : m_cuts) { - const auto gmtPtCut = cut.first; - const auto qualLevel = cut.second; - std::string name = "effNum_" + m_effStrings[var] + "_" + std::to_string(gmtPtCut) + "_" + - m_etaStrings[etaReg] + "_" + m_qualStrings[qualLevel]; - m_histoKeyEffNumVarType histoKeyEffNum = {var, gmtPtCut, etaReg, qualLevel}; - m_EfficiencyNumVarHistos[histoKeyEffNum] = - ibooker.book1D(name, name + ";" + m_effLabelStrings[var], histBins.size() - 1, &histBins[0]); - } + ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/resolution"); + std::string histoname = ""; + for (const auto eta : etaRegions_) { + for (const auto q : qualLevels_) { + for (const auto var : resTypes_){ + histoname = muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q] + "_" + resNames_[var]; + auto nbins = std::get<0>(getHistBinsRes(var)); + auto xmin = std::get<1>(getHistBinsRes(var)); + auto xmax = std::get<2>(getHistBinsRes(var)); + resolutionHistos_[mutype][eta][q][var] = ibooker.book1D(histoname, resNames_[var] +";" + resLabels_[var], nbins, xmin, xmax); } } } } -void L1TPhase2MuonOffline::bookResolutionHistos(DQMStore::IBooker& ibooker, MuType mutype) { - edmLogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookResolutionHistos()" << endl; - - ibooker.setCurrentFolder(m_HistFolder + "/" + muonNames_[mutype] + "/resolution"); - - for (const auto var : m_resTypes) { - auto nbins = std::get<0>(getHistBinsRes(var)); - auto xmin = std::get<1>(getHistBinsRes(var)); - auto xmax = std::get<2>(getHistBinsRes(var)); - for (const auto etaReg : m_etaRegions) { - for (const auto qualLevel : m_qualLevelsRes) { - m_histoKeyResType histoKeyRes = {var, etaReg, qualLevel}; - std::string name = "resolution_" + m_resStrings[var] + "_" + m_etaStrings[etaReg] + "_" + m_qualStrings[qualLevel]; - m_ResolutionHistos[histoKeyRes] = ibooker.book1D(name, name + ";" + m_resLabelStrings[var], nbins, xmin, xmax); - } - } - } -} -*/ //____________________________________________________________________ void L1TPhase2MuonOffline::fillControlHistos(){ @@ -426,10 +272,67 @@ void L1TPhase2MuonOffline::fillControlHistos(){ controlHistos_[kTkMuon][kQual]->Fill(muIt.hwQual()); controlHistos_[kTkMuon][kZ0] ->Fill(lsb_z0 * muIt.hwZ0()); controlHistos_[kTkMuon][kD0] ->Fill(lsb_d0 * muIt.hwD0()); + } +} +void L1TPhase2MuonOffline::fillEfficiencyHistos(){ + for (auto muIt : gmtSAMuonPairs_){ + auto eta = muIt.etaRegion(); + for (const auto q : qualLevels_) { + if (muIt.gmtQual() < q*4) continue; + for (const auto var : resTypes_) { + auto varToFill = muIt.getDeltaVar(var); + + efficiencyDen_[kSAMuon][eta][q][var]->Fill(varToFill) ; + if (muIt.gmtPt() < 0) continue; // gmt muon does not exits + efficiencyNum_[kSAMuon][eta][q][var]->Fill(varToFill) ; + } + } + } + + for (auto muIt : gmtTkMuonPairs_){ + auto eta = muIt.etaRegion(); + for (const auto q : qualLevels_) { + if (muIt.gmtQual() < q*4) continue; + for (const auto var : resTypes_) { + auto varToFill = muIt.getDeltaVar(var); + + efficiencyDen_[kTkMuon][eta][q][var]->Fill(varToFill) ; + if (muIt.gmtPt() < 0) continue; // gmt muon does not exits + efficiencyNum_[kTkMuon][eta][q][var]->Fill(varToFill) ; + } + } } +} +void L1TPhase2MuonOffline::fillResolutionHistos(){ + for (auto muIt : gmtSAMuonPairs_){ + if (muIt.gmtPt() < 0) continue; + + auto eta = muIt.etaRegion(); + for (const auto q : qualLevels_) { + if (muIt.gmtQual() < q*4) continue; + for (const auto var : resTypes_) { + auto varToFill = muIt.getDeltaVar(var); + + resolutionHistos_[kSAMuon][eta][q][var]->Fill(varToFill) ; + } + } + } + + for (auto muIt : gmtTkMuonPairs_){ + if (muIt.gmtPt() < 0) continue; + + auto eta = muIt.etaRegion(); + for (const auto q : qualLevels_) { + if (muIt.gmtQual() < q*4) continue; + for (const auto var : resTypes_) { + auto varToFill = muIt.getDeltaVar(var); + + resolutionHistos_[kTkMuon][eta][q][var]->Fill(varToFill) ; + } + } + } } - //_____________________________________________________________________ void L1TPhase2MuonOffline::matchMuonsToGen(std::vector genmus) { gmtSAMuonPairs_.clear(); @@ -440,18 +343,18 @@ void L1TPhase2MuonOffline::matchMuonsToGen(std::vector for (const reco::GenParticle * gen : genmus){ edm::LogInfo("L1TPhase2MuonOffline") << "Looping on genmus: "<< gen << endl; - GenMuonGMTPair pairBestCand(&(*gen), nullptr, muonpropagator_); + GenMuonGMTPair pairBestCand(&(*gen), nullptr); for (auto& muIt : *gmtSAMuon_) { - GenMuonGMTPair pairTmpCand(&(*gen), &(muIt), muonpropagator_); + GenMuonGMTPair pairTmpCand(&(*gen), &(muIt)); if ((pairTmpCand.dR() < maxGmtMuonDR_) && (pairTmpCand.dR() < pairBestCand.dR())) { pairBestCand = pairTmpCand; } } gmtSAMuonPairs_.emplace_back(pairBestCand); - GenMuonGMTPair pairBestCand2(&(*gen), nullptr, muonpropagator_); + GenMuonGMTPair pairBestCand2(&(*gen), nullptr); for (auto& tkmuIt : *gmtTkMuon_) { - GenMuonGMTPair pairTmpCand(&(*gen), &(tkmuIt), muonpropagator_); + GenMuonGMTPair pairTmpCand(&(*gen), &(tkmuIt)); if ((pairTmpCand.dR() < maxGmtMuonDR_) && (pairTmpCand.dR() < pairBestCand2.dR())) { pairBestCand2 = pairTmpCand; } From 80145450a2da7004856dee6804ee4776fb45fdd7 Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 20 Apr 2022 12:55:49 +0200 Subject: [PATCH 11/66] include Harvesting (cherry picked from commit 9bf305060ac39de3676c7da5b5655db23146b07c) --- .../interface/L1TPhase2MuonOffline.h | 6 +- .../python/L1TPhase2MuonDQMEfficiency_cfi.py | 37 +++++++++ .../python/L1TPhase2MuonOffline_cfi.py | 14 +--- .../L1TriggerDqmOffline_SecondStep_cff.py | 3 +- .../L1Trigger/src/L1TPhase2MuonOffline.cc | 78 +++++++++++++------ 5 files changed, 97 insertions(+), 41 deletions(-) create mode 100644 DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h index f73b60a684d2d..114012c552d5b 100644 --- a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h @@ -71,7 +71,7 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { enum EffType { kEffPt, kEffPhi, kEffEta, kEffTypes }; enum ResType { kResPt, kRes1OverPt, kResQOverPt, kResPhi, kResEta, kResCh, kNResTypes }; enum EtaRegion { kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf, kNEtaRegions }; - enum QualLevel { kQualAll, kQualOpen, kQualDouble, kQualSingle, kNQualLevels }; + enum QualLevel { kQualOpen, kQualDouble, kQualSingle, kNQualLevels }; protected: void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override; @@ -124,7 +124,7 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { // config params std::string histFolder_; - //std::vector cutsVPSet_; + std::vector cutsVPSet_; std::vector effVsPtBins_; std::vector effVsPhiBins_; @@ -158,7 +158,7 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { // helper variables std::vector gmtSAMuonPairs_; std::vector gmtTkMuonPairs_; - //std::vector> cuts_; + std::vector> cuts_; float lsb_pt ; float lsb_phi; diff --git a/DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py new file mode 100644 index 0000000000000..afbec55075485 --- /dev/null +++ b/DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py @@ -0,0 +1,37 @@ +import FWCore.ParameterSet.Config as cms + +# generate the efficiency strings for the DQMGenericClient from the pt and quality cuts +def generateEfficiencyStrings(ptQualCuts): + numDenDir = "nums_and dens/" + varStrings = ['Pt', 'Eta', 'Phi'] + etaStrings = ['etaMin0_etaMax0p83', 'etaMin0p83_etaMax1p24', 'etaMin1p24_etaMax2p4', 'etaMin0_etaMax2p4'] + qualStrings = {'qualOpen', 'qualDouble', 'qualSingle'} + muonStrings = ['SAMuon','TkMuon'] + + efficiencyStrings = [] + + for muonString in muonStrings: + for qualString in qualStrings: + for etaString in etaStrings: + effNumDenPrefix = numDenDir+"Eff_"+muonString+"_"+etaString+"_"+qualString+"_" + effNamePrefix = "efficiencies/eff_"+muonString+"_"+etaString+"_"+qualString+"_" + + for varString in varStrings: + effDenName = effNumDenPrefix+varString+"_Den" + effNumName = effNumDenPrefix+varString+"_Num" + effName = effNamePrefix+varString + + efficiencyStrings.append(effName+" '"+effName+";;L1 muon efficiency' "+effNumName+" "+effDenName) + return efficiencyStrings + +from DQMServices.Core.DQMEDHarvester import DQMEDHarvester +from DQMOffline.L1Trigger.L1TPhase2MuonOffline_cfi import ptQualCuts + +l1tPhase2MuonEfficiency = DQMEDHarvester("DQMGenericClient", + subDirs = cms.untracked.vstring(["L1T/L1TPhase2/Muons/SAMuon","L1T/L1TPhase2/Muons/TkMuon"]), + efficiency = cms.vstring(), + efficiencyProfile = cms.untracked.vstring(generateEfficiencyStrings(ptQualCuts)), + resolution = cms.vstring(), + outputFileName = cms.untracked.string(""), + verbose = cms.untracked.uint32(4) +) diff --git a/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py index f88c30ad0b534..953ccf5075056 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py @@ -27,7 +27,7 @@ effVsVtxBins = range(0, 101) # A list of pt cut + quality cut pairs for which efficiency plots should be made -ptQualCuts = [[22, 12], [15, 8], [7, 8], [3, 4]] +ptQualCuts = [[22, 12], [15, 8], [3, 4]] cutsPSets = [] for ptQualCut in ptQualCuts: cutsPSets.append(cms.untracked.PSet(ptCut = cms.untracked.int32(ptQualCut[0]), @@ -35,7 +35,7 @@ from DQMServices.Core.DQMEDAnalyzer import DQMEDAnalyzer l1tPhase2MuonOffline = DQMEDAnalyzer('L1TPhase2MuonOffline', - histFolder = cms.untracked.string('L1T/L1TObjects/L1TMuonPhase2/'), + histFolder = cms.untracked.string('L1T/L1TPhase2/Muons/'), cuts = cms.untracked.VPSet(cutsPSets), useL1AtVtxCoord = cms.untracked.bool(False), @@ -47,16 +47,6 @@ efficiencyVsPhiBins = cms.untracked.vdouble(effVsPhiBins), efficiencyVsEtaBins = cms.untracked.vdouble(effVsEtaBins), efficiencyVsVtxBins = cms.untracked.vdouble(effVsVtxBins), - - # muon track extrapolation to 2nd station - muProp = cms.PSet( - useTrack = cms.string("tracker"), # 'none' to use Candidate P4; or 'tracker', 'muon', 'global' - useState = cms.string("atVertex"), # 'innermost' and 'outermost' require the TrackExtra - useSimpleGeometry = cms.bool(True), - useStation2 = cms.bool(True), - fallbackToME1 = cms.bool(False), - ), - ) diff --git a/DQMOffline/L1Trigger/python/L1TriggerDqmOffline_SecondStep_cff.py b/DQMOffline/L1Trigger/python/L1TriggerDqmOffline_SecondStep_cff.py index ec3c8ddf765a1..6d9709f8c7068 100644 --- a/DQMOffline/L1Trigger/python/L1TriggerDqmOffline_SecondStep_cff.py +++ b/DQMOffline/L1Trigger/python/L1TriggerDqmOffline_SecondStep_cff.py @@ -16,6 +16,7 @@ from DQMOffline.L1Trigger.L1TTauDiff_cfi import * from DQMOffline.L1Trigger.L1TMuonDQMEfficiency_cff import * +from DQMOffline.L1Trigger.L1TPhase2MuonDQMEfficiency_cfi import * # harvesting sequence for all datasets DQMHarvestL1TMon = cms.Sequence( @@ -52,6 +53,6 @@ # harvesting sequence for phase 2 DQMHarvestL1TPhase2 = cms.Sequence( - + l1tPhase2MuonEfficiency ) diff --git a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc index 2ccc9defc1ef7..7b96986f39166 100644 --- a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc @@ -101,7 +101,7 @@ L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : effTypes_({kEffPt, kEffPhi, kEffEta}), resTypes_({kResPt, kResQOverPt, kResPhi, kResEta}), etaRegions_({kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf}), - qualLevels_({kQualAll, kQualOpen, kQualDouble, kQualSingle}), + qualLevels_({kQualOpen, kQualDouble, kQualSingle}), resNames_({{kResPt, "pt"}, {kRes1OverPt, "1overpt"}, {kResQOverPt, "qoverpt"}, @@ -118,13 +118,12 @@ L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : {kEtaRegionBmtf, "etaMin0_etaMax0p83"}, {kEtaRegionOmtf, "etaMin0p83_etaMax1p24"}, {kEtaRegionEmtf, "etaMin1p24_etaMax2p4"}}), - qualNames_({{kQualAll, "qualAll"}, - {kQualOpen, "qualOpen"}, - {kQualDouble, "qualDouble"}, - {kQualSingle, "qualSingle"}}), + qualNames_({{kQualOpen, "qualOpen"}, + {kQualDouble, "qualDouble"}, + {kQualSingle, "qualSingle"}}), muonNames_({{kSAMuon, "SAMuon"}, {kTkMuon, "TkMuon"}}), histFolder_(ps.getUntrackedParameter("histFolder")), -// cutsVPSet_(ps.getUntrackedParameter>("cuts")), + cutsVPSet_(ps.getUntrackedParameter>("cuts")), effVsPtBins_(ps.getUntrackedParameter>("efficiencyVsPtBins")), effVsPhiBins_(ps.getUntrackedParameter>("efficiencyVsPhiBins")), effVsEtaBins_(ps.getUntrackedParameter>("efficiencyVsEtaBins")), @@ -138,6 +137,20 @@ L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : lsb_eta = Phase2L1GMT::LSBeta; lsb_z0 = Phase2L1GMT::LSBSAz0; lsb_d0 = Phase2L1GMT::LSBSAd0; + + for (const auto& c : cutsVPSet_) { + const auto qCut = c.getUntrackedParameter("qualCut"); + QualLevel qLevel = kQualOpen; + if (qCut > 11) { + qLevel = kQualSingle; + } else if (qCut > 7) { + qLevel = kQualDouble; + } else if (qCut > 3) { + qLevel = kQualOpen; + } + cuts_.emplace_back(std::make_pair(c.getUntrackedParameter("ptCut"), qLevel)); + } + } //_____________________________________________________________________ @@ -213,23 +226,25 @@ void L1TPhase2MuonOffline::bookControlHistos(DQMStore::IBooker& ibooker, MuType void L1TPhase2MuonOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType mutype) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl; - ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/efficiencies"); + ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/nums_and_dens"); std::string histoname = ""; for (const auto eta : etaRegions_) { for (const auto q : qualLevels_) { - histoname = muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q]; + histoname = "Eff_" + muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q]; + auto histBins = getHistBinsEff(kEffPt); efficiencyNum_[mutype][eta][q][kEffPt] = ibooker.book1D(histoname + "_Pt_Num", "MuonPt; p_{T} ;", histBins.size()-1, &histBins[0]); - efficiencyDen_[mutype][eta][q][kEffPt] = ibooker.book1D(histoname + "_Pt_Den", "MuonPt; p_{T} ;", histBins.size()-1, &histBins[0]); - + efficiencyDen_[mutype][eta][q][kEffPt] = ibooker.book1D(histoname + "_Pt_Den", "MuonPt; p_{T} ;", histBins.size()-1, &histBins[0]); + histBins = getHistBinsEff(kEffEta); efficiencyNum_[mutype][eta][q][kEffEta] = ibooker.book1D(histoname + "_Eta_Num", "MuonEta; #eta ;", histBins.size()-1, &histBins[0]); efficiencyDen_[mutype][eta][q][kEffEta] = ibooker.book1D(histoname + "_Eta_Den", "MuonEta; #eta ;", histBins.size()-1, &histBins[0]); - + histBins = getHistBinsEff(kEffPhi); efficiencyNum_[mutype][eta][q][kEffPhi] = ibooker.book1D(histoname + "_Phi_Num", "MuonPhi; #phi ;", histBins.size()-1, &histBins[0]); efficiencyDen_[mutype][eta][q][kEffPhi] = ibooker.book1D(histoname + "_Phi_Den", "MuonPhi; #phi ;", histBins.size()-1, &histBins[0]); + } } } @@ -241,7 +256,7 @@ void L1TPhase2MuonOffline::bookResolutionHistos(DQMStore::IBooker& ibooker, MuTy for (const auto eta : etaRegions_) { for (const auto q : qualLevels_) { for (const auto var : resTypes_){ - histoname = muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q] + "_" + resNames_[var]; + histoname = "Res_" + muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q] + "_" + resNames_[var]; auto nbins = std::get<0>(getHistBinsRes(var)); auto xmin = std::get<1>(getHistBinsRes(var)); auto xmax = std::get<2>(getHistBinsRes(var)); @@ -275,33 +290,46 @@ void L1TPhase2MuonOffline::fillControlHistos(){ } } void L1TPhase2MuonOffline::fillEfficiencyHistos(){ + for (auto muIt : gmtSAMuonPairs_){ auto eta = muIt.etaRegion(); - for (const auto q : qualLevels_) { - if (muIt.gmtQual() < q*4) continue; - for (const auto var : resTypes_) { - auto varToFill = muIt.getDeltaVar(var); + for (const auto var : effTypes_) { + auto varToFill = muIt.getVar(var); + for (const auto& cut : cuts_){ + const auto gmtPtCut = cut.first; + const auto q = cut.second; - efficiencyDen_[kSAMuon][eta][q][var]->Fill(varToFill) ; + efficiencyDen_[kSAMuon][eta][q][var]->Fill(varToFill) ; if (muIt.gmtPt() < 0) continue; // gmt muon does not exits - efficiencyNum_[kSAMuon][eta][q][var]->Fill(varToFill) ; + + if (muIt.gmtQual() < q*4) continue; //quality requirements + if (var != kEffPt && muIt.gmtPt() < gmtPtCut) continue; // pt requirement + + efficiencyNum_[kSAMuon][eta][q][var]->Fill(varToFill); } } } - + + /// FOR TK MUONS for (auto muIt : gmtTkMuonPairs_){ auto eta = muIt.etaRegion(); - for (const auto q : qualLevels_) { - if (muIt.gmtQual() < q*4) continue; - for (const auto var : resTypes_) { - auto varToFill = muIt.getDeltaVar(var); + for (const auto var : effTypes_) { + auto varToFill = muIt.getVar(var); + for (const auto& cut : cuts_){ + const auto gmtPtCut = cut.first; + const auto q = cut.second; - efficiencyDen_[kTkMuon][eta][q][var]->Fill(varToFill) ; + efficiencyDen_[kTkMuon][eta][q][var]->Fill(varToFill) ; if (muIt.gmtPt() < 0) continue; // gmt muon does not exits - efficiencyNum_[kTkMuon][eta][q][var]->Fill(varToFill) ; + + if (muIt.gmtQual() < q*4) continue; //quality requirements + if (var != kEffPt && muIt.gmtPt() < gmtPtCut) continue; // pt requirement + + efficiencyNum_[kTkMuon][eta][q][var]->Fill(varToFill); } } } + } void L1TPhase2MuonOffline::fillResolutionHistos(){ From 4194565e9c07a66fcef7ab0345de802380f82f86 Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 20 Apr 2022 15:58:30 +0200 Subject: [PATCH 12/66] fix folder on Harvesting (cherry picked from commit 5be6759c0d68c9905c8c8f27bdb790e421ae1537) --- DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py index afbec55075485..761ed7247c863 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2MuonDQMEfficiency_cfi.py @@ -2,7 +2,7 @@ # generate the efficiency strings for the DQMGenericClient from the pt and quality cuts def generateEfficiencyStrings(ptQualCuts): - numDenDir = "nums_and dens/" + numDenDir = "nums_and_dens/" varStrings = ['Pt', 'Eta', 'Phi'] etaStrings = ['etaMin0_etaMax0p83', 'etaMin0p83_etaMax1p24', 'etaMin1p24_etaMax2p4', 'etaMin0_etaMax2p4'] qualStrings = {'qualOpen', 'qualDouble', 'qualSingle'} From 719126db1638f3bbb5db71290cc68720accbefe0 Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Tue, 28 Dec 2021 11:01:44 -0600 Subject: [PATCH 13/66] Changes to L1TrackerEtMissProducer if the L1TrackSelectionProducer is run first. (cherry picked from commit e1dda8deb549973d6e32de0367142625ddbc091e) --- .../plugins/L1TrackerEtMissProducer.cc | 108 +++++------------- .../python/L1TrackerEtMissProducer_cfi.py | 21 +--- 2 files changed, 31 insertions(+), 98 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index 6696b9f926155..61abec466ea22 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -34,6 +34,8 @@ class L1TrackerEtMissProducer : public edm::stream::EDProducer<> { public: typedef TTTrack L1TTTrackType; typedef std::vector L1TTTrackCollectionType; + typedef edm::Ref L1TTTrackRefType; + typedef std::vector L1TTTrackRefCollectionType; typedef Vertex L1VertexType; typedef VertexCollection L1VertexCollectionType; @@ -47,18 +49,11 @@ class L1TrackerEtMissProducer : public edm::stream::EDProducer<> { virtual void endJob(); // ----------member data --------------------------- - const float maxZ0_; // in cm - float deltaZ_; // in cm - const float Chi2RphidofMax_; - const float Chi2RzdofMax_; - const float bendChi2Max_; - const float minPt_; // in GeV - const int nStubsmin_; - const int nPSStubsMin_; // minimum number of stubs in PS modules - const float maxPt_; - const float maxEta_; - const int highPtTracks_; // saturate or truncate - const bool displaced_; // prompt/displaced tracks + float deltaZ_; // in cm + float maxPt_; // in GeV + int highPtTracks_; // saturate or truncate + bool displaced_; // prompt/displaced tracks + vector z0Thresholds_; // Threshold for track to vertex association vector etaRegions_; // Eta bins for choosing deltaZ threshold bool debug_; @@ -67,30 +62,22 @@ class L1TrackerEtMissProducer : public edm::stream::EDProducer<> { std::string L1ExtendedMetCollectionName; const edm::EDGetTokenT pvToken_; - const edm::EDGetTokenT trackToken_; - edm::ESGetToken tTopoToken_; + const edm::EDGetTokenT trackToken_; }; // constructor// L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) - : maxZ0_((float)iConfig.getParameter("maxZ0")), - deltaZ_((float)iConfig.getParameter("deltaZ")), - Chi2RphidofMax_((float)iConfig.getParameter("chi2rphidofMax")), - Chi2RzdofMax_((float)iConfig.getParameter("chi2rzdofMax")), - bendChi2Max_((float)iConfig.getParameter("bendChi2Max")), - minPt_((float)iConfig.getParameter("minPt")), - nStubsmin_(iConfig.getParameter("nStubsmin")), - nPSStubsMin_(iConfig.getParameter("nPSStubsMin")), - maxPt_((float)iConfig.getParameter("maxPt")), - maxEta_((float)iConfig.getParameter("maxEta")), - highPtTracks_(iConfig.getParameter("highPtTracks")), - displaced_(iConfig.getParameter("displaced")), - z0Thresholds_(iConfig.getParameter>("z0Thresholds")), - etaRegions_(iConfig.getParameter>("etaRegions")), - debug_(iConfig.getParameter("debug")), - pvToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), - trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))), - tTopoToken_(esConsumes(edm::ESInputTag("", ""))) { + : pvToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), + trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))) { + deltaZ_ = (float)iConfig.getParameter("deltaZ"); + maxPt_ = (float)iConfig.getParameter("maxPt"); + highPtTracks_ = iConfig.getParameter("highPtTracks"); + displaced_ = iConfig.getParameter("displaced"); + z0Thresholds_ = iConfig.getParameter>("z0Thresholds"); + etaRegions_ = iConfig.getParameter>("etaRegions"); + + debug_ = iConfig.getParameter("debug"); + L1MetCollectionName = (std::string)iConfig.getParameter("L1MetCollectionName"); if (displaced_) { @@ -113,9 +100,8 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& edm::Handle L1VertexHandle; iEvent.getByToken(pvToken_, L1VertexHandle); - edm::Handle L1TTTrackHandle; + edm::Handle L1TTTrackHandle; iEvent.getByToken(trackToken_, L1TTTrackHandle); - L1TTTrackCollectionType::const_iterator trackIter; if (!L1VertexHandle.isValid()) { LogError("L1TrackerEtMissProducer") << "\nWarning: VertexCollection not found in the event. Exit\n"; @@ -135,36 +121,14 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& double etTot_PU = 0; float zVTX = L1VertexHandle->begin()->z0(); - int numtracks = 0; int numqualitytracks = 0; int numassoctracks = 0; - for (trackIter = L1TTTrackHandle->begin(); trackIter != L1TTTrackHandle->end(); ++trackIter) { - numtracks++; - float pt = trackIter->momentum().perp(); - float phi = trackIter->momentum().phi(); - float eta = trackIter->momentum().eta(); - float chi2rphidof = trackIter->chi2XYRed(); - float chi2rzdof = trackIter->chi2ZRed(); - float bendChi2 = trackIter->stubPtConsistency(); - float z0 = trackIter->z0(); - //unsigned int Sector = trackIter->phiSector(); - std::vector>, TTStub>> - theStubs = trackIter->getStubRefs(); - int nstubs = (int)theStubs.size(); - - if (pt < minPt_) - continue; - if (std::abs(z0) > maxZ0_) - continue; - if (std::abs(eta) > maxEta_) - continue; - if (chi2rphidof > Chi2RphidofMax_) - continue; - if (chi2rzdof > Chi2RzdofMax_) - continue; - if (bendChi2 > bendChi2Max_) - continue; + for (const auto & track : *L1TTTrackHandle) { + float pt = track->momentum().perp(); + float phi = track->momentum().phi(); + float eta = track->momentum().eta(); + float z0 = track->z0(); if (maxPt_ > 0 && pt > maxPt_) { if (highPtTracks_ == 0) @@ -173,27 +137,11 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& pt = maxPt_; // saturate } - int nPS = 0; // number of stubs in PS modules - // loop over the stubs - for (unsigned int istub = 0; istub < (unsigned int)theStubs.size(); istub++) { - DetId detId(theStubs.at(istub)->getDetId()); - if (detId.det() == DetId::Detector::Tracker) { - if ((detId.subdetId() == StripSubdetector::TOB && tTopo.tobLayer(detId) <= 3) || - (detId.subdetId() == StripSubdetector::TID && tTopo.tidRing(detId) <= 9)) - nPS++; - } - } - - if (nstubs < nStubsmin_) - continue; - if (nPS < nPSStubsMin_) - continue; - numqualitytracks++; if (!displaced_) { // if displaced, deltaZ = 3.0 cm, very loose // construct deltaZ cut to be based on track eta - for (unsigned int reg = 0; reg < etaRegions_.size() - 1; reg++) { + for (unsigned int reg = 0; reg < etaRegions_.size(); reg++) { if (std::abs(eta) >= etaRegions_[reg] && std::abs(eta) < etaRegions_[reg + 1]) { deltaZ_ = z0Thresholds_[reg]; break; @@ -230,8 +178,8 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& << "\n" << "MET: " << et << "| Phi: " << etphi << "\n" - << "# Intial Tracks: " << numtracks << "\n" - << "# Tracks after Quality Cuts: " << numqualitytracks << "\n" + << "# Tracks after Quality Cuts: " << L1TTTrackHandle->size() << "\n" + << "# Tacks after additional highPt Cuts: " << numqualitytracks << "\n" << "# Tracks Associated to Vertex: " << numassoctracks << "\n" << "========================================================" << "\n"; diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py index b13ad6c86872a..603ea2743dcb6 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -1,19 +1,12 @@ import FWCore.ParameterSet.Config as cms from L1Trigger.VertexFinder.VertexProducer_cff import VertexProducer +from L1Trigger.L1TTrackMatch.L1TrackSelectionProducer_cfi import L1TrackSelectionProducer, L1TrackSelectionProducerExtended L1TrackerEtMiss = cms.EDProducer('L1TrackerEtMissProducer', - L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), + L1TrackInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value()), L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), L1MetCollectionName = cms.string("L1TrackerEtMiss"), - maxZ0 = cms.double ( 15. ) , # in cm - maxEta = cms.double ( 2.4 ) , # max eta allowed for chosen tracks - chi2rzdofMax = cms.double( 5. ), # max chi2rz/dof allowed for chosen tracks - chi2rphidofMax = cms.double( 20. ), # max chi2rphi/dof allowed for chosen tracks - bendChi2Max = cms.double( 2.25 ),# max bendchi2 allowed for chosen tracks - minPt = cms.double( 2. ), # in GeV deltaZ = cms.double( 3. ), # in cm - nStubsmin = cms.int32( 4 ), # min number of stubs for the tracks - nPSStubsMin = cms.int32( -1 ), # min number of stubs in the PS Modules maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. # When maxPt < 0, no special treatment is done for high PT tracks. @@ -27,19 +20,11 @@ ) L1TrackerEtMissExtended = cms.EDProducer('L1TrackerEtMissProducer', #NOT OPTIMIZED, STUDIED, OR USED - L1TrackInputTag = cms.InputTag("TTTracksFromExtendedTrackletEmulation", "Level1TTTracks"), + L1TrackInputTag = cms.InputTag("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value()), L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), L1MetCollectionName = cms.string("L1TrackerEtMiss"), L1MetExtendedCollectionName = cms.string("L1TrackerExtendedEtMiss"), - maxZ0 = cms.double ( 15. ) , # in cm - maxEta = cms.double ( 2.4 ) , # max eta allowed for chosen tracks - chi2rzdofMax = cms.double( 10. ), # max chi2rz/dof allowed - chi2rphidofMax = cms.double( 40. ), # max chi2rphi/dof allowed - bendChi2Max = cms.double( 2.4 ),# max bendchi2 allowed for chosen tracks - minPt = cms.double( 3. ), # in GeV deltaZ = cms.double( 3.0 ), # in cm - nStubsmin = cms.int32( 4 ), # min number of stubs for the tracks - nPSStubsMin = cms.int32( -1 ), # min number of stubs in the PS Modules maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. # When maxPt < 0, no special treatment is done for high PT tracks. From 1bb391e7bab908042f50257d9b003432af5b6201 Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Tue, 28 Dec 2021 13:29:57 -0600 Subject: [PATCH 14/66] Rely on the L1TrackSelectionProducer for all of the track quality cuts and the track-vertex association. (cherry picked from commit 970dc1b45d1cf975a9bc745abd94a99fd6d19955) --- .../plugins/L1TrackerEtMissProducer.cc | 111 +++++------------- .../python/L1TrackerEtMissProducer_cfi.py | 13 +- 2 files changed, 30 insertions(+), 94 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index 61abec466ea22..b5ada97c6ec3a 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -4,6 +4,7 @@ // Modified by Christopher Brown 27 March 2021 // system include files +#include #include // user include files @@ -13,113 +14,78 @@ #include "DataFormats/L1TCorrelator/interface/TkEtMiss.h" #include "DataFormats/L1TCorrelator/interface/TkEtMissFwd.h" #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" -#include "DataFormats/L1Trigger/interface/Vertex.h" #include "DataFormats/Math/interface/LorentzVector.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/Framework/interface/EventSetup.h" #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" +#include "FWCore/Framework/interface/global/EDProducer.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" -// detector geometry -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - using namespace l1t; -class L1TrackerEtMissProducer : public edm::stream::EDProducer<> { +class L1TrackerEtMissProducer : public edm::global::EDProducer<> { public: typedef TTTrack L1TTTrackType; typedef std::vector L1TTTrackCollectionType; typedef edm::Ref L1TTTrackRefType; typedef std::vector L1TTTrackRefCollectionType; - typedef Vertex L1VertexType; - typedef VertexCollection L1VertexCollectionType; - explicit L1TrackerEtMissProducer(const edm::ParameterSet&); ~L1TrackerEtMissProducer() override; private: - virtual void beginJob(); - void produce(edm::Event&, const edm::EventSetup&) override; - virtual void endJob(); + void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; // ----------member data --------------------------- - float deltaZ_; // in cm + const edm::EDGetTokenT trackToken_; + const edm::EDGetTokenT vtxAssocTrackToken_; + std::string L1MetCollectionName; float maxPt_; // in GeV int highPtTracks_; // saturate or truncate - bool displaced_; // prompt/displaced tracks - - vector z0Thresholds_; // Threshold for track to vertex association - vector etaRegions_; // Eta bins for choosing deltaZ threshold bool debug_; - - std::string L1MetCollectionName; - std::string L1ExtendedMetCollectionName; - - const edm::EDGetTokenT pvToken_; - const edm::EDGetTokenT trackToken_; }; -// constructor// +// constructor L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) - : pvToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), - trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))) { - deltaZ_ = (float)iConfig.getParameter("deltaZ"); - maxPt_ = (float)iConfig.getParameter("maxPt"); - highPtTracks_ = iConfig.getParameter("highPtTracks"); - displaced_ = iConfig.getParameter("displaced"); - z0Thresholds_ = iConfig.getParameter>("z0Thresholds"); - etaRegions_ = iConfig.getParameter>("etaRegions"); - - debug_ = iConfig.getParameter("debug"); - - L1MetCollectionName = (std::string)iConfig.getParameter("L1MetCollectionName"); - - if (displaced_) { - L1ExtendedMetCollectionName = (std::string)iConfig.getParameter("L1MetExtendedCollectionName"); - produces(L1ExtendedMetCollectionName); - } else - produces(L1MetCollectionName); + : trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))), + vtxAssocTrackToken_(consumes(iConfig.getParameter("L1TrackAssociatedInputTag"))), + L1MetCollectionName(iConfig.getParameter("L1MetCollectionName")), + maxPt_(iConfig.getParameter("maxPt")), + highPtTracks_(iConfig.getParameter("highPtTracks")), + debug_(iConfig.getParameter("debug")) { + produces(L1MetCollectionName); } L1TrackerEtMissProducer::~L1TrackerEtMissProducer() {} -void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { +void L1TrackerEtMissProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { using namespace edm; std::unique_ptr METCollection(new TkEtMissCollection); - // Tracker Topology - const TrackerTopology& tTopo = iSetup.getData(tTopoToken_); - - edm::Handle L1VertexHandle; - iEvent.getByToken(pvToken_, L1VertexHandle); - edm::Handle L1TTTrackHandle; iEvent.getByToken(trackToken_, L1TTTrackHandle); - if (!L1VertexHandle.isValid()) { - LogError("L1TrackerEtMissProducer") << "\nWarning: VertexCollection not found in the event. Exit\n"; - return; - } + edm::Handle L1TTTrackAssociatedHandle; + iEvent.getByToken(vtxAssocTrackToken_, L1TTTrackAssociatedHandle); if (!L1TTTrackHandle.isValid()) { LogError("L1TrackerEtMissProducer") << "\nWarning: L1TTTrackCollection not found in the event. Exit\n"; return; } + if (!L1TTTrackAssociatedHandle.isValid()) { + LogError("L1TrackerEtMissProducer") << "\nWarning: L1TTTrackAssociatedCollection not found in the event. Exit\n"; + return; + } + float sumPx = 0; float sumPy = 0; float etTot = 0; double sumPx_PU = 0; double sumPy_PU = 0; double etTot_PU = 0; - float zVTX = L1VertexHandle->begin()->z0(); int numqualitytracks = 0; int numassoctracks = 0; @@ -127,8 +93,6 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& for (const auto & track : *L1TTTrackHandle) { float pt = track->momentum().perp(); float phi = track->momentum().phi(); - float eta = track->momentum().eta(); - float z0 = track->z0(); if (maxPt_ > 0 && pt > maxPt_) { if (highPtTracks_ == 0) @@ -139,21 +103,7 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& numqualitytracks++; - if (!displaced_) { // if displaced, deltaZ = 3.0 cm, very loose - // construct deltaZ cut to be based on track eta - for (unsigned int reg = 0; reg < etaRegions_.size(); reg++) { - if (std::abs(eta) >= etaRegions_[reg] && std::abs(eta) < etaRegions_[reg + 1]) { - deltaZ_ = z0Thresholds_[reg]; - break; - } - } - if (std::abs(eta) >= etaRegions_[etaRegions_.size() - 1]) { - deltaZ_ = z0Thresholds_[etaRegions_.size() - 1]; - break; - } - } - - if (std::abs(z0 - zVTX) <= deltaZ_) { + if (std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(), track) != L1TTTrackAssociatedHandle->end()) { numassoctracks++; sumPx += pt * cos(phi); sumPy += pt * sin(phi); @@ -178,9 +128,9 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& << "\n" << "MET: " << et << "| Phi: " << etphi << "\n" - << "# Tracks after Quality Cuts: " << L1TTTrackHandle->size() << "\n" + << "# Tracks after quality cuts: " << L1TTTrackHandle->size() << "\n" << "# Tacks after additional highPt Cuts: " << numqualitytracks << "\n" - << "# Tracks Associated to Vertex: " << numassoctracks << "\n" + << "# Tracks associated to vertex: " << numassoctracks << "\n" << "========================================================" << "\n"; } @@ -188,14 +138,7 @@ void L1TrackerEtMissProducer::produce(edm::Event& iEvent, const edm::EventSetup& int ibx = 0; METCollection->push_back(TkEtMiss(missingEt, TkEtMiss::kMET, etphi, numassoctracks, ibx)); - if (displaced_) - iEvent.put(std::move(METCollection), L1ExtendedMetCollectionName); - else - iEvent.put(std::move(METCollection), L1MetCollectionName); + iEvent.put(std::move(METCollection), L1MetCollectionName); } // end producer -void L1TrackerEtMissProducer::beginJob() {} - -void L1TrackerEtMissProducer::endJob() {} - DEFINE_FWK_MODULE(L1TrackerEtMissProducer); diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py index 603ea2743dcb6..9f02a2d561a41 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -4,35 +4,28 @@ L1TrackerEtMiss = cms.EDProducer('L1TrackerEtMissProducer', L1TrackInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value()), + L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), L1MetCollectionName = cms.string("L1TrackerEtMiss"), - deltaZ = cms.double( 3. ), # in cm maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. # When maxPt < 0, no special treatment is done for high PT tracks. highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. # When maxPt < 0, no special treatment is done for high PT tracks. - displaced = cms.bool(False), # Use promt/displaced tracks - z0Thresholds = cms.vdouble( 0.37, 0.5, 0.6, 0.75, 1.0, 1.6 ), # Threshold for track to vertex association. - etaRegions = cms.vdouble( 0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4 ), # Eta bins for choosing deltaZ threshold. debug = cms.bool(False) ) L1TrackerEtMissExtended = cms.EDProducer('L1TrackerEtMissProducer', #NOT OPTIMIZED, STUDIED, OR USED L1TrackInputTag = cms.InputTag("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value()), + L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), - L1MetCollectionName = cms.string("L1TrackerEtMiss"), - L1MetExtendedCollectionName = cms.string("L1TrackerExtendedEtMiss"), - deltaZ = cms.double( 3.0 ), # in cm + L1MetCollectionName = cms.string("L1TrackerExtendedEtMiss"), maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. # When maxPt < 0, no special treatment is done for high PT tracks. highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. # When maxPt < 0, no special treatment is done for high PT tracks. - displaced = cms.bool(True), # Use promt/displaced tracks - z0Thresholds = cms.vdouble( 3.0, 3.0, 3.0, 3.0, 3.0, 3.0 ), # Threshold for track to vertex association. - etaRegions = cms.vdouble( 0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4 ), # Eta bins for choosing deltaZ threshold. debug = cms.bool(False) ) From 8e50f641be4f6388d640044d05047a0845b145b8 Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Thu, 5 May 2022 10:17:01 -0500 Subject: [PATCH 15/66] Update the track selection and et miss producer emulation files. (cherry picked from commit 94c1662faaebd8b4d97adcd39e8d983580a6a833) --- .../python/L1TrackSelectionProducer_cfi.py | 23 ++++++++++++++++--- .../python/L1TrackerEtMissProducer_cfi.py | 14 +++-------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py index e7bdf4f3ddd3a..9be5ca92b8e42 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py @@ -29,8 +29,25 @@ ) L1TrackSelectionProducerExtended = L1TrackSelectionProducer.clone( - l1TracksInputTag = "L1GTTInputProducerExtended : Level1TTTracksExtendedConverted", - outputCollectionName = "Level1TTTracksExtendedSelected", - useDisplacedTracksDeltaZOverride = 3.0, # Use prompt/displaced tracks + l1TracksInputTag = cms.InputTag("L1GTTInputProducerExtended","Level1TTTracksExtendedConverted"), + outputCollectionName = cms.string("Level1TTTracksExtendedSelected"), + cutSet = cms.PSet( + ptMin = cms.double(3.0), # pt must be greater than this value, [GeV] + absEtaMax = cms.double(2.4), # absolute value of eta must be less than this value + absZ0Max = cms.double(15.0), # z0 must be less than this value, [cm] + nStubsMin = cms.int32(4), # number of stubs must be greater than or equal to this value + nPSStubsMin = cms.int32(0), # the number of stubs in the PS Modules must be greater than or equal to this value + + reducedBendChi2Max = cms.double(2.4), # bend chi2 must be less than this value + reducedChi2RZMax = cms.double(10.0), # chi2rz/dof must be less than this value + reducedChi2RPhiMax = cms.double(40.0), # chi2rphi/dof must be less than this value + + #deltaZMaxEtaBounds = cms.vdouble(0.0, absEtaMax.value), # these values define the bin boundaries in |eta| + #deltaZMax = cms.vdouble(0.5), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] + deltaZMaxEtaBounds = cms.vdouble(0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4), # these values define the bin boundaries in |eta| + deltaZMax = cms.vdouble(3.0, 3.0, 3.0, 3.0, 3.0, 3.0), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] + ), + useDisplacedTracksDeltaZOverride = cms.double(3.0), # Use promt/displaced tracks ) + diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py index 9f02a2d561a41..6d5b2dde35321 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -7,7 +7,7 @@ L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), L1MetCollectionName = cms.string("L1TrackerEtMiss"), - maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as + maxPt = cms.double( -10. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. # When maxPt < 0, no special treatment is done for high PT tracks. highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored @@ -16,16 +16,8 @@ debug = cms.bool(False) ) -L1TrackerEtMissExtended = cms.EDProducer('L1TrackerEtMissProducer', #NOT OPTIMIZED, STUDIED, OR USED +L1TrackerEtMissExtended = L1TrackerEtMiss.clone( #NOT OPTIMIZED, STUDIED, OR USED L1TrackInputTag = cms.InputTag("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value()), - L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), - L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), + L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value() + "Associated"), L1MetCollectionName = cms.string("L1TrackerExtendedEtMiss"), - maxPt = cms.double( 200. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as - # mismeasured and are treated according to highPtTracks below. - # When maxPt < 0, no special treatment is done for high PT tracks. - highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored - # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. - # When maxPt < 0, no special treatment is done for high PT tracks. - debug = cms.bool(False) ) From 79fea1112dac67a61e63759dfb0e683bba9c862c Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Fri, 6 May 2022 13:16:23 -0500 Subject: [PATCH 16/66] Update the input files for CMSSW_12_3_X. (cherry picked from commit 6158b7ad872a58a28b05a25cc9771489359eb743) --- .../test/L1TrackObjectNtupleMaker_cfg.py | 25 ++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py index b30b3292fc211..e902c0a7d2d33 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py @@ -25,8 +25,8 @@ process.load('Configuration.StandardSequences.Services_cff') process.load('Configuration.EventContent.EventContent_cff') process.load('Configuration.StandardSequences.MagneticField_cff') -process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') -process.load('Configuration.Geometry.GeometryExtended2026D49_cff') +process.load('Configuration.Geometry.GeometryExtended2026D77Reco_cff') +process.load('Configuration.Geometry.GeometryExtended2026D77_cff') process.load('Configuration.StandardSequences.EndOfProcess_cff') process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') @@ -43,18 +43,15 @@ process.maxEvents = cms.untracked.PSet(input = cms.untracked.int32(10)) readFiles = cms.untracked.vstring( - # 'file:F7BF4AED-51F1-9D47-B86D-6C3DDA134AB9.root' - '/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/F7BF4AED-51F1-9D47-B86D-6C3DDA134AB9.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/075DCEC8-A2E9-7E48-A630-E1CBF89370A9.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/07EEAB60-C58E-6146-804B-6BA1B8E14875.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/09C2F689-B97E-6C44-94D2-C76445A4D703.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/01816581-F04F-B849-83AA-38A348F9320B.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/11564303-DE2D-474D-99ED-F4CB2793C5FB.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/176B2AC1-57AA-DE46-85FC-D375D25C4C2A.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/1818154D-11CB-9841-932A-A48845A430B6.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/19678708-B88E-A547-884E-CD1D924B2D3C.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/1D2905A5-5CB9-BB41-8C59-64427CEE7082.root', -'/store/relval/CMSSW_11_1_0_pre2/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU25ns_110X_mcRun4_realistic_v2_2026D49PU200-v1/20000/1F59B52D-BD93-CA4A-BB59-64E00A436EEF.root' + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/c6df2819-ed05-4b98-8f92-81b7d1b1092e.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/3f476d95-1ef7-4be6-977b-6bcd1a7c5678.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/68d651da-4cb7-4bf4-b002-66aecc57a2bc.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/db0e0ce2-4c5a-4988-9dbd-52066e40b9d2.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/257a9712-0a96-47b7-897e-f5d980605e46.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/bee31399-8559-4243-b539-cae1ea897def.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/24629540-2377-4168-9ae5-518ddd4c43a9.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/e31ba8f0-332a-4a1a-8bc0-91a12a5fe3db.root', + '/store/relval/CMSSW_12_3_0_pre4/RelValTTbar_14TeV/GEN-SIM-DIGI-RAW/PU_123X_mcRun4_realistic_v3_2026D77PU200-v1/2580000/17902198-4db6-4fcc-9e8c-787991b4db32.root', ) secFiles = cms.untracked.vstring() From 6cc466c1fe297f39f1d4d4b8e43864ac94620e80 Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Fri, 6 May 2022 15:38:12 -0500 Subject: [PATCH 17/66] Switch to using edm::RefVector as opposed to std::vector> (cherry picked from commit 06d29f658a1d92603807ce963e0ef160a7cc6ca3) --- DataFormats/L1TrackTrigger/src/classes_def.xml | 2 ++ L1Trigger/L1TTrackMatch/plugins/L1TrackSelectionProducer.cc | 3 ++- L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc | 3 +-- L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DataFormats/L1TrackTrigger/src/classes_def.xml b/DataFormats/L1TrackTrigger/src/classes_def.xml index 596906bdbb6af..9d5ce0be50192 100644 --- a/DataFormats/L1TrackTrigger/src/classes_def.xml +++ b/DataFormats/L1TrackTrigger/src/classes_def.xml @@ -22,6 +22,8 @@ + + diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackSelectionProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackSelectionProducer.cc index 65a6a67df2432..dbe75da651992 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackSelectionProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackSelectionProducer.cc @@ -34,6 +34,7 @@ // user include files #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Common/interface/Ref.h" +#include "DataFormats/Common/interface/RefVector.h" #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" #include "DataFormats/L1Trigger/interface/Vertex.h" #include "DataFormats/L1Trigger/interface/VertexWord.h" @@ -82,7 +83,7 @@ class L1TrackSelectionProducer : public edm::global::EDProducer<> { typedef std::vector TTTrackCollection; typedef edm::Handle TTTrackCollectionHandle; typedef edm::Ref TTTrackRef; - typedef std::vector TTTrackRefCollection; + typedef edm::RefVector TTTrackRefCollection; typedef std::unique_ptr TTTrackRefCollectionUPtr; // ----------member functions ---------------------- diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index b5ada97c6ec3a..3032e4135db75 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -28,8 +28,7 @@ class L1TrackerEtMissProducer : public edm::global::EDProducer<> { public: typedef TTTrack L1TTTrackType; typedef std::vector L1TTTrackCollectionType; - typedef edm::Ref L1TTTrackRefType; - typedef std::vector L1TTTrackRefCollectionType; + typedef edm::RefVector L1TTTrackRefCollectionType; explicit L1TrackerEtMissProducer(const edm::ParameterSet&); ~L1TrackerEtMissProducer() override; diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc index 1ee535d05705b..eae50c80e2b7e 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc @@ -107,7 +107,7 @@ class L1TrackObjectNtupleMaker : public edm::one::EDAnalyzer L1TrackPtrCollection; typedef std::vector L1TrackCollection; typedef edm::Ref L1TrackRef; - typedef std::vector L1TrackRefCollection; + typedef edm::RefVector L1TrackRefCollection; public: // Constructor/destructor From c4670bc711792ddc12611158bf848b11889b3ab4 Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Fri, 6 May 2022 15:38:38 -0500 Subject: [PATCH 18/66] Remove an unnecessary input tag. (cherry picked from commit c5c05bb2bb7417baa3364262543fffed8f061dbe) --- L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py | 1 - 1 file changed, 1 deletion(-) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py index 6d5b2dde35321..3501098763fbb 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -5,7 +5,6 @@ L1TrackerEtMiss = cms.EDProducer('L1TrackerEtMissProducer', L1TrackInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value()), L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), - L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), L1MetCollectionName = cms.string("L1TrackerEtMiss"), maxPt = cms.double( -10. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. From 06912387f06d3a496198d0fe842ea670f40f6c70 Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Fri, 6 May 2022 15:39:58 -0500 Subject: [PATCH 19/66] Make the MET emulation use the selection tool as opposed to its own internal selection code. (cherry picked from commit 860eefff14a51108ac2850ac66e620b2fb5c8188) --- .../L1TrackerEtMissEmulatorProducer.cc | 112 +++--------------- .../L1TrackerEtMissEmulatorProducer_cfi.py | 15 +-- 2 files changed, 22 insertions(+), 105 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc index 3e1c880e3bb0b..5700cebb822a6 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc @@ -42,6 +42,7 @@ class L1TrackerEtMissEmulatorProducer : public edm::stream::EDProducer<> { public: typedef TTTrack L1TTTrackType; typedef std::vector L1TTTrackCollectionType; + typedef edm::RefVector L1TTTrackRefCollectionType; typedef l1t::VertexWordCollection L1VertexCollectionType; typedef l1t::VertexWord L1VertexType; @@ -58,23 +59,9 @@ class L1TrackerEtMissEmulatorProducer : public edm::stream::EDProducer<> { // ----------member data --------------------------- std::vector cosLUT_; // Cos LUT array - std::vector EtaRegionsLUT_; // Various precomputed LUTs - std::vector DeltaZLUT_; std::vector phiQuadrants_; std::vector phiShifts_; - l1tmetemu::z_t minZ0_; - l1tmetemu::z_t maxZ0_; - l1tmetemu::eta_t maxEta_; - TTTrack_TrackWord::chi2rphi_t chi2rphiMax_; - TTTrack_TrackWord::chi2rz_t chi2rzMax_; - TTTrack_TrackWord::bendChi2_t bendChi2Max_; - l1tmetemu::pt_t minPt_; - l1tmetemu::nstub_t nStubsmin_; - - vector z0Thresholds_; - vector etaRegions_; - l1tmetemu::z_t deltaZ0_ = 0; int cordicSteps_; @@ -88,13 +75,15 @@ class L1TrackerEtMissEmulatorProducer : public edm::stream::EDProducer<> { std::string L1MetCollectionName_; const edm::EDGetTokenT pvToken_; - const edm::EDGetTokenT trackToken_; + const edm::EDGetTokenT trackToken_; + const edm::EDGetTokenT vtxAssocTrackToken_; }; // constructor// L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer(const edm::ParameterSet& iConfig) : pvToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), - trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))) { + trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))), + vtxAssocTrackToken_(consumes(iConfig.getParameter("L1TrackAssociatedInputTag"))) { // Setup LUTs TrackTransform.generateLUTs(); phiQuadrants_ = TrackTransform.getPhiQuad(); @@ -111,28 +100,6 @@ L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer(const edm::Para // Name of output ED Product L1MetCollectionName_ = (std::string)iConfig.getParameter("L1MetCollectionName"); - // Input parameter cuts and convert to correct integer representations - maxZ0_ = l1tmetemu::digitizeSignedValue( - (double)iConfig.getParameter("maxZ0"), l1tmetemu::kInternalVTXWidth, l1tmetemu::kStepZ0); - minZ0_ = (1 << TTTrack_TrackWord::TrackBitWidths::kZ0Size) - maxZ0_; - - maxEta_ = l1tmetemu::digitizeSignedValue( - (double)iConfig.getParameter("maxEta"), l1tmetemu::kInternalEtaWidth, l1tmetemu::kStepEta); - - chi2rphiMax_ = - l1tmetemu::getBin((double)iConfig.getParameter("chi2rphidofMax"), TTTrack_TrackWord::chi2RPhiBins); - chi2rzMax_ = l1tmetemu::getBin((double)iConfig.getParameter("chi2rzdofMax"), TTTrack_TrackWord::chi2RZBins); - bendChi2Max_ = - l1tmetemu::getBin((double)iConfig.getParameter("bendChi2Max"), TTTrack_TrackWord::bendChi2Bins); - - minPt_ = l1tmetemu::digitizeSignedValue( - (double)iConfig.getParameter("minPt"), l1tmetemu::kInternalPtWidth, l1tmetemu::kStepPt); - - nStubsmin_ = (l1tmetemu::nstub_t)iConfig.getParameter("nStubsmin"); - - z0Thresholds_ = iConfig.getParameter>("z0Thresholds"); - etaRegions_ = iConfig.getParameter>("etaRegions"); - if (debug_ == 5) { cordicDebug_ = true; } @@ -143,8 +110,6 @@ L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer(const edm::Para // Compute LUTs cosLUT_ = l1tmetemu::generateCosLUT(cosLUTbins); - EtaRegionsLUT_ = l1tmetemu::generateEtaRegionLUT(etaRegions_); - DeltaZLUT_ = l1tmetemu::generateDeltaZLUT(z0Thresholds_); produces>(L1MetCollectionName_); } @@ -159,9 +124,12 @@ void L1TrackerEtMissEmulatorProducer::produce(edm::Event& iEvent, const edm::Eve edm::Handle L1VertexHandle; iEvent.getByToken(pvToken_, L1VertexHandle); - edm::Handle L1TTTrackHandle; + edm::Handle L1TTTrackHandle; iEvent.getByToken(trackToken_, L1TTTrackHandle); + edm::Handle L1TTTrackAssociatedHandle; + iEvent.getByToken(vtxAssocTrackToken_, L1TTTrackAssociatedHandle); + // Initialize cordic class Cordic cordicSqrt(l1tmetemu::kMETPhiBins, l1tmetemu::kMETSize, cordicSteps_, cordicDebug_); @@ -175,6 +143,11 @@ void L1TrackerEtMissEmulatorProducer::produce(edm::Event& iEvent, const edm::Eve return; } + if (!L1TTTrackAssociatedHandle.isValid()) { + LogError("L1TrackerEtMissEmulatorProducer") << "\nWarning: L1TTTrackAssociatedCollection not found in the event. Exit\n"; + return; + } + // Initialize sector sums, need 0 initialization in case a sector has no // tracks l1tmetemu::Et_t sumPx[l1tmetemu::kNSector * 2] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; @@ -182,70 +155,24 @@ void L1TrackerEtMissEmulatorProducer::produce(edm::Event& iEvent, const edm::Eve int sector_totals[l1tmetemu::kNSector] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; // Track counters - int num_tracks{0}; - int num_assoc_tracks{0}; int num_quality_tracks{0}; + int num_assoc_tracks{0}; // Get reference to first vertex in event vertex collection L1VertexType& vtx = const_cast(L1VertexHandle->at(0)); for (const auto& track : *L1TTTrackHandle) { - num_tracks++; - L1TTTrackType& track_ref = const_cast(track); // Get Reference to track to pass to TrackTransform + num_quality_tracks++; + L1TTTrackType& track_ref = const_cast(*track); // Get Reference to track to pass to TrackTransform // Convert to internal track representation InternalEtWord EtTrack = TrackTransform.transformTrack(track_ref, vtx); - // Parameter cuts - if (EtTrack.pt < minPt_) - continue; - - // Z signed so double bound - if (EtTrack.z0 & (1 << (l1tmetemu::kInternalVTXWidth - 1))) { - // if negative - if (EtTrack.z0 <= maxZ0_) - continue; - } else { - if (EtTrack.z0 > minZ0_) - continue; - } - if (EtTrack.eta > maxEta_) - continue; - - // Quality Cuts - if (EtTrack.chi2rphidof >= chi2rphiMax_) - continue; - - if (EtTrack.chi2rzdof >= chi2rzMax_) - continue; - - if (EtTrack.bendChi2 >= bendChi2Max_) - continue; - - if (EtTrack.nstubs < nStubsmin_) - continue; - - num_quality_tracks++; - - // Temporary int representation to get the difference - int tempz = l1tmetemu::unpackSignedValue(EtTrack.z0, l1tmetemu::kInternalVTXWidth); - int temppv = l1tmetemu::unpackSignedValue(EtTrack.pV, l1tmetemu::kInternalVTXWidth); - - l1tmetemu::z_t z_diff = abs(tempz - temppv); - - // Track to vertex association, adaptive z window based on eta region - for (unsigned int reg = 0; reg < l1tmetemu::kNEtaRegion; reg++) { - if (EtTrack.eta >= EtaRegionsLUT_[reg] && EtTrack.eta < EtaRegionsLUT_[reg + 1]) { - deltaZ0_ = DeltaZLUT_[reg]; - break; - } - } - - if (z_diff <= deltaZ0_) { + if (std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(), track) != L1TTTrackAssociatedHandle->end()) { num_assoc_tracks++; if (debug_ == 7) { edm::LogVerbatim("L1TrackerEtMissEmulatorProducer") - << "Track to Vertex ID: " << num_tracks << "\n" + << "Track to Vertex ID: " << num_quality_tracks << "\n" << "Phi Sector: " << EtTrack.Sector << " pT: " << EtTrack.pt << " Phi: " << EtTrack.globalPhi << " TanL: " << EtTrack.eta << " Z0: " << EtTrack.z0 << " Nstub: " << EtTrack.nstubs << " Chi2rphi: " << EtTrack.chi2rphidof << " Chi2rz: " << EtTrack.chi2rzdof @@ -410,7 +337,6 @@ void L1TrackerEtMissEmulatorProducer::produce(edm::Event& iEvent, const edm::Eve << "Integer MET: " << EtMiss.Et << "| Integer MET phi: " << EtMiss.Phi << "\n" << "Float MET: " << (EtMiss.Et) * l1tmetemu::kStepMET << "| Float MET phi: " << (float)tempPhi * l1tmetemu::kStepMETPhi - M_PI << "\n" - << "# Intial Tracks: " << num_tracks << "\n" << "# Tracks after Quality Cuts: " << num_quality_tracks << "\n" << "# Tracks Associated to Vertex: " << num_assoc_tracks << "\n" << "========================================================\n"; diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissEmulatorProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissEmulatorProducer_cfi.py index 87ea3ed5df1cc..445f9580d671a 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissEmulatorProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissEmulatorProducer_cfi.py @@ -1,25 +1,16 @@ import FWCore.ParameterSet.Config as cms from L1Trigger.VertexFinder.VertexProducer_cff import VertexProducer +from L1Trigger.L1TTrackMatch.L1TrackSelectionProducer_cfi import L1TrackSelectionProducer L1TrackerEmuEtMiss = cms.EDProducer('L1TrackerEtMissEmulatorProducer', - L1TrackInputTag = cms.InputTag("L1GTTInputProducer","Level1TTTracksConverted"), + L1TrackInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Emulation"), + L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "AssociatedEmulation"), # To bypass GTT input module use cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks") # and set useGTTinput to false L1VertexInputTag = cms.InputTag("VertexProducer", VertexProducer.l1VertexCollectionName.value()), # This will use the vertex algorithm as specified in VertexProducer_cff, if using emulated vertex # set useVertexEmulator to true L1MetCollectionName = cms.string("L1TrackerEmuEtMiss"), - - maxZ0 = cms.double ( 15. ) , # in cm - maxEta = cms.double ( 2.4 ) , # max eta allowed for chosen tracks - minPt = cms.double( 2.02 ), - chi2rzdofMax = cms.double( 5. ), # max chi2rz/dof allowed for chosen tracks - chi2rphidofMax = cms.double( 20. ), # max chi2rphi/dof allowed for chosen tracks - bendChi2Max = cms.double( 2.25 ),# max bendchi2 allowed for chosen tracks - nStubsmin = cms.int32( 4 ), # min number of stubs for the tracks - - z0Thresholds = cms.vdouble( 0.37, 0.5, 0.6, 0.75, 1.0, 1.6 ), # Threshold for track to vertex association. - etaRegions = cms.vdouble( 0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4 ), # Eta bins for choosing deltaZ threshold. nCordicSteps = cms.int32( 8 ), #Number of steps for cordic sqrt and phi computation debug = cms.int32( 0 ), #0 - No Debug, 1 - LUT debug, 2 - Phi Debug, 3 - Z debug, 4 - Et Debug, 5 - Cordic Debug, 6 - Output, 7 - Every Selected Track From 67b8dfd1284925316072740c2c21561d648099ac Mon Sep 17 00:00:00 2001 From: Alexx Perloff Date: Fri, 6 May 2022 16:15:32 -0500 Subject: [PATCH 20/66] Updates from the code format checks (cherry picked from commit 64f042f32c185c7c29bd267ae993bb6ca3c410b4) --- .../plugins/L1TrackerEtMissEmulatorProducer.cc | 9 ++++++--- .../L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc | 8 +++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc index 5700cebb822a6..e138575d7b0dd 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissEmulatorProducer.cc @@ -83,7 +83,8 @@ class L1TrackerEtMissEmulatorProducer : public edm::stream::EDProducer<> { L1TrackerEtMissEmulatorProducer::L1TrackerEtMissEmulatorProducer(const edm::ParameterSet& iConfig) : pvToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))), - vtxAssocTrackToken_(consumes(iConfig.getParameter("L1TrackAssociatedInputTag"))) { + vtxAssocTrackToken_( + consumes(iConfig.getParameter("L1TrackAssociatedInputTag"))) { // Setup LUTs TrackTransform.generateLUTs(); phiQuadrants_ = TrackTransform.getPhiQuad(); @@ -144,7 +145,8 @@ void L1TrackerEtMissEmulatorProducer::produce(edm::Event& iEvent, const edm::Eve } if (!L1TTTrackAssociatedHandle.isValid()) { - LogError("L1TrackerEtMissEmulatorProducer") << "\nWarning: L1TTTrackAssociatedCollection not found in the event. Exit\n"; + LogError("L1TrackerEtMissEmulatorProducer") + << "\nWarning: L1TTTrackAssociatedCollection not found in the event. Exit\n"; return; } @@ -168,7 +170,8 @@ void L1TrackerEtMissEmulatorProducer::produce(edm::Event& iEvent, const edm::Eve // Convert to internal track representation InternalEtWord EtTrack = TrackTransform.transformTrack(track_ref, vtx); - if (std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(), track) != L1TTTrackAssociatedHandle->end()) { + if (std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(), track) != + L1TTTrackAssociatedHandle->end()) { num_assoc_tracks++; if (debug_ == 7) { edm::LogVerbatim("L1TrackerEtMissEmulatorProducer") diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index 3032e4135db75..ab031e65ff838 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -48,7 +48,8 @@ class L1TrackerEtMissProducer : public edm::global::EDProducer<> { // constructor L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfig) : trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))), - vtxAssocTrackToken_(consumes(iConfig.getParameter("L1TrackAssociatedInputTag"))), + vtxAssocTrackToken_( + consumes(iConfig.getParameter("L1TrackAssociatedInputTag"))), L1MetCollectionName(iConfig.getParameter("L1MetCollectionName")), maxPt_(iConfig.getParameter("maxPt")), highPtTracks_(iConfig.getParameter("highPtTracks")), @@ -89,7 +90,7 @@ void L1TrackerEtMissProducer::produce(edm::StreamID, edm::Event& iEvent, const e int numqualitytracks = 0; int numassoctracks = 0; - for (const auto & track : *L1TTTrackHandle) { + for (const auto& track : *L1TTTrackHandle) { float pt = track->momentum().perp(); float phi = track->momentum().phi(); @@ -102,7 +103,8 @@ void L1TrackerEtMissProducer::produce(edm::StreamID, edm::Event& iEvent, const e numqualitytracks++; - if (std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(), track) != L1TTTrackAssociatedHandle->end()) { + if (std::find(L1TTTrackAssociatedHandle->begin(), L1TTTrackAssociatedHandle->end(), track) != + L1TTTrackAssociatedHandle->end()) { numassoctracks++; sumPx += pt * cos(phi); sumPy += pt * sin(phi); From 26d8e9f405c96073ff5a8a6e984f1d7165c982a6 Mon Sep 17 00:00:00 2001 From: Gianluca Date: Tue, 24 May 2022 15:44:01 +0200 Subject: [PATCH 21/66] Drop old e/g simulation (TDR) from sequence and event content (cherry picked from commit aa65bc62c5a3348a382a12099aad4510aeee5fe1) --- .../Configuration/python/L1Trigger_EventContent_cff.py | 3 +++ L1Trigger/Configuration/python/SimL1Emulator_cff.py | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index faea19d14a457..92c1964d0e787 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -182,6 +182,9 @@ def _appendPhase2Digis(obj): 'keep *_L1TowerCalibration_*_*', 'keep *_L1CaloJet_*_*', 'keep *_L1CaloJetHTT_*_*', + 'keep *_L1TkMuons_*_*', + 'keep *_L1TkGlbMuons_*_*', + 'keep *_L1TkMuonsTP_*_*', 'keep *_pfClustersFromL1EGClusters_*_*', 'keep *_pfClustersFromCombinedCaloHCal_*_*', 'keep *_pfClustersFromCombinedCaloHF_*_*', diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index b11653fde3701..b183831954095 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -135,8 +135,17 @@ # ######################################################################## from L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi import L1TkPrimaryVertex +from L1Trigger.L1TTrackMatch.L1TkMuonProducer_cfi import L1TkMuons, L1TkMuonsTP +from L1Trigger.L1TTrackMatch.L1TkGlbMuonProducer_cfi import L1TkGlbMuons + _phase2_siml1emulator.add(L1TkPrimaryVertex) + +_phase2_siml1emulator.add( L1TkMuons ) +_phase2_siml1emulator.add( L1TkMuonsTP ) +_phase2_siml1emulator.add( L1TkGlbMuons ) + + # Emulated GMT Muons (Tk + Stub, Tk + MuonTFT, StandaloneMuon) # ######################################################################## from L1Trigger.Phase2L1GMT.gmt_cfi import * From 4663a8762e34e780f03d1f629780e41bb1dcd047 Mon Sep 17 00:00:00 2001 From: Gianluca Date: Tue, 24 May 2022 15:44:37 +0200 Subject: [PATCH 22/66] Fix customization to be able to read files containing old PFCandidate formats (cherry picked from commit 82605313eb96ba9b7cf922d917ebd2eaef0e671f) --- .../Configuration/python/customisePhase2FEVTDEBUGHLT.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 L1Trigger/Configuration/python/customisePhase2FEVTDEBUGHLT.py diff --git a/L1Trigger/Configuration/python/customisePhase2FEVTDEBUGHLT.py b/L1Trigger/Configuration/python/customisePhase2FEVTDEBUGHLT.py new file mode 100644 index 0000000000000..077dfd402064d --- /dev/null +++ b/L1Trigger/Configuration/python/customisePhase2FEVTDEBUGHLT.py @@ -0,0 +1,5 @@ +import FWCore.ParameterSet.Config as cms + +def customisePhase2FEVTDEBUGHLT(process): + process.source.inputCommands = cms.untracked.vstring("keep *","drop l1tPFCandidates_*_*_RECO") + return process From e44c90e3b1230c2a83c6781cb8bdd4bf404a3395 Mon Sep 17 00:00:00 2001 From: Dylan Rankin Date: Thu, 26 May 2022 08:42:32 -0500 Subject: [PATCH 23/66] removing collections and configs (cherry picked from commit 27d6561f842203441f65cd0dd60db6b1bd279945) --- .../python/l1pfJetMet_cff.py | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py b/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py index 61c8cb9e1fa1b..f16c314809d3c 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py @@ -1,19 +1,5 @@ import FWCore.ParameterSet.Config as cms -from RecoMET.METProducers.pfMet_cfi import pfMet -_pfMet = pfMet.clone(calculateSignificance = False) -l1PFMetCalo = _pfMet.clone(src = "l1pfCandidates:Calo") -l1PFMetPF = _pfMet.clone(src = "l1pfCandidates:PF") -l1PFMetPuppi = _pfMet.clone(src = "l1pfCandidates:Puppi") - -l1PFMetsTask = cms.Task(l1PFMetCalo, l1PFMetPF, l1PFMetPuppi) - -from RecoJets.JetProducers.ak4PFJets_cfi import ak4PFJets -_ak4PFJets = ak4PFJets.clone(doAreaFastjet = False) -ak4PFL1Calo = _ak4PFJets.clone(src = 'l1pfCandidates:Calo') -ak4PFL1PF = _ak4PFJets.clone(src = 'l1pfCandidates:PF') -ak4PFL1Puppi = _ak4PFJets.clone(src = 'l1pfCandidates:Puppi') - from L1Trigger.Phase2L1ParticleFlow.L1SeedConePFJetProducer_cfi import L1SeedConePFJetProducer, L1SeedConePFJetEmulatorProducer from L1Trigger.Phase2L1ParticleFlow.DeregionizerProducer_cfi import DeregionizerProducer as l1ctLayer2Deregionizer scPFL1PF = L1SeedConePFJetProducer.clone(L1PFObjects = 'l1ctLayer1:PF') @@ -30,17 +16,11 @@ phase2_hgcalV10.toModify(_correctedJets, correctorFile = "L1Trigger/Phase2L1ParticleFlow/data/jecs/jecs.PU200_106X.root") from Configuration.Eras.Modifier_phase2_hgcalV11_cff import phase2_hgcalV11 phase2_hgcalV11.toModify(_correctedJets, correctorFile = "L1Trigger/Phase2L1ParticleFlow/data/jecs/jecs.PU200_110X.root") - -ak4PFL1CaloCorrected = _correctedJets.clone(jets = 'ak4PFL1Calo', correctorDir = 'L1CaloJets') -ak4PFL1PFCorrected = _correctedJets.clone(jets = 'ak4PFL1PF', correctorDir = 'L1PFJets') -ak4PFL1PuppiCorrected = _correctedJets.clone(jets = 'ak4PFL1Puppi', correctorDir = 'L1PuppiJets') scPFL1PuppiCorrectedEmulator = _correctedJets.clone(jets = 'scPFL1PuppiEmulator', correctorDir = 'L1PuppiSC4EmuDeregJets') l1PFJetsTask = cms.Task( - ak4PFL1Calo, ak4PFL1PF, ak4PFL1Puppi, - ak4PFL1CaloCorrected, ak4PFL1PFCorrected, ak4PFL1PuppiCorrected, - l1ctLayer2Deregionizer, scPFL1PF, scPFL1Puppi, scPFL1PuppiEmulator, scPFL1PuppiCorrectedEmulator + l1ctLayer2Deregionizer, scPFL1PF, scPFL1Puppi, scPFL1PuppiEmulator, scPFL1PuppiCorrectedEmulator, scPFL1PuppiCorrectedEmulatorMHT ) From 3c558baee40eb6bab0d3b24f87ea48ae4855f05b Mon Sep 17 00:00:00 2001 From: Dylan Rankin Date: Thu, 26 May 2022 09:50:25 -0500 Subject: [PATCH 24/66] more config removal (cherry picked from commit 3aff717eccde35b16bc638449765399c2d55e779) --- .../python/L1NNTauProducer_cff.py | 36 +- .../python/l1ParticleFlow_cff.py | 310 ------------------ .../python/l1pfProducer_cfi.py | 69 ---- 3 files changed, 32 insertions(+), 383 deletions(-) delete mode 100644 L1Trigger/Phase2L1ParticleFlow/python/l1ParticleFlow_cff.py delete mode 100644 L1Trigger/Phase2L1ParticleFlow/python/l1pfProducer_cfi.py diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py b/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py index c1ffa1b4d2f1f..a1208663ba593 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py @@ -1,7 +1,35 @@ import FWCore.ParameterSet.Config as cms -from L1Trigger.Phase2L1ParticleFlow.L1NNTauProducer_cfi import * +from L1Trigger.Phase2L1ParticleFlow.l1ctLayer1_cff import l1ctLayer1Barrel,l1ctLayer1HGCal,l1ctLayer1 + +#from L1Trigger.Phase2L1ParticleFlow.L1NNTauProducer_cfi import * + +#L1NNTauProducerPuppi = L1NNTauProducer.clone( +# NNFileName = cms.string("L1Trigger/Phase2L1ParticleFlow/data/tau_3layer_puppi.pb") +# ) + + +L1NNTauProducerPuppi = cms.EDProducer("L1NNTauProducer", + seedpt = cms.double(10), + conesize = cms.double(0.4), + tausize = cms.double(0.1), + maxtaus = cms.int32(5), + nparticles = cms.int32(10), + HW = cms.bool(True), + debug = cms.bool(False), + L1PFObjects = cms.InputTag("l1ctLayer1:Puppi"), #1pfCandidates:Puppi"),#l1pfCandidates + NNFileName = cms.string("L1Trigger/Phase2L1ParticleFlow/data/tau_3layer_puppi.pb") +) + +L1NNTauProducerPF = cms.EDProducer("L1NNTauProducer", + seedpt = cms.double(10), + conesize = cms.double(0.4), + tausize = cms.double(0.1), + maxtaus = cms.int32(5), + nparticles = cms.int32(10), + HW = cms.bool(True), + debug = cms.bool(False), + L1PFObjects = cms.InputTag("l1ctLayer1:PF"),#l1pfCandidates + NNFileName = cms.string("L1Trigger/Phase2L1ParticleFlow/data/tau_3layer.pb") +) -L1NNTauProducerPuppi = L1NNTauProducer.clone( - NNFileName = cms.string("L1Trigger/Phase2L1ParticleFlow/data/tau_3layer_puppi.pb") - ) diff --git a/L1Trigger/Phase2L1ParticleFlow/python/l1ParticleFlow_cff.py b/L1Trigger/Phase2L1ParticleFlow/python/l1ParticleFlow_cff.py deleted file mode 100644 index 2a6fbb286ab91..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/python/l1ParticleFlow_cff.py +++ /dev/null @@ -1,310 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from L1Trigger.Phase2L1ParticleFlow.pfTracksFromL1Tracks_cfi import pfTracksFromL1Tracks -from L1Trigger.Phase2L1ParticleFlow.pfClustersFromL1EGClusters_cfi import pfClustersFromL1EGClusters -from L1Trigger.Phase2L1ParticleFlow.pfClustersFromCombinedCalo_cff import pfClustersFromCombinedCaloHCal, pfClustersFromCombinedCaloHF -from L1Trigger.Phase2L1ParticleFlow.pfClustersFromHGC3DClusters_cfi import pfClustersFromHGC3DClusters -from L1Trigger.Phase2L1ParticleFlow.l1pfProducer_cfi import l1pfProducer -from L1Trigger.Phase2L1ParticleFlow.l1TkEgAlgo_cfi import tkEgConfig - -pfTracksFromL1TracksBarrel = pfTracksFromL1Tracks.clone( - resolCalo = pfClustersFromCombinedCaloHCal.resol.clone(), -) - - -l1ParticleFlow_calo_Task = cms.Task( - pfClustersFromL1EGClusters , - pfClustersFromCombinedCaloHCal , - pfClustersFromCombinedCaloHF , - pfClustersFromHGC3DClusters -) -l1ParticleFlow_calo = cms.Sequence(l1ParticleFlow_calo_Task) - -l1TkEgConfigBarrel = tkEgConfig.clone( - doBremRecovery=False, - writeEgSta=False -) - -# PF in the barrel -l1pfProducerBarrel = l1pfProducer.clone( - # inputs - tracks = cms.InputTag('pfTracksFromL1TracksBarrel'), - emClusters = [ cms.InputTag('pfClustersFromL1EGClusters') ], - hadClusters = [ cms.InputTag('pfClustersFromCombinedCaloHCal:calibrated') ], - # track-based PUPPI - puppiUsingBareTracks = True, - puppiDrMin = 0.07, - puppiPtMax = 50., - vtxAlgo = "external", - vtxFormat = cms.string("TkPrimaryVertex"), - vtxCollection = cms.InputTag("L1TkPrimaryVertex",""), - # eg algo configuration - tkEgAlgoConfig = l1TkEgConfigBarrel, - # puppi tuning - puAlgo = "LinearizedPuppi", - puppiEtaCuts = cms.vdouble( 1.6 ), # just one bin - puppiPtCuts = cms.vdouble( 1.0 ), - puppiPtCutsPhotons = cms.vdouble( 1.0 ), - puppiPtSlopes = cms.vdouble( 0.3 ), # coefficient for pT - puppiPtSlopesPhotons = cms.vdouble( 0.3 ), - puppiPtZeros = cms.vdouble( 4.0 ), # ballpark pT from PU - puppiPtZerosPhotons = cms.vdouble( 2.5 ), - puppiAlphaSlopes = cms.vdouble( 0.7 ), # coefficient for alpha - puppiAlphaSlopesPhotons = cms.vdouble( 0.7 ), - puppiAlphaZeros = cms.vdouble( 6.0 ), # ballpark alpha from PU - puppiAlphaZerosPhotons = cms.vdouble( 6.0 ), - puppiAlphaCrops = cms.vdouble( 4 ), # max. absolute value for alpha term - puppiAlphaCropsPhotons = cms.vdouble( 4 ), - puppiPriors = cms.vdouble( 5.0 ), - puppiPriorsPhotons = cms.vdouble( 1.0 ), - # regionalize - useRelativeRegionalCoordinates = cms.bool(False), - trackRegionMode = cms.string("atCalo"), - regions = cms.VPSet( - cms.PSet( - etaBoundaries = cms.vdouble(-1.5,1.5), - phiSlices = cms.uint32(1), - etaExtra = cms.double(0.3), - phiExtra = cms.double(0.0) - ), - ), -) -l1ParticleFlow_pf_barrel_Task = cms.Task( - pfTracksFromL1TracksBarrel , - l1pfProducerBarrel -) -l1ParticleFlow_pf_barrel = cms.Sequence(l1ParticleFlow_pf_barrel_Task) - - -l1TkEgConfigHGCal = tkEgConfig.clone( - debug=0 -) - -# PF in HGCal -pfTracksFromL1TracksHGCal = pfTracksFromL1Tracks.clone( - resolCalo = pfClustersFromHGC3DClusters.resol.clone(), -) -l1pfProducerHGCal = l1pfProducer.clone( - # algo - pfAlgo = "PFAlgo2HGC", - # inputs - tracks = cms.InputTag('pfTracksFromL1TracksHGCal'), - emClusters = [ cms.InputTag("pfClustersFromHGC3DClusters:egamma")], # used only for E/gamma - hadClusters = [ cms.InputTag("pfClustersFromHGC3DClusters") ], - # track-based PUPPI - puppiDrMin = 0.04, - puppiPtMax = 50., - puppiUsingBareTracks = True, - vtxAlgo = "external", - vtxFormat = cms.string("TkPrimaryVertex"), - vtxCollection = cms.InputTag("L1TkPrimaryVertex",""), - # eg algo configuration - tkEgAlgoConfig = l1TkEgConfigHGCal, - # puppi tuning - puAlgo = "LinearizedPuppi", - puppiEtaCuts = cms.vdouble( 2.0, 2.4, 3.1 ), # two bins in the tracker (different pT), one outside - puppiPtCuts = cms.vdouble( 1.0, 2.0, 4.0 ), - puppiPtCutsPhotons = cms.vdouble( 1.0, 2.0, 4.0 ), - puppiPtSlopes = cms.vdouble( 0.3, 0.3, 0.3 ), # coefficient for pT - puppiPtSlopesPhotons = cms.vdouble( 0.4, 0.4, 0.4 ), #When e/g ID not applied, use: cms.vdouble( 0.3, 0.3, 0.3 ), - puppiPtZeros = cms.vdouble( 5.0, 7.0, 9.0 ), # ballpark pT from PU - puppiPtZerosPhotons = cms.vdouble( 3.0, 4.0, 5.0 ), - puppiAlphaSlopes = cms.vdouble( 1.5, 1.5, 2.2 ), - puppiAlphaSlopesPhotons = cms.vdouble( 1.5, 1.5, 2.2 ), - puppiAlphaZeros = cms.vdouble( 6.0, 6.0, 9.0 ), - puppiAlphaZerosPhotons = cms.vdouble( 6.0, 6.0, 9.0 ), - puppiAlphaCrops = cms.vdouble( 3 , 3 , 4 ), # max. absolute value for alpha term - puppiAlphaCropsPhotons = cms.vdouble( 3 , 3 , 4 ), - puppiPriors = cms.vdouble( 5.0, 5.0, 7.0 ), - puppiPriorsPhotons = cms.vdouble( 1.5, 1.5, 5.0 ), #When e/g ID not applied, use: cms.vdouble( 3.5, 3.5, 7.0 ), - # regionalize - useRelativeRegionalCoordinates = cms.bool(False), - trackRegionMode = cms.string("atCalo"), - regions = cms.VPSet( - cms.PSet( - etaBoundaries = cms.vdouble(-2.5,-1.5), - phiSlices = cms.uint32(1), - etaExtra = cms.double(0.3), - phiExtra = cms.double(0.0) - ), - cms.PSet( - etaBoundaries = cms.vdouble(1.5,2.5), - phiSlices = cms.uint32(1), - etaExtra = cms.double(0.3), - phiExtra = cms.double(0.0) - ), - ), -) -l1pfProducerHGCal.linking.trackCaloDR = 0.1 # more precise cluster positions -l1pfProducerHGCal.linking.ecalPriority = False -l1pfProducerHGCalNoTK = l1pfProducerHGCal.clone(regions = cms.VPSet( - cms.PSet( - etaBoundaries = cms.vdouble(-3,-2.5), - phiSlices = cms.uint32(1), - etaExtra = cms.double(0.3), - phiExtra = cms.double(0.0) - ), - cms.PSet( - etaBoundaries = cms.vdouble(2.5,3), - phiSlices = cms.uint32(1), - etaExtra = cms.double(0.3), - phiExtra = cms.double(0.0) - ), -)) - -l1ParticleFlow_pf_hgcal_Task = cms.Task( - pfTracksFromL1TracksHGCal , - l1pfProducerHGCal , - l1pfProducerHGCalNoTK -) -l1ParticleFlow_pf_hgcal = cms.Sequence(l1ParticleFlow_pf_hgcal_Task) - -l1TkEgConfigHF = tkEgConfig.clone( - debug=0 -) -# PF in HF -l1pfProducerHF = l1pfProducer.clone( - # inputs - tracks = cms.InputTag(''), # no tracks - emClusters = [ ], - hadClusters = [ cms.InputTag('pfClustersFromCombinedCaloHF:calibrated') ], - hadPtCut = 15, - # not really useful, but for consistency - puppiDrMin = 0.1, - puppiPtMax = 100., - vtxAlgo = "external", - vtxFormat = cms.string("TkPrimaryVertex"), - vtxCollection = cms.InputTag("L1TkPrimaryVertex",""), - # eg algo configuration - tkEgAlgoConfig = l1TkEgConfigHF, - # puppi tuning - puAlgo = "LinearizedPuppi", - puppiEtaCuts = cms.vdouble( 5.5 ), # one bin - puppiPtCuts = cms.vdouble( 10. ), - puppiPtCutsPhotons = cms.vdouble( 10. ), # not used (no photons in HF) - puppiPtSlopes = cms.vdouble( 0.25), - puppiPtSlopesPhotons = cms.vdouble( 0.25), # not used (no photons in HF) - puppiPtZeros = cms.vdouble( 14. ), # ballpark pT from PU - puppiPtZerosPhotons = cms.vdouble( 14. ), # not used (no photons in HF) - puppiAlphaSlopes = cms.vdouble( 0.6 ), - puppiAlphaSlopesPhotons = cms.vdouble( 0.6 ), # not used (no photons in HF) - puppiAlphaZeros = cms.vdouble( 9.0 ), - puppiAlphaZerosPhotons = cms.vdouble( 9.0 ), # not used (no photons in HF) - puppiAlphaCrops = cms.vdouble( 4 ), - puppiAlphaCropsPhotons = cms.vdouble( 4 ), # not used (no photons in HF) - puppiPriors = cms.vdouble( 6.0 ), - puppiPriorsPhotons = cms.vdouble( 6.0 ), # not used (no photons in HF) - # regionalize - useRelativeRegionalCoordinates = cms.bool(False), - trackRegionMode = cms.string("atCalo"), - regions = cms.VPSet( - cms.PSet( - etaBoundaries = cms.vdouble(-5.5,-3), - phiSlices = cms.uint32(1), - etaExtra = cms.double(0.0), - phiExtra = cms.double(0.0) - ), - cms.PSet( - etaBoundaries = cms.vdouble(3,5.5), - phiSlices = cms.uint32(1), - etaExtra = cms.double(0.0), - phiExtra = cms.double(0.0) - ), - ) -) -l1ParticleFlow_pf_hf_Task = cms.Task( - l1pfProducerHF -) -l1ParticleFlow_pf_hf = cms.Sequence(l1ParticleFlow_pf_hf_Task) - - -# PF in the TSA Region -l1pfProducerTSA = l1pfProducerBarrel.clone( - trackRegionMode = cms.string("atVertex"), - regions = cms.VPSet( - cms.PSet( - etaBoundaries = cms.vdouble(-3,3), - phiSlices = cms.uint32(18), - etaExtra = cms.double(0.0), - phiExtra = cms.double(0.0) - ), - ), -) -l1ParticleFlow_pf_tsa = cms.Sequence( - pfTracksFromL1TracksBarrel + - l1pfProducerTSA -) - -# Merging all outputs -l1pfCandidates = cms.EDProducer("L1TPFCandMultiMerger", - pfProducers = cms.VInputTag( - cms.InputTag("l1pfProducerBarrel"), - cms.InputTag("l1pfProducerHGCal"), - cms.InputTag("l1pfProducerHGCalNoTK"), - cms.InputTag("l1pfProducerHF") - ), - labelsToMerge = cms.vstring("Calo", "TK", "TKVtx", "PF", "Puppi"), - regionalLabelsToMerge = cms.vstring(), -) - -l1tCorrelatorEG = cms.EDProducer( - "L1TEGMultiMerger", - tkElectrons=cms.VPSet( - cms.PSet( - instance=cms.string("L1TkEleEE"), - pfProducers=cms.VInputTag( - cms.InputTag("l1pfProducerHGCal", 'L1TkEle') - ) - ), - cms.PSet( - instance=cms.string("L1TkEleEB"), - pfProducers=cms.VInputTag( - cms.InputTag("l1pfProducerBarrel", 'L1TkEle') - ) - ) - ), - tkEms=cms.VPSet( - cms.PSet( - instance=cms.string("L1TkEmEE"), - pfProducers=cms.VInputTag( - cms.InputTag("l1pfProducerHGCal", 'L1TkEm'), - cms.InputTag("l1pfProducerHGCalNoTK", 'L1TkEm') - ) - ), - cms.PSet( - instance=cms.string("L1TkEmEB"), - pfProducers=cms.VInputTag( - cms.InputTag("l1pfProducerBarrel", 'L1TkEm') - ) - ) - ), - tkEgs=cms.VPSet( - cms.PSet( - instance=cms.string("L1EgEE"), - pfProducers=cms.VInputTag( - cms.InputTag("l1pfProducerHGCal", 'L1Eg'), - cms.InputTag("l1pfProducerHGCalNoTK", 'L1Eg') - ) - ) - ) -) - -l1ParticleFlow_proper = cms.Sequence( - l1ParticleFlow_calo + - l1ParticleFlow_pf_barrel + - l1ParticleFlow_pf_hgcal + - l1ParticleFlow_pf_hf + - l1pfCandidates + - l1tCorrelatorEG -) - -l1ParticleFlow = cms.Sequence(l1ParticleFlow_proper) - -l1ParticleFlowTask = cms.Task( - l1ParticleFlow_calo_Task, - l1ParticleFlow_pf_barrel_Task, - l1ParticleFlow_pf_hgcal_Task, - l1ParticleFlow_pf_hf_Task, - cms.Task(l1pfCandidates), - cms.Task(l1tCorrelatorEG), -) diff --git a/L1Trigger/Phase2L1ParticleFlow/python/l1pfProducer_cfi.py b/L1Trigger/Phase2L1ParticleFlow/python/l1pfProducer_cfi.py deleted file mode 100644 index 6503d52cacf3a..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/python/l1pfProducer_cfi.py +++ /dev/null @@ -1,69 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from math import sqrt - -l1pfProducer = cms.EDProducer("L1TPFProducer", - tracks = cms.InputTag('pfTracksFromL1Tracks'), - muons = cms.InputTag('simGmtStage2Digis',), - tkMuons = cms.InputTag('L1TkMuons'), - # type of muons to be used in PF (enable only one at a time) - useStandaloneMuons = cms.bool(True), - useTrackerMuons = cms.bool(False), - emClusters = cms.VInputTag(cms.InputTag('pfClustersFromHGC3DClustersEM'), cms.InputTag('pfClustersFromL1EGClusters')), - hadClusters = cms.VInputTag(cms.InputTag('pfClustersFromCombinedCalo:calibrated')), - emPtCut = cms.double(0.5), - hadPtCut = cms.double(1.0), - trkPtCut = cms.double(2.0), - etaCharged = cms.double(2.5), - puppiDr = cms.double(0.3), - puppiDrMin = cms.double(0.1), - puppiPtMax = cms.double(999), - puppiEtaCuts = cms.vdouble(1.5, 2.5, 3.0, 5.5), - puppiPtCuts = cms.vdouble(0.0, 3.0, 6.0, 8.0), - puppiPtCutsPhotons = cms.vdouble(0.0, 3.0, 6.0, 8.0), - puppiUsingBareTracks = cms.bool(False), # use PF - nVtx = cms.int32(2), - vtxRes = cms.double(0.333), - vtxAlgo = cms.string("TP"), - vtxAdaptiveCut = cms.bool(True), - pfAlgo = cms.string("PFAlgo3"), - puAlgo = cms.string("Puppi"), - linking = cms.PSet( - # track -> mu linking configurables - trackMuDR = cms.double(0.2), # accounts for poor resolution of standalone, and missing propagations - trackMuMatch = cms.string("boxBestByPtRatio"), # also drBestByPtRatio - # track -> em linking configurables - trackEmDR = cms.double(0.04), # 1 Ecal crystal size is 0.02, and ~2 cm in HGCal is ~0.007 - trackEmUseAlsoTrackSigma = cms.bool(True), # also use the track uncertainty for electron linking - trackEmMayUseCaloMomenta = cms.bool(True), # use calo momenta for 1 emcalo to 1 track match electrons - # em -> calo linking configurables - emCaloDR = cms.double(0.10), # 1 Hcal tower size is ~0.09 - caloEmPtMinFrac = cms.double(0.5), # Calo object must have an EM Et at least half of that of the EM cluster to allow linking - emCaloUseAlsoCaloSigma = cms.bool(True), # also use the track uncertainty for electron linking - emCaloSubtractionPtSlope = cms.double(1.2), # e/pi ratio of HCal - # track -> calo linking configurables - trackCaloLinkMetric = cms.string("bestByDRPt"), - #trackCaloLinkMetric = cms.string("bestByDR"), - trackCaloDR = cms.double(0.15), - trackCaloNSigmaLow = cms.double(2.0), - trackCaloNSigmaHigh = cms.double(sqrt(1.0)), # sqrt(x) since in the hardware we use sigma squared - useTrackCaloSigma = cms.bool(True), # take the uncertainty on the calo cluster from the track, for linking purposes - sumTkCaloErr2 = cms.bool(True), # add up track calo errors in quadrature instead of linearly - rescaleTracks = cms.bool(False), # if tracks exceed the calo, rescale the track momenta - useCaloTrkWeightedAverage = cms.bool(False), # do the weighted average of track & calo pTs if it's a 1-1 link - # how to deal with unlinked tracks - maxInvisiblePt = cms.double(10.0), # max allowed pt of a track with no calo energy - tightTrackMaxInvisiblePt = cms.double(20), - # how to deal with neutrals - ecalPriority = cms.bool(True), # take first ecal energy when making neutrals - # other features not turned on: reliniking of neutrals to track-matched calo clusters with track excess - caloReLink = cms.bool(False), - caloReLinkDR = cms.double(0.3), - caloReLinkThreshold = cms.double(0.5), - # other features not turned on: matching too high pt tracks to calo but rescaling track pt (not implemented in PFAlgo3) - rescaleUnmatchedTrack = cms.bool(False), - ), - sortOutputs = cms.bool(True), - sortInputs = cms.bool(True), - debug = cms.untracked.int32(0), -) From 85f2f6fcdd3c96cde09735be1ddc4d2ba4847c0e Mon Sep 17 00:00:00 2001 From: Dylan Rankin Date: Thu, 26 May 2022 09:51:15 -0500 Subject: [PATCH 25/66] deleting old modules (cherry picked from commit 8630eab1be62006291eb2f713b4516862cafa36a) --- .../interface/LinearizedPuppiAlgo.h | 33 -- .../interface/PUAlgoBase.h | 45 --- .../interface/PuppiAlgo.h | 39 -- .../plugins/L1TPFProducer.cc | 361 ------------------ .../src/LinearizedPuppiAlgo.cc | 145 ------- .../Phase2L1ParticleFlow/src/PUAlgoBase.cc | 208 ---------- .../Phase2L1ParticleFlow/src/PuppiAlgo.cc | 273 ------------- 7 files changed, 1104 deletions(-) delete mode 100644 L1Trigger/Phase2L1ParticleFlow/interface/LinearizedPuppiAlgo.h delete mode 100644 L1Trigger/Phase2L1ParticleFlow/interface/PUAlgoBase.h delete mode 100644 L1Trigger/Phase2L1ParticleFlow/interface/PuppiAlgo.h delete mode 100644 L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFProducer.cc delete mode 100644 L1Trigger/Phase2L1ParticleFlow/src/LinearizedPuppiAlgo.cc delete mode 100644 L1Trigger/Phase2L1ParticleFlow/src/PUAlgoBase.cc delete mode 100644 L1Trigger/Phase2L1ParticleFlow/src/PuppiAlgo.cc diff --git a/L1Trigger/Phase2L1ParticleFlow/interface/LinearizedPuppiAlgo.h b/L1Trigger/Phase2L1ParticleFlow/interface/LinearizedPuppiAlgo.h deleted file mode 100644 index a281176015912..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/interface/LinearizedPuppiAlgo.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef L1Trigger_Phase2L1ParticleFlow_LinearizedPuppiAlgo_h -#define L1Trigger_Phase2L1ParticleFlow_LinearizedPuppiAlgo_h - -#include "L1Trigger/Phase2L1ParticleFlow/interface/PuppiAlgo.h" - -namespace l1tpf_impl { - - class LinearizedPuppiAlgo : public PuppiAlgo { - public: - LinearizedPuppiAlgo(const edm::ParameterSet &); - ~LinearizedPuppiAlgo() override; - - const std::vector &puGlobalNames() const override; - void doPUGlobals(const std::vector &rs, float z0, float npu, std::vector &globals) const override; - void runNeutralsPU(Region &r, float z0, float npu, const std::vector &globals) const override; - - protected: - void computePuppiWeights(Region &r, - float npu, - const std::vector &alphaC, - const std::vector &alphaF) const; - - std::vector puppiPriors_, puppiPriorsPhotons_; - std::vector puppiPtSlopes_, puppiPtSlopesPhotons_; - std::vector puppiPtZeros_, puppiPtZerosPhotons_; - std::vector puppiAlphaSlopes_, puppiAlphaSlopesPhotons_; - std::vector puppiAlphaZeros_, puppiAlphaZerosPhotons_; - std::vector puppiAlphaCrops_, puppiAlphaCropsPhotons_; - }; - -} // namespace l1tpf_impl - -#endif diff --git a/L1Trigger/Phase2L1ParticleFlow/interface/PUAlgoBase.h b/L1Trigger/Phase2L1ParticleFlow/interface/PUAlgoBase.h deleted file mode 100644 index 0262ffffe3636..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/interface/PUAlgoBase.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef L1Trigger_Phase2L1ParticleFlow_PUAlgoBase_h -#define L1Trigger_Phase2L1ParticleFlow_PUAlgoBase_h - -#include "L1Trigger/Phase2L1ParticleFlow/interface/Region.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -namespace l1tpf_impl { - - class PUAlgoBase { - public: - PUAlgoBase(const edm::ParameterSet &); - virtual ~PUAlgoBase(); - - /// global operations - enum class VertexAlgo { Old, TP, External }; - virtual void doVertexing(std::vector &rs, - VertexAlgo algo, - float &vz) const; // region is not const since it sets the fromPV bit of the tracks - - virtual void doVertexings( - std::vector &rs, - VertexAlgo algo, - std::vector &vz) const; // region is not const since it sets the fromPV bit of the tracks - - virtual void runChargedPV(Region &r, float z0) const; - virtual void runChargedPV(Region &r, std::vector &z0) const; - - virtual const std::vector &puGlobalNames() const; - virtual void doPUGlobals(const std::vector &rs, float z0, float npu, std::vector &globals) const = 0; - virtual void runNeutralsPU(Region &r, float z0, float npu, const std::vector &globals) const = 0; - virtual void runNeutralsPU(Region &r, - std::vector &z0, - float npu, - const std::vector &globals) const = 0; - - protected: - int debug_; - float etaCharged_, vtxRes_; - bool vtxAdaptiveCut_; - int nVtx_; - }; - -} // namespace l1tpf_impl - -#endif diff --git a/L1Trigger/Phase2L1ParticleFlow/interface/PuppiAlgo.h b/L1Trigger/Phase2L1ParticleFlow/interface/PuppiAlgo.h deleted file mode 100644 index bfcbc208ddeed..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/interface/PuppiAlgo.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef L1Trigger_Phase2L1ParticleFlow_PuppiAlgo_h -#define L1Trigger_Phase2L1ParticleFlow_PuppiAlgo_h - -#include "L1Trigger/Phase2L1ParticleFlow/interface/PUAlgoBase.h" - -namespace l1tpf_impl { - - class PuppiAlgo : public PUAlgoBase { - public: - PuppiAlgo(const edm::ParameterSet &); - ~PuppiAlgo() override; - - const std::vector &puGlobalNames() const override; - void doPUGlobals(const std::vector &rs, float z0, float npu, std::vector &globals) const override; - void runNeutralsPU(Region &r, float z0, float npu, const std::vector &globals) const override; - void runNeutralsPU(Region &r, std::vector &z0, float npu, const std::vector &globals) const override; - - protected: - virtual void computePuppiMedRMS( - const std::vector &rs, float &alphaCMed, float &alphaCRms, float &alphaFMed, float &alphaFRms) const; - virtual void fillPuppi(Region &r) const; - virtual void computePuppiAlphas(const Region &r, std::vector &alphaC, std::vector &alphaF) const; - void computePuppiWeights(Region &r, - const std::vector &alphaC, - const std::vector &alphaF, - float alphaCMed, - float alphaCRms, - float alphaFMed, - float alphaFRms) const; - - float puppiDr_, puppiDrMin_, puppiPtMax_; - std::vector puppiEtaCuts_, puppiPtCuts_, puppiPtCutsPhotons_; - std::vector intPuppiEtaCuts_, intPuppiPtCuts_, intPuppiPtCutsPhotons_; - bool puppiUsingBareTracks_; - }; - -} // namespace l1tpf_impl - -#endif diff --git a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFProducer.cc b/L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFProducer.cc deleted file mode 100644 index e5c21e798facf..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/plugins/L1TPFProducer.cc +++ /dev/null @@ -1,361 +0,0 @@ -// system include files -#include -#include -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" - -#include "DataFormats/Common/interface/View.h" -#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" - -#include "DataFormats/Math/interface/deltaR.h" - -#include "L1Trigger/Phase2L1ParticleFlow/interface/RegionMapper.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/PFAlgoBase.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/PFAlgo3.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/PFAlgo2HGC.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/PFTkEGAlgo.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/PuppiAlgo.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/LinearizedPuppiAlgo.h" - -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" - -#include "DataFormats/L1TCorrelator/interface/TkElectron.h" -#include "DataFormats/L1TCorrelator/interface/TkElectronFwd.h" -#include "DataFormats/L1Trigger/interface/EGamma.h" -#include "DataFormats/L1TCorrelator/interface/TkEm.h" -#include "DataFormats/L1TCorrelator/interface/TkEmFwd.h" - -//-------------------------------------------------------------------------------------------------- -class L1TPFProducer : public edm::stream::EDProducer<> { -public: - explicit L1TPFProducer(const edm::ParameterSet&); - ~L1TPFProducer() override; - -private: - edm::ParameterSet config_; - int debug_; - - bool useStandaloneMuons_; - bool useTrackerMuons_; - - bool hasTracks_; - edm::EDGetTokenT tkCands_; - float trkPt_; - l1tpf_impl::PUAlgoBase::VertexAlgo vtxAlgo_; - edm::EDGetTokenT> extTkVtx_; - - edm::EDGetTokenT muCands_; // standalone muons - edm::EDGetTokenT tkMuCands_; // tk muons - - std::vector> emCands_; - std::vector> hadCands_; - - float emPtCut_, hadPtCut_; - - bool sortOutputs_; - - l1tpf_impl::RegionMapper l1regions_; - std::unique_ptr l1pfalgo_; - std::unique_ptr l1pualgo_; - std::unique_ptr l1tkegalgo_; - - // region of interest debugging - float debugEta_, debugPhi_, debugR_; - - void beginStream(edm::StreamID) override; - void produce(edm::Event&, const edm::EventSetup&) override; - void addUInt(unsigned int value, std::string iLabel, edm::Event& iEvent); -}; - -// -// constructors and destructor -// -L1TPFProducer::L1TPFProducer(const edm::ParameterSet& iConfig) - : config_(iConfig), - debug_(iConfig.getUntrackedParameter("debug", 0)), - useStandaloneMuons_(iConfig.getParameter("useStandaloneMuons")), - useTrackerMuons_(iConfig.getParameter("useTrackerMuons")), - hasTracks_(!iConfig.getParameter("tracks").label().empty()), - tkCands_(hasTracks_ ? consumes(iConfig.getParameter("tracks")) - : edm::EDGetTokenT()), - trkPt_(iConfig.getParameter("trkPtCut")), - muCands_(consumes(iConfig.getParameter("muons"))), - tkMuCands_(consumes(iConfig.getParameter("tkMuons"))), - emPtCut_(iConfig.getParameter("emPtCut")), - hadPtCut_(iConfig.getParameter("hadPtCut")), - sortOutputs_(iConfig.getParameter("sortOutputs")), - l1regions_(iConfig), - l1pfalgo_(nullptr), - l1pualgo_(nullptr), - l1tkegalgo_(nullptr), - debugEta_(iConfig.getUntrackedParameter("debugEta", 0)), - debugPhi_(iConfig.getUntrackedParameter("debugPhi", 0)), - debugR_(iConfig.getUntrackedParameter("debugR", -1)) { - produces("PF"); - produces("Puppi"); - - produces("EmCalo"); - produces("Calo"); - produces("TK"); - produces("TKVtx"); - - produces("z0"); - - for (const auto& tag : iConfig.getParameter>("emClusters")) { - emCands_.push_back(consumes(tag)); - } - for (const auto& tag : iConfig.getParameter>("hadClusters")) { - hadCands_.push_back(consumes(tag)); - } - - const std::string& algo = iConfig.getParameter("pfAlgo"); - if (algo == "PFAlgo3") { - l1pfalgo_ = std::make_unique(iConfig); - } else if (algo == "PFAlgo2HGC") { - l1pfalgo_ = std::make_unique(iConfig); - } else - throw cms::Exception("Configuration", "Unsupported PFAlgo"); - - const std::string& pualgo = iConfig.getParameter("puAlgo"); - if (pualgo == "Puppi") { - l1pualgo_ = std::make_unique(iConfig); - } else if (pualgo == "LinearizedPuppi") { - l1pualgo_ = std::make_unique(iConfig); - } else - throw cms::Exception("Configuration", "Unsupported PUAlgo"); - - l1tkegalgo_ = std::make_unique(iConfig.getParameter("tkEgAlgoConfig")); - if (l1tkegalgo_->writeEgSta()) - produces>("L1Eg"); - produces("L1TkEle"); - produces("L1TkEm"); - - std::string vtxAlgo = iConfig.getParameter("vtxAlgo"); - if (vtxAlgo == "TP") - vtxAlgo_ = l1tpf_impl::PUAlgoBase::VertexAlgo::TP; - else if (vtxAlgo == "old") - vtxAlgo_ = l1tpf_impl::PUAlgoBase::VertexAlgo::Old; - else if (vtxAlgo == "external") { - vtxAlgo_ = l1tpf_impl::PUAlgoBase::VertexAlgo::External; - const std::string& vtxFormat = iConfig.getParameter("vtxFormat"); - if (vtxFormat == "TkPrimaryVertex") { - extTkVtx_ = consumes>(iConfig.getParameter("vtxCollection")); - } else - throw cms::Exception("Configuration") << "Unsupported vtxFormat " << vtxFormat << "\n"; - } else - throw cms::Exception("Configuration") << "Unsupported vtxAlgo " << vtxAlgo << "\n"; - - for (const std::string& label : l1pualgo_->puGlobalNames()) { - produces(label); - } - - for (int tot = 0; tot <= 1; ++tot) { - for (int i = 0; i < l1tpf_impl::Region::n_input_types; ++i) { - produces(std::string(tot ? "totNL1" : "maxNL1") + l1tpf_impl::Region::inputTypeName(i)); - } - for (int i = 0; i < l1tpf_impl::Region::n_output_types; ++i) { - produces(std::string(tot ? "totNL1PF" : "maxNL1PF") + l1tpf_impl::Region::outputTypeName(i)); - produces(std::string(tot ? "totNL1Puppi" : "maxNL1Puppi") + l1tpf_impl::Region::outputTypeName(i)); - } - } - for (int i = 0; i < l1tpf_impl::Region::n_input_types; ++i) { - produces>(std::string("vecNL1") + l1tpf_impl::Region::inputTypeName(i)); - } - for (int i = 0; i < l1tpf_impl::Region::n_output_types; ++i) { - produces>(std::string("vecNL1PF") + l1tpf_impl::Region::outputTypeName(i)); - produces>(std::string("vecNL1Puppi") + l1tpf_impl::Region::outputTypeName(i)); - } -} - -L1TPFProducer::~L1TPFProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -void L1TPFProducer::beginStream(edm::StreamID id) {} - -// ------------ method called to produce the data ------------ -void L1TPFProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // clear the regions also at the beginning, in case one event didn't complete but the job continues on - l1regions_.clear(); - - /// ------ READ TRACKS ---- - if (hasTracks_) { - edm::Handle htracks; - iEvent.getByToken(tkCands_, htracks); - const auto& tracks = *htracks; - for (unsigned int itk = 0, ntk = tracks.size(); itk < ntk; ++itk) { - const auto& tk = tracks[itk]; - // adding objects to PF - if (debugR_ > 0 && deltaR(tk.eta(), tk.phi(), debugEta_, debugPhi_) > debugR_) - continue; - if (tk.pt() > trkPt_ && tk.quality() > 0) { - l1regions_.addTrack(tk, l1t::PFTrackRef(htracks, itk)); - } - } - } - - /// ------ READ MUONS ---- - /// ------- first check that not more than one version of muons (standaloneMu or trackerMu) is set to be used in l1pflow - if (useStandaloneMuons_ && useTrackerMuons_) { - throw cms::Exception( - "Configuration", - "setting useStandaloneMuons=True && useTrackerMuons=True is not to be done, as it would duplicate all muons\n"); - } - - if (useStandaloneMuons_) { - edm::Handle muons; - iEvent.getByToken(muCands_, muons); - for (auto it = muons->begin(0), ed = muons->end(0); it != ed; ++it) { - const l1t::Muon& mu = *it; - if (debugR_ > 0 && deltaR(mu.eta(), mu.phi(), debugEta_, debugPhi_) > debugR_) - continue; - l1regions_.addMuon(mu); - } - } - - if (useTrackerMuons_) { - edm::Handle muons; - iEvent.getByToken(tkMuCands_, muons); - for (auto it = muons->begin(), ed = muons->end(); it != ed; ++it) { - const l1t::TkMuon& mu = *it; - if (debugR_ > 0 && deltaR(mu.eta(), mu.phi(), debugEta_, debugPhi_) > debugR_) - continue; - l1regions_.addMuon(mu); // FIXME add a l1t::PFCandidate::MuonRef - } - } - - // ------ READ CALOS ----- - edm::Handle caloHandle; - for (const auto& tag : emCands_) { - iEvent.getByToken(tag, caloHandle); - const auto& calos = *caloHandle; - for (unsigned int ic = 0, nc = calos.size(); ic < nc; ++ic) { - const auto& calo = calos[ic]; - if (debugR_ > 0 && deltaR(calo.eta(), calo.phi(), debugEta_, debugPhi_) > debugR_) - continue; - if (calo.pt() > emPtCut_) - l1regions_.addEmCalo(calo, l1t::PFClusterRef(caloHandle, ic)); - } - } - for (const auto& tag : hadCands_) { - iEvent.getByToken(tag, caloHandle); - const auto& calos = *caloHandle; - for (unsigned int ic = 0, nc = calos.size(); ic < nc; ++ic) { - const auto& calo = calos[ic]; - if (debugR_ > 0 && deltaR(calo.eta(), calo.phi(), debugEta_, debugPhi_) > debugR_) - continue; - if (calo.pt() > hadPtCut_) - l1regions_.addCalo(calo, l1t::PFClusterRef(caloHandle, ic)); - } - } - - // First, get a copy of the discretized and corrected inputs, and write them out - iEvent.put(l1regions_.fetchCalo(/*ptmin=*/0.1, /*em=*/true), "EmCalo"); - iEvent.put(l1regions_.fetchCalo(/*ptmin=*/0.1, /*em=*/false), "Calo"); - iEvent.put(l1regions_.fetchTracks(/*ptmin=*/0.0, /*fromPV=*/false), "TK"); - - // Then do the vertexing, and save it out - std::vector z0s; - std::vector> ptsums; - float z0 = 0; - if (vtxAlgo_ == l1tpf_impl::PUAlgoBase::VertexAlgo::External) { - double ptsum = 0; - if (!extTkVtx_.isUninitialized()) { - edm::Handle> vtxHandle; - iEvent.getByToken(extTkVtx_, vtxHandle); - //std::cout << "---> PF Ext == NVTx == " << vtxHandle->size() << std::endl; - for (const l1t::TkPrimaryVertex& vtx : *vtxHandle) { - ptsums.push_back(std::pair(vtx.zvertex(), vtx.sum())); - if (ptsum == 0 || vtx.sum() > ptsum) { - z0 = vtx.zvertex(); - ptsum = vtx.sum(); - } - } - } else - throw cms::Exception("LogicError", "Inconsistent vertex configuration"); - } - std::stable_sort(ptsums.begin(), ptsums.end(), [](const auto& a, const auto& b) { return a.first > b.first; }); - for (unsigned i0 = 0; i0 < ptsums.size(); i0++) { - z0s.push_back(ptsums[i0].second); - } - //l1pualgo_->doVertexing(l1regions_.regions(), vtxAlgo_, z0); - l1pualgo_->doVertexings(l1regions_.regions(), vtxAlgo_, z0s); - iEvent.put(std::make_unique(z0), "z0"); - - // Then also save the tracks with a vertex cut - iEvent.put(l1regions_.fetchTracks(/*ptmin=*/0.0, /*fromPV=*/true), "TKVtx"); - - // Then run PF in each region - for (auto& l1region : l1regions_.regions()) { - l1pfalgo_->runPF(l1region); - l1tkegalgo_->runTkEG(l1region); - l1pualgo_->runChargedPV(l1region, z0s); - // this is a separate step since the z0 from vertex might come at different latency - l1tkegalgo_->runTkIso(l1region, z0); - l1tkegalgo_->runPFIso(l1region, z0); - } - // Then get our alphas (globally) - std::vector puGlobals; - l1pualgo_->doPUGlobals(l1regions_.regions(), z0, -1., puGlobals); // FIXME we don't have yet an external PU estimate - const std::vector& puGlobalNames = l1pualgo_->puGlobalNames(); - if (puGlobals.size() != puGlobalNames.size()) - throw cms::Exception("LogicError", "Mismatch in the number of global pileup inputs"); - for (unsigned int i = 0, n = puGlobalNames.size(); i < n; ++i) { - iEvent.put(std::make_unique(puGlobals[i]), puGlobalNames[i]); - } - - // Then run puppi (regionally) - for (auto& l1region : l1regions_.regions()) { - l1pualgo_->runNeutralsPU(l1region, z0s, -1., puGlobals); - l1region.outputCrop(sortOutputs_); - } - - // save PF into the event - iEvent.put(l1regions_.fetch(false), "PF"); - - // and save puppi - iEvent.put(l1regions_.fetch(true), "Puppi"); - - // save the EG objects - l1regions_.putEgObjects(iEvent, l1tkegalgo_->writeEgSta(), "L1Eg", "L1TkEm", "L1TkEle"); - - // Then go do the multiplicities - - for (int i = 0; i < l1tpf_impl::Region::n_input_types; ++i) { - auto totAndMax = l1regions_.totAndMaxInput(i); - addUInt(totAndMax.first, std::string("totNL1") + l1tpf_impl::Region::inputTypeName(i), iEvent); - addUInt(totAndMax.second, std::string("maxNL1") + l1tpf_impl::Region::inputTypeName(i), iEvent); - iEvent.put(l1regions_.vecInput(i), std::string("vecNL1") + l1tpf_impl::Region::inputTypeName(i)); - } - for (int i = 0; i < l1tpf_impl::Region::n_output_types; ++i) { - auto totAndMaxPF = l1regions_.totAndMaxOutput(i, false); - auto totAndMaxPuppi = l1regions_.totAndMaxOutput(i, true); - addUInt(totAndMaxPF.first, std::string("totNL1PF") + l1tpf_impl::Region::outputTypeName(i), iEvent); - addUInt(totAndMaxPF.second, std::string("maxNL1PF") + l1tpf_impl::Region::outputTypeName(i), iEvent); - addUInt(totAndMaxPuppi.first, std::string("totNL1Puppi") + l1tpf_impl::Region::outputTypeName(i), iEvent); - addUInt(totAndMaxPuppi.second, std::string("maxNL1Puppi") + l1tpf_impl::Region::outputTypeName(i), iEvent); - iEvent.put(l1regions_.vecOutput(i, false), std::string("vecNL1PF") + l1tpf_impl::Region::outputTypeName(i)); - iEvent.put(l1regions_.vecOutput(i, true), std::string("vecNL1Puppi") + l1tpf_impl::Region::outputTypeName(i)); - } - - // finally clear the regions - l1regions_.clear(); -} - -void L1TPFProducer::addUInt(unsigned int value, std::string iLabel, edm::Event& iEvent) { - iEvent.put(std::make_unique(value), iLabel); -} - -//define this as a plug-in -#include "FWCore/Framework/interface/MakerMacros.h" -DEFINE_FWK_MODULE(L1TPFProducer); diff --git a/L1Trigger/Phase2L1ParticleFlow/src/LinearizedPuppiAlgo.cc b/L1Trigger/Phase2L1ParticleFlow/src/LinearizedPuppiAlgo.cc deleted file mode 100644 index d9232c19f6a10..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/src/LinearizedPuppiAlgo.cc +++ /dev/null @@ -1,145 +0,0 @@ -#include "L1Trigger/Phase2L1ParticleFlow/interface/LinearizedPuppiAlgo.h" -#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/dbgPrintf.h" - -#include "Math/ProbFunc.h" - -namespace { - std::vector vd2vf(const std::vector &vd) { - std::vector ret; - ret.insert(ret.end(), vd.begin(), vd.end()); - return ret; - } -} // namespace - -using namespace l1tpf_impl; - -LinearizedPuppiAlgo::LinearizedPuppiAlgo(const edm::ParameterSet &iConfig) - : PuppiAlgo(iConfig), - puppiPriors_(vd2vf(iConfig.getParameter>("puppiPriors"))), - puppiPriorsPhotons_(vd2vf(iConfig.getParameter>("puppiPriorsPhotons"))), - puppiPtSlopes_(vd2vf(iConfig.getParameter>("puppiPtSlopes"))), - puppiPtSlopesPhotons_(vd2vf(iConfig.getParameter>("puppiPtSlopesPhotons"))), - puppiPtZeros_(vd2vf(iConfig.getParameter>("puppiPtZeros"))), - puppiPtZerosPhotons_(vd2vf(iConfig.getParameter>("puppiPtZerosPhotons"))), - puppiAlphaSlopes_(vd2vf(iConfig.getParameter>("puppiAlphaSlopes"))), - puppiAlphaSlopesPhotons_(vd2vf(iConfig.getParameter>("puppiAlphaSlopesPhotons"))), - puppiAlphaZeros_(vd2vf(iConfig.getParameter>("puppiAlphaZeros"))), - puppiAlphaZerosPhotons_(vd2vf(iConfig.getParameter>("puppiAlphaZerosPhotons"))), - puppiAlphaCrops_(vd2vf(iConfig.getParameter>("puppiAlphaCrops"))), - puppiAlphaCropsPhotons_(vd2vf(iConfig.getParameter>("puppiAlphaCropsPhotons"))) { - if (puppiPriors_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiPriors\n"); - if (puppiPtSlopes_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiPtSlopes\n"); - if (puppiPtZeros_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiPtZeros\n"); - if (puppiAlphaSlopes_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaSlopes\n"); - if (puppiAlphaZeros_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaZeros\n"); - if (puppiAlphaCrops_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaCrops\n"); - if (puppiPriorsPhotons_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiPriorsPhotons\n"); - if (puppiPtSlopesPhotons_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiPtSlopesPhotons\n"); - if (puppiPtZerosPhotons_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiPtZerosPhotons\n"); - if (puppiAlphaSlopesPhotons_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaSlopesPhotons\n"); - if (puppiAlphaZerosPhotons_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaZerosPhotons\n"); - if (puppiAlphaCropsPhotons_.size() != puppiEtaCuts_.size()) - throw cms::Exception("Configuration", "Mismatched lenght for puppiAlphaCropsPhotons\n"); -} - -LinearizedPuppiAlgo::~LinearizedPuppiAlgo() {} - -const std::vector &LinearizedPuppiAlgo::puGlobalNames() const { - static const std::vector names_{}; - return names_; -} -void LinearizedPuppiAlgo::doPUGlobals(const std::vector &rs, - float z0, - float npu, - std::vector &globals) const { - globals.clear(); -} -void LinearizedPuppiAlgo::runNeutralsPU(Region &r, float z0, float npu, const std::vector &globals) const { - std::vector alphaC, alphaF; - PuppiAlgo::computePuppiAlphas(r, alphaC, alphaF); - computePuppiWeights(r, npu, alphaC, alphaF); - PuppiAlgo::fillPuppi(r); -} - -void LinearizedPuppiAlgo::computePuppiWeights(Region &r, - float npu, - const std::vector &alphaC, - const std::vector &alphaF) const { - if (debug_ && npu > 0) - dbgPrintf("LinPup\t npu estimate %7.2f --> log(npu/200) = %+6.2f \n", npu, std::log(npu / 200.f)); - for (unsigned int ip = 0, np = r.pf.size(); ip < np; ++ip) { - PFParticle &p = r.pf[ip]; - // charged - if (p.hwId == l1t::PFCandidate::ChargedHadron || p.hwId == l1t::PFCandidate::Electron || - p.hwId == l1t::PFCandidate::Muon) { - p.setPuppiW(p.chargedPV || p.hwId == l1t::PFCandidate::Muon ? 1.0 : 0); - if (debug_ == 2) - dbgPrintf( - "LinPup\t charged id %1d pt %7.2f eta %+5.2f phi %+5.2f fromPV %1d " - " --> puppi weight %.3f puppi pt %7.2f \n", - p.hwId, - p.floatPt(), - p.floatEta(), - p.floatPhi(), - p.chargedPV, - p.floatPuppiW(), - p.floatPt() * p.floatPuppiW()); - continue; - } - // neutral - float absEta = r.relativeCoordinates ? r.globalAbsEta(p.floatEta()) : std::abs(p.floatEta()); - bool central = absEta < etaCharged_; // FIXME could make a better integer implementation - bool photon = (p.hwId == l1t::PFCandidate::Photon); - // get alpha - float alpha = central ? alphaC[ip] : alphaF[ip]; - alpha = (alpha > 0 ? std::log(alpha) : 0); - // get eta bin - unsigned int ietaBin = 0, lastBin = puppiEtaCuts_.size() - 1; - while (ietaBin < lastBin && absEta > puppiEtaCuts_[ietaBin]) { - ietaBin++; - } - float alphaZero = (photon ? puppiAlphaZerosPhotons_ : puppiAlphaZeros_)[ietaBin]; - float alphaSlope = (photon ? puppiAlphaSlopesPhotons_ : puppiAlphaSlopes_)[ietaBin]; - float alphaCrop = (photon ? puppiAlphaCropsPhotons_ : puppiAlphaCrops_)[ietaBin]; - float x2a = std::clamp(alphaSlope * (alpha - alphaZero), -alphaCrop, alphaCrop); - // weight by pT - float ptZero = (photon ? puppiPtZerosPhotons_ : puppiPtZeros_)[ietaBin]; - float ptSlope = (photon ? puppiPtSlopesPhotons_ : puppiPtSlopes_)[ietaBin]; - float x2pt = ptSlope * (p.floatPt() - ptZero); - // weight by prior - float prior = (photon ? puppiPriorsPhotons_ : puppiPriors_)[ietaBin]; - float x2prior = (npu > 0 ? std::log(npu / 200.f) : 0) + prior; - // total - float x2 = x2a + x2pt - x2prior; - p.setPuppiW(1.0 / (1.0 + std::exp(-x2))); - if (debug_ == 1 || debug_ == 2 || debug_ == int(10 + ietaBin)) - dbgPrintf( - "LinPup\t neutral id %1d pt %7.2f eta %+5.2f phi %+5.2f alpha %+6.2f x2a %+5.2f x2pt %+6.2f x2prior " - "%+6.2f --> x2 %+6.2f --> puppi weight %.3f puppi pt %7.2f \n", - p.hwId, - p.floatPt(), - p.floatEta(), - p.floatPhi(), - alpha, - x2a, - x2pt, - -x2prior, - x2, - p.floatPuppiW(), - p.floatPt() * p.floatPuppiW()); - } -} diff --git a/L1Trigger/Phase2L1ParticleFlow/src/PUAlgoBase.cc b/L1Trigger/Phase2L1ParticleFlow/src/PUAlgoBase.cc deleted file mode 100644 index b5bff3e21f93f..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/src/PUAlgoBase.cc +++ /dev/null @@ -1,208 +0,0 @@ -#include "L1Trigger/Phase2L1ParticleFlow/interface/PUAlgoBase.h" - -#include - -using namespace l1tpf_impl; - -PUAlgoBase::PUAlgoBase(const edm::ParameterSet &iConfig) - : debug_(iConfig.getUntrackedParameter("debug", 0)), - etaCharged_(iConfig.getParameter("etaCharged")), - vtxRes_(iConfig.getParameter("vtxRes")), - vtxAdaptiveCut_(iConfig.getParameter("vtxAdaptiveCut")), - nVtx_(iConfig.getParameter("nVtx")) {} - -PUAlgoBase::~PUAlgoBase() {} - -void PUAlgoBase::runChargedPV(Region &r, float z0) const { - int16_t iZ0 = round(z0 * InputTrack::Z0_SCALE); - int16_t iDZ = round(1.5 * vtxRes_ * InputTrack::Z0_SCALE); - int16_t iDZ2 = vtxAdaptiveCut_ ? round(4.0 * vtxRes_ * InputTrack::Z0_SCALE) : iDZ; - for (PFParticle &p : r.pf) { - bool barrel = std::abs(p.track.hwVtxEta) < InputTrack::VTX_ETA_1p3; - if (r.relativeCoordinates) - barrel = - (std::abs(r.globalAbsEta(p.track.floatVtxEta())) < 1.3); // FIXME could make a better integer implementation - p.chargedPV = (p.hwId <= 1 && std::abs(p.track.hwZ0 - iZ0) < (barrel ? iDZ : iDZ2)); - } -} - -void PUAlgoBase::runChargedPV(Region &r, std::vector &z0s) const { - int16_t iDZ = round(1.5 * vtxRes_ * InputTrack::Z0_SCALE); - int16_t iDZ2 = vtxAdaptiveCut_ ? round(4.0 * vtxRes_ * InputTrack::Z0_SCALE) : iDZ; - for (PFParticle &p : r.pf) { - bool barrel = std::abs(p.track.hwVtxEta) < InputTrack::VTX_ETA_1p3; - if (r.relativeCoordinates) - barrel = - (std::abs(r.globalAbsEta(p.track.floatVtxEta())) < 1.3); // FIXME could make a better integer implementation - //p.chargedPV = (p.hwId <= 1 && std::abs(p.track.hwZ0 - iZ0) < (barrel ? iDZ : iDZ2)); - bool pFromPV = false; - for (int v = 0; v < nVtx_; v++) { - int16_t iZ0 = round(z0s[v] * InputTrack::Z0_SCALE); - if (std::abs(p.track.hwZ0 - iZ0) < (barrel ? iDZ : iDZ2)) - pFromPV = true; - } - p.chargedPV = pFromPV; - } -} - -void PUAlgoBase::doVertexing(std::vector &rs, VertexAlgo algo, float &pvdz) const { - int lNBins = int(40. / vtxRes_); - if (algo == VertexAlgo::TP) - lNBins *= 3; - std::unique_ptr h_dz(new TH1F("h_dz", "h_dz", lNBins, -20, 20)); - if (algo != VertexAlgo::External) { - for (const Region &r : rs) { - for (const PropagatedTrack &p : r.track) { - if (rs.size() > 1) { - if (!r.fiducialLocal(p.floatVtxEta(), p.floatVtxPhi())) - continue; // skip duplicates - } - h_dz->Fill(p.floatDZ(), std::min(p.floatPt(), 50.f)); - } - } - } - switch (algo) { - case VertexAlgo::External: - break; - case VertexAlgo::Old: { - int imaxbin = h_dz->GetMaximumBin(); - pvdz = h_dz->GetXaxis()->GetBinCenter(imaxbin); - }; break; - case VertexAlgo::TP: { - float max = 0; - int bmax = -1; - for (int b = 1; b <= lNBins; ++b) { - float sum3 = h_dz->GetBinContent(b) + h_dz->GetBinContent(b + 1) + h_dz->GetBinContent(b - 1); - if (bmax == -1 || sum3 > max) { - max = sum3; - bmax = b; - } - } - pvdz = h_dz->GetXaxis()->GetBinCenter(bmax); - }; break; - } - int16_t iZ0 = round(pvdz * InputTrack::Z0_SCALE); - int16_t iDZ = round(1.5 * vtxRes_ * InputTrack::Z0_SCALE); - int16_t iDZ2 = vtxAdaptiveCut_ ? round(4.0 * vtxRes_ * InputTrack::Z0_SCALE) : iDZ; - for (Region &r : rs) { - for (PropagatedTrack &p : r.track) { - bool central = std::abs(p.hwVtxEta) < InputTrack::VTX_ETA_1p3; - if (r.relativeCoordinates) - central = - (std::abs(r.globalAbsEta(p.floatVtxEta())) < 1.3); // FIXME could make a better integer implementation - p.fromPV = (std::abs(p.hwZ0 - iZ0) < (central ? iDZ : iDZ2)); - } - } -} - -void PUAlgoBase::doVertexings(std::vector &rs, VertexAlgo algo, std::vector &pvdz) const { - int lNBins = int(40. / vtxRes_); - if (algo == VertexAlgo::TP || algo == VertexAlgo::External) - lNBins *= 3; - std::unique_ptr h_dz(new TH1F("h_dz", "h_dz", lNBins, -20, 20)); - for (const Region &r : rs) { - for (const PropagatedTrack &p : r.track) { - if (rs.size() > 1) { - if (!r.fiducialLocal(p.floatVtxEta(), p.floatVtxPhi())) - continue; // skip duplicates - } - h_dz->Fill(p.floatDZ(), std::min(p.floatPt(), 50.f)); - } - } - switch (algo) { - case VertexAlgo::External: { - int lBin[nVtx_]; - for (int vtx = 0; vtx < int(nVtx_); vtx++) - lBin[vtx] = -1; - for (int vtx = 0; vtx < int(nVtx_) - int(pvdz.size()); vtx++) { - float max = 0; - for (int b = 1; b <= lNBins; ++b) { - bool pPass = false; - for (int v = 0; v < vtx; v++) { - if (lBin[v] == b) - pPass = true; - } - if (pPass) - continue; - float sum3 = h_dz->GetBinContent(b) + h_dz->GetBinContent(b + 1) + h_dz->GetBinContent(b - 1); - if (lBin[vtx] == -1 || sum3 > max) { - max = sum3; - lBin[vtx] = b; - } - } - float tmpdz = h_dz->GetXaxis()->GetBinCenter(lBin[vtx]); - pvdz.push_back(tmpdz); - } - } break; - case VertexAlgo::Old: { - int lBin[nVtx_]; - for (int vtx = 0; vtx < nVtx_; ++vtx) { - float pMax = 0; - lBin[vtx] = -1; - for (int b = 1; b <= lNBins; ++b) { - bool pPass = false; - for (int v = 0; v < vtx; v++) { - if (lBin[v] == b) - pPass = true; - } - if (pPass) - continue; - float pVal = h_dz->GetBinContent(b); - if (pMax < pVal || lBin[vtx] == -1) { - pMax = pVal; - lBin[vtx] = b; - } - } - float tmpdz = h_dz->GetXaxis()->GetBinCenter(lBin[vtx]); - pvdz.push_back(tmpdz); - } - }; break; - case VertexAlgo::TP: { - int lBin[nVtx_]; - for (int vtx = 0; vtx < int(nVtx_); vtx++) - lBin[vtx] = -1; - for (int vtx = 0; vtx < nVtx_; vtx++) { - float max = 0; - for (int b = 1; b <= lNBins; ++b) { - bool pPass = false; - for (int v = 0; v < vtx; v++) { - if (lBin[v] == b) - pPass = true; - } - if (pPass) - continue; - float sum3 = h_dz->GetBinContent(b) + h_dz->GetBinContent(b + 1) + h_dz->GetBinContent(b - 1); - if (lBin[vtx] == -1 || sum3 > max) { - max = sum3; - lBin[vtx] = b; - } - } - float tmpdz = h_dz->GetXaxis()->GetBinCenter(lBin[vtx]); - pvdz.push_back(tmpdz); - } - }; break; - } - - int16_t iDZ = round(1.5 * vtxRes_ * InputTrack::Z0_SCALE); - int16_t iDZ2 = vtxAdaptiveCut_ ? round(4.0 * vtxRes_ * InputTrack::Z0_SCALE) : iDZ; - for (Region &r : rs) { - for (PropagatedTrack &p : r.track) { - bool central = std::abs(p.hwVtxEta) < InputTrack::VTX_ETA_1p3; - if (r.relativeCoordinates) - central = - (std::abs(r.globalAbsEta(p.floatVtxEta())) < 1.3); // FIXME could make a better integer implementation - bool pFromPV = false; - for (int v = 0; v < nVtx_; v++) { - int16_t iZ0 = round(pvdz[v] * InputTrack::Z0_SCALE); - if (std::abs(p.hwZ0 - iZ0) < (central ? iDZ : iDZ2)) - pFromPV = true; - } - p.fromPV = pFromPV; - } - } -} - -const std::vector &PUAlgoBase::puGlobalNames() const { - static const std::vector empty_; - return empty_; -} diff --git a/L1Trigger/Phase2L1ParticleFlow/src/PuppiAlgo.cc b/L1Trigger/Phase2L1ParticleFlow/src/PuppiAlgo.cc deleted file mode 100644 index 41b1780df2906..0000000000000 --- a/L1Trigger/Phase2L1ParticleFlow/src/PuppiAlgo.cc +++ /dev/null @@ -1,273 +0,0 @@ -#include "L1Trigger/Phase2L1ParticleFlow/interface/PuppiAlgo.h" -#include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" -#include "FWCore/Utilities/interface/Exception.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "L1Trigger/Phase2L1ParticleFlow/interface/dbgPrintf.h" - -#include "Math/ProbFunc.h" - -namespace { - std::vector vd2vf(const std::vector &vd) { - std::vector ret; - ret.insert(ret.end(), vd.begin(), vd.end()); - return ret; - } -} // namespace - -using namespace l1tpf_impl; - -PuppiAlgo::PuppiAlgo(const edm::ParameterSet &iConfig) - : PUAlgoBase(iConfig), - puppiDr_(iConfig.getParameter("puppiDr")), - puppiDrMin_(iConfig.getParameter("puppiDrMin")), - puppiPtMax_(iConfig.getParameter("puppiPtMax")), - puppiEtaCuts_(vd2vf(iConfig.getParameter>("puppiEtaCuts"))), - puppiPtCuts_(vd2vf(iConfig.getParameter>("puppiPtCuts"))), - puppiPtCutsPhotons_(vd2vf(iConfig.getParameter>("puppiPtCutsPhotons"))), - puppiUsingBareTracks_(iConfig.getParameter("puppiUsingBareTracks")) { - debug_ = iConfig.getUntrackedParameter("puppiDebug", debug_); - if (puppiEtaCuts_.size() != puppiPtCuts_.size() || puppiPtCuts_.size() != puppiPtCutsPhotons_.size()) { - throw cms::Exception("Configuration", "Bad PUPPI config"); - } - for (unsigned int i = 0, n = puppiEtaCuts_.size(); i < n; ++i) { - intPuppiEtaCuts_.push_back(std::round(puppiEtaCuts_[i] * CaloCluster::ETAPHI_SCALE)); - intPuppiPtCuts_.push_back(std::round(puppiPtCuts_[i] * CaloCluster::PT_SCALE)); - intPuppiPtCutsPhotons_.push_back(std::round(puppiPtCutsPhotons_[i] * CaloCluster::PT_SCALE)); - } -} - -PuppiAlgo::~PuppiAlgo() {} - -const std::vector &PuppiAlgo::puGlobalNames() const { - static const std::vector names_{"alphaCMed", "alphaCRms", "alphaFMed", "alphaFRms"}; - return names_; -} -void PuppiAlgo::doPUGlobals(const std::vector &rs, float z0, float npu, std::vector &globals) const { - globals.resize(4); - computePuppiMedRMS(rs, globals[0], globals[1], globals[2], globals[3]); -} - -void PuppiAlgo::runNeutralsPU(Region &r, float z0, float npu, const std::vector &globals) const { - std::vector alphaC, alphaF; - computePuppiAlphas(r, alphaC, alphaF); - computePuppiWeights(r, alphaC, alphaF, globals[0], globals[1], globals[2], globals[3]); - fillPuppi(r); -} - -void PuppiAlgo::runNeutralsPU(Region &r, std::vector &z0, float npu, const std::vector &globals) const { - float z0tmp = 0; - runNeutralsPU(r, z0tmp, npu, globals); -} - -void PuppiAlgo::computePuppiAlphas(const Region &r, std::vector &alphaC, std::vector &alphaF) const { - alphaC.resize(r.pf.size()); - alphaF.resize(r.pf.size()); - float puppiDr2 = std::pow(puppiDr_, 2), puppiDr2min = std::pow(puppiDrMin_, 2); - for (unsigned int ip = 0, np = r.pf.size(); ip < np; ++ip) { - const PFParticle &p = r.pf[ip]; - if (p.hwId <= 1) - continue; - // neutral - alphaC[ip] = 0; - alphaF[ip] = 0; - for (const PFParticle &p2 : r.pf) { - float dr2 = ::deltaR2(p.floatEta(), p.floatPhi(), p2.floatEta(), p2.floatPhi()); - if (dr2 > 0 && dr2 < puppiDr2) { - float w = std::pow(std::min(p2.floatPt(), puppiPtMax_), 2) / std::max(puppiDr2min, dr2); - alphaF[ip] += w; - if (p2.chargedPV) - alphaC[ip] += w; - } - } - if (puppiUsingBareTracks_) { - alphaC[ip] = 0; - for (const PropagatedTrack &p2 : r.track) { - if (!p2.fromPV) - continue; - if (!p2.quality(l1tpf_impl::InputTrack::PFLOOSE)) - continue; - float dr2 = ::deltaR2(p.floatEta(), p.floatPhi(), p2.floatEta(), p2.floatPhi()); - if (dr2 > 0 && dr2 < puppiDr2) { - alphaC[ip] += std::pow(std::min(p2.floatPt(), puppiPtMax_), 2) / std::max(puppiDr2min, dr2); - } - } - } - } -} - -void PuppiAlgo::computePuppiWeights(Region &r, - const std::vector &alphaC, - const std::vector &alphaF, - float alphaCMed, - float alphaCRms, - float alphaFMed, - float alphaFRms) const { - int16_t ietacut = std::round(etaCharged_ * CaloCluster::ETAPHI_SCALE); - for (unsigned int ip = 0, np = r.pf.size(); ip < np; ++ip) { - PFParticle &p = r.pf[ip]; - // charged - if (p.hwId == l1t::PFCandidate::ChargedHadron || p.hwId == l1t::PFCandidate::Electron || - p.hwId == l1t::PFCandidate::Muon) { - p.setPuppiW(p.chargedPV || p.hwId == l1t::PFCandidate::Muon ? 1.0 : 0); - if (debug_) - dbgPrintf( - "PUPPI \t charged id %1d pt %7.2f eta %+5.2f phi %+5.2f alpha %+7.2f x2 %+7.2f --> puppi weight %.3f " - "puppi pt %7.2f \n", - p.hwId, - p.floatPt(), - p.floatEta(), - p.floatPhi(), - 0., - 0., - p.floatPuppiW(), - p.floatPt() * p.floatPuppiW()); - continue; - } - // neutral - float alpha = -99, x2 = -99; - bool central = std::abs(p.hwEta) < ietacut; - if (r.relativeCoordinates) - central = - (std::abs(r.globalAbsEta(p.floatEta())) < etaCharged_); // FIXME could make a better integer implementation - if (central) { - if (alphaC[ip] > 0) { - alpha = std::log(alphaC[ip]); - x2 = (alpha - alphaCMed) * std::abs(alpha - alphaCMed) / std::pow(alphaCRms, 2); - p.setPuppiW(ROOT::Math::chisquared_cdf(x2, 1)); - } else { - p.setPuppiW(0); - } - } else { - if (alphaF[ip] > 0) { - alpha = std::log(alphaF[ip]); - x2 = (alpha - alphaFMed) * std::abs(alpha - alphaFMed) / std::pow(alphaFRms, 2); - p.setPuppiW(ROOT::Math::chisquared_cdf(x2, 1)); - } else { - p.setPuppiW(0); - } - } - if (debug_) - dbgPrintf( - "PUPPI \t neutral id %1d pt %7.2f eta %+5.2f phi %+5.2f alpha %+7.2f x2 %+7.2f --> puppi weight %.3f " - "puppi pt %7.2f \n", - p.hwId, - p.floatPt(), - p.floatEta(), - p.floatPhi(), - alpha, - x2, - p.floatPuppiW(), - p.floatPt() * p.floatPuppiW()); - } -} - -void PuppiAlgo::computePuppiMedRMS( - const std::vector &rs, float &alphaCMed, float &alphaCRms, float &alphaFMed, float &alphaFRms) const { - std::vector alphaFs; - std::vector alphaCs; - int16_t ietacut = std::round(etaCharged_ * CaloCluster::ETAPHI_SCALE); - float puppiDr2 = std::pow(puppiDr_, 2), puppiDr2min = std::pow(puppiDrMin_, 2); - for (const Region &r : rs) { - for (const PFParticle &p : r.pf) { - bool central = std::abs(p.hwEta) < ietacut; - if (r.relativeCoordinates) - central = (r.globalAbsEta(p.floatEta()) < etaCharged_); // FIXME could make a better integer implementation - if (central) { - if (p.hwId > 1 || p.chargedPV) - continue; - } - float alphaC = 0, alphaF = 0; - for (const PFParticle &p2 : r.pf) { - float dr2 = ::deltaR2(p.floatEta(), p.floatPhi(), p2.floatEta(), p2.floatPhi()); - if (dr2 > 0 && dr2 < puppiDr2) { - float w = std::pow(std::min(p2.floatPt(), puppiPtMax_), 2) / std::max(puppiDr2min, dr2); - alphaF += w; - if (p2.chargedPV) - alphaC += w; - } - } - if (puppiUsingBareTracks_) { - alphaC = 0; - for (const PropagatedTrack &p2 : r.track) { - if (!p2.fromPV) - continue; - float dr2 = ::deltaR2(p.floatEta(), p.floatPhi(), p2.floatEta(), p2.floatPhi()); - if (dr2 > 0 && dr2 < puppiDr2) { - alphaC += std::pow(std::min(p2.floatPt(), puppiPtMax_), 2) / std::max(puppiDr2min, dr2); - } - } - } - if (central) { - if (alphaC > 0) - alphaCs.push_back(std::log(alphaC)); - } else { - if (alphaF > 0) - alphaFs.push_back(std::log(alphaF)); - } - } - } - std::sort(alphaCs.begin(), alphaCs.end()); - std::sort(alphaFs.begin(), alphaFs.end()); - - if (alphaCs.size() > 1) { - alphaCMed = alphaCs[alphaCs.size() / 2 + 1]; - double sum = 0.0; - for (float alpha : alphaCs) - sum += std::pow(alpha - alphaCMed, 2); - alphaCRms = std::sqrt(float(sum) / alphaCs.size()); - } else { - alphaCMed = 8.; - alphaCRms = 8.; - } - - if (alphaFs.size() > 1) { - alphaFMed = alphaFs[alphaFs.size() / 2 + 1]; - double sum = 0.0; - for (float alpha : alphaFs) - sum += std::pow(alpha - alphaFMed, 2); - alphaFRms = std::sqrt(float(sum) / alphaFs.size()); - } else { - alphaFMed = 6.; - alphaFRms = 6.; - } - if (debug_) - dbgPrintf("PUPPI \t alphaC = %+6.2f +- %6.2f (%4lu), alphaF = %+6.2f +- %6.2f (%4lu)\n", - alphaCMed, - alphaCRms, - alphaCs.size(), - alphaFMed, - alphaFRms, - alphaFs.size()); -} - -void PuppiAlgo::fillPuppi(Region &r) const { - uint16_t PUPPIW_0p01 = std::round(0.01 * PFParticle::PUPPI_SCALE); - r.puppi.clear(); - for (PFParticle &p : r.pf) { - if (p.hwId == l1t::PFCandidate::ChargedHadron || p.hwId == l1t::PFCandidate::Electron || - p.hwId == l1t::PFCandidate::Muon) { // charged - if (p.hwPuppiWeight > 0) { - r.puppi.push_back(p); - } - } else { // neutral - if (p.hwPuppiWeight > PUPPIW_0p01) { - // FIXME would work better with PUPPI_SCALE being a power of two, to do the shift - // FIXME done with floats - int16_t hwPt = (float(p.hwPt) * float(p.hwPuppiWeight) / float(PFParticle::PUPPI_SCALE)); - int16_t hwPtCut = 0, hwAbsEta = r.relativeCoordinates - ? round(r.globalAbsEta(p.floatEta()) * CaloCluster::ETAPHI_SCALE) - : std::abs(p.hwEta); - for (unsigned int ietaBin = 0, nBins = intPuppiEtaCuts_.size(); ietaBin < nBins; ++ietaBin) { - if (hwAbsEta < intPuppiEtaCuts_[ietaBin]) { - hwPtCut = (p.hwId == l1t::PFCandidate::Photon ? intPuppiPtCutsPhotons_[ietaBin] : intPuppiPtCuts_[ietaBin]); - break; - } - } - if (hwPt > hwPtCut) { - r.puppi.push_back(p); - r.puppi.back().hwPt = hwPt; - } - } - } - } -} From 2ad4f29208c306626c45b45a106fe0fa9d7818cb Mon Sep 17 00:00:00 2001 From: Santiago Date: Fri, 27 May 2022 10:25:53 +0200 Subject: [PATCH 26/66] drop old muon simulation (TDR) from sequence and event content (cherry picked from commit 1730a584a78db1f356f88c1fd8644a86127d0671) --- .../python/L1Trigger_EventContent_cff.py | 13 ++++++++++--- L1Trigger/Configuration/python/SimL1Emulator_cff.py | 9 ++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 92c1964d0e787..3691ffb2cc0a6 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -182,9 +182,16 @@ def _appendPhase2Digis(obj): 'keep *_L1TowerCalibration_*_*', 'keep *_L1CaloJet_*_*', 'keep *_L1CaloJetHTT_*_*', - 'keep *_L1TkMuons_*_*', - 'keep *_L1TkGlbMuons_*_*', - 'keep *_L1TkMuonsTP_*_*', + 'keep *_L1TkElectronsCrystal_*_*', + 'keep *_L1TkElectronsLooseCrystal_*_*', + 'keep *_L1TkElectronsEllipticMatchCrystal_*_*', + 'keep *_L1TkIsoElectronsCrystal_*_*', + 'keep *_L1TkPhotonsCrystal_*_*', + 'keep *_L1TkElectronsHGC_*_*', + 'keep *_L1TkElectronsEllipticMatchHGC_*_*', + 'keep *_L1TkElectronsLooseHGC_*_*', + 'keep *_L1TkIsoElectronsHGC_*_*', + 'keep *_L1TkPhotonsHGC_*_*', 'keep *_pfClustersFromL1EGClusters_*_*', 'keep *_pfClustersFromCombinedCaloHCal_*_*', 'keep *_pfClustersFromCombinedCaloHF_*_*', diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index b183831954095..30b29d14b0828 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -135,17 +135,12 @@ # ######################################################################## from L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi import L1TkPrimaryVertex -from L1Trigger.L1TTrackMatch.L1TkMuonProducer_cfi import L1TkMuons, L1TkMuonsTP -from L1Trigger.L1TTrackMatch.L1TkGlbMuonProducer_cfi import L1TkGlbMuons +from L1Trigger.L1TTrackMatch.L1TkElectronTrackProducer_cfi import L1TkElectronsCrystal, L1TkElectronsLooseCrystal, L1TkElectronsEllipticMatchCrystal, L1TkIsoElectronsCrystal, L1TkElectronsHGC, L1TkElectronsEllipticMatchHGC, L1TkIsoElectronsHGC, L1TkElectronsLooseHGC +from L1Trigger.L1TTrackMatch.L1TkEmParticleProducer_cfi import L1TkPhotonsCrystal, L1TkPhotonsHGC _phase2_siml1emulator.add(L1TkPrimaryVertex) -_phase2_siml1emulator.add( L1TkMuons ) -_phase2_siml1emulator.add( L1TkMuonsTP ) -_phase2_siml1emulator.add( L1TkGlbMuons ) - - # Emulated GMT Muons (Tk + Stub, Tk + MuonTFT, StandaloneMuon) # ######################################################################## from L1Trigger.Phase2L1GMT.gmt_cfi import * From 0ce1e79bf48db53649e829bdad60b8808b46b332 Mon Sep 17 00:00:00 2001 From: Santiago Date: Fri, 27 May 2022 11:23:37 +0200 Subject: [PATCH 27/66] drop old (TDR) modules for TkMuon collections, now they are generated with the GMT emulator (cherry picked from commit fdd13d34a4409666dedde61feac2865c1e14cef7) --- .../interface/L1TkMuCorrDynamicWindows.h | 132 --- .../L1TTrackMatch/interface/L1TkMuMantra.h | 125 --- .../L1TTrackMatch/interface/MuMatchWindow.h | 44 - .../plugins/L1TkGlbMuonProducer.cc | 340 -------- .../L1TTrackMatch/plugins/L1TkMuonProducer.cc | 782 ------------------ .../python/L1TkGlbMuonProducer_cfi.py | 20 - .../python/L1TkMuonProducer_cfi.py | 79 -- .../src/L1TkMuCorrDynamicWindows.cc | 408 --------- L1Trigger/L1TTrackMatch/src/L1TkMuMantra.cc | 220 ----- L1Trigger/L1TTrackMatch/src/MuMatchWindow.cc | 40 - 10 files changed, 2190 deletions(-) delete mode 100644 L1Trigger/L1TTrackMatch/interface/L1TkMuCorrDynamicWindows.h delete mode 100644 L1Trigger/L1TTrackMatch/interface/L1TkMuMantra.h delete mode 100644 L1Trigger/L1TTrackMatch/interface/MuMatchWindow.h delete mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TkGlbMuonProducer.cc delete mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc delete mode 100644 L1Trigger/L1TTrackMatch/python/L1TkGlbMuonProducer_cfi.py delete mode 100644 L1Trigger/L1TTrackMatch/python/L1TkMuonProducer_cfi.py delete mode 100644 L1Trigger/L1TTrackMatch/src/L1TkMuCorrDynamicWindows.cc delete mode 100644 L1Trigger/L1TTrackMatch/src/L1TkMuMantra.cc delete mode 100644 L1Trigger/L1TTrackMatch/src/MuMatchWindow.cc diff --git a/L1Trigger/L1TTrackMatch/interface/L1TkMuCorrDynamicWindows.h b/L1Trigger/L1TTrackMatch/interface/L1TkMuCorrDynamicWindows.h deleted file mode 100644 index 71809f52d6c13..0000000000000 --- a/L1Trigger/L1TTrackMatch/interface/L1TkMuCorrDynamicWindows.h +++ /dev/null @@ -1,132 +0,0 @@ -#ifndef L1Trigger_L1TTrackMatch_L1TKMUCORRDYNAMICWINDOWS_H -#define L1Trigger_L1TTrackMatch_L1TKMUCORRDYNAMICWINDOWS_H - -#include "TFile.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" -#include "DataFormats/L1Trigger/interface/Muon.h" -#include "DataFormats/L1TMuon/interface/EMTFTrack.h" -#include "DataFormats/Math/interface/angle_units.h" - -#include "L1Trigger/L1TTrackMatch/interface/MuMatchWindow.h" -#include "L1Trigger/L1TMuonEndCap/interface/Common.h" - -class L1TkMuCorrDynamicWindows { -public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollectionType; - - L1TkMuCorrDynamicWindows(const std::vector& bounds, TFile* fIn_theta, TFile* fIn_phi); - L1TkMuCorrDynamicWindows( - const std::vector& bounds, TFile* fIn_theta, TFile* fIn_phi, TFile* fIn_theta_S1, TFile* fIn_phi_S1); - ~L1TkMuCorrDynamicWindows() {} - std::vector find_match( - const EMTFTrackCollection& l1mus, - const L1TTTrackCollectionType& l1trks); // gives a vector with the idxs of muons for each L1TTT - std::vector find_match_stub( - const EMTFHitCollection& l1mus, - const L1TTTrackCollectionType& l1trks, - const int& station, - bool requireBX0 = true); // gives a vector with the idxs of muon stubs from station "station" for each L1TTT - - // ------------------------------ - static std::vector prepare_corr_bounds(const string& fname, const string& hname); - - void set_safety_factor(float sf_l, float sf_h) { - safety_factor_l_ = sf_l; - safety_factor_h_ = sf_h; - } - void set_sf_initialrelax(float sf_l, float sf_h) { - initial_sf_l_ = sf_l; - initial_sf_h_ = sf_h; - } - void set_relaxation_pattern(float pt_start, float pt_end) { - pt_start_ = pt_start; - pt_end_ = pt_end; - } - void set_safety_factor(float sf) { set_safety_factor(sf, sf); } - void set_sf_initialrelax(float sf) { set_sf_initialrelax(sf, sf); } - void set_do_relax_factor(bool val) { do_relax_factor_ = val; } - - void set_do_trk_qual_presel(bool val) { track_qual_presel_ = val; } - - // setters for trk - void set_n_trk_par(int val) { nTrkPars_ = val; } - void set_min_trk_p(float val) { min_trk_p_ = val; } - void set_max_trk_aeta(float val) { max_trk_aeta_ = val; } - void set_max_trk_chi2(float val) { max_trk_chi2_ = val; } - void set_min_trk_nstubs(int val) { min_trk_nstubs_ = val; } - - // getters for trk - const int n_trk_par() { return nTrkPars_; } - const float min_trk_p() { return min_trk_p_; } - const float max_trk_aeta() { return max_trk_aeta_; } - const float max_trk_chi2() { return max_trk_chi2_; } - const int min_trk_nstubs() { return min_trk_nstubs_; } - -private: - int findBin(double val); - - // resolves ambiguities to give max 1 tkmu per EMTF - // if a pointer to narbitrated is passed, this vector is filled with the number of tracks arbitrated that were matched to the same EMTF - std::vector make_unique_coll(const unsigned int& l1musSize, - const L1TTTrackCollectionType& l1trks, - const std::vector& matches); - - // converters - double eta_to_theta(double x) { - // give theta in rad - return (2. * atan(exp(-1. * x))); - } - - double to_mpio2_pio2(double x) { - // put the angle in radians between -pi/2 and pi/2 - while (x >= 0.5 * M_PI) - x -= M_PI; - while (x < -0.5 * M_PI) - x += M_PI; - return x; - } - - double sf_progressive(double x, double xstart, double xstop, double ystart, double ystop) { - if (x < xstart) - return ystart; - if (x >= xstart && x < xstop) - return ystart + (x - xstart) * (ystop - ystart) / (xstop - xstart); - return ystop; - } - - int nbins_; // counts the number of MatchWindow = bounds_.size() - 1 - std::vector bounds_; // counts the boundaries of the MatchWindow (in eta/theta) - std::vector wdws_theta_; - std::vector wdws_phi_; - std::vector wdws_theta_S1_; - std::vector wdws_phi_S1_; - float safety_factor_l_; // increase the lower theta/phi threshold by this fractions - float safety_factor_h_; // increase the upper theta/phi threshold by this fractions - float initial_sf_l_; // the start of the relaxation - float initial_sf_h_; // the start of the relaxation - float pt_start_; // the relaxation of the threshold - float pt_end_; // the relaxation of the threshold - bool do_relax_factor_; // true if applying the linear relaxation - bool track_qual_presel_; // if true, apply the track preselection - - // trk configurable params - int nTrkPars_; // 4 - float min_trk_p_; // 3.5 - float max_trk_aeta_; // 2.5 - float max_trk_chi2_; // 100 - int min_trk_nstubs_; // 4 -}; - -#endif diff --git a/L1Trigger/L1TTrackMatch/interface/L1TkMuMantra.h b/L1Trigger/L1TTrackMatch/interface/L1TkMuMantra.h deleted file mode 100644 index 0a621d1b036d1..0000000000000 --- a/L1Trigger/L1TTrackMatch/interface/L1TkMuMantra.h +++ /dev/null @@ -1,125 +0,0 @@ -#ifndef L1Trigger_L1TTrackMatch_L1TKMUMANTRA_H -#define L1Trigger_L1TTrackMatch_L1TKMUMANTRA_H - -/* -** class : GenericDataFormat -** author : L.Cadamuro (UF) -** date : 4/11/2019 -** brief : very generic structs to be used as inputs to the correlator -** : to make sure that Mantra can handle muons and tracks from all the detectors -*/ - -namespace L1TkMuMantraDF { - - struct track_df { - double pt; // GeV - double eta; // rad, -inf / +inf - double theta; // rad, 0 -> +90-90 - double phi; // rad, -pi / + pi - int nstubs; // - double chi2; // - int charge; // -1. +1 - }; - - struct muon_df { - double pt; // GeV - double eta; // rad, -inf / +inf - double theta; // rad, 0 -> +90-90 - double phi; // rad, -pi / + pi - int charge; // -1. +1 - }; -} // namespace L1TkMuMantraDF - -/* -** class : L1TkMuMantra -** author : L.Cadamuro (UF) -** date : 4/11/2019 -** brief : correlates muons and tracks using pre-encoded windows -*/ - -#include -#include -#include -#include -#include "L1Trigger/L1TTrackMatch/interface/MuMatchWindow.h" -#include - -#include "TFile.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DataFormats/Math/interface/angle_units.h" - -class L1TkMuMantra { -public: - L1TkMuMantra(const std::vector& bounds, TFile* fIn_theta, TFile* fIn_phi, std::string name); - ~L1TkMuMantra(){}; - - // returns a vector with the same size of muons, each with an index to the matched L1 track, or -1 if no match is found - std::vector find_match(const std::vector& tracks, - const std::vector& muons); - - void test(double eta, double pt); - - void relax_windows(double& low, double cent, double& high); // will modify low and high - - void set_safety_factor(float sf_l, float sf_h) { - safety_factor_l_ = sf_l; - safety_factor_h_ = sf_h; - if (verbosity_ > 0) - LogTrace("L1TkMuMantra") << name_ << " safety factor LOW is " << safety_factor_l_ << std::endl; - if (verbosity_ > 0) - LogTrace("L1TkMuMantra") << name_ << " safety factor HIGH is " << safety_factor_h_ << std::endl; - } - - int sign(double x) { - if (x == 0) - return 1; - return (0 < x) - (x < 0); - } - - void setArbitrationType(std::string type); // MaxPt, MinDeltaPt - - // static functions, meant to be used from outside to interface with MAnTra - static std::vector prepare_corr_bounds(std::string fname, std::string hname); - - // converters - static double eta_to_theta(double x) { - // give theta in rad - return (2. * atan(exp(-1. * x))); - } - - static double to_mpio2_pio2(double x) { - // put the angle in radians between -pi/2 and pi/2 - while (x >= 0.5 * M_PI) - x -= M_PI; - while (x < -0.5 * M_PI) - x += M_PI; - return x; - } - -private: - int findBin(double val); - - std::string name_; - - int nbins_; // counts the number of MuMatchWindow = bounds_.size() - 1 - std::vector bounds_; // counts the boundaries of the MuMatchWindow (in eta/theta) - std::vector wdws_theta_; - std::vector wdws_phi_; - - int min_nstubs = 4; // >= min_nstubs - double max_chi2 = 100; // < max_chi2 - - float safety_factor_l_; // increase the lower theta/phi threshold by this fractions w.r.t. the center - float safety_factor_h_; // increase the upper theta/phi threshold by this fractions w.r.t. the center - - enum sortParType { - kMaxPt, // pick the highest pt track matched - kMinDeltaPt // pick the track with the smallest pt difference w.r.t the muon - }; - - sortParType sort_type_; - - int verbosity_ = 0; -}; - -#endif // L1TKMUMANTRA_H diff --git a/L1Trigger/L1TTrackMatch/interface/MuMatchWindow.h b/L1Trigger/L1TTrackMatch/interface/MuMatchWindow.h deleted file mode 100644 index aa8a6da239bf7..0000000000000 --- a/L1Trigger/L1TTrackMatch/interface/MuMatchWindow.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef L1Trigger_L1TTrackMatch_MUMATCHWINDOW_H -#define L1Trigger_L1TTrackMatch_MUMATCHWINDOW_H - -#include "TF1.h" -#include -#include -#include - -/* -** class : MuMatchWindow -** author : L.Cadamuro (UF) -** date : 25/12/2018 -** brief : encodes the lower, central, and upper bounds to match a track to a muon -** to be flexible, limits are given as strings to create a TF1 function -*/ - -class MuMatchWindow { -public: - MuMatchWindow(); - MuMatchWindow(std::string name); - ~MuMatchWindow(); - void SetName(std::string name) { name_ = name; } - - void SetLower(std::string formula); - void SetCentral(std::string formula); - void SetUpper(std::string formula); - - void SetLower(TF1* formula); - void SetCentral(TF1* formula); - void SetUpper(TF1* formula); - - // bool matches (double pt); - const double bound_low(double pt) { return fLow_->Eval(pt); } - const double bound_cent(double pt) { return fCent_->Eval(pt); } - const double bound_high(double pt) { return fHigh_->Eval(pt); } - -private: - std::string name_; - std::shared_ptr fLow_; - std::shared_ptr fCent_; - std::shared_ptr fHigh_; -}; - -#endif diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkGlbMuonProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkGlbMuonProducer.cc deleted file mode 100644 index c7b54835e60dd..0000000000000 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkGlbMuonProducer.cc +++ /dev/null @@ -1,340 +0,0 @@ -// input: L1TkTracks and L1Muon -// match the two and produce a collection of L1TkGlbMuonParticle -// eventually, this should be made modular and allow to swap out different algorithms - -// user include files -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/L1Trigger/interface/Muon.h" -#include "DataFormats/Math/interface/LorentzVector.h" -#include "DataFormats/Math/interface/angle_units.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/Math/interface/deltaPhi.h" -#include "DataFormats/L1TCorrelator/interface/TkGlbMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkGlbMuonFwd.h" -#include "L1Trigger/L1TMuon/interface/MicroGMTConfiguration.h" -#include "L1Trigger/L1TMuonEndCap/interface/Common.h" - -// system include files -#include -#include - -static constexpr float mu_mass = 0.105658369; -static constexpr float dr2_cutoff = 0.3; -static constexpr float matching_factor_eta = 3.; -static constexpr float matching_factor_phi = 4.; -static constexpr float min_mu_propagator_p = 3.5; -static constexpr float min_mu_propagator_barrel_pT = 3.5; -static constexpr float min_mu_propagator_barrel_eta = 1.1; -static constexpr float max_mu_propagator_eta = 2.5; -static constexpr float sigmaEtaTP_loweta = 0.0288; -static constexpr float sigmaEtaTP_mediumeta = 0.025; -static constexpr float sigmaEtaTP_higheta = 0.0144; -static constexpr float sigmaPhiTP_value = 0.0126; -static constexpr float eta_boundary1 = 1.55; -static constexpr float eta_boundary2 = 1.65; -static constexpr float eta_boundary3 = 2.4; -static constexpr float sigmaEta_scaling = 0.100; -static constexpr float sigmaPhi_scaling = 0.106; -static constexpr float scaling_to_2ndstation = 850.; -static constexpr float deta_tkz_scaling = 550.; - -using namespace l1t; - -class L1TkGlbMuonProducer : public edm::global::EDProducer<> { -public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollectionType; - - struct PropState { //something simple, imagine it's hardware emulation - PropState() : pt(-99), eta(-99), phi(-99), sigmaPt(-99), sigmaEta(-99), sigmaPhi(-99), valid(false) {} - float pt; - float eta; - float phi; - float sigmaPt; - float sigmaEta; - float sigmaPhi; - bool valid; - }; - - enum AlgoType { kTP = 1, kDynamicWindows = 2, kMantra = 3 }; - - explicit L1TkGlbMuonProducer(const edm::ParameterSet&); - ~L1TkGlbMuonProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - PropState propagateToGMT(const L1TTTrackType& l1tk) const; - double sigmaEtaTP(const Muon& mu) const; - double sigmaPhiTP(const Muon& mu) const; - - // the TP algorithm - void runOnMuonCollection_v1(const edm::Handle&, - const edm::Handle&, - TkGlbMuonCollection& tkMuons) const; - - float etaMin_; - float etaMax_; - float etaBO_; //eta value for barrel-overlap fontier - float etaOE_; //eta value for overlap-endcap fontier - float zMax_; // |z_track| < zMax_ in cm - float chi2Max_; - float pTMinTra_; - float dRMax_; - int nStubsmin_; // minimum number of stubs - bool correctGMTPropForTkZ_; - bool use5ParameterFit_; - bool useTPMatchWindows_; - - const edm::EDGetTokenT muToken; - const edm::EDGetTokenT > > trackToken_; -}; - -L1TkGlbMuonProducer::L1TkGlbMuonProducer(const edm::ParameterSet& iConfig) - : etaMin_((float)iConfig.getParameter("ETAMIN")), - etaMax_((float)iConfig.getParameter("ETAMAX")), - zMax_((float)iConfig.getParameter("ZMAX")), - chi2Max_((float)iConfig.getParameter("CHI2MAX")), - pTMinTra_((float)iConfig.getParameter("PTMINTRA")), - dRMax_((float)iConfig.getParameter("DRmax")), - nStubsmin_(iConfig.getParameter("nStubsmin")), - muToken(consumes(iConfig.getParameter("L1MuonInputTag"))), - trackToken_(consumes > >( - iConfig.getParameter("L1TrackInputTag"))) { - correctGMTPropForTkZ_ = iConfig.getParameter("correctGMTPropForTkZ"); - - use5ParameterFit_ = iConfig.getParameter("use5ParameterFit"); - useTPMatchWindows_ = iConfig.getParameter("useTPMatchWindows"); - produces(); -} - -L1TkGlbMuonProducer::~L1TkGlbMuonProducer() {} - -// ------------ method called to produce the data ------------ -void L1TkGlbMuonProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - // the L1Mu objects - edm::Handle l1musH; - iEvent.getByToken(muToken, l1musH); - - // the L1Tracks - edm::Handle l1tksH; - iEvent.getByToken(trackToken_, l1tksH); - - auto tkMuons = std::make_unique(); - - // Fill the collection - runOnMuonCollection_v1(l1musH, l1tksH, *tkMuons); - - // put the new track+muon objects in the event! - iEvent.put(std::move(tkMuons)); -}; - -void L1TkGlbMuonProducer::runOnMuonCollection_v1(const edm::Handle& muonH, - const edm::Handle& l1tksH, - TkGlbMuonCollection& tkMuons) const { - const L1TTTrackCollectionType& l1tks = (*l1tksH.product()); - const MuonBxCollection& l1mus = (*muonH.product()); - - int imu = 0; - - for (auto l1mu = l1mus.begin(0); l1mu != l1mus.end(0); ++l1mu) { // considering BX = only - edm::Ref l1muRef(muonH, imu); - imu++; - - float l1mu_eta = l1mu->eta(); - float l1mu_phi = l1mu->phi(); - - float l1mu_feta = std::abs(l1mu_eta); - if (l1mu_feta < etaMin_) - continue; - if (l1mu_feta > etaMax_) - continue; - - float drmin = 999; - - PropState matchProp; - int match_idx = -1; - int il1tk = -1; - - int nTracksMatch = 0; - - for (const auto& l1tk : l1tks) { - il1tk++; - - float l1tk_pt = l1tk.momentum().perp(); - if (l1tk_pt < pTMinTra_) - continue; - - float l1tk_z = l1tk.POCA().z(); - if (std::abs(l1tk_z) > zMax_) - continue; - - float l1tk_chi2 = l1tk.chi2(); - if (l1tk_chi2 > chi2Max_) - continue; - - int l1tk_nstubs = l1tk.getStubRefs().size(); - if (l1tk_nstubs < nStubsmin_) - continue; - - float l1tk_eta = l1tk.momentum().eta(); - float l1tk_phi = l1tk.momentum().phi(); - - float dr2 = reco::deltaR2(l1mu_eta, l1mu_phi, l1tk_eta, l1tk_phi); - if (dr2 > dr2_cutoff) - continue; - - nTracksMatch++; - - const PropState& pstate = propagateToGMT(l1tk); - if (!pstate.valid) - continue; - - float dr2prop = reco::deltaR2(l1mu_eta, l1mu_phi, pstate.eta, pstate.phi); - // FIXME: check if this matching procedure can be improved with - // a pT dependent dR window - if (dr2prop < drmin) { - drmin = dr2prop; - match_idx = il1tk; - matchProp = pstate; - } - } // over l1tks - - LogDebug("L1TkGlbMuonProducer") << "matching index is " << match_idx; - if (match_idx >= 0) { - const L1TTTrackType& matchTk = l1tks[match_idx]; - - float sigmaEta = sigmaEtaTP(*l1mu); - float sigmaPhi = sigmaPhiTP(*l1mu); - - float etaCut = matching_factor_eta * sqrt(sigmaEta * sigmaEta + matchProp.sigmaEta * matchProp.sigmaEta); - float phiCut = matching_factor_phi * sqrt(sigmaPhi * sigmaPhi + matchProp.sigmaPhi * matchProp.sigmaPhi); - - float dEta = std::abs(matchProp.eta - l1mu_eta); - float dPhi = std::abs(deltaPhi(matchProp.phi, l1mu_phi)); - - bool matchCondition = useTPMatchWindows_ ? dEta < etaCut && dPhi < phiCut : drmin < dRMax_; - - if (matchCondition) { - edm::Ptr l1tkPtr(l1tksH, match_idx); - - const auto& p3 = matchTk.momentum(); - float p4e = sqrt(mu_mass * mu_mass + p3.mag2()); - - math::XYZTLorentzVector l1tkp4(p3.x(), p3.y(), p3.z(), p4e); - - const auto& tkv3 = matchTk.POCA(); - math::XYZPoint v3(tkv3.x(), tkv3.y(), tkv3.z()); // why is this defined? - - float trkisol = -999; - - TkGlbMuon l1tkmu(l1tkp4, l1muRef, l1tkPtr, trkisol); - - l1tkmu.setTrkzVtx((float)tkv3.z()); - l1tkmu.setdR(drmin); - l1tkmu.setNTracksMatched(nTracksMatch); - tkMuons.push_back(l1tkmu); - } - } - } //over l1mus -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void L1TkGlbMuonProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - // L1TkGlbMuons - edm::ParameterSetDescription desc; - desc.add("L1MuonInputTag", edm::InputTag("simGmtStage2Digis")); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("ETAMIN", 0); - desc.add("ETAMAX", 5.0); - desc.add("ZMAX", 25.0); - desc.add("CHI2MAX", 100.0); - desc.add("PTMINTRA", 2.0); - desc.add("DRmax", 0.5); - desc.add("nStubsmin", 4); - desc.add("correctGMTPropForTkZ", true); - desc.add("use5ParameterFit", false); - desc.add("useTPMatchWindows", true); - descriptions.add("L1TkGlbMuons", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); -} - -L1TkGlbMuonProducer::PropState L1TkGlbMuonProducer::propagateToGMT(const L1TkGlbMuonProducer::L1TTTrackType& tk) const { - auto p3 = tk.momentum(); - float tk_pt = p3.perp(); - float tk_p = p3.mag(); - float tk_eta = p3.eta(); - float tk_aeta = std::abs(tk_eta); - float tk_phi = p3.phi(); - float tk_q = tk.rInv() > 0 ? 1. : -1.; - float tk_z = tk.POCA().z(); - if (!correctGMTPropForTkZ_) - tk_z = 0; - - L1TkGlbMuonProducer::PropState dest; - if (tk_p < min_mu_propagator_p) - return dest; - if (tk_aeta < min_mu_propagator_barrel_eta && tk_pt < min_mu_propagator_barrel_pT) - return dest; - if (tk_aeta > max_mu_propagator_eta) - return dest; - - //0th order: - dest.valid = true; - - float dzCorrPhi = 1.; - float deta = 0; - float etaProp = tk_aeta; - - if (tk_aeta < min_mu_propagator_barrel_eta) { - etaProp = min_mu_propagator_barrel_eta; - deta = tk_z / deta_tkz_scaling / cosh(tk_aeta); - } else { - float delta = tk_z / scaling_to_2ndstation; //roughly scales as distance to 2nd station - if (tk_eta > 0) - delta *= -1; - dzCorrPhi = 1. + delta; - - float zOzs = tk_z / scaling_to_2ndstation; - if (tk_eta > 0) - deta = zOzs / (1. - zOzs); - else - deta = zOzs / (1. + zOzs); - deta = deta * tanh(tk_eta); - } - float resPhi = tk_phi - 1.464 * tk_q * cosh(1.7) / cosh(etaProp) / tk_pt * dzCorrPhi - M_PI / 144.; - resPhi = reco::reduceRange(resPhi); - - dest.eta = tk_eta + deta; - dest.phi = resPhi; - dest.pt = tk_pt; //not corrected for eloss - - dest.sigmaEta = sigmaEta_scaling / tk_pt; //multiple scattering term - dest.sigmaPhi = sigmaPhi_scaling / tk_pt; //need a better estimate for these - return dest; -} - -double L1TkGlbMuonProducer::sigmaEtaTP(const Muon& l1mu) const { - float l1mu_eta = l1mu.eta(); - if (std::abs(l1mu_eta) <= eta_boundary1) - return sigmaEtaTP_loweta; - else if (std::abs(l1mu_eta) > eta_boundary1 && std::abs(l1mu_eta) <= eta_boundary2) - return sigmaEtaTP_mediumeta; - else if (std::abs(l1mu_eta) > eta_boundary2 && std::abs(l1mu_eta) <= eta_boundary3) - return sigmaEtaTP_higheta; - return sigmaEtaTP_loweta; -} - -double L1TkGlbMuonProducer::sigmaPhiTP(const Muon& mu) const { return sigmaPhiTP_value; } - -//define this as a plug-in -DEFINE_FWK_MODULE(L1TkGlbMuonProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc deleted file mode 100644 index 8199d7ac45315..0000000000000 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc +++ /dev/null @@ -1,782 +0,0 @@ -// input: L1TkTracks and RegionalMuonCand (standalone with component details) -// match the two and produce a collection of TkMuon -// eventually, this should be made modular and allow to swap out different algorithms - -// user include files -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/Common/interface/Handle.h" -#include "DataFormats/L1Trigger/interface/Muon.h" -#include "DataFormats/Math/interface/LorentzVector.h" -#include "DataFormats/Math/interface/angle_units.h" -#include "DataFormats/Math/interface/deltaR.h" -#include "DataFormats/Math/interface/deltaPhi.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" -#include "L1Trigger/L1TMuon/interface/MicroGMTConfiguration.h" -#include "L1Trigger/L1TTrackMatch/interface/L1TkMuCorrDynamicWindows.h" -#include "L1Trigger/L1TTrackMatch/interface/L1TkMuMantra.h" -#include "L1Trigger/L1TMuonEndCap/interface/Common.h" - -// system include files -#include -#include - -static constexpr float mu_mass = 0.105658369; -static constexpr int barrel_MTF_region = 1; -static constexpr int overlap_MTF_region = 2; -static constexpr int endcap_MTF_region = 3; -static constexpr float eta_scale = 0.010875; -static constexpr float phi_scale = 2 * M_PI / 576.; -static constexpr float dr2_cutoff = 0.3; -static constexpr float matching_factor_eta = 3.; -static constexpr float matching_factor_phi = 4.; -static constexpr float min_mu_propagator_p = 3.5; -static constexpr float min_mu_propagator_barrel_pT = 3.5; -static constexpr float max_mu_propagator_eta = 2.5; - -using namespace l1t; - -class L1TkMuonProducer : public edm::stream::EDProducer<> { -public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollectionType; - - struct PropState { //something simple, imagine it's hardware emulation - PropState() : pt(-99), eta(-99), phi(-99), sigmaPt(-99), sigmaEta(-99), sigmaPhi(-99), valid(false) {} - float pt; - float eta; - float phi; - float sigmaPt; - float sigmaEta; - float sigmaPhi; - bool valid; - }; - - enum AlgoType { kTP = 1, kDynamicWindows = 2, kMantra = 3 }; - - explicit L1TkMuonProducer(const edm::ParameterSet&); - ~L1TkMuonProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void produce(edm::Event&, const edm::EventSetup&) override; - PropState propagateToGMT(const L1TTTrackType& l1tk) const; - double sigmaEtaTP(const RegionalMuonCand& mu) const; - double sigmaPhiTP(const RegionalMuonCand& mu) const; - - // the TP algorithm - void runOnMTFCollection_v1(const edm::Handle&, - const edm::Handle&, - TkMuonCollection& tkMuons, - const int detector) const; - - // algo for endcap regions using dynamic windows for making the match - void runOnMTFCollection_v2(const edm::Handle&, - const edm::Handle&, - TkMuonCollection& tkMuons) const; - - // given the matching indexes, build the output collection of track muons - void build_tkMuons_from_idxs(TkMuonCollection& tkMuons, - const std::vector& matches, - const edm::Handle& l1tksH, - const edm::Handle& muonH, - int detector) const; - - void build_tkMuons_from_idxs(TkMuonCollection& tkMuons, - const std::vector& matches, - const edm::Handle& l1tksH, - const edm::Handle& emtfTksH, - int detector) const; - - // dump and convert tracks to the format needed for the MAnTra correlator - std::vector product_to_trkvec(const L1TTTrackCollectionType& l1tks) const; // tracks - // regional muon finder - std::vector product_to_muvec(const RegionalMuonCandBxCollection& l1mtfs) const; - // endcap muon finder - eventually to be moved to regional candidate - std::vector product_to_muvec(const EMTFTrackCollection& l1mus) const; - - float etaMin_; - float etaMax_; - float etaBO_; //eta value for barrel-overlap fontier - float etaOE_; //eta value for overlap-endcap fontier - bool useRegionEtaMatching_; - float zMax_; // |z_track| < zMax_ in cm - float chi2Max_; - float pTMinTra_; - float dRMax_; - int nStubsmin_; // minimum number of stubs - bool correctGMTPropForTkZ_; - bool use5ParameterFit_; - bool useTPMatchWindows_; - bool applyQuality_; - - AlgoType bmtfMatchAlgoVersion_; - AlgoType omtfMatchAlgoVersion_; - AlgoType emtfMatchAlgoVersion_; - - std::unique_ptr dwcorr_; - - std::unique_ptr mantracorr_barr_; - std::unique_ptr mantracorr_ovrl_; - std::unique_ptr mantracorr_endc_; - int mantra_n_trk_par_; - - const edm::EDGetTokenT bmtfToken_; - const edm::EDGetTokenT omtfToken_; - const edm::EDGetTokenT emtfToken_; - // the track collection, directly from the EMTF and not formatted by GT - const edm::EDGetTokenT emtfTCToken_; - const edm::EDGetTokenT > > trackToken_; -}; - -L1TkMuonProducer::L1TkMuonProducer(const edm::ParameterSet& iConfig) - : etaMin_((float)iConfig.getParameter("ETAMIN")), - etaMax_((float)iConfig.getParameter("ETAMAX")), - etaBO_(iConfig.exists("ETABARRELOVERLAP") ? (float)iConfig.getParameter("ETABARRELOVERLAP") : 0.83), - etaOE_(iConfig.exists("ETAOVERLAPENDCAP") ? (float)iConfig.getParameter("ETAOVERLAPENDCAP") : 1.24), - useRegionEtaMatching_(iConfig.exists("useRegionEtaMatching") ? iConfig.getParameter("useRegionEtaMatching") - : true), - zMax_((float)iConfig.getParameter("ZMAX")), - chi2Max_((float)iConfig.getParameter("CHI2MAX")), - pTMinTra_((float)iConfig.getParameter("PTMINTRA")), - dRMax_((float)iConfig.getParameter("DRmax")), - nStubsmin_(iConfig.getParameter("nStubsmin")), - - // --- mantra corr params - mantra_n_trk_par_(iConfig.getParameter("mantra_n_trk_par")), - bmtfToken_(consumes(iConfig.getParameter("L1BMTFInputTag"))), - omtfToken_(consumes(iConfig.getParameter("L1OMTFInputTag"))), - emtfToken_(consumes(iConfig.getParameter("L1EMTFInputTag"))), - emtfTCToken_(consumes(iConfig.getParameter("L1EMTFTrackCollectionInputTag"))), - trackToken_(consumes > >( - iConfig.getParameter("L1TrackInputTag"))) { - // --------------------- configuration of the muon algorithm type - - std::string bmtfMatchAlgoVersionString = iConfig.getParameter("bmtfMatchAlgoVersion"); - std::transform(bmtfMatchAlgoVersionString.begin(), - bmtfMatchAlgoVersionString.end(), - bmtfMatchAlgoVersionString.begin(), - ::tolower); // make lowercase - - std::string omtfMatchAlgoVersionString = iConfig.getParameter("omtfMatchAlgoVersion"); - std::transform(omtfMatchAlgoVersionString.begin(), - omtfMatchAlgoVersionString.end(), - omtfMatchAlgoVersionString.begin(), - ::tolower); // make lowercase - - std::string emtfMatchAlgoVersionString = iConfig.getParameter("emtfMatchAlgoVersion"); - std::transform(emtfMatchAlgoVersionString.begin(), - emtfMatchAlgoVersionString.end(), - emtfMatchAlgoVersionString.begin(), - ::tolower); // make lowercase - - if (bmtfMatchAlgoVersionString == "tp") - bmtfMatchAlgoVersion_ = kTP; - else if (bmtfMatchAlgoVersionString == "mantra") - bmtfMatchAlgoVersion_ = kMantra; - else - throw cms::Exception("TkMuAlgoConfig") - << "the ID " << bmtfMatchAlgoVersionString << " of the BMTF algo matcher passed is invalid\n"; - - if (omtfMatchAlgoVersionString == "tp") - omtfMatchAlgoVersion_ = kTP; - else if (omtfMatchAlgoVersionString == "mantra") - omtfMatchAlgoVersion_ = kMantra; - else - throw cms::Exception("TkMuAlgoConfig") - << "the ID " << omtfMatchAlgoVersionString << " of the OMTF algo matcher passed is invalid\n"; - - if (emtfMatchAlgoVersionString == "tp") - emtfMatchAlgoVersion_ = kTP; - else if (emtfMatchAlgoVersionString == "dynamicwindows") - emtfMatchAlgoVersion_ = kDynamicWindows; - else if (emtfMatchAlgoVersionString == "mantra") - emtfMatchAlgoVersion_ = kMantra; - else - throw cms::Exception("TkMuAlgoConfig") - << "the ID " << emtfMatchAlgoVersionString << " of the EMTF algo matcher passed is invalid\n"; - - correctGMTPropForTkZ_ = iConfig.getParameter("correctGMTPropForTkZ"); - - use5ParameterFit_ = iConfig.getParameter("use5ParameterFit"); - useTPMatchWindows_ = iConfig.getParameter("useTPMatchWindows"); - applyQuality_ = iConfig.exists("applyQualityCuts") ? iConfig.getParameter("applyQualityCuts") : false; - - produces(); - - // initializations - if (emtfMatchAlgoVersion_ == kDynamicWindows) { - // FIXME: to merge eventually into an unique file with bith phi and theta boundaries - std::string fIn_bounds_name = iConfig.getParameter("emtfcorr_boundaries").fullPath(); - std::string fIn_theta_name = iConfig.getParameter("emtfcorr_theta_windows").fullPath(); - std::string fIn_phi_name = iConfig.getParameter("emtfcorr_phi_windows").fullPath(); - const auto& bounds = L1TkMuCorrDynamicWindows::prepare_corr_bounds(fIn_bounds_name, "h_dphi_l"); - TFile* fIn_theta = TFile::Open(fIn_theta_name.c_str()); - TFile* fIn_phi = TFile::Open(fIn_phi_name.c_str()); - dwcorr_ = std::make_unique(bounds, fIn_theta, fIn_phi); - - // files can be closed since the correlator code clones the TF1s - fIn_theta->Close(); - fIn_phi->Close(); - - // FIXME: more initialisation using the parameters passed from the cfg - dwcorr_->set_safety_factor(iConfig.getParameter("final_window_factor")); - dwcorr_->set_sf_initialrelax(iConfig.getParameter("initial_window_factor")); - - dwcorr_->set_relaxation_pattern(iConfig.getParameter("pt_start_relax"), - iConfig.getParameter("pt_end_relax")); - - dwcorr_->set_do_relax_factor(iConfig.getParameter("do_relax_factors")); - - dwcorr_->set_n_trk_par(iConfig.getParameter("n_trk_par")); - dwcorr_->set_min_trk_p(iConfig.getParameter("min_trk_p")); - dwcorr_->set_max_trk_aeta(iConfig.getParameter("max_trk_aeta")); - dwcorr_->set_max_trk_chi2(iConfig.getParameter("max_trk_chi2")); - dwcorr_->set_min_trk_nstubs(iConfig.getParameter("min_trk_nstubs")); - dwcorr_->set_do_trk_qual_presel(true); - } - - if (bmtfMatchAlgoVersion_ == kMantra) { - std::string fIn_bounds_name = iConfig.getParameter("mantra_bmtfcorr_boundaries").fullPath(); - std::string fIn_theta_name = iConfig.getParameter("mantra_bmtfcorr_theta_windows").fullPath(); - std::string fIn_phi_name = iConfig.getParameter("mantra_bmtfcorr_phi_windows").fullPath(); - - const auto& bounds = L1TkMuMantra::prepare_corr_bounds(fIn_bounds_name, "h_dphi_l"); - - TFile* fIn_theta = TFile::Open(fIn_theta_name.c_str()); - TFile* fIn_phi = TFile::Open(fIn_phi_name.c_str()); - - mantracorr_barr_ = std::make_unique(bounds, fIn_theta, fIn_phi, "mantra_barrel"); - - fIn_theta->Close(); - fIn_phi->Close(); - - // settings : NB : now hardcoded, could be read from cfg - mantracorr_barr_->set_safety_factor(0.5, 0.5); - mantracorr_barr_->setArbitrationType("MaxPt"); - } - - if (omtfMatchAlgoVersion_ == kMantra) { - std::string fIn_bounds_name = iConfig.getParameter("mantra_omtfcorr_boundaries").fullPath(); - std::string fIn_theta_name = iConfig.getParameter("mantra_omtfcorr_theta_windows").fullPath(); - std::string fIn_phi_name = iConfig.getParameter("mantra_omtfcorr_phi_windows").fullPath(); - - const auto& bounds = L1TkMuMantra::prepare_corr_bounds(fIn_bounds_name, "h_dphi_l"); - - TFile* fIn_theta = TFile::Open(fIn_theta_name.c_str()); - TFile* fIn_phi = TFile::Open(fIn_phi_name.c_str()); - - mantracorr_ovrl_ = std::make_unique(bounds, fIn_theta, fIn_phi, "mantra_overlap"); - - fIn_theta->Close(); - fIn_phi->Close(); - - // settings : NB : now hardcoded, could be read from cfg - mantracorr_ovrl_->set_safety_factor(0.5, 0.5); - mantracorr_ovrl_->setArbitrationType("MaxPt"); - } - - if (emtfMatchAlgoVersion_ == kMantra) { - std::string fIn_bounds_name = iConfig.getParameter("mantra_emtfcorr_boundaries").fullPath(); - std::string fIn_theta_name = iConfig.getParameter("mantra_emtfcorr_theta_windows").fullPath(); - std::string fIn_phi_name = iConfig.getParameter("mantra_emtfcorr_phi_windows").fullPath(); - - const auto& bounds = L1TkMuMantra::prepare_corr_bounds(fIn_bounds_name, "h_dphi_l"); - - TFile* fIn_theta = TFile::Open(fIn_theta_name.c_str()); - TFile* fIn_phi = TFile::Open(fIn_phi_name.c_str()); - - mantracorr_endc_ = std::make_unique(bounds, fIn_theta, fIn_phi, "mantra_endcap"); - - fIn_theta->Close(); - fIn_phi->Close(); - - // settings : NB : now hardcoded, could be read from cfg - mantracorr_endc_->set_safety_factor(0.5, 0.5); - mantracorr_endc_->setArbitrationType("MaxPt"); - } -} - -L1TkMuonProducer::~L1TkMuonProducer() {} - -// ------------ method called to produce the data ------------ -void L1TkMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - // the L1Mu objects - edm::Handle l1bmtfH; - edm::Handle l1omtfH; - edm::Handle l1emtfH; - edm::Handle l1emtfTCH; - - iEvent.getByToken(bmtfToken_, l1bmtfH); - iEvent.getByToken(omtfToken_, l1omtfH); - iEvent.getByToken(emtfToken_, l1emtfH); - iEvent.getByToken(emtfTCToken_, l1emtfTCH); - - // the L1Tracks - edm::Handle l1tksH; - iEvent.getByToken(trackToken_, l1tksH); - - TkMuonCollection oc_bmtf_tkmuon; - TkMuonCollection oc_omtf_tkmuon; - TkMuonCollection oc_emtf_tkmuon; - - std::vector mantradf_tracks; // if needed, just encode once for all trk finders - if (bmtfMatchAlgoVersion_ == kMantra || omtfMatchAlgoVersion_ == kMantra || emtfMatchAlgoVersion_ == kMantra) { - mantradf_tracks = product_to_trkvec(*l1tksH.product()); - } - - // process each of the MTF collections separately! -- we don't want to filter the muons - - // ----------------------------------------------------- barrel - if (bmtfMatchAlgoVersion_ == kTP) - runOnMTFCollection_v1(l1bmtfH, l1tksH, oc_bmtf_tkmuon, barrel_MTF_region); - else if (bmtfMatchAlgoVersion_ == kMantra) { - const auto& muons = product_to_muvec(*l1bmtfH.product()); - const auto& match_idx = mantracorr_barr_->find_match(mantradf_tracks, muons); - build_tkMuons_from_idxs(oc_bmtf_tkmuon, match_idx, l1tksH, l1bmtfH, barrel_MTF_region); - } else { - throw cms::Exception("TkMuAlgoConfig") << " barrel : trying to run an invalid algorithm version " - << bmtfMatchAlgoVersion_ << " (this should never happen)\n"; - return; - } - - // ----------------------------------------------------- overlap - if (omtfMatchAlgoVersion_ == kTP) - runOnMTFCollection_v1(l1omtfH, l1tksH, oc_omtf_tkmuon, overlap_MTF_region); - else if (omtfMatchAlgoVersion_ == kMantra) { - const auto& muons = product_to_muvec(*l1omtfH.product()); - const auto& match_idx = mantracorr_ovrl_->find_match(mantradf_tracks, muons); - build_tkMuons_from_idxs(oc_omtf_tkmuon, match_idx, l1tksH, l1omtfH, overlap_MTF_region); - } else { - throw cms::Exception("TkMuAlgoConfig") << " overlap : trying to run an invalid algorithm version " - << omtfMatchAlgoVersion_ << " (this should never happen)\n"; - return; - } - - // ----------------------------------------------------- endcap - if (emtfMatchAlgoVersion_ == kTP) - runOnMTFCollection_v1(l1emtfH, l1tksH, oc_emtf_tkmuon, endcap_MTF_region); - else if (emtfMatchAlgoVersion_ == kDynamicWindows) - runOnMTFCollection_v2(l1emtfTCH, l1tksH, oc_emtf_tkmuon); - else if (emtfMatchAlgoVersion_ == kMantra) { - const auto& muons = product_to_muvec(*l1emtfTCH.product()); - const auto& match_idx = mantracorr_endc_->find_match(mantradf_tracks, muons); - //for the TkMu that were built from a EMTFCollection - pass the emtf track as ref - build_tkMuons_from_idxs(oc_emtf_tkmuon, match_idx, l1tksH, l1emtfTCH, endcap_MTF_region); - } else { - throw cms::Exception("TkMuAlgoConfig") << "endcap : trying to run an invalid algorithm version " - << emtfMatchAlgoVersion_ << " (this should never happen)\n"; - return; - } - - // now combine all trk muons into a single output collection! - auto oc_tkmuon = std::make_unique(); - for (const auto& p : {oc_bmtf_tkmuon, oc_omtf_tkmuon, oc_emtf_tkmuon}) { - oc_tkmuon->insert(oc_tkmuon->end(), p.begin(), p.end()); - } - - // put the new track+muon objects in the event! - iEvent.put(std::move(oc_tkmuon)); -}; - -void L1TkMuonProducer::runOnMTFCollection_v1(const edm::Handle& muonH, - const edm::Handle& l1tksH, - TkMuonCollection& tkMuons, - const int detector) const { - const L1TTTrackCollectionType& l1tks = (*l1tksH.product()); - const RegionalMuonCandBxCollection& l1mtfs = (*muonH.product()); - - int imu = 0; - for (auto l1mu = l1mtfs.begin(0); l1mu != l1mtfs.end(0); ++l1mu) { // considering BX = only - - edm::Ref l1muRef(muonH, imu); - imu++; - - float l1mu_eta = l1mu->hwEta() * eta_scale; - // get the global phi - float l1mu_phi = - MicroGMTConfiguration::calcGlobalPhi(l1mu->hwPhi(), l1mu->trackFinderType(), l1mu->processor()) * phi_scale; - - float l1mu_feta = std::abs(l1mu_eta); - if (l1mu_feta < etaMin_) - continue; - if (l1mu_feta > etaMax_) - continue; - - float drmin = 999; - - PropState matchProp; - int match_idx = -1; - int il1tk = -1; - - int nTracksMatch = 0; - - for (const auto& l1tk : l1tks) { - il1tk++; - - float l1tk_pt = l1tk.momentum().perp(); - if (l1tk_pt < pTMinTra_) - continue; - - float l1tk_z = l1tk.POCA().z(); - if (std::abs(l1tk_z) > zMax_) - continue; - - float l1tk_chi2 = l1tk.chi2(); - if (l1tk_chi2 > chi2Max_) - continue; - - int l1tk_nstubs = l1tk.getStubRefs().size(); - if (l1tk_nstubs < nStubsmin_) - continue; - - float l1tk_eta = l1tk.momentum().eta(); - float l1tk_phi = l1tk.momentum().phi(); - - float dr2 = reco::deltaR2(l1mu_eta, l1mu_phi, l1tk_eta, l1tk_phi); - if (dr2 > dr2_cutoff) - continue; - - nTracksMatch++; - - const PropState& pstate = propagateToGMT(l1tk); - if (!pstate.valid) - continue; - - float dr2prop = reco::deltaR2(l1mu_eta, l1mu_phi, pstate.eta, pstate.phi); - // FIXME: check if this matching procedure can be improved with - // a pT dependent dR window - if (dr2prop < drmin) { - drmin = dr2prop; - match_idx = il1tk; - matchProp = pstate; - } - } // over l1tks - - LogDebug("L1TkMuonProducer") << "matching index is " << match_idx; - if (match_idx >= 0) { - const L1TTTrackType& matchTk = l1tks[match_idx]; - - float sigmaEta = sigmaEtaTP(*l1mu); - float sigmaPhi = sigmaPhiTP(*l1mu); - - float etaCut = matching_factor_eta * sqrt(sigmaEta * sigmaEta + matchProp.sigmaEta * matchProp.sigmaEta); - float phiCut = matching_factor_phi * sqrt(sigmaPhi * sigmaPhi + matchProp.sigmaPhi * matchProp.sigmaPhi); - - float dEta = std::abs(matchProp.eta - l1mu_eta); - float dPhi = std::abs(deltaPhi(matchProp.phi, l1mu_phi)); - - bool matchCondition = useTPMatchWindows_ ? dEta < etaCut && dPhi < phiCut : drmin < dRMax_; - - if (matchCondition) { - edm::Ptr l1tkPtr(l1tksH, match_idx); - - const auto& p3 = matchTk.momentum(); - float p4e = sqrt(mu_mass * mu_mass + p3.mag2()); - - math::XYZTLorentzVector l1tkp4(p3.x(), p3.y(), p3.z(), p4e); - - const auto& tkv3 = matchTk.POCA(); - math::XYZPoint v3(tkv3.x(), tkv3.y(), tkv3.z()); // why is this defined? - - float trkisol = -999; - - TkMuon l1tkmu(l1tkp4, l1muRef, l1tkPtr, trkisol); - - if (useRegionEtaMatching_) { - if (detector == barrel_MTF_region) { - if (std::abs(l1tkmu.eta()) > etaBO_) - continue; - } else if (detector == overlap_MTF_region) { - if (std::abs(l1tkmu.eta()) < etaBO_) - continue; - if (std::abs(l1tkmu.eta()) > etaOE_) - continue; - } else if (detector == endcap_MTF_region) { - if (std::abs(l1tkmu.eta()) < etaOE_) - continue; - } - } - l1tkmu.setTrackCurvature(matchTk.rInv()); - l1tkmu.setTrkzVtx((float)tkv3.z()); - l1tkmu.setdR(drmin); - l1tkmu.setNTracksMatched(nTracksMatch); - l1tkmu.setMuonDetector(detector); - l1tkmu.setQuality(l1muRef->hwQual()); - tkMuons.push_back(l1tkmu); - } - } - } //over l1mus -} - -void L1TkMuonProducer::runOnMTFCollection_v2(const edm::Handle& muonH, - const edm::Handle& l1tksH, - TkMuonCollection& tkMuons) const { - const EMTFTrackCollection& l1mus = (*muonH.product()); - const L1TTTrackCollectionType& l1trks = (*l1tksH.product()); - const auto& corr_mu_idxs = dwcorr_->find_match(l1mus, l1trks); - // it's a vector with as many entries as the L1TT vector. - // >= 0 : the idx in the EMTF vector of matched mu - // < 0: no match - - // sanity check - if (corr_mu_idxs.size() != l1trks.size()) - throw cms::Exception("TkMuAlgoOutput") - << "the size of tkmu indices does not match the size of input trk collection\n"; - - for (uint il1ttrack = 0; il1ttrack < corr_mu_idxs.size(); ++il1ttrack) { - int emtf_idx = corr_mu_idxs[il1ttrack]; - if (emtf_idx < 0) - continue; - - const L1TTTrackType& matchTk = l1trks[il1ttrack]; - const auto& p3 = matchTk.momentum(); - const auto& tkv3 = matchTk.POCA(); - float p4e = sqrt(mu_mass * mu_mass + p3.mag2()); - math::XYZTLorentzVector l1tkp4(p3.x(), p3.y(), p3.z(), p4e); - - edm::Ref l1muRef; - edm::Ptr l1tkPtr(l1tksH, il1ttrack); - float trkisol = -999; // now doing as in the TP algo - TkMuon l1tkmu(l1tkp4, l1muRef, l1tkPtr, trkisol); - - // avoid leaking of candidates to overlap region... - if (useRegionEtaMatching_ && std::abs(l1tkmu.eta()) < etaOE_) - continue; - - l1tkmu.setTrackCurvature(matchTk.rInv()); - l1tkmu.setTrkzVtx((float)tkv3.z()); - l1tkmu.setMuonDetector(endcap_MTF_region); - tkMuons.push_back(l1tkmu); - } - - return; -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void L1TkMuonProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -L1TkMuonProducer::PropState L1TkMuonProducer::propagateToGMT(const L1TkMuonProducer::L1TTTrackType& tk) const { - auto p3 = tk.momentum(); - float tk_pt = p3.perp(); - float tk_p = p3.mag(); - float tk_eta = p3.eta(); - float tk_aeta = std::abs(tk_eta); - float tk_phi = p3.phi(); - float tk_q = tk.rInv() > 0 ? 1. : -1.; - float tk_z = tk.POCA().z(); - if (!correctGMTPropForTkZ_) - tk_z = 0; - - L1TkMuonProducer::PropState dest; - if (tk_p < min_mu_propagator_p) - return dest; - if (tk_aeta < 1.1 && tk_pt < min_mu_propagator_barrel_pT) - return dest; - if (tk_aeta > max_mu_propagator_eta) - return dest; - - //0th order: - dest.valid = true; - - float dzCorrPhi = 1.; - float deta = 0; - float etaProp = tk_aeta; - - if (tk_aeta < 1.1) { - etaProp = 1.1; - deta = tk_z / 550. / cosh(tk_aeta); - } else { - float delta = tk_z / 850.; //roughly scales as distance to 2nd station - if (tk_eta > 0) - delta *= -1; - dzCorrPhi = 1. + delta; - - float zOzs = tk_z / 850.; - if (tk_eta > 0) - deta = zOzs / (1. - zOzs); - else - deta = zOzs / (1. + zOzs); - deta = deta * tanh(tk_eta); - } - float resPhi = tk_phi - 1.464 * tk_q * cosh(1.7) / cosh(etaProp) / tk_pt * dzCorrPhi - M_PI / 144.; - resPhi = reco::reduceRange(resPhi); - - dest.eta = tk_eta + deta; - dest.phi = resPhi; - dest.pt = tk_pt; //not corrected for eloss - - dest.sigmaEta = 0.100 / tk_pt; //multiple scattering term - dest.sigmaPhi = 0.106 / tk_pt; //need a better estimate for these - return dest; -} - -double L1TkMuonProducer::sigmaEtaTP(const RegionalMuonCand& l1mu) const { - float l1mu_eta = l1mu.hwEta() * eta_scale; - if (std::abs(l1mu_eta) <= 1.55) - return 0.0288; - else if (std::abs(l1mu_eta) > 1.55 && std::abs(l1mu_eta) <= 1.65) - return 0.025; - else if (std::abs(l1mu_eta) > 1.65 && std::abs(l1mu_eta) <= 2.4) - return 0.0144; - return 0.0288; -} - -double L1TkMuonProducer::sigmaPhiTP(const RegionalMuonCand& mu) const { return 0.0126; } - -// ------------------------------------------------------------------------------------------------------------ - -std::vector L1TkMuonProducer::product_to_trkvec(const L1TTTrackCollectionType& l1tks) const { - std::vector result(l1tks.size()); - for (uint itrk = 0; itrk < l1tks.size(); ++itrk) { - auto& trk = l1tks[itrk]; - - result[itrk].pt = trk.momentum().perp(); - result[itrk].eta = trk.momentum().eta(); - result[itrk].theta = L1TkMuMantra::to_mpio2_pio2(L1TkMuMantra::eta_to_theta(trk.momentum().eta())); - result[itrk].phi = trk.momentum().phi(); - result[itrk].nstubs = trk.getStubRefs().size(); - result[itrk].chi2 = trk.chi2(); - result[itrk].charge = (trk.rInv() > 0 ? 1 : -1); - } - - return result; -} - -std::vector L1TkMuonProducer::product_to_muvec( - const RegionalMuonCandBxCollection& l1mtfs) const { - std::vector result; - for (auto l1mu = l1mtfs.begin(0); l1mu != l1mtfs.end(0); ++l1mu) // considering BX = 0 only - { - L1TkMuMantraDF::muon_df this_mu; - this_mu.pt = l1mu->hwPt() * 0.5; - this_mu.eta = l1mu->hwEta() * eta_scale; - this_mu.theta = L1TkMuMantra::to_mpio2_pio2(L1TkMuMantra::eta_to_theta(l1mu->hwEta() * eta_scale)); - this_mu.phi = - MicroGMTConfiguration::calcGlobalPhi(l1mu->hwPhi(), l1mu->trackFinderType(), l1mu->processor()) * phi_scale; - this_mu.charge = (l1mu->hwSign() == 0 ? 1 : -1); // charge sign bit (charge = (-1)^(sign)) - result.push_back(this_mu); - } - return result; -} - -std::vector L1TkMuonProducer::product_to_muvec(const EMTFTrackCollection& l1mus) const { - std::vector result(l1mus.size()); - for (uint imu = 0; imu < l1mus.size(); ++imu) { - auto& mu = l1mus[imu]; - - // dropping the emtf tracks with certain quality... - int emtfQual = (mu.Mode() == 11 || mu.Mode() == 13 || mu.Mode() == 14 || mu.Mode() == 15); - if (applyQuality_ && !emtfQual) - continue; - - result[imu].pt = mu.Pt(); - result[imu].eta = mu.Eta(); - result[imu].theta = L1TkMuMantra::to_mpio2_pio2(L1TkMuMantra::eta_to_theta(mu.Eta())); - result[imu].phi = angle_units::operators::convertDegToRad(mu.Phi_glob()); - result[imu].charge = mu.Charge(); - } - return result; -} - -void L1TkMuonProducer::build_tkMuons_from_idxs(TkMuonCollection& tkMuons, - const std::vector& matches, - const edm::Handle& l1tksH, - const edm::Handle& muonH, - int detector) const { - for (uint imatch = 0; imatch < matches.size(); ++imatch) { - int match_trk_idx = matches[imatch]; - if (match_trk_idx < 0) - continue; // this muon was not matched to any candidate - - // take properties of the track - const L1TTTrackType& matchTk = (*l1tksH.product())[match_trk_idx]; - const auto& p3 = matchTk.momentum(); - const auto& tkv3 = matchTk.POCA(); - float p4e = sqrt(mu_mass * mu_mass + p3.mag2()); - math::XYZTLorentzVector l1tkp4(p3.x(), p3.y(), p3.z(), p4e); - - edm::Ptr l1tkPtr(l1tksH, match_trk_idx); - auto l1muRef = muonH.isValid() ? edm::Ref(muonH, imatch) - : edm::Ref(); - - float trkisol = -999; - TkMuon l1tkmu(l1tkp4, l1muRef, l1tkPtr, trkisol); - l1tkmu.setTrackCurvature(matchTk.rInv()); - l1tkmu.setTrkzVtx((float)tkv3.z()); - l1tkmu.setMuonDetector(detector); - l1tkmu.setQuality(l1muRef->hwQual()); - - // apply region cleaning (probably this is not the best way, but since this is going to - // be a patch and temporary, it is OK) - if (useRegionEtaMatching_) { - if (detector == barrel_MTF_region) { - if (std::abs(l1tkmu.eta()) > etaBO_) - continue; - } else if (detector == overlap_MTF_region) { - if (std::abs(l1tkmu.eta()) < etaBO_) - continue; - if (std::abs(l1tkmu.eta()) > etaOE_) - continue; - } else if (detector == endcap_MTF_region) { - if (std::abs(l1tkmu.eta()) < etaOE_) - continue; - } - } - tkMuons.push_back(l1tkmu); - } - return; -} - -void L1TkMuonProducer::build_tkMuons_from_idxs(TkMuonCollection& tkMuons, - const std::vector& matches, - const edm::Handle& l1tksH, - const edm::Handle& emtfTksH, - int detector) const { - for (uint imatch = 0; imatch < matches.size(); ++imatch) { - int match_trk_idx = matches[imatch]; - if (match_trk_idx < 0) - continue; // this muon was not matched to any candidate - - // take properties of the track - const L1TTTrackType& matchTk = (*l1tksH.product())[match_trk_idx]; - const auto& p3 = matchTk.momentum(); - const auto& tkv3 = matchTk.POCA(); - float p4e = sqrt(mu_mass * mu_mass + p3.mag2()); - math::XYZTLorentzVector l1tkp4(p3.x(), p3.y(), p3.z(), p4e); - - edm::Ptr l1tkPtr(l1tksH, match_trk_idx); - - auto l1emtfTrk = - emtfTksH.isValid() ? edm::Ref(emtfTksH, imatch) : edm::Ref(); - - float trkisol = -999; - TkMuon l1tkmu(l1tkp4, l1emtfTrk, l1tkPtr, trkisol); - l1tkmu.setTrackCurvature(matchTk.rInv()); - l1tkmu.setTrkzVtx((float)tkv3.z()); - l1tkmu.setMuonDetector(detector); - l1tkmu.setQuality(l1emtfTrk->Mode()); - - if (useRegionEtaMatching_ && std::abs(l1tkmu.eta()) < etaOE_) - continue; - - tkMuons.push_back(l1tkmu); - } - return; -} - -//define this as a plug-in -DEFINE_FWK_MODULE(L1TkMuonProducer); diff --git a/L1Trigger/L1TTrackMatch/python/L1TkGlbMuonProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkGlbMuonProducer_cfi.py deleted file mode 100644 index cf9d2e5308fa1..0000000000000 --- a/L1Trigger/L1TTrackMatch/python/L1TkGlbMuonProducer_cfi.py +++ /dev/null @@ -1,20 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -L1TkGlbMuons = cms.EDProducer("L1TkGlbMuonProducer", - ############################################### - ############################################### common stuff - L1MuonInputTag = cms.InputTag("simGmtStage2Digis"), - L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), - ############################################### - ############################################### TP algo - ETAMIN = cms.double(0), - ETAMAX = cms.double(5.), # no cut - ZMAX = cms.double( 25. ), # in cm - CHI2MAX = cms.double( 100. ), - PTMINTRA = cms.double( 2. ), # in GeV - DRmax = cms.double( 0.5 ), - nStubsmin = cms.int32( 4 ), # minimum number of stubs - correctGMTPropForTkZ = cms.bool(True), - use5ParameterFit = cms.bool(False), #use 4-pars by defaults - useTPMatchWindows = cms.bool(True), -) diff --git a/L1Trigger/L1TTrackMatch/python/L1TkMuonProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkMuonProducer_cfi.py deleted file mode 100644 index db7443a36cd24..0000000000000 --- a/L1Trigger/L1TTrackMatch/python/L1TkMuonProducer_cfi.py +++ /dev/null @@ -1,79 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -L1TkMuons = cms.EDProducer("L1TkMuonProducer", - ############################################### - ## switches that control the algos for the regions - bmtfMatchAlgoVersion = cms.string( 'TP' ), - omtfMatchAlgoVersion = cms.string( 'MAnTra' ), - emtfMatchAlgoVersion = cms.string( 'MAnTra' ), - ############################################### common stuff - L1BMTFInputTag = cms.InputTag("simKBmtfDigis","BMTF"), - L1OMTFInputTag = cms.InputTag("simOmtfDigis","OMTF"), - L1EMTFInputTag = cms.InputTag("simEmtfDigis","EMTF"), - L1EMTFTrackCollectionInputTag = cms.InputTag("simEmtfDigis"), - L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), - ############################################### - ############################################### TP algo - ETAMIN = cms.double(0), - ETAMAX = cms.double(5.), # no cut - ETABARRELOVERLAP = cms.double(0.83), - ETAOVERLAPENDCAP = cms.double(1.24), - useRegionEtaMatching = cms.bool(True), - ZMAX = cms.double( 25. ), # in cm - CHI2MAX = cms.double( 100. ), - PTMINTRA = cms.double( 2. ), # in GeV - DRmax = cms.double( 0.5 ), - nStubsmin = cms.int32( 4 ), # minimum number of stubs -# closest = cms.bool( True ), - correctGMTPropForTkZ = cms.bool(True), - use5ParameterFit = cms.bool(False), #use 4-pars by defaults - useTPMatchWindows = cms.bool(True), - applyQualityCuts = cms.bool(False), - # emtfMatchAlgoVersion = cms.int32( 1 ), # version of matching EMTF with Trackes (1 or 2) - ############################################### - ############################################### DynamicWindows algo - ##### parameters for the DynamicWindows algo - eventually to put in a separate file, that will override some dummy defaults - emtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_boundaries.root'), - emtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_theta_q99.root'), - emtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_phi_q99.root'), - ## block to control the evolution of the matching window vs pt - ## if do_relax_factors = False ==> global scale of upper and lower boundaries by "final_window_factor" - ## if do_relax_factors = True ==> progressive linear scale, the factor is - ## - initial_window_factor for pt <= pt_start_relax - ## - final_window_factor for pt >= pt_end_relax - ## - and a linear interpolation in the middle - ## facror = 0 --> no changes to the window size - initial_window_factor = cms.double(0.0), - final_window_factor = cms.double(0.5), - pt_start_relax = cms.double(2.0), - pt_end_relax = cms.double(6.0), - do_relax_factors = cms.bool(True), - ## - n_trk_par = cms.int32(4), # 4 or 5 - min_trk_p = cms.double(3.5), - max_trk_aeta = cms.double(2.5), - max_trk_chi2 = cms.double(100.0), - min_trk_nstubs = cms.int32(4), - ############################################### - ############################################### Mantra algo - ## please NOTE that as of 6/11/2019, only these parameters are effectively used for the MAnTra correlator - # - mantra_n_trk_par = cms.int32(4), # 4 or 5 - # - mantra_bmtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_barrel/matching_windows_boundaries.root'), - mantra_bmtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_barrel/matching_windows_theta_q99.root'), - mantra_bmtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_barrel/matching_windows_phi_q99.root'), - # - mantra_omtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_overlap/matching_windows_boundaries.root'), - mantra_omtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_overlap/matching_windows_theta_q99.root'), - mantra_omtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_overlap/matching_windows_phi_q99.root'), - # - mantra_emtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_boundaries.root'), - mantra_emtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_theta_q99.root'), - mantra_emtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_phi_q99.root'), -) - -L1TkMuonsTP = L1TkMuons.clone( - emtfMatchAlgoVersion='TP', - useTPMatchWindows = True -) diff --git a/L1Trigger/L1TTrackMatch/src/L1TkMuCorrDynamicWindows.cc b/L1Trigger/L1TTrackMatch/src/L1TkMuCorrDynamicWindows.cc deleted file mode 100644 index 082174f341a3e..0000000000000 --- a/L1Trigger/L1TTrackMatch/src/L1TkMuCorrDynamicWindows.cc +++ /dev/null @@ -1,408 +0,0 @@ -#include "L1Trigger/L1TTrackMatch/interface/L1TkMuCorrDynamicWindows.h" -#include "DataFormats/Math/interface/deltaPhi.h" -#include "DataFormats/Math/interface/angle_units.h" - -// ROOT includes -#include "TH1.h" -#include "TH2.h" - -L1TkMuCorrDynamicWindows::L1TkMuCorrDynamicWindows(const std::vector& bounds, TFile* fIn_theta, TFile* fIn_phi) - : wdws_theta_(bounds.size() - 1, MuMatchWindow()), - wdws_phi_(bounds.size() - 1, MuMatchWindow()), - wdws_theta_S1_(bounds.size() - 1, MuMatchWindow()), - wdws_phi_S1_(bounds.size() - 1, MuMatchWindow()) { - set_safety_factor(0.5); - set_sf_initialrelax(0.0); - set_relaxation_pattern(2.0, 6.0); - set_do_relax_factor(true); - - track_qual_presel_ = true; - - nbins_ = bounds.size() - 1; - bounds_ = bounds; - - // now load in memory the TF1 fits - - for (int ib = 0; ib < nbins_; ++ib) { - std::string wdn; - std::string nml; - std::string nmh; - TF1* fl; - TF1* fh; - - // Station 2 - wdn = std::string("wdw_theta_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - fl = (TF1*)fIn_theta->Get(nml.c_str()); - fh = (TF1*)fIn_theta->Get(nmh.c_str()); - if (fl == nullptr || fh == nullptr) - throw cms::Exception("L1TkMuCorrDynamicWindows") - << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n"; - wdws_theta_.at(ib).SetName(wdn); - wdws_theta_.at(ib).SetLower(fl); - wdws_theta_.at(ib).SetUpper(fh); - - wdn = std::string("wdw_phi_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - fl = (TF1*)fIn_phi->Get(nml.c_str()); - fh = (TF1*)fIn_phi->Get(nmh.c_str()); - if (fl == nullptr || fh == nullptr) - throw cms::Exception("L1TkMuCorrDynamicWindows") - << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n"; - wdws_phi_.at(ib).SetName(wdn); - wdws_phi_.at(ib).SetLower(fl); - wdws_phi_.at(ib).SetUpper(fh); - } -} - -L1TkMuCorrDynamicWindows::L1TkMuCorrDynamicWindows( - const std::vector& bounds, TFile* fIn_theta, TFile* fIn_phi, TFile* fIn_theta_S1, TFile* fIn_phi_S1) - : wdws_theta_(bounds.size() - 1, MuMatchWindow()), - wdws_phi_(bounds.size() - 1, MuMatchWindow()), - wdws_theta_S1_(bounds.size() - 1, MuMatchWindow()), - wdws_phi_S1_(bounds.size() - 1, MuMatchWindow()) { - set_safety_factor(0.0); - set_sf_initialrelax(0.0); - set_relaxation_pattern(2.0, 6.0); - set_do_relax_factor(true); - - track_qual_presel_ = true; - - nbins_ = bounds.size() - 1; - bounds_ = bounds; - - // now load in memory the TF1 fits - - for (int ib = 0; ib < nbins_; ++ib) { - std::string wdn; - std::string nml; - std::string nmh; - TF1* fl; - TF1* fh; - - // Station 2 - wdn = std::string("wdw_theta_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - fl = (TF1*)fIn_theta->Get(nml.c_str()); - fh = (TF1*)fIn_theta->Get(nmh.c_str()); - if (fl == nullptr || fh == nullptr) - throw cms::Exception("L1TkMuCorrDynamicWindows") - << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n"; - wdws_theta_.at(ib).SetName(wdn); - wdws_theta_.at(ib).SetLower(fl); - wdws_theta_.at(ib).SetUpper(fh); - - wdn = std::string("wdw_phi_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - fl = (TF1*)fIn_phi->Get(nml.c_str()); - fh = (TF1*)fIn_phi->Get(nmh.c_str()); - if (fl == nullptr || fh == nullptr) - throw cms::Exception("L1TkMuCorrDynamicWindows") - << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n"; - wdws_phi_.at(ib).SetName(wdn); - wdws_phi_.at(ib).SetLower(fl); - wdws_phi_.at(ib).SetUpper(fh); - - // Station 1 - MW's don't have to exist for TkMuon correlator - // It is only needed for TkMuStub - wdn = std::string("wdw_theta_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - fl = (TF1*)fIn_theta_S1->Get(nml.c_str()); - fh = (TF1*)fIn_theta_S1->Get(nmh.c_str()); - if (fl == nullptr || fh == nullptr) - throw cms::Exception("L1TkMuCorrDynamicWindows") - << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n"; - wdws_theta_S1_.at(ib).SetName(wdn); - wdws_theta_S1_.at(ib).SetLower(fl); - wdws_theta_S1_.at(ib).SetUpper(fh); - - wdn = std::string("wdw_phi_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - fl = (TF1*)fIn_phi_S1->Get(nml.c_str()); - fh = (TF1*)fIn_phi_S1->Get(nmh.c_str()); - if (fl == nullptr || fh == nullptr) - throw cms::Exception("L1TkMuCorrDynamicWindows") - << "TF1 named " << nml << " or " << nmh << " not found in file " << fIn_theta->GetName() << ".\n"; - wdws_phi_S1_.at(ib).SetName(wdn); - wdws_phi_S1_.at(ib).SetLower(fl); - wdws_phi_S1_.at(ib).SetUpper(fh); - } -} - -int L1TkMuCorrDynamicWindows::findBin(double val) { - // not the most efficient, nor the most elegant implementation for now - if (val < bounds_.at(0)) - return 0; - if (val >= bounds_.back()) - return (nbins_ - 1); // i.e. bounds_size() -2 - - for (uint ib = 0; ib < bounds_.size() - 1; ++ib) { - if (val >= bounds_.at(ib) && val < bounds_.at(ib + 1)) - return ib; - } - - //"Something strange happened at val. - throw cms::Exception("L1TkMuCorrDynamicWindows") << "Can't find bin.\n"; - return 0; -} - -std::vector L1TkMuCorrDynamicWindows::find_match(const EMTFTrackCollection& l1mus, - const L1TTTrackCollectionType& l1trks) { - std::vector out(l1trks.size()); - for (auto l1trkit = l1trks.begin(); l1trkit != l1trks.end(); ++l1trkit) { - float trk_pt = l1trkit->momentum().perp(); - float trk_p = l1trkit->momentum().mag(); - float trk_aeta = std::abs(l1trkit->momentum().eta()); - float trk_theta = to_mpio2_pio2(eta_to_theta(l1trkit->momentum().eta())); - float trk_phi = l1trkit->momentum().phi(); - int trk_charge = (l1trkit->rInv() > 0 ? 1 : -1); - - // porting some selections from the MuonTrackCorr finder - // https://github.com/cms-l1t-offline/cmssw/blob/l1t-phase2-932-v1.6/L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc#L264 - // in future, make preselections confiuguable - bool reject_trk = false; - if (trk_p < min_trk_p_) - reject_trk = true; - if (trk_aeta > max_trk_aeta_) - reject_trk = true; - if (track_qual_presel_) { - float l1tk_chi2 = l1trkit->chi2(); - int l1tk_nstubs = l1trkit->getStubRefs().size(); - if (l1tk_chi2 >= max_trk_chi2_) - reject_trk = true; - if (l1tk_nstubs < min_trk_nstubs_) - reject_trk = true; - } - - int ibin = findBin(trk_aeta); - - std::vector> matched; // dtheta, dphi, idx - // loop on muons to see which match - for (auto l1muit = l1mus.begin(); l1muit != l1mus.end(); ++l1muit) { - // match only muons in the central bx - as the track collection refers anyway to bx 0 only - if (l1muit->BX() != 0) - continue; - - // putting everything in rad - float emtf_theta = to_mpio2_pio2(eta_to_theta(l1muit->Eta())); - float emtf_phi = angle_units::operators::convertDegToRad(l1muit->Phi_glob()); - - float dtheta = std::abs(emtf_theta - trk_theta); - float dphi = reco::deltaPhi(emtf_phi, trk_phi); - float adphi = std::abs(dphi); - - double sf_l; - double sf_h; - if (do_relax_factor_) { - sf_l = sf_progressive(trk_pt, pt_start_, pt_end_, initial_sf_l_, safety_factor_l_); - sf_h = sf_progressive(trk_pt, pt_start_, pt_end_, initial_sf_h_, safety_factor_h_); - } else { - sf_l = safety_factor_l_; - sf_h = safety_factor_h_; - } - - if ( - // emtf_theta * trk_theta > 0 && - dtheta > (1 - sf_l) * wdws_theta_.at(ibin).bound_low(trk_pt) && - dtheta <= (1 + sf_h) * wdws_theta_.at(ibin).bound_high(trk_pt) && - adphi > (1 - sf_l) * wdws_phi_.at(ibin).bound_low(trk_pt) && - adphi <= (1 + sf_h) * wdws_phi_.at(ibin).bound_high(trk_pt) && dphi * trk_charge < 0 && // sign requirement - // rndm > 0.5 - true) - matched.emplace_back(dtheta, adphi, std::distance(l1mus.begin(), l1muit)); - } - - if (reject_trk) - matched.clear(); // quick fix - to be optimised to avoid the operations above - - if (matched.empty()) - out.at(std::distance(l1trks.begin(), l1trkit)) = -1; - else { - std::sort(matched.begin(), matched.end()); // closest in theta, then in phi - out.at(std::distance(l1trks.begin(), l1trkit)) = std::get<2>(matched.at(0)); - } - } - - // now convert out to a unique set - return make_unique_coll(l1mus.size(), l1trks, out); -} - -std::vector L1TkMuCorrDynamicWindows::find_match_stub(const EMTFHitCollection& l1mus, - const L1TTTrackCollectionType& l1trks, - const int& station, - bool requireBX0) { - std::vector out(l1trks.size()); - for (auto l1trkit = l1trks.begin(); l1trkit != l1trks.end(); ++l1trkit) { - float trk_pt = l1trkit->momentum().perp(); - float trk_p = l1trkit->momentum().mag(); - float trk_aeta = std::abs(l1trkit->momentum().eta()); - float trk_theta = to_mpio2_pio2(eta_to_theta(l1trkit->momentum().eta())); - float trk_phi = l1trkit->momentum().phi(); - int trk_charge = (l1trkit->rInv() > 0 ? 1 : -1); - - // porting some selections from the MuonTrackCorr finder - // https://github.com/cms-l1t-offline/cmssw/blob/l1t-phase2-932-v1.6/L1Trigger/L1TTrackMatch/plugins/L1TkMuonProducer.cc#L264 - // for future: make preselections confiuguable - bool reject_trk = false; - if (trk_p < min_trk_p_) - reject_trk = true; - if (trk_aeta > max_trk_aeta_) - reject_trk = true; - if (track_qual_presel_) { - float l1tk_chi2 = l1trkit->chi2(); - int l1tk_nstubs = l1trkit->getStubRefs().size(); - if (l1tk_chi2 >= max_trk_chi2_) - reject_trk = true; - if (l1tk_nstubs < min_trk_nstubs_) - reject_trk = true; - } - - int ibin = findBin(trk_aeta); - - std::vector> matched; // dtheta, dphi, idx - // loop on stubs to see which match - for (auto l1muit = l1mus.begin(); l1muit != l1mus.end(); ++l1muit) { - if (!(l1muit->Is_CSC() || l1muit->Is_RPC())) - continue; - - int hit_station = l1muit->Station(); - // match only stubs in the central bx - as the track collection refers anyway to bx 0 only - if (requireBX0 && l1muit->BX() != 0) - continue; - - // allow only track matching to stubs from the given station, station= 1,2,3,4 - if (station < 5 && hit_station != station) - continue; - // in case of station=12 allow track matching to stubs from either station 1 or 2. - else if (station == 12 && hit_station > 2) // good for tkMuStub12 - continue; - // in case of station=123 allow track matching to stubs from either station 1, 2, or 3. - else if (station == 123 && hit_station > 3) // good for tkMuStub123 - continue; - // in case of station=1234 allow track matching to stubs from either station 1, 2, 3, or 4. - else if (station == 1234 && hit_station > 4) // good for tkMuStub1234 - continue; - - float emtf_theta = to_mpio2_pio2(eta_to_theta(l1muit->Eta_sim())); - float emtf_phi = angle_units::operators::convertDegToRad(l1muit->Phi_sim()); - - float dtheta = std::abs(emtf_theta - trk_theta); - float dphi = reco::deltaPhi(emtf_phi, trk_phi); - float adphi = std::abs(dphi); - - double sf_l; - double sf_h; - if (do_relax_factor_) { - sf_l = sf_progressive(trk_pt, pt_start_, pt_end_, initial_sf_l_, safety_factor_l_); - sf_h = sf_progressive(trk_pt, pt_start_, pt_end_, initial_sf_h_, safety_factor_h_); - } else { - sf_l = safety_factor_l_; - sf_h = safety_factor_h_; - } - - if (hit_station == 1 && - //if hit in station 1 use these matching windows for checking - - dtheta > (1 - sf_l) * wdws_theta_S1_.at(ibin).bound_low(trk_pt) && - dtheta <= (1 + sf_h) * wdws_theta_S1_.at(ibin).bound_high(trk_pt) && - adphi > (1 - sf_l) * wdws_phi_S1_.at(ibin).bound_low(trk_pt) && - adphi <= (1 + sf_h) * wdws_phi_S1_.at(ibin).bound_high(trk_pt) && - dphi * trk_charge < 0 && // sign requirement - true) - matched.emplace_back(dtheta, adphi, std::distance(l1mus.begin(), l1muit)); - - if (hit_station == 2 && dtheta > (1 - sf_l) * wdws_theta_.at(ibin).bound_low(trk_pt) && - dtheta <= (1 + sf_h) * wdws_theta_.at(ibin).bound_high(trk_pt) && - adphi > (1 - sf_l) * wdws_phi_.at(ibin).bound_low(trk_pt) && - adphi <= (1 + sf_h) * wdws_phi_.at(ibin).bound_high(trk_pt) && dphi * trk_charge < 0 && // sign requirement - // rndm > 0.5 - true) - matched.emplace_back(dtheta, adphi, std::distance(l1mus.begin(), l1muit)); - } - - if (reject_trk) - matched.clear(); // quick fix - to be optimised to avoid the operations above - - if (matched.empty()) - out.at(std::distance(l1trks.begin(), l1trkit)) = -1; - else { - std::sort(matched.begin(), matched.end()); // closest in theta, then in phi - out.at(std::distance(l1trks.begin(), l1trkit)) = std::get<2>(matched.at(0)); - } - } - - // return out; - - // now convert out to a unique set - auto unique_out = make_unique_coll(l1mus.size(), l1trks, out); - - return unique_out; -} - -std::vector L1TkMuCorrDynamicWindows::make_unique_coll(const unsigned int& l1musSize, - const L1TTTrackCollectionType& l1trks, - const std::vector& matches) { - std::vector out(matches.size(), -1); - - std::vector> macthed_to_emtf(l1musSize, - std::vector(0)); // one vector of matched trk idx per EMTF - - for (unsigned int itrack = 0; itrack < matches.size(); ++itrack) { - int iemtf = matches.at(itrack); - if (iemtf < 0) - continue; - macthed_to_emtf.at(iemtf).push_back(itrack); - } - - std::function track_less_than_proto = - [](int idx1, int idx2, const L1TTTrackCollectionType& l1trkcoll, int nTrackParams) { - float pt1 = l1trkcoll.at(idx1).momentum().perp(); - float pt2 = l1trkcoll.at(idx2).momentum().perp(); - return (pt1 < pt2); - }; - - // // and binds to accept only 2 params - std::function track_less_than = - std::bind(track_less_than_proto, std::placeholders::_1, std::placeholders::_2, l1trks, nTrkPars_); - - for (unsigned int iemtf = 0; iemtf < macthed_to_emtf.size(); ++iemtf) { - std::vector& thisv = macthed_to_emtf.at(iemtf); - if (thisv.empty()) - continue; - - std::sort(thisv.begin(), thisv.end(), track_less_than); - - // copy to the output - int best_trk = thisv.back(); - out.at(best_trk) = iemtf; - } - - return out; -} - -std::vector L1TkMuCorrDynamicWindows::prepare_corr_bounds(const string& fname, const string& hname) { - // find the boundaries of the match windoww - TFile* fIn = TFile::Open(fname.c_str()); - if (fIn == nullptr) { - throw cms::Exception("L1TkMuMantra") << "Can't find file " << fname << " to derive bounds.\n"; - } - TH2* h_test = (TH2*)fIn->Get(hname.c_str()); - if (h_test == nullptr) { - throw cms::Exception("L1TkMuCorrDynamicWindows") - << "Can't find histo " << hname << " in file " << fname << " to derive bounds.\n"; - } - - int nbds = h_test->GetNbinsY() + 1; - vector bounds(nbds); - for (int ib = 0; ib < nbds; ++ib) { - bounds.at(ib) = h_test->GetYaxis()->GetBinLowEdge(ib + 1); - } - fIn->Close(); - return bounds; -} diff --git a/L1Trigger/L1TTrackMatch/src/L1TkMuMantra.cc b/L1Trigger/L1TTrackMatch/src/L1TkMuMantra.cc deleted file mode 100644 index b26e25af5ab2f..0000000000000 --- a/L1Trigger/L1TTrackMatch/src/L1TkMuMantra.cc +++ /dev/null @@ -1,220 +0,0 @@ -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "L1Trigger/L1TTrackMatch/interface/L1TkMuMantra.h" -#include "DataFormats/Math/interface/deltaPhi.h" - -#include "TH2.h" -#include "TFile.h" - -using namespace L1TkMuMantraDF; - -L1TkMuMantra::L1TkMuMantra(const std::vector& bounds, - TFile* fIn_theta, - TFile* fIn_phi, - std::string name = "mantra") - : wdws_theta_(bounds.size() - 1, MuMatchWindow()), wdws_phi_(bounds.size() - 1, MuMatchWindow()) { - name_ = name; - - safety_factor_l_ = 0.0; - safety_factor_h_ = 0.0; - - sort_type_ = kMaxPt; - - // copy boundaries - nbins_ = bounds.size() - 1; - bounds_ = bounds; - - // now load in memory the TF1 fits - - for (int ib = 0; ib < nbins_; ++ib) { - std::string wdn; - std::string nml; - std::string nmc; - std::string nmh; - TF1* fl; - TF1* fc; - TF1* fh; - - wdn = name_ + std::string("_wdw_theta_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmc = std::string("fit_cent_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - - fl = (TF1*)fIn_theta->Get(nml.c_str()); - fc = (TF1*)fIn_theta->Get(nmc.c_str()); - fh = (TF1*)fIn_theta->Get(nmh.c_str()); - if (fl == nullptr || fc == nullptr || fh == nullptr) { - if (verbosity_ > 0) { - LogTrace("L1TkMuMantra") << "... fit theta low : " << fl << std::endl; - LogTrace("L1TkMuMantra") << "... fit theta cent : " << fc << std::endl; - LogTrace("L1TkMuMantra") << "... fit theta high : " << fh << std::endl; - } - throw cms::Exception("L1TkMuMantra") << "TF1 named " << nml << " or " << nmc << " or " << nmh - << " not found in file " << fIn_theta->GetName() << ".\n"; - } - wdws_theta_.at(ib).SetName(wdn); - wdws_theta_.at(ib).SetLower(fl); - wdws_theta_.at(ib).SetCentral(fc); - wdws_theta_.at(ib).SetUpper(fh); - - wdn = name_ + std::string("_wdw_phi_") + std::to_string(ib + 1); - nml = std::string("fit_low_") + std::to_string(ib + 1); - nmc = std::string("fit_cent_") + std::to_string(ib + 1); - nmh = std::string("fit_high_") + std::to_string(ib + 1); - fl = (TF1*)fIn_phi->Get(nml.c_str()); - fc = (TF1*)fIn_phi->Get(nmc.c_str()); - fh = (TF1*)fIn_phi->Get(nmh.c_str()); - if (fl == nullptr || fc == nullptr || fh == nullptr) { - if (verbosity_ > 0) { - LogTrace("L1TkMuMantra") << "... fit phi low : " << fl << std::endl; - LogTrace("L1TkMuMantra") << "... fit phi cent : " << fc << std::endl; - LogTrace("L1TkMuMantra") << "... fit phi high : " << fh << std::endl; - } - throw cms::Exception("L1TkMuMantra") << "TF1 named " << nml << " or " << nmc << " or " << nmh - << " not found in file " << fIn_theta->GetName() << ".\n"; - } - wdws_phi_.at(ib).SetName(wdn); - wdws_phi_.at(ib).SetLower(fl); - wdws_phi_.at(ib).SetCentral(fc); - wdws_phi_.at(ib).SetUpper(fh); - } -} - -int L1TkMuMantra::findBin(double val) { - // FIXME: not the most efficient, nor the most elegant implementation for now - if (val < bounds_.at(0)) - return 0; - if (val >= bounds_.back()) - return (nbins_ - 1); // i.e. bounds_size() -2 - - for (uint ib = 0; ib < bounds_.size() - 1; ++ib) { - if (val >= bounds_.at(ib) && val < bounds_.at(ib + 1)) - return ib; - } - - if (verbosity_ > 0) - LogTrace("L1TkMuMantra") << "Something strange happened at val " << val << std::endl; - return 0; -} - -void L1TkMuMantra::test(double eta, double pt) { - int ibin = findBin(eta); - - LogTrace("L1TkMuMantra") << " ---- eta : " << eta << " pt: " << pt << std::endl; - LogTrace("L1TkMuMantra") << " ---- bin " << ibin << std::endl; - LogTrace("L1TkMuMantra") << " ---- " - << "- low_phi : " << wdws_phi_.at(ibin).bound_low(pt) - << "- cent_phi : " << wdws_phi_.at(ibin).bound_cent(pt) - << "- high_phi : " << wdws_phi_.at(ibin).bound_high(pt) << std::endl; - - LogTrace("L1TkMuMantra") << " ---- " - << "- low_theta : " << wdws_theta_.at(ibin).bound_low(pt) - << "- cent_theta : " << wdws_theta_.at(ibin).bound_cent(pt) - << "- high_theta : " << wdws_theta_.at(ibin).bound_high(pt) << std::endl; - - return; -} - -std::vector L1TkMuMantra::find_match(const std::vector& tracks, const std::vector& muons) { - std::vector result(muons.size(), -1); // init all TkMu to index -1 - for (uint imu = 0; imu < muons.size(); ++imu) { - muon_df mu = muons.at(imu); - std::vector> matched_trks; // sort_par, idx - for (uint itrk = 0; itrk < tracks.size(); ++itrk) { - // preselection of tracks - track_df trk = tracks.at(itrk); - if (trk.chi2 >= max_chi2) - continue; // require trk.chi2 < max_chi2 - if (trk.nstubs < min_nstubs) - continue; // require trk.nstubs >= min_nstubs - - double dphi_charge = reco::deltaPhi(trk.phi, mu.phi) * trk.charge; - // sign from theta, to avoid division by 0 - double dtheta_endc = (mu.theta - trk.theta) * sign(mu.theta); - if (sign(mu.theta) != sign(trk.theta)) { - // crossing the barrel -> remove 180 deg to the theta of the neg candidate to avoid jumps at eta = 0 - dtheta_endc -= TMath::Pi(); - } - - // lookup the values - int ibin = findBin(std::abs(trk.eta)); - - double phi_low = wdws_phi_.at(ibin).bound_low(trk.pt); - double phi_cent = wdws_phi_.at(ibin).bound_cent(trk.pt); - double phi_high = wdws_phi_.at(ibin).bound_high(trk.pt); - relax_windows(phi_low, phi_cent, phi_high); // apply the safety factor - bool in_phi = (dphi_charge > phi_low && dphi_charge < phi_high); - - double theta_low = wdws_theta_.at(ibin).bound_low(trk.pt); - double theta_cent = wdws_theta_.at(ibin).bound_cent(trk.pt); - double theta_high = wdws_theta_.at(ibin).bound_high(trk.pt); - relax_windows(theta_low, theta_cent, theta_high); // apply the safety factor - bool in_theta = (dtheta_endc > theta_low && dtheta_endc < theta_high); - - if (in_phi && in_theta) { - double sort_par = 99999; - if (sort_type_ == kMaxPt) - sort_par = trk.pt; - else if (sort_type_ == kMinDeltaPt) { - // trk.pt should always be > 0, but put this protection just in case - sort_par = (trk.pt > 0 ? std::abs(1. - (mu.pt / trk.pt)) : 0); - } - matched_trks.emplace_back(sort_par, itrk); - } - } - - // choose out of the matched tracks the best one - if (!matched_trks.empty()) { - sort(matched_trks.begin(), matched_trks.end()); - int ibest = 99999; - if (sort_type_ == kMaxPt) - ibest = matched_trks.rbegin()->second; // sorted low to high -> take last for highest pT (rbegin) - else if (sort_type_ == kMinDeltaPt) - ibest = matched_trks.begin()->second; // sorted low to high -> take first for min pT distance (begin) - result.at(imu) = ibest; - } - } - - return result; -} - -void L1TkMuMantra::relax_windows(double& low, double cent, double& high) { - double delta_high = high - cent; - double delta_low = cent - low; - - high = high + safety_factor_h_ * delta_high; - low = low - safety_factor_l_ * delta_low; - - return; -} - -void L1TkMuMantra::setArbitrationType(std::string type) { - if (verbosity_ > 0) - LogTrace("L1TkMuMantra") << "L1TkMuMantra : setting arbitration type to " << type << std::endl; - if (type == "MaxPt") - sort_type_ = kMaxPt; - else if (type == "MinDeltaPt") - sort_type_ = kMinDeltaPt; - else - throw cms::Exception("L1TkMuMantra") << "setArbitrationType : cannot understand the arbitration type passed.\n"; -} - -std::vector L1TkMuMantra::prepare_corr_bounds(std::string fname, std::string hname) { - // find the boundaries of the match windoww - TFile* fIn = TFile::Open(fname.c_str()); - if (fIn == nullptr) { - throw cms::Exception("L1TkMuMantra") << "Can't find file " << fname << " to derive bounds.\n"; - } - TH2* h_test = (TH2*)fIn->Get(hname.c_str()); - if (h_test == nullptr) { - throw cms::Exception("L1TkMuMantra") << "Can't find histo " << hname << " in file " << fname - << " to derive bounds.\n"; - } - - int nbds = h_test->GetNbinsY() + 1; - std::vector bounds(nbds); - for (int ib = 0; ib < nbds; ++ib) { - bounds.at(ib) = h_test->GetYaxis()->GetBinLowEdge(ib + 1); - } - fIn->Close(); - return bounds; -} diff --git a/L1Trigger/L1TTrackMatch/src/MuMatchWindow.cc b/L1Trigger/L1TTrackMatch/src/MuMatchWindow.cc deleted file mode 100644 index 54b527c50d141..0000000000000 --- a/L1Trigger/L1TTrackMatch/src/MuMatchWindow.cc +++ /dev/null @@ -1,40 +0,0 @@ -#include "L1Trigger/L1TTrackMatch/interface/MuMatchWindow.h" - -MuMatchWindow::MuMatchWindow() { name_ = ""; } - -MuMatchWindow::MuMatchWindow(std::string name) { SetName(name); } - -MuMatchWindow::~MuMatchWindow() {} - -void MuMatchWindow::SetLower(std::string formula) { - TF1 f("tmp", formula.c_str(), 0, 1000); - SetLower(&f); -} - -void MuMatchWindow::SetCentral(std::string formula) { - TF1 f("tmp", formula.c_str(), 0, 1000); - SetCentral(&f); -} - -void MuMatchWindow::SetUpper(std::string formula) { - TF1 f("tmp", formula.c_str(), 0, 1000); - SetUpper(&f); -} - -void MuMatchWindow::SetLower(TF1* formula) { - if (fLow_) - throw std::runtime_error("Cannot initialize twice fLow_"); - fLow_ = std::shared_ptr((TF1*)formula->Clone((name_ + std::string("low")).c_str())); -} - -void MuMatchWindow::SetCentral(TF1* formula) { - if (fCent_) - throw std::runtime_error("Cannot initialize twice fCent_"); - fCent_ = std::shared_ptr((TF1*)formula->Clone((name_ + std::string("cent")).c_str())); -} - -void MuMatchWindow::SetUpper(TF1* formula) { - if (fHigh_) - throw std::runtime_error("Cannot initialize twice fHigh_"); - fHigh_ = std::shared_ptr((TF1*)formula->Clone((name_ + std::string("high")).c_str())); -} From c34e04c4e7ff065fadf52c12923ad28b59ccf1f2 Mon Sep 17 00:00:00 2001 From: Gianluca Date: Mon, 13 Jun 2022 14:26:45 +0200 Subject: [PATCH 28/66] remove obsolete e/g plugins (cherry picked from commit 31600b06867c4713f1fcf701c9a69d09fbb6536e) --- .../interface/L1EGammaEECalibrator.h | 25 - .../plugins/L1EGammaEEProducer.cc | 168 ---- .../python/L1TCaloTriggerNtuples_cff.py | 24 - .../python/l1EGammaEEProducer_cfi.py | 5 - .../python/l1EgammaStaProducers_cff.py | 4 +- L1Trigger/L1CaloTrigger/python/ntuple_cfi.py | 55 -- .../L1CaloTrigger/src/L1EGammaEECalibrator.cc | 61 -- L1Trigger/L1CaloTrigger/test/BuildFile.xml | 12 - .../test/ntuples/L1TCaloTriggerNtupleBase.h | 14 - .../test/ntuples/L1TriggerNtupleEgamma.cc | 64 -- .../ntuples/L1TriggerNtupleTkElectrons.cc | 72 -- .../ntuples/L1TriggerNtupleTrackTrigger.cc | 162 ---- .../test/runL1TP2EgammaNtuples_D49geom.py | 139 --- .../interface/L1TkElectronTrackMatchAlgo.h | 30 - .../plugins/L1TkElectronTrackProducer.cc | 792 ------------------ .../plugins/L1TkEmParticleProducer.cc | 299 ------- .../python/L1TkEgammaObjects_cff.py | 8 - .../python/L1TkElectronTrackProducer_cfi.py | 100 --- .../python/L1TkEmParticleProducer_cfi.py | 55 -- .../src/L1TkElectronTrackMatchAlgo.cc | 124 --- 20 files changed, 1 insertion(+), 2212 deletions(-) delete mode 100644 L1Trigger/L1CaloTrigger/interface/L1EGammaEECalibrator.h delete mode 100644 L1Trigger/L1CaloTrigger/plugins/L1EGammaEEProducer.cc delete mode 100644 L1Trigger/L1CaloTrigger/python/L1TCaloTriggerNtuples_cff.py delete mode 100644 L1Trigger/L1CaloTrigger/python/l1EGammaEEProducer_cfi.py delete mode 100644 L1Trigger/L1CaloTrigger/python/ntuple_cfi.py delete mode 100644 L1Trigger/L1CaloTrigger/src/L1EGammaEECalibrator.cc delete mode 100644 L1Trigger/L1CaloTrigger/test/BuildFile.xml delete mode 100644 L1Trigger/L1CaloTrigger/test/ntuples/L1TCaloTriggerNtupleBase.h delete mode 100644 L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleEgamma.cc delete mode 100644 L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTkElectrons.cc delete mode 100644 L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTrackTrigger.cc delete mode 100644 L1Trigger/L1CaloTrigger/test/runL1TP2EgammaNtuples_D49geom.py delete mode 100644 L1Trigger/L1TTrackMatch/interface/L1TkElectronTrackMatchAlgo.h delete mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TkElectronTrackProducer.cc delete mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TkEmParticleProducer.cc delete mode 100644 L1Trigger/L1TTrackMatch/python/L1TkEgammaObjects_cff.py delete mode 100644 L1Trigger/L1TTrackMatch/python/L1TkElectronTrackProducer_cfi.py delete mode 100644 L1Trigger/L1TTrackMatch/python/L1TkEmParticleProducer_cfi.py delete mode 100644 L1Trigger/L1TTrackMatch/src/L1TkElectronTrackMatchAlgo.cc diff --git a/L1Trigger/L1CaloTrigger/interface/L1EGammaEECalibrator.h b/L1Trigger/L1CaloTrigger/interface/L1EGammaEECalibrator.h deleted file mode 100644 index 51a8efe024e57..0000000000000 --- a/L1Trigger/L1CaloTrigger/interface/L1EGammaEECalibrator.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef L1Trigger_L1CaloTrigger_L1EGammaEECalibrator_h -#define L1Trigger_L1CaloTrigger_L1EGammaEECalibrator_h - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include - -class L1EGammaEECalibrator { -public: - explicit L1EGammaEECalibrator(const edm::ParameterSet&); - - float calibrationFactor(const float& pt, const float& eta) const; - -private: - int etaBin(float eta) const { return bin(eta_bins, std::abs(eta)); } - int ptBin(float pt) const { return bin(pt_bins, pt); } - int bin(const std::set& container, float value) const; - - std::set eta_bins; - std::set pt_bins; - std::vector calib_factors; -}; - -#endif diff --git a/L1Trigger/L1CaloTrigger/plugins/L1EGammaEEProducer.cc b/L1Trigger/L1CaloTrigger/plugins/L1EGammaEEProducer.cc deleted file mode 100644 index 61c777c51919b..0000000000000 --- a/L1Trigger/L1CaloTrigger/plugins/L1EGammaEEProducer.cc +++ /dev/null @@ -1,168 +0,0 @@ -#include "FWCore/Framework/interface/stream/EDProducer.h" -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" - -#include "DataFormats/L1THGCal/interface/HGCalMulticluster.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "DataFormats/L1Trigger/interface/EGamma.h" -#include "L1Trigger/L1CaloTrigger/interface/L1EGammaEECalibrator.h" -#include "DataFormats/Math/interface/deltaPhi.h" - -namespace l1tp2 { - // we sort the clusters in pt - bool compare_cluster_pt(const l1t::HGCalMulticluster *cl1, const l1t::HGCalMulticluster *cl2) { - return cl1->pt() > cl2->pt(); - } -}; // namespace l1tp2 - -int etaBin(const l1t::HGCalMulticluster *cl) { - static float constexpr eta_min = 1.; - static float constexpr eta_max = 4.; - static unsigned constexpr n_eta_bins = 150; - int eta_bin = floor((std::abs(cl->eta()) - eta_min) / ((eta_max - eta_min) / n_eta_bins)); - if (cl->eta() < 0) - return -1 * eta_bin; // bin 0 doesn't exist - return eta_bin; -} - -int get_phi_bin(const l1t::HGCalMulticluster *cl) { - static constexpr float phi_min = -M_PI; - static constexpr float phi_max = M_PI; - static constexpr unsigned n_phi_bins = 63; - return floor(std::abs(reco::deltaPhi(cl->phi(), phi_min)) / ((phi_max - phi_min) / n_phi_bins)); -} - -pair get_eta_phi_bin(const l1t::HGCalMulticluster *cl) { return std::make_pair(etaBin(cl), get_phi_bin(cl)); } - -class L1EGammaEEProducer : public edm::stream::EDProducer<> { -public: - explicit L1EGammaEEProducer(const edm::ParameterSet &); - -private: - void produce(edm::Event &, const edm::EventSetup &) override; - - edm::EDGetToken multiclusters_token_; - L1EGammaEECalibrator calibrator_; -}; - -L1EGammaEEProducer::L1EGammaEEProducer(const edm::ParameterSet &iConfig) - : multiclusters_token_( - consumes(iConfig.getParameter("Multiclusters"))), - calibrator_(iConfig.getParameter("calibrationConfig")) { - produces>("L1EGammaCollectionBXVWithCuts"); -} - -void L1EGammaEEProducer::produce(edm::Event &iEvent, const edm::EventSetup &iSetup) { - float minEt_ = 0; - - std::unique_ptr> l1EgammaBxCollection(new l1t::EGammaBxCollection); - - // retrieve clusters 3D - edm::Handle multiclusters_h; - iEvent.getByToken(multiclusters_token_, multiclusters_h); - const l1t::HGCalMulticlusterBxCollection &multiclusters = *multiclusters_h; - - std::vector selected_multiclusters; - std::map, std::vector> etaphi_bins; - - // here we loop on the TPGs - for (auto cl3d = multiclusters.begin(0); cl3d != multiclusters.end(0); cl3d++) { - if (cl3d->hwQual()) { - if (cl3d->et() > minEt_) { - int hw_quality = 1; // baseline EG ID passed - if (std::abs(cl3d->eta()) >= 1.52) { - hw_quality = 2; // baseline EG ID passed + cleanup of transition region - } - - float calib_factor = calibrator_.calibrationFactor(cl3d->pt(), cl3d->eta()); - l1t::EGamma eg = - l1t::EGamma(reco::Candidate::PolarLorentzVector(cl3d->pt() / calib_factor, cl3d->eta(), cl3d->phi(), 0.)); - eg.setHwQual(hw_quality); - eg.setHwIso(1); - eg.setIsoEt(-1); // just temporarily as a dummy value - l1EgammaBxCollection->push_back(0, eg); - if (hw_quality == 2) { - // we build the EM interpreted EG object - l1t::EGamma eg_emint = l1t::EGamma(reco::Candidate::PolarLorentzVector( - cl3d->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM), cl3d->eta(), cl3d->phi(), 0.)); - eg_emint.setHwQual(4); - eg_emint.setHwIso(1); - eg_emint.setIsoEt(-1); // just temporarily as a dummy value - l1EgammaBxCollection->push_back(0, eg_emint); - // we also prepare for the brem recovery procedure - selected_multiclusters.push_back(&(*cl3d)); - auto eta_phi_bin = get_eta_phi_bin(&(*cl3d)); - auto bucket = etaphi_bins.find(eta_phi_bin); - if (bucket == etaphi_bins.end()) { - std::vector vec; - vec.push_back(&(*cl3d)); - etaphi_bins[eta_phi_bin] = vec; - } else { - bucket->second.push_back(&(*cl3d)); - } - } - } - } - } - - std::sort(selected_multiclusters.begin(), selected_multiclusters.end(), l1tp2::compare_cluster_pt); - std::set used_clusters; - for (const auto &cl3d : selected_multiclusters) { - if (used_clusters.find(cl3d) == used_clusters.end()) { - float pt = cl3d->pt(); - // we drop the Had component of the energy - if (cl3d->hOverE() != -1) - pt = cl3d->pt() / (1 + cl3d->hOverE()); - reco::Candidate::PolarLorentzVector mom(pt, cl3d->eta(), cl3d->phi(), 0.); - reco::Candidate::PolarLorentzVector mom_eint( - cl3d->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM), cl3d->eta(), cl3d->phi(), 0.); - - // this is not yet used - used_clusters.insert(cl3d); - auto eta_phi_bin = get_eta_phi_bin(cl3d); - - for (int eta_bin : {eta_phi_bin.first - 1, eta_phi_bin.first, eta_phi_bin.first + 1}) { - for (int phi_bin : {eta_phi_bin.second - 1, eta_phi_bin.second, eta_phi_bin.second + 1}) { - auto bucket = etaphi_bins.find(std::make_pair(eta_bin, phi_bin)); - if (bucket != etaphi_bins.end()) { - // this bucket is not empty - for (const auto &other_cl_ptr : bucket->second) { - if (used_clusters.find(other_cl_ptr) == used_clusters.end()) { - if (std::abs(other_cl_ptr->eta() - cl3d->eta()) < 0.02) { - if (std::abs(reco::deltaPhi(other_cl_ptr->phi(), cl3d->phi())) < 0.1) { - float pt_other = other_cl_ptr->pt(); - if (other_cl_ptr->hOverE() != -1) - pt_other = other_cl_ptr->pt() / (1 + other_cl_ptr->hOverE()); - mom += reco::Candidate::PolarLorentzVector(pt_other, other_cl_ptr->eta(), other_cl_ptr->phi(), 0.); - mom_eint += reco::Candidate::PolarLorentzVector( - other_cl_ptr->iPt(l1t::HGCalMulticluster::EnergyInterpretation::EM), - other_cl_ptr->eta(), - other_cl_ptr->phi(), - 0.); - used_clusters.insert(other_cl_ptr); - } - } - } - } - } - } - } - float calib_factor = calibrator_.calibrationFactor(mom.pt(), mom.eta()); - l1t::EGamma eg = - l1t::EGamma(reco::Candidate::PolarLorentzVector(mom.pt() / calib_factor, mom.eta(), mom.phi(), 0.)); - eg.setHwQual(3); - eg.setHwIso(1); - l1EgammaBxCollection->push_back(0, eg); - - l1t::EGamma eg_emint_brec = - l1t::EGamma(reco::Candidate::PolarLorentzVector(mom_eint.pt(), mom_eint.eta(), mom_eint.phi(), 0.)); - eg_emint_brec.setHwQual(5); - eg_emint_brec.setHwIso(1); - l1EgammaBxCollection->push_back(0, eg_emint_brec); - } - } - - iEvent.put(std::move(l1EgammaBxCollection), "L1EGammaCollectionBXVWithCuts"); -} - -DEFINE_FWK_MODULE(L1EGammaEEProducer); diff --git a/L1Trigger/L1CaloTrigger/python/L1TCaloTriggerNtuples_cff.py b/L1Trigger/L1CaloTrigger/python/L1TCaloTriggerNtuples_cff.py deleted file mode 100644 index 5c3d602ce1baf..0000000000000 --- a/L1Trigger/L1CaloTrigger/python/L1TCaloTriggerNtuples_cff.py +++ /dev/null @@ -1,24 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from L1Trigger.L1THGCalUtilities.hgcalTriggerNtuples_cfi import * - -l1CaloTriggerNtuplizer = hgcalTriggerNtuplizer.clone() - -ntuple_multiclusters_hmvdr = ntuple_multiclusters.clone() -ntuple_multiclusters_hmvdr.Prefix = cms.untracked.string('HMvDR') - -l1CaloTriggerNtuplizer.Ntuples = cms.VPSet(ntuple_event, - ntuple_gen, - ntuple_triggercells, - ntuple_multiclusters_hmvdr) - -from L1Trigger.L1CaloTrigger.ntuple_cfi import * - -l1CaloTriggerNtuplizer.Ntuples.append(ntuple_egammaEE) -l1CaloTriggerNtuplizer.Ntuples.append(ntuple_egammaEB) -l1CaloTriggerNtuplizer.Ntuples.append(ntuple_TTTracks) -l1CaloTriggerNtuplizer.Ntuples.append(ntuple_tkEleEllEE) -l1CaloTriggerNtuplizer.Ntuples.append(ntuple_tkEleEllEB) - -l1CaloTriggerNtuples = cms.Sequence(l1CaloTriggerNtuplizer) - diff --git a/L1Trigger/L1CaloTrigger/python/l1EGammaEEProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/l1EGammaEEProducer_cfi.py deleted file mode 100644 index 161e8e8faa27e..0000000000000 --- a/L1Trigger/L1CaloTrigger/python/l1EGammaEEProducer_cfi.py +++ /dev/null @@ -1,5 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -l1EGammaEEProducer = cms.EDProducer("L1EGammaEEProducer", - calibrationConfig = cms.PSet(calibrationFile = cms.FileInPath('L1Trigger/L1TCalorimeter/data/calib_ee_v1.json')), - Multiclusters=cms.InputTag('hgcalBackEndLayer2Producer:HGCalBackendLayer2Processor3DClustering')) diff --git a/L1Trigger/L1CaloTrigger/python/l1EgammaStaProducers_cff.py b/L1Trigger/L1CaloTrigger/python/l1EgammaStaProducers_cff.py index 6bf59009af963..46dec1ae4ed00 100644 --- a/L1Trigger/L1CaloTrigger/python/l1EgammaStaProducers_cff.py +++ b/L1Trigger/L1CaloTrigger/python/l1EgammaStaProducers_cff.py @@ -1,9 +1,7 @@ import FWCore.ParameterSet.Config as cms -from L1Trigger.L1CaloTrigger.l1EGammaEEProducer_cfi import * from L1Trigger.L1CaloTrigger.L1EGammaCrystalsEmulatorProducer_cfi import * -l1EgammaStaProducers = cms.Sequence(l1EGammaEEProducer+L1EGammaClusterEmuProducer) +l1EgammaStaProducers = cms.Sequence(L1EGammaClusterEmuProducer) -l1EgammaStaProducersEE = cms.Sequence(l1EGammaEEProducer) l1EgammaStaProducersEB = cms.Sequence(L1EGammaClusterEmuProducer) diff --git a/L1Trigger/L1CaloTrigger/python/ntuple_cfi.py b/L1Trigger/L1CaloTrigger/python/ntuple_cfi.py deleted file mode 100644 index 644ccd9d7a1be..0000000000000 --- a/L1Trigger/L1CaloTrigger/python/ntuple_cfi.py +++ /dev/null @@ -1,55 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -ntuple_egammaEE = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleEgamma'), - Egamma = cms.InputTag('l1EGammaEEProducer:L1EGammaCollectionBXVWithCuts'), - BranchNamePrefix = cms.untracked.string("egammaEE") -) - -ntuple_egammaEB = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleEgamma'), - Egamma = cms.InputTag("L1EGammaClusterEmuProducer"), - BranchNamePrefix = cms.untracked.string("egammaEB") -) - -ntuple_TTTracks = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleTrackTrigger'), - TTTracks = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), - BranchNamePrefix = cms.untracked.string("l1Trk") -) - -ntuple_tkEleEE = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleTkElectrons'), - TkElectrons = cms.InputTag("L1TkElectronsHGC","EG"), - BranchNamePrefix = cms.untracked.string("tkEleEE") -) - -ntuple_tkEleEB = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleTkElectrons'), - TkElectrons = cms.InputTag("L1TkElectronsCrystal","EG"), - BranchNamePrefix = cms.untracked.string("tkEleEB") -) - -ntuple_tkEleEllEE = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleTkElectrons'), - TkElectrons = cms.InputTag("L1TkElectronsEllipticMatchHGC","EG"), - BranchNamePrefix = cms.untracked.string("tkEleEE") -) - -ntuple_tkEleEllEB = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleTkElectrons'), - TkElectrons = cms.InputTag("L1TkElectronsEllipticMatchCrystal","EG"), - BranchNamePrefix = cms.untracked.string("tkEleEB") -) - -ntuple_tkIsoEleEE = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleTkElectrons'), - TkElectrons = cms.InputTag("L1TkIsoElectronsHGC","EG"), - BranchNamePrefix = cms.untracked.string("tkIsoEleEE") -) - -ntuple_tkIsoEleEB = cms.PSet( - NtupleName = cms.string('L1TriggerNtupleTkElectrons'), - TkElectrons = cms.InputTag("L1TkIsoElectronsCrystal","EG"), - BranchNamePrefix = cms.untracked.string("tkIsoEleEB") -) diff --git a/L1Trigger/L1CaloTrigger/src/L1EGammaEECalibrator.cc b/L1Trigger/L1CaloTrigger/src/L1EGammaEECalibrator.cc deleted file mode 100644 index ddd9ee590a12c..0000000000000 --- a/L1Trigger/L1CaloTrigger/src/L1EGammaEECalibrator.cc +++ /dev/null @@ -1,61 +0,0 @@ -#include "L1Trigger/L1CaloTrigger/interface/L1EGammaEECalibrator.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/ParameterSet/interface/FileInPath.h" -#include "boost/property_tree/ptree.hpp" -#include "boost/property_tree/json_parser.hpp" -#include - -namespace l1tp2 { - std::vector as_vector(boost::property_tree::ptree const& pt, - boost::property_tree::ptree::key_type const& key) { - std::vector ret; - for (const auto& item : pt.get_child(key)) - ret.push_back(item.second.get_value()); - return ret; - } -}; // namespace l1tp2 - -L1EGammaEECalibrator::L1EGammaEECalibrator(const edm::ParameterSet& pset) { - //read the JSON file and populate the eta - pt bins and the value container - boost::property_tree::ptree calibration_map; - read_json(pset.getParameter("calibrationFile").fullPath(), calibration_map); - - auto eta_l = l1tp2::as_vector(calibration_map, "eta_l"); - std::copy(eta_l.begin(), eta_l.end(), std::inserter(eta_bins, eta_bins.end())); - auto eta_h = l1tp2::as_vector(calibration_map, "eta_h"); - eta_bins.insert(eta_h.back()); - - auto pt_l = l1tp2::as_vector(calibration_map, "pt_l"); - std::copy(pt_l.begin(), pt_l.end(), std::inserter(pt_bins, pt_bins.end())); - auto pt_h = l1tp2::as_vector(calibration_map, "pt_h"); - pt_bins.insert(pt_h.back()); - - auto calib_data = l1tp2::as_vector(calibration_map, "calib"); - auto n_bins_eta = eta_bins.size(); - auto n_bins_pt = pt_bins.size(); - calib_factors.reserve(n_bins_eta * n_bins_pt); - for (auto calib_f = calib_data.begin(); calib_f != calib_data.end(); ++calib_f) { - auto index = calib_f - calib_data.begin(); - int eta_bin = etaBin(eta_l[index]); - int pt_bin = ptBin(pt_l[index]); - calib_factors[(eta_bin * n_bins_pt) + pt_bin] = *calib_f; - } -} - -int L1EGammaEECalibrator::bin(const std::set& container, float value) const { - auto bin_l = container.upper_bound(value); - if (bin_l == container.end()) { - // value not mapped to any bin - return -1; - } - return std::distance(container.begin(), bin_l) - 1; -} - -float L1EGammaEECalibrator::calibrationFactor(const float& pt, const float& eta) const { - int bin_eta = etaBin(eta); - int bin_pt = ptBin(pt); - if (bin_eta == -1 || bin_pt == -1) - return 1.; - auto n_bins_pt = pt_bins.size(); - return calib_factors[(bin_eta * n_bins_pt) + bin_pt]; -} diff --git a/L1Trigger/L1CaloTrigger/test/BuildFile.xml b/L1Trigger/L1CaloTrigger/test/BuildFile.xml deleted file mode 100644 index e55b6f2e11d1f..0000000000000 --- a/L1Trigger/L1CaloTrigger/test/BuildFile.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/L1Trigger/L1CaloTrigger/test/ntuples/L1TCaloTriggerNtupleBase.h b/L1Trigger/L1CaloTrigger/test/ntuples/L1TCaloTriggerNtupleBase.h deleted file mode 100644 index d12ccc710fbf2..0000000000000 --- a/L1Trigger/L1CaloTrigger/test/ntuples/L1TCaloTriggerNtupleBase.h +++ /dev/null @@ -1,14 +0,0 @@ -#include "L1Trigger/L1THGCalUtilities/interface/HGCalTriggerNtupleBase.h" - -class L1TCaloTriggerNtupleBase : public HGCalTriggerNtupleBase { -public: - L1TCaloTriggerNtupleBase(const edm::ParameterSet& conf) - : HGCalTriggerNtupleBase(conf), - branch_name_prefix_(conf.getUntrackedParameter("BranchNamePrefix", "")) {} - ~L1TCaloTriggerNtupleBase() override{}; - - std::string branch_name_w_prefix(const std::string name) const { return branch_name_prefix_ + "_" + name; } - -private: - std::string branch_name_prefix_; -}; diff --git a/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleEgamma.cc b/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleEgamma.cc deleted file mode 100644 index e474c516bb2f9..0000000000000 --- a/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleEgamma.cc +++ /dev/null @@ -1,64 +0,0 @@ -#include "DataFormats/L1Trigger/interface/EGamma.h" -#include "L1TCaloTriggerNtupleBase.h" - -class L1TriggerNtupleEgamma : public L1TCaloTriggerNtupleBase { -public: - L1TriggerNtupleEgamma(const edm::ParameterSet& conf); - ~L1TriggerNtupleEgamma() override{}; - void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final; - void fill(const edm::Event& e, const edm::EventSetup& es) final; - -private: - void clear() final; - - edm::EDGetToken egamma_token_; - - int egamma_n_; - std::vector egamma_pt_; - std::vector egamma_energy_; - std::vector egamma_eta_; - std::vector egamma_phi_; - std::vector egamma_hwQual_; -}; - -DEFINE_EDM_PLUGIN(HGCalTriggerNtupleFactory, L1TriggerNtupleEgamma, "L1TriggerNtupleEgamma"); - -L1TriggerNtupleEgamma::L1TriggerNtupleEgamma(const edm::ParameterSet& conf) : L1TCaloTriggerNtupleBase(conf) {} - -void L1TriggerNtupleEgamma::initialize(TTree& tree, const edm::ParameterSet& conf, edm::ConsumesCollector&& collector) { - egamma_token_ = collector.consumes(conf.getParameter("Egamma")); - - tree.Branch(branch_name_w_prefix("n").c_str(), &egamma_n_, branch_name_w_prefix("n/I").c_str()); - tree.Branch(branch_name_w_prefix("pt").c_str(), &egamma_pt_); - tree.Branch(branch_name_w_prefix("energy").c_str(), &egamma_energy_); - tree.Branch(branch_name_w_prefix("eta").c_str(), &egamma_eta_); - tree.Branch(branch_name_w_prefix("phi").c_str(), &egamma_phi_); - tree.Branch(branch_name_w_prefix("hwQual").c_str(), &egamma_hwQual_); -} - -void L1TriggerNtupleEgamma::fill(const edm::Event& e, const edm::EventSetup& es) { - // retrieve towers - edm::Handle egamma_h; - e.getByToken(egamma_token_, egamma_h); - const l1t::EGammaBxCollection& egamma_collection = *egamma_h; - - clear(); - for (auto egee_itr = egamma_collection.begin(0); egee_itr != egamma_collection.end(0); egee_itr++) { - egamma_n_++; - // physical values - egamma_pt_.emplace_back(egee_itr->pt()); - egamma_energy_.emplace_back(egee_itr->energy()); - egamma_eta_.emplace_back(egee_itr->eta()); - egamma_phi_.emplace_back(egee_itr->phi()); - egamma_hwQual_.emplace_back(egee_itr->hwQual()); - } -} - -void L1TriggerNtupleEgamma::clear() { - egamma_n_ = 0; - egamma_pt_.clear(); - egamma_energy_.clear(); - egamma_eta_.clear(); - egamma_phi_.clear(); - egamma_hwQual_.clear(); -} diff --git a/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTkElectrons.cc b/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTkElectrons.cc deleted file mode 100644 index 03df9545ba321..0000000000000 --- a/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTkElectrons.cc +++ /dev/null @@ -1,72 +0,0 @@ -#include "L1TCaloTriggerNtupleBase.h" - -#include "DataFormats/L1TCorrelator/interface/TkElectron.h" -#include "DataFormats/L1TCorrelator/interface/TkElectronFwd.h" - -class L1TriggerNtupleTkElectrons : public L1TCaloTriggerNtupleBase { -public: - L1TriggerNtupleTkElectrons(const edm::ParameterSet& conf); - ~L1TriggerNtupleTkElectrons() override{}; - void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final; - void fill(const edm::Event& e, const edm::EventSetup& es) final; - -private: - void clear() final; - - edm::EDGetToken tkEle_token_; - - int tkEle_n_; - std::vector tkEle_pt_; - std::vector tkEle_energy_; - std::vector tkEle_eta_; - std::vector tkEle_phi_; - std::vector tkEle_hwQual_; - std::vector tkEle_tkIso_; -}; - -DEFINE_EDM_PLUGIN(HGCalTriggerNtupleFactory, L1TriggerNtupleTkElectrons, "L1TriggerNtupleTkElectrons"); - -L1TriggerNtupleTkElectrons::L1TriggerNtupleTkElectrons(const edm::ParameterSet& conf) - : L1TCaloTriggerNtupleBase(conf) {} - -void L1TriggerNtupleTkElectrons::initialize(TTree& tree, - const edm::ParameterSet& conf, - edm::ConsumesCollector&& collector) { - tkEle_token_ = collector.consumes(conf.getParameter("TkElectrons")); - - tree.Branch(branch_name_w_prefix("n").c_str(), &tkEle_n_, branch_name_w_prefix("n/I").c_str()); - tree.Branch(branch_name_w_prefix("pt").c_str(), &tkEle_pt_); - tree.Branch(branch_name_w_prefix("energy").c_str(), &tkEle_energy_); - tree.Branch(branch_name_w_prefix("eta").c_str(), &tkEle_eta_); - tree.Branch(branch_name_w_prefix("phi").c_str(), &tkEle_phi_); - tree.Branch(branch_name_w_prefix("hwQual").c_str(), &tkEle_hwQual_); - tree.Branch(branch_name_w_prefix("tkIso").c_str(), &tkEle_tkIso_); -} - -void L1TriggerNtupleTkElectrons::fill(const edm::Event& e, const edm::EventSetup& es) { - // retrieve towers - edm::Handle tkEle_h; - e.getByToken(tkEle_token_, tkEle_h); - const l1t::TkElectronCollection& tkEle_collection = *tkEle_h; - - clear(); - for (auto tkele_itr : tkEle_collection) { - tkEle_n_++; - tkEle_pt_.emplace_back(tkele_itr.pt()); - tkEle_energy_.emplace_back(tkele_itr.energy()); - tkEle_eta_.emplace_back(tkele_itr.eta()); - tkEle_phi_.emplace_back(tkele_itr.phi()); - tkEle_hwQual_.emplace_back(tkele_itr.EGRef()->hwQual()); - tkEle_tkIso_.emplace_back(tkele_itr.trkIsol()); - } -} - -void L1TriggerNtupleTkElectrons::clear() { - tkEle_n_ = 0; - tkEle_pt_.clear(); - tkEle_energy_.clear(); - tkEle_eta_.clear(); - tkEle_phi_.clear(); - tkEle_hwQual_.clear(); - tkEle_tkIso_.clear(); -} diff --git a/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTrackTrigger.cc b/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTrackTrigger.cc deleted file mode 100644 index a7427527eea94..0000000000000 --- a/L1Trigger/L1CaloTrigger/test/ntuples/L1TriggerNtupleTrackTrigger.cc +++ /dev/null @@ -1,162 +0,0 @@ -#include "L1Trigger/L1THGCal/interface/HGCalTriggerTools.h" - -#include "L1Trigger/L1TTrackMatch/interface/pTFrom2Stubs.h" - -#include "DataFormats/L1TrackTrigger/interface/TTTrack.h" -#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" -#include "DataFormats/Math/interface/LorentzVector.h" -#include "DataFormats/Candidate/interface/Candidate.h" -#include "DataFormats/ParticleFlowReco/interface/PFCluster.h" - -#include "MagneticField/Engine/interface/MagneticField.h" -#include "MagneticField/Records/interface/IdealMagneticFieldRecord.h" - -#include "CommonTools/BaseParticlePropagator/interface/BaseParticlePropagator.h" -#include "FWCore/Framework/interface/ESWatcher.h" - -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" -#include "Geometry/Records/interface/CaloGeometryRecord.h" -#include "L1Trigger/L1THGCal/interface/HGCalTriggerGeometryBase.h" - -#include "L1Trigger/L1CaloTrigger/test/ntuples/L1TCaloTriggerNtupleBase.h" - -class L1TriggerNtupleTrackTrigger : public L1TCaloTriggerNtupleBase { -public: - L1TriggerNtupleTrackTrigger(const edm::ParameterSet& conf); - ~L1TriggerNtupleTrackTrigger() override = default; - void initialize(TTree&, const edm::ParameterSet&, edm::ConsumesCollector&&) final; - void fill(const edm::Event& e, const edm::EventSetup& es) final; - typedef TTTrack L1TTTrackType; - -private: - void clear() final; - std::pair propagateToCalo(const math::XYZTLorentzVector& iMom, - const math::XYZTLorentzVector& iVtx, - double iCharge, - double iBField); - - edm::EDGetTokenT>> track_token_; - edm::ESGetToken magf_token; - edm::ESGetToken geom_token; - edm::ESGetToken trigGeom_token; - - int l1track_n_; - std::vector l1track_pt_; - std::vector l1track_pt2stubs_; - std::vector l1track_eta_; - std::vector l1track_phi_; - std::vector l1track_curv_; - std::vector l1track_chi2_; - std::vector l1track_chi2Red_; - std::vector l1track_nStubs_; - std::vector l1track_z0_; - std::vector l1track_charge_; - std::vector l1track_caloeta_; - std::vector l1track_calophi_; - - edm::ESWatcher magfield_watcher_; - HGCalTriggerTools triggerTools_; -}; - -DEFINE_EDM_PLUGIN(HGCalTriggerNtupleFactory, L1TriggerNtupleTrackTrigger, "L1TriggerNtupleTrackTrigger"); - -L1TriggerNtupleTrackTrigger::L1TriggerNtupleTrackTrigger(const edm::ParameterSet& conf) - : L1TCaloTriggerNtupleBase(conf) {} - -void L1TriggerNtupleTrackTrigger::initialize(TTree& tree, - const edm::ParameterSet& conf, - edm::ConsumesCollector&& collector) { - track_token_ = - collector.consumes>>(conf.getParameter("TTTracks")); - magf_token = collector.esConsumes(); - geom_token = collector.esConsumes(); - trigGeom_token = collector.esConsumes(); - - tree.Branch(branch_name_w_prefix("n").c_str(), &l1track_n_, branch_name_w_prefix("n/I").c_str()); - tree.Branch(branch_name_w_prefix("pt").c_str(), &l1track_pt_); - tree.Branch(branch_name_w_prefix("pt2stubs").c_str(), &l1track_pt2stubs_); - tree.Branch(branch_name_w_prefix("eta").c_str(), &l1track_eta_); - tree.Branch(branch_name_w_prefix("phi").c_str(), &l1track_phi_); - tree.Branch(branch_name_w_prefix("curv").c_str(), &l1track_curv_); - tree.Branch(branch_name_w_prefix("chi2").c_str(), &l1track_chi2_); - tree.Branch(branch_name_w_prefix("chi2Red").c_str(), &l1track_chi2Red_); - tree.Branch(branch_name_w_prefix("nStubs").c_str(), &l1track_nStubs_); - tree.Branch(branch_name_w_prefix("z0").c_str(), &l1track_z0_); - tree.Branch(branch_name_w_prefix("charge").c_str(), &l1track_charge_); - tree.Branch(branch_name_w_prefix("caloeta").c_str(), &l1track_caloeta_); - tree.Branch(branch_name_w_prefix("calophi").c_str(), &l1track_calophi_); -} - -void L1TriggerNtupleTrackTrigger::fill(const edm::Event& ev, const edm::EventSetup& es) { - // the L1Tracks - const edm::Handle>& l1TTTrackHandle = ev.getHandle(track_token_); - - float fBz = 0; - if (magfield_watcher_.check(es)) { - const edm::ESHandle& magfield = es.getHandle(magf_token); - fBz = magfield->inTesla(GlobalPoint(0, 0, 0)).z(); - } - - // geometry needed to call pTFrom2Stubs - const edm::ESHandle& geomHandle = es.getHandle(geom_token); - const TrackerGeometry* tGeom = geomHandle.product(); - - triggerTools_.eventSetup(es, trigGeom_token); - - clear(); - for (auto trackIter = l1TTTrackHandle->begin(); trackIter != l1TTTrackHandle->end(); ++trackIter) { - l1track_n_++; - l1track_pt_.emplace_back(trackIter->momentum().perp()); - l1track_pt2stubs_.emplace_back(pTFrom2Stubs::pTFrom2(trackIter, tGeom)); - l1track_eta_.emplace_back(trackIter->momentum().eta()); - l1track_phi_.emplace_back(trackIter->momentum().phi()); - l1track_curv_.emplace_back(trackIter->rInv()); - l1track_chi2_.emplace_back(trackIter->chi2()); - l1track_chi2Red_.emplace_back(trackIter->chi2Red()); - l1track_nStubs_.emplace_back(trackIter->getStubRefs().size()); - float z0 = trackIter->POCA().z(); //cm - int charge = trackIter->rInv() > 0 ? +1 : -1; - - reco::Candidate::PolarLorentzVector p4p( - trackIter->momentum().perp(), trackIter->momentum().eta(), trackIter->momentum().phi(), 0); // no mass ? - reco::Particle::LorentzVector p4(p4p.X(), p4p.Y(), p4p.Z(), p4p.E()); - reco::Particle::Point vtx(0., 0., z0); - - auto caloetaphi = propagateToCalo(p4, math::XYZTLorentzVector(0., 0., z0, 0.), charge, fBz); - - l1track_z0_.emplace_back(z0); - l1track_charge_.emplace_back(charge); - l1track_caloeta_.emplace_back(caloetaphi.first); - l1track_calophi_.emplace_back(caloetaphi.second); - } -} - -void L1TriggerNtupleTrackTrigger::clear() { - l1track_n_ = 0; - l1track_pt_.clear(); - l1track_pt2stubs_.clear(); - l1track_eta_.clear(); - l1track_phi_.clear(); - l1track_curv_.clear(); - l1track_chi2_.clear(); - l1track_chi2Red_.clear(); - l1track_nStubs_.clear(); - l1track_z0_.clear(); - l1track_charge_.clear(); - l1track_caloeta_.clear(); - l1track_calophi_.clear(); -} - -std::pair L1TriggerNtupleTrackTrigger::propagateToCalo(const math::XYZTLorentzVector& iMom, - const math::XYZTLorentzVector& iVtx, - double iCharge, - double iBField) { - BaseParticlePropagator prop = BaseParticlePropagator(RawParticle(iMom, iVtx, iCharge), 0., 0., iBField); - prop.setPropagationConditions(129.0, triggerTools_.getLayerZ(1), false); - prop.propagate(); - double ecalShowerDepth = reco::PFCluster::getDepthCorrection(prop.particle().momentum().E(), false, false); - math::XYZVector point = math::XYZVector(prop.particle().vertex()) + - math::XYZTLorentzVector(prop.particle().momentum()).Vect().Unit() * ecalShowerDepth; - return std::make_pair(point.eta(), point.phi()); -} diff --git a/L1Trigger/L1CaloTrigger/test/runL1TP2EgammaNtuples_D49geom.py b/L1Trigger/L1CaloTrigger/test/runL1TP2EgammaNtuples_D49geom.py deleted file mode 100644 index ecc07070f0a54..0000000000000 --- a/L1Trigger/L1CaloTrigger/test/runL1TP2EgammaNtuples_D49geom.py +++ /dev/null @@ -1,139 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from Configuration.StandardSequences.Eras import eras -process = cms.Process('DIGI',eras.Phase2C9) - - -# import of standard configurations -process.load('Configuration.StandardSequences.Services_cff') -process.load('SimGeneral.HepPDTESSource.pythiapdt_cfi') -process.load('FWCore.MessageService.MessageLogger_cfi') -process.load('Configuration.EventContent.EventContent_cff') -process.load('SimGeneral.MixingModule.mixNoPU_cfi') -process.load('Configuration.Geometry.GeometryExtended2026D49Reco_cff') -process.load('Configuration.Geometry.GeometryExtended2026D49_cff') -process.load('Configuration.StandardSequences.MagneticField_cff') -process.load('Configuration.StandardSequences.Generator_cff') -process.load('IOMC.EventVertexGenerators.VtxSmearedHLLHC14TeV_cfi') -process.load('GeneratorInterface.Core.genFilterSummary_cff') -process.load('Configuration.StandardSequences.SimIdeal_cff') -process.load('Configuration.StandardSequences.Digi_cff') -process.load('Configuration.StandardSequences.SimL1Emulator_cff') -process.load('Configuration.StandardSequences.DigiToRaw_cff') -process.load('Configuration.StandardSequences.EndOfProcess_cff') -process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff') - - -############################################################ -# L1 tracking -############################################################ - -# remake stubs ? -process.load('L1Trigger.TrackTrigger.TrackTrigger_cff') -from L1Trigger.TrackTrigger.TTStubAlgorithmRegister_cfi import * -process.load("SimTracker.TrackTriggerAssociation.TrackTriggerAssociator_cff") -process.load("L1Trigger.TrackFindingTracklet.Tracklet_cfi") -process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi") - -# process.TTClusterStub = cms.Path(process.TrackTriggerClustersStubs) -# process.TTClusterStubTruth = cms.Path(process.TrackTriggerAssociatorClustersStubs) - - -process.TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag( - cms.InputTag('TTTracksFromTrackletEmulation', 'Level1TTTracks')) - -# emulation -process.TTTracksEmulationWithTruth = cms.Path( - process.offlineBeamSpot * - process.TTTracksFromTrackletEmulation * - process.TrackTriggerAssociatorTracks) -# L1TRK_PROC.asciiFileName = cms.untracked.string("evlist.txt") - - - - - -process.maxEvents = cms.untracked.PSet( - input = cms.untracked.int32(200) -) - -# Input source -process.source = cms.Source("PoolSource", - fileNames = cms.untracked.vstring('file:/data/cerminar/Phase2HLTTDRWinter20DIGI/SingleElectron_PT2to200/GEN-SIM-DIGI-RAW/PU200_110X_mcRun4_realistic_v3_ext2-v2/F32C5A21-F0E9-9149-B04A-883CC704E820.root'), - # fileNames = cms.untracked.vstring('/store/mc/PhaseIIMTDTDRAutumn18DR/SinglePion_FlatPt-2to100/FEVT/PU200_103X_upgrade2023_realistic_v2-v1/70000/FFA969EE-22E0-E447-86AA-46A6CBF6407D.root'), - inputCommands=cms.untracked.vstring( - 'keep *', - 'drop l1tEMTFHit2016Extras_simEmtfDigis_CSC_HLT', - 'drop l1tEMTFHit2016Extras_simEmtfDigis_RPC_HLT', - 'drop l1tEMTFHit2016s_simEmtfDigis__HLT', - 'drop l1tEMTFTrack2016Extras_simEmtfDigis__HLT', - 'drop l1tEMTFTrack2016s_simEmtfDigis__HLT', - 'drop FTLClusteredmNewDetSetVector_mtdClusters_FTLBarrel_RECO', - 'drop FTLClusteredmNewDetSetVector_mtdClusters_FTLEndcap_RECO', - 'drop MTDTrackingRecHitedmNewDetSetVector_mtdTrackingRecHits__RECO', - 'drop BTLDetIdBTLSampleFTLDataFrameTsSorted_mix_FTLBarrel_HLT', - 'drop ETLDetIdETLSampleFTLDataFrameTsSorted_mix_FTLEndcap_HLT', - ) - ) - -process.options = cms.untracked.PSet( - -) - -# Production Info -process.configurationMetadata = cms.untracked.PSet( - version = cms.untracked.string('$Revision: 1.20 $'), - annotation = cms.untracked.string('SingleElectronPt10_cfi nevts:10'), - name = cms.untracked.string('Applications') -) - -# Output definition -process.TFileService = cms.Service( - "TFileService", - fileName = cms.string("ntuple.root") - ) - -# Other statements -from Configuration.AlCa.GlobalTag import GlobalTag -process.GlobalTag = GlobalTag(process.GlobalTag, 'auto:phase2_realistic', '') - -# load HGCAL TPG simulation -process.load('L1Trigger.L1THGCal.hgcalTriggerPrimitives_cff') - -# To add truth-matched calo cells and downstream objects -# process.load('L1Trigger.L1THGCalUtilities.caloTruthCells_cff') -# process.hgcalTriggerPrimitives += process.caloTruthCells -# process.load('L1Trigger.L1THGCalUtilities.caloTruthCellsNtuples_cff') - -process.hgcl1tpg_step = cms.Path(process.hgcalTriggerPrimitives) - -# load Standalone EG producers -process.load('L1Trigger.L1CaloTrigger.l1EgammaStaProducers_cff') -process.l1EgammaStaProducers_step = cms.Path(process.l1EgammaStaProducers) - -# load track matching modules -process.load('L1Trigger.L1TTrackMatch.L1TkEgammaObjects_cff') -process.l1EgammaTrackMatchProducers_step = cms.Path(process.l1TkElectronTrackEllipticProducers) - -# load ntuplizer -process.load('L1Trigger.L1CaloTrigger.L1TCaloTriggerNtuples_cff') -process.ntuple_step = cms.Path(process.l1CaloTriggerNtuples) - -# customization from Giovanni -# process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters.threshold_histo_multicluster = 0.5 -# process.hgcalBackEndLayer2Producer.ProcessorParameters.C3d_parameters.histoMax_C3d_seeding_parameters.binSumsHisto = cms.vuint32( -# 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 -# ) - -# Schedule definition -process.schedule = cms.Schedule( - process.TTTracksEmulationWithTruth, - process.hgcl1tpg_step, - process.l1EgammaTrackMatchProducers_step, - process.l1EgammaStaProducers_step, - process.ntuple_step) - -# Add early deletion of temporary data products to reduce peak memory need -from Configuration.StandardSequences.earlyDeleteSettings_cff import customiseEarlyDelete -process = customiseEarlyDelete(process) -# End adding early deletion diff --git a/L1Trigger/L1TTrackMatch/interface/L1TkElectronTrackMatchAlgo.h b/L1Trigger/L1TTrackMatch/interface/L1TkElectronTrackMatchAlgo.h deleted file mode 100644 index 1fd86fc14656b..0000000000000 --- a/L1Trigger/L1TTrackMatch/interface/L1TkElectronTrackMatchAlgo.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef L1Trigger_L1TTrackMatch_L1TkElectronTrackMatchAlgo_HH -#define L1Trigger_L1TTrackMatch_L1TkElectronTrackMatchAlgo_HH - -#include "DataFormats/L1Trigger/interface/EGamma.h" -#include "DataFormats/GeometryVector/interface/GlobalPoint.h" -#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" - -namespace L1TkElectronTrackMatchAlgo { - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollection; - void doMatch(BXVector::const_iterator egIter, - const edm::Ptr& pTrk, - double& dph, - double& dr, - double& deta); - void doMatchClusterET(BXVector::const_iterator egIter, - const edm::Ptr& pTrk, - double& dph, - double& dr, - double& deta); - void doMatch(const GlobalPoint& epos, const edm::Ptr& pTrk, double& dph, double& dr, double& deta); - - double deltaR(const GlobalPoint& epos, const edm::Ptr& pTrk); - double deltaPhi(const GlobalPoint& epos, const edm::Ptr& pTrk); - double deltaPhiClusterET(BXVector::const_iterator egIter, const edm::Ptr& pTrk); - double deltaEta(const GlobalPoint& epos, const edm::Ptr& pTrk); - GlobalPoint calorimeterPosition(double phi, double eta, double e); - -} // namespace L1TkElectronTrackMatchAlgo -#endif diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkElectronTrackProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkElectronTrackProducer.cc deleted file mode 100644 index 533944beddbaa..0000000000000 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkElectronTrackProducer.cc +++ /dev/null @@ -1,792 +0,0 @@ -// -*- C++ -*- -// -/**\class L1TkElectronTrackMatchAlgo - - Description: Producer of a TkElectron, for the algorithm matching a L1Track to the L1EG object - - Implementation: - [Notes on implementation] -*/ -// -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/stream/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" - -#include "DataFormats/Common/interface/Handle.h" -#include "FWCore/Utilities/interface/InputTag.h" -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/L1TCorrelator/interface/TkElectron.h" -#include "DataFormats/L1TCorrelator/interface/TkElectronFwd.h" - -#include "DataFormats/Math/interface/LorentzVector.h" - -#include "Geometry/Records/interface/TrackerDigiGeometryRecord.h" -#include "Geometry/TrackerGeometryBuilder/interface/TrackerGeometry.h" - -// Matching Algorithm -#include "L1Trigger/L1TTrackMatch/interface/L1TkElectronTrackMatchAlgo.h" -#include "L1Trigger/L1TTrackMatch/interface/L1TkElectronEtComparator.h" -#include "L1Trigger/L1TTrackMatch/interface/pTFrom2Stubs.h" - -#include "DataFormats/Math/interface/deltaPhi.h" -#include "DataFormats/L1Trigger/interface/EGamma.h" - -#include - -static constexpr float EB_MaxEta = 0.9; - -using namespace l1t; - -// -// class declaration -// - -class L1TkElectronTrackProducer : public edm::stream::EDProducer<> { -public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollectionType; - - explicit L1TkElectronTrackProducer(const edm::ParameterSet&); - ~L1TkElectronTrackProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - //void beginJob() override; - void produce(edm::Event&, const edm::EventSetup&) override; - //void endJob() override; - - float isolation(const edm::Handle& trkHandle, int match_index); - double getPtScaledCut(double pt, std::vector& parameters); - bool selectMatchedTrack(double& d_r, double& d_phi, double& d_eta, double& tk_pt, float& eg_eta); - - // ----------member data --------------------------- - std::string label; - - const float etMin_; // min ET in GeV of L1EG objects - const float pTMinTra_; - const float dRMin_; - const float dRMax_; - float deltaZ_; // | z_track - z_ref_track | < deltaZ_ in cm. - // Used only when primaryVtxConstrain_ = True. - const float maxChi2IsoTracks_; - const unsigned int minNStubsIsoTracks_; - float isoCut_; - bool relativeIsolation_; - bool primaryVtxConstrain_; // use the primary vertex (default = false) - float trkQualityChi2_; - float trkQualityPtMin_; - bool useTwoStubsPT_; - bool useClusterET_; // use cluster et to extrapolate tracks - std::vector dPhiCutoff_; - std::vector dRCutoff_; - std::vector dEtaCutoff_; - std::string matchType_; - - const edm::EDGetTokenT egToken_; - const edm::EDGetTokenT>> trackToken_; - const edm::ESGetToken tGeomToken_; -}; - -// -// constructors and destructor -// -L1TkElectronTrackProducer::L1TkElectronTrackProducer(const edm::ParameterSet& iConfig) - : label(iConfig.getParameter("label")), - etMin_((float)iConfig.getParameter("ETmin")), - pTMinTra_((float)iConfig.getParameter("PTMINTRA")), - dRMin_((float)iConfig.getParameter("DRmin")), - dRMax_((float)iConfig.getParameter("DRmax")), - deltaZ_((float)iConfig.getParameter("DeltaZ")), - maxChi2IsoTracks_(iConfig.getParameter("maxChi2IsoTracks")), - minNStubsIsoTracks_(iConfig.getParameter("minNStubsIsoTracks")), - isoCut_((float)iConfig.getParameter("IsoCut")), - relativeIsolation_(iConfig.getParameter("RelativeIsolation")), - trkQualityChi2_((float)iConfig.getParameter("TrackChi2")), - trkQualityPtMin_((float)iConfig.getParameter("TrackMinPt")), - useTwoStubsPT_(iConfig.getParameter("useTwoStubsPT")), - useClusterET_(iConfig.getParameter("useClusterET")), - dPhiCutoff_(iConfig.getParameter>("TrackEGammaDeltaPhi")), - dRCutoff_(iConfig.getParameter>("TrackEGammaDeltaR")), - dEtaCutoff_(iConfig.getParameter>("TrackEGammaDeltaEta")), - matchType_(iConfig.getParameter("TrackEGammaMatchType")), - egToken_(consumes(iConfig.getParameter("L1EGammaInputTag"))), - trackToken_(consumes>>( - iConfig.getParameter("L1TrackInputTag"))), - tGeomToken_(esConsumes()) { - produces(label); -} - -L1TkElectronTrackProducer::~L1TkElectronTrackProducer() {} - -// ------------ method called to produce the data ------------ -void L1TkElectronTrackProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { - std::unique_ptr result(new TkElectronCollection); - - // geometry needed to call pTFrom2Stubs - const TrackerGeometry& tGeom = iSetup.getData(tGeomToken_); - const TrackerGeometry* tGeometry = &tGeom; - - // the L1EGamma objects - edm::Handle eGammaHandle; - iEvent.getByToken(egToken_, eGammaHandle); - EGammaBxCollection eGammaCollection = (*eGammaHandle.product()); - EGammaBxCollection::const_iterator egIter; - - // the L1Tracks - edm::Handle L1TTTrackHandle; - iEvent.getByToken(trackToken_, L1TTTrackHandle); - L1TTTrackCollectionType::const_iterator trackIter; - - if (!eGammaHandle.isValid()) { - throw cms::Exception("L1TkElectronTrackProducer") - << "\nWarning: L1EmCollection not found in the event. Exit" << std::endl; - return; - } - if (!L1TTTrackHandle.isValid()) { - throw cms::Exception("L1TkElectronTrackProducer") - << "\nWarning: L1TTTrackCollectionType not found in the event. Exit." << std::endl; - return; - } - - int ieg = 0; - for (egIter = eGammaCollection.begin(0); egIter != eGammaCollection.end(0); ++egIter) { // considering BX = only - edm::Ref EGammaRef(eGammaHandle, ieg); - ieg++; - - float e_ele = egIter->energy(); - float eta_ele = egIter->eta(); - float et_ele = 0; - float cosh_eta_ele = cosh(eta_ele); - if (cosh_eta_ele > 0.0) - et_ele = e_ele / cosh_eta_ele; - else - et_ele = -1.0; - if (etMin_ > 0.0 && et_ele <= etMin_) - continue; - // match the L1EG object with a L1Track - float drmin = 999; - int itr = 0; - int itrack = -1; - for (trackIter = L1TTTrackHandle->begin(); trackIter != L1TTTrackHandle->end(); ++trackIter) { - edm::Ptr L1TrackPtr(L1TTTrackHandle, itr); - double trkPt_fit = trackIter->momentum().perp(); - double trkPt_stubs = pTFrom2Stubs::pTFrom2(trackIter, tGeometry); - double trkPt = trkPt_fit; - if (useTwoStubsPT_) - trkPt = trkPt_stubs; - - if (trkPt > trkQualityPtMin_ && trackIter->chi2() < trkQualityChi2_) { - double dPhi = 99.; - double dR = 99.; - double dEta = 99.; - if (useClusterET_) - L1TkElectronTrackMatchAlgo::doMatchClusterET(egIter, L1TrackPtr, dPhi, dR, dEta); - else - L1TkElectronTrackMatchAlgo::doMatch(egIter, L1TrackPtr, dPhi, dR, dEta); - if (dR < drmin && selectMatchedTrack(dR, dPhi, dEta, trkPt, eta_ele)) { - drmin = dR; - itrack = itr; - } - } - itr++; - } - if (itrack >= 0) { - edm::Ptr matchedL1TrackPtr(L1TTTrackHandle, itrack); - - const math::XYZTLorentzVector P4 = egIter->p4(); - float trkisol = isolation(L1TTTrackHandle, itrack); - if (relativeIsolation_ && et_ele > 0.0) { // relative isolation - trkisol = trkisol / et_ele; - } - - TkElectron trkEm(P4, EGammaRef, matchedL1TrackPtr, trkisol); - - trkEm.setTrackCurvature(matchedL1TrackPtr->rInv()); // should this have npars? 4? 5? - - //std::cout<rInv()<<" "<rInv(4)<<" "<rInv()<push_back(trkEm); - } else { - // the object is written to the collection only - // if it passes the isolation cut - if (trkisol <= isoCut_) - result->push_back(trkEm); - } - } - - } // end loop over EGamma objects - - iEvent.put(std::move(result), label); -} - -// ------------ method called once each job just before starting event loop ------------ -//void L1TkElectronTrackProducer::beginJob() {} - -// ------------ method called once each job just after ending the event loop ------------ -//void L1TkElectronTrackProducer::endJob() {} - -// ------------ method called when starting to processes a run ------------ -/* -void -L1TkElectronTrackProducer::beginRun(edm::Run& iRun, edm::EventSetup const& iSetup) -{ -} -*/ - -// ------------ method called when ending the processing of a run ------------ -/* -void -L1TkElectronTrackProducer::endRun(edm::Run&, edm::EventSetup const&) -{ -} -*/ - -// ------------ method called when starting to processes a luminosity block ------------ -/* -void -L1TkElectronTrackProducer::beginLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&) -{ -} -*/ - -// ------------ method called when ending the processing of a luminosity block ------------ -/* -void -L1TkElectronTrackProducer::endLuminosityBlock(edm::LuminosityBlock&, edm::EventSetup const&) -{ -} -*/ - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void L1TkElectronTrackProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - { - // L1TkElectrons - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("simCaloStage2Digis")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectrons", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkIsoElectrons - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("simCaloStage2Digis")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", 0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkIsoElectrons", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkElectronsLoose - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("simCaloStage2Digis")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 3.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.12, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectronsLoose", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkElectronsCrystal - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("L1EGammaClusterEmuProducer")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectronsCrystal", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkIsoElectronsCrystal - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("L1EGammaClusterEmuProducer")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", 0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkIsoElectronsCrystal", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkElectronsLooseCrystal - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("L1EGammaClusterEmuProducer")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 3.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.12, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectronsLooseCrystal", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkElectronsEllipticMatchCrystal - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("L1EGammaClusterEmuProducer")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "EllipticalCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 0.015, - 0.025, - 10000000000.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectronsEllipticMatchCrystal", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkElectronsHGC - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("l1EGammaEEProducer", "L1EGammaCollectionBXVWithCuts")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectronsHGC", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkElectronsEllipticMatchHGC - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("l1EGammaEEProducer", "L1EGammaCollectionBXVWithCuts")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "EllipticalCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 0.01, - 0.01, - 10000000000.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 100); - desc.add("minNStubsIsoTracks", 4); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectronsEllipticMatchHGC", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkIsoElectronsHGC - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("l1EGammaEEProducer", "L1EGammaCollectionBXVWithCuts")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 10.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.08, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", 0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.4); - desc.add("maxChi2IsoTracks", 100); - desc.add("minNStubsIsoTracks", 4); - desc.add("DeltaZ", 1.0); - descriptions.add("L1TkIsoElectronsHGC", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } - { - // L1TkElectronsLooseHGC - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("l1EGammaEEProducer", "L1EGammaCollectionBXVWithCuts")); - desc.add("ETmin", -1.0); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("TrackChi2", 10000000000.0); - desc.add("TrackMinPt", 3.0); - desc.add("useTwoStubsPT", false); - desc.add("useClusterET", false); - desc.add("TrackEGammaMatchType", "PtDependentCut"); - desc.add>("TrackEGammaDeltaPhi", - { - 0.07, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaR", - { - 0.12, - 0.0, - 0.0, - }); - desc.add>("TrackEGammaDeltaEta", - { - 10000000000.0, - 0.0, - 0.0, - }); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", -0.1); - desc.add("PTMINTRA", 2.0); - desc.add("DRmin", 0.03); - desc.add("DRmax", 0.2); - desc.add("maxChi2IsoTracks", 10000000000.0); - desc.add("minNStubsIsoTracks", 0); - desc.add("DeltaZ", 0.6); - descriptions.add("L1TkElectronsLooseHGC", desc); - // or use the following to generate the label from the module's C++ type - //descriptions.addWithDefaultLabel(desc); - } -} - -// method to calculate isolation -float L1TkElectronTrackProducer::isolation(const edm::Handle& trkHandle, int match_index) { - edm::Ptr matchedTrkPtr(trkHandle, match_index); - L1TTTrackCollectionType::const_iterator trackIter; - - float sumPt = 0.0; - int itr = 0; - - float dRMin2 = dRMin_ * dRMin_; - float dRMax2 = dRMax_ * dRMax_; - - for (trackIter = trkHandle->begin(); trackIter != trkHandle->end(); ++trackIter) { - if (itr++ != match_index) { - if (trackIter->chi2() > maxChi2IsoTracks_ || trackIter->momentum().perp() <= pTMinTra_ || - trackIter->getStubRefs().size() < minNStubsIsoTracks_) { - continue; - } - - float dZ = std::abs(trackIter->POCA().z() - matchedTrkPtr->POCA().z()); - - float phi1 = trackIter->momentum().phi(); - float phi2 = matchedTrkPtr->momentum().phi(); - float dPhi = reco::deltaPhi(phi1, phi2); - float dEta = (trackIter->momentum().eta() - matchedTrkPtr->momentum().eta()); - float dR2 = (dPhi * dPhi + dEta * dEta); - - if (dR2 > dRMin2 && dR2 < dRMax2 && dZ < deltaZ_ && trackIter->momentum().perp() > pTMinTra_) { - sumPt += trackIter->momentum().perp(); - } - } - } - - return sumPt; -} -double L1TkElectronTrackProducer::getPtScaledCut(double pt, std::vector& parameters) { - return (parameters[0] + parameters[1] * exp(parameters[2] * pt)); -} -bool L1TkElectronTrackProducer::selectMatchedTrack( - double& d_r, double& d_phi, double& d_eta, double& tk_pt, float& eg_eta) { - if (matchType_ == "PtDependentCut") { - if (std::abs(d_phi) < getPtScaledCut(tk_pt, dPhiCutoff_) && d_r < getPtScaledCut(tk_pt, dRCutoff_)) - return true; - } else { - double deta_max = dEtaCutoff_[0]; - if (std::abs(eg_eta) < EB_MaxEta) - deta_max = dEtaCutoff_[1]; - double dphi_max = dPhiCutoff_[0]; - if ((d_eta / deta_max) * (d_eta / deta_max) + (d_phi / dphi_max) * (d_phi / dphi_max) < 1) - return true; - } - return false; -} -//define this as a plug-in -DEFINE_FWK_MODULE(L1TkElectronTrackProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkEmParticleProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkEmParticleProducer.cc deleted file mode 100644 index 57cb1dd6a5bde..0000000000000 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkEmParticleProducer.cc +++ /dev/null @@ -1,299 +0,0 @@ -// -*- C++ -*- -// -// -// dummy producer for a TkEm -// - -// system include files -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DataFormats/Common/interface/Handle.h" - -#include "DataFormats/L1TCorrelator/interface/TkEm.h" -#include "DataFormats/L1TCorrelator/interface/TkEmFwd.h" -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" - -#include "DataFormats/Math/interface/LorentzVector.h" -#include "DataFormats/Math/interface/deltaR.h" - -// for L1Tracks: -#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" - -#include -#include - -static constexpr float EtaECal = 1.479; -static constexpr float REcal = 129.; -static constexpr float ZEcal = 315.4; -using namespace l1t; -// -// class declaration -// - -class L1TkEmParticleProducer : public edm::global::EDProducer<> { -public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollectionType; - - explicit L1TkEmParticleProducer(const edm::ParameterSet&); - ~L1TkEmParticleProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - - float CorrectedEta(float eta, float zv) const; - -private: - void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - - // ----------member data --------------------------- - - const edm::EDGetTokenT egToken_; - const edm::EDGetTokenT trackToken_; - const edm::EDGetTokenT vertexToken_; - - const std::string label_; - - const float etMin_; // min ET in GeV of L1EG objects - const float zMax_; // |z_track| < zMax_ in cm - const float chi2Max_; - const float pTMinTra_; - const float dR2Min_; - const float dR2Max_; - const bool primaryVtxConstrain_; // use the primary vertex (default = false) - const float deltaZMax_; // | z_track - z_primaryvtx | < deltaZMax_ in cm. - // Used only when primaryVtxConstrain_ = True. - const float isoCut_; - const bool relativeIsolation_; -}; - -// -// constructors and destructor -// -L1TkEmParticleProducer::L1TkEmParticleProducer(const edm::ParameterSet& iConfig) - : egToken_(consumes(iConfig.getParameter("L1EGammaInputTag"))), - trackToken_(consumes(iConfig.getParameter("L1TrackInputTag"))), - vertexToken_(consumes(iConfig.getParameter("L1VertexInputTag"))), - label_(iConfig.getParameter("label")), - etMin_((float)iConfig.getParameter("ETmin")), - zMax_((float)iConfig.getParameter("ZMAX")), - chi2Max_((float)iConfig.getParameter("CHI2MAX")), - pTMinTra_((float)iConfig.getParameter("PTMINTRA")), - dR2Min_((float)iConfig.getParameter("DRmin") * (float)iConfig.getParameter("DRmin")), - dR2Max_((float)iConfig.getParameter("DRmax") * (float)iConfig.getParameter("DRmax")), - primaryVtxConstrain_(iConfig.getParameter("PrimaryVtxConstrain")), - deltaZMax_((float)iConfig.getParameter("DeltaZMax")), - isoCut_((float)iConfig.getParameter("IsoCut")), - relativeIsolation_(iConfig.getParameter("RelativeIsolation")) { - produces(label_); -} - -L1TkEmParticleProducer::~L1TkEmParticleProducer() {} - -// ------------ method called to produce the data ------------ -void L1TkEmParticleProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - using namespace edm; - - auto result = std::make_unique(); - - // the L1Tracks - edm::Handle L1TTTrackHandle; - iEvent.getByToken(trackToken_, L1TTTrackHandle); - if (!L1TTTrackHandle.isValid()) { - LogError("L1TkEmParticleProducer") << "\nWarning: L1TTTrackCollectionType not found in the event. Exit." - << std::endl; - return; - } - - // the primary vertex (used only if primaryVtxConstrain_ = true) - float zvtxL1tk = -999; - bool primaryVtxConstrain = primaryVtxConstrain_; - edm::Handle L1VertexHandle; - iEvent.getByToken(vertexToken_, L1VertexHandle); - if (!L1VertexHandle.isValid()) { - LogWarning("L1TkEmParticleProducer") - << "Warning: TkPrimaryVertexCollection not found in the event. Won't use any PrimaryVertex constraint." - << std::endl; - primaryVtxConstrain = false; - } else { - std::vector::const_iterator vtxIter = L1VertexHandle->begin(); - // by convention, the first vertex in the collection is the one that should - // be used by default - zvtxL1tk = vtxIter->zvertex(); - } - - if (!L1TTTrackHandle.isValid()) { - LogError("L1TkEmParticleProducer") << "\nWarning: L1TTTrackCollectionType not found in the event. Exit." - << std::endl; - return; - } - - // Now loop over the L1EGamma objects - - edm::Handle eGammaHandle; - iEvent.getByToken(egToken_, eGammaHandle); - if (!eGammaHandle.isValid()) { - LogError("L1TkEmParticleProducer") << "\nWarning: L1EmCollection not found in the event. Exit." << std::endl; - return; - } - EGammaBxCollection eGammaCollection = (*eGammaHandle.product()); - EGammaBxCollection::const_iterator egIter; - - int ieg = 0; - for (egIter = eGammaCollection.begin(0); egIter != eGammaCollection.end(0); ++egIter) // considering BX = only - { - edm::Ref EGammaRef(eGammaHandle, ieg); - ieg++; - - float et = egIter->et(); - if (et < etMin_) - continue; - - float eta = egIter->eta(); - // The eta of the L1EG object is seen from (0,0,0). - // if primaryVtxConstrain_ = true, and for the PV constrained iso, use the zvtxL1tk to correct the eta(L1EG) - // that is used in the calculation of DeltaR. - float etaPV = CorrectedEta(eta, zvtxL1tk); - - float phi = egIter->phi(); - - // calculate the isolation of the L1EG object with - // respect to L1Tracks. - - float sumPt = 0; - float sumPtPV = 0; - - for (const auto& track : *L1TTTrackHandle) { - float Pt = track.momentum().perp(); - float Eta = track.momentum().eta(); - float Phi = track.momentum().phi(); - float z = track.POCA().z(); - if (fabs(z) > zMax_) - continue; - if (Pt < pTMinTra_) - continue; - float chi2 = track.chi2(); - if (chi2 > chi2Max_) - continue; - - float dr2 = reco::deltaR2(Eta, Phi, eta, phi); - if (dr2 < dR2Max_ && dr2 >= dR2Min_) { - sumPt += Pt; - } - - if (zvtxL1tk > -999 && std::abs(z - zvtxL1tk) >= deltaZMax_) - continue; // Now, PV constrained trackSum: - - dr2 = reco::deltaR2(Eta, Phi, etaPV, phi); // recompute using the corrected eta - if (dr2 < dR2Max_ && dr2 >= dR2Min_) { - sumPtPV += Pt; - } - } // end loop over tracks - - float trkisol = -999; - float trkisolPV = -999; - if (relativeIsolation_) { - if (et > 0) { - trkisol = sumPt / et; - trkisolPV = sumPtPV / et; - } // relative isolation - } else { // absolute isolation - trkisol = sumPt; - trkisolPV = sumPtPV; - } - - float isolation = primaryVtxConstrain ? trkisolPV : trkisol; - - const math::XYZTLorentzVector P4 = egIter->p4(); - TkEm trkEm(P4, EGammaRef, trkisol, trkisolPV); - - if (isoCut_ <= 0) { - // write the L1TkEm particle to the collection, - // irrespective of its relative isolation - result->push_back(trkEm); - } else { - // the object is written to the collection only - // if it passes the isolation cut - if (isolation <= isoCut_) - result->push_back(trkEm); - } - - } // end loop over EGamma objects - - iEvent.put(std::move(result), label_); -} - -// -------------------------------------------------------------------------------------- - -float L1TkEmParticleProducer::CorrectedEta(float eta, float zv) const { - // Correct the eta of the L1EG object once we know the zvertex - - if (zv == 0.) - return eta; - - if (eta == 0) { - float thetaprime = atan(-REcal / zv); - if (thetaprime < 0) - thetaprime = thetaprime + M_PI; - float etaprime = -log(tan(0.5 * thetaprime)); - return etaprime; - } - - bool IsBarrel = (std::abs(eta) < EtaECal); - - float tanhalftheta = exp(-eta); - float tantheta = 2. * tanhalftheta / (1. - tanhalftheta * tanhalftheta); - - float delta; - if (IsBarrel) - delta = REcal / tantheta; - else - delta = eta > 0 ? ZEcal : -ZEcal; - - float etaprime; - if (delta == zv) { - etaprime = 0.; - } else { - float tanthetaprime = delta * tantheta / (delta - zv); - float thetaprime = atan(tanthetaprime); - if (thetaprime < 0) - thetaprime = thetaprime + M_PI; - etaprime = -log(tan(0.5 * thetaprime)); - } - - return etaprime; -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void L1TkEmParticleProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.add("label", "EG"); - desc.add("L1EGammaInputTag", edm::InputTag("simCaloStage2Digis")); - desc.add("L1TrackInputTag", edm::InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks")); - desc.add("L1VertexInputTag", edm::InputTag("L1TkPrimaryVertex")); - desc.add("ETmin", -1.); - desc.add("RelativeIsolation", true); - desc.add("IsoCut", 0.23); - desc.add("ZMAX", 25.); - desc.add("CHI2MAX", 100.); - desc.add("PTMINTRA", 2.); - desc.add("DRmin", 0.07); - desc.add("DRmax", 0.30); - desc.add("PrimaryVtxConstrain", false); - desc.add("DeltaZMax", 0.6); - descriptions.add("l1TkEmParticleProducer", desc); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(L1TkEmParticleProducer); diff --git a/L1Trigger/L1TTrackMatch/python/L1TkEgammaObjects_cff.py b/L1Trigger/L1TTrackMatch/python/L1TkEgammaObjects_cff.py deleted file mode 100644 index 16ff02bdb55c4..0000000000000 --- a/L1Trigger/L1TTrackMatch/python/L1TkEgammaObjects_cff.py +++ /dev/null @@ -1,8 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -from L1Trigger.L1TTrackMatch.L1TkElectronTrackProducer_cfi import * - -l1TkElectronTrackEllipticProducers = cms.Sequence(L1TkElectronsEllipticMatchCrystal+L1TkElectronsEllipticMatchHGC) -l1TkElectronTrackEllipticProducersEB = cms.Sequence(L1TkElectronsEllipticMatchCrystal) -l1TkElectronTrackEllipticProducersEE = cms.Sequence(L1TkElectronsEllipticMatchHGC) - diff --git a/L1Trigger/L1TTrackMatch/python/L1TkElectronTrackProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkElectronTrackProducer_cfi.py deleted file mode 100644 index b54a72209ac45..0000000000000 --- a/L1Trigger/L1TTrackMatch/python/L1TkElectronTrackProducer_cfi.py +++ /dev/null @@ -1,100 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -L1TkElectrons = cms.EDProducer("L1TkElectronTrackProducer", - label = cms.string("EG"), # labels the collection of L1TkEmParticleProducer that is produced. - # (not really needed actually) - L1EGammaInputTag = cms.InputTag("simCaloStage2Digis",""), - # Only the L1EG objects that have ET > ETmin in GeV - # are considered. ETmin < 0 means that no cut is applied. - ETmin = cms.double( -1.0 ), - L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), - # Quality cuts on Track and Track L1EG matching criteria - TrackChi2 = cms.double(1e10), # minimum Chi2 to select tracks - TrackMinPt = cms.double(10.0), # minimum Pt to select tracks - useTwoStubsPT = cms.bool( False ), - useClusterET = cms.bool( False ), - TrackEGammaMatchType = cms.string("PtDependentCut"), - TrackEGammaDeltaPhi = cms.vdouble(0.07, 0.0, 0.0), # functional Delta Phi cut parameters to match Track with L1EG objects - TrackEGammaDeltaR = cms.vdouble(0.08, 0.0, 0.0), # functional Delta R cut parameters to match Track with L1EG objects - TrackEGammaDeltaEta = cms.vdouble(1e10, 0.0, 0.0), # Delta Eta cutoff to match Track with L1EG objects - # are considered. (unused in default configuration) - RelativeIsolation = cms.bool( True ), # default = True. The isolation variable is relative if True, - # else absolute. - # Cut on the (Trk-based) isolation: only the L1TkElectron for which - # the isolation is below RelIsoCut are written into - # the output collection. When RelIsoCut < 0, no cut is applied. - # When RelativeIsolation = False, IsoCut is in GeV. - # Determination of the isolation w.r.t. L1Tracks : - IsoCut = cms.double( -0.10 ), - PTMINTRA = cms.double( 2. ), # in GeV - DRmin = cms.double( 0.03), - DRmax = cms.double( 0.2 ), - maxChi2IsoTracks = cms.double(1e10), # max chi2 cut for a track to be considered for isolation computation - minNStubsIsoTracks = cms.int32(0), # min cut on # of stubs for a track to be considered for isolation computation - DeltaZ = cms.double( 0.6 ) # in cm. Used for tracks to be used isolation calculation -) -L1TkIsoElectrons = L1TkElectrons.clone( - IsoCut = cms.double( 0.10 ) -) -# for LowPt Electron -L1TkElectronsLoose = L1TkElectrons.clone( - TrackEGammaDeltaPhi = cms.vdouble(0.07, 0.0, 0.0), - TrackEGammaDeltaR = cms.vdouble(0.12, 0.0, 0.0), - TrackMinPt = cms.double( 3.0 ) -) - - -#### Additional collections that right now only the menu team is using - to be renamed/redefined by the EGamma group -# The important change is the EG seed -> PhaseII instead of PhaseI - -#barrel -L1TkElectronsCrystal = L1TkElectrons.clone( - L1EGammaInputTag = cms.InputTag("L1EGammaClusterEmuProducer"), - IsoCut = cms.double(-0.1) -) - -L1TkIsoElectronsCrystal=L1TkElectronsCrystal.clone( - IsoCut = cms.double(0.1) -) - -L1TkElectronsLooseCrystal = L1TkElectronsCrystal.clone( - TrackEGammaDeltaPhi = cms.vdouble(0.07, 0.0, 0.0), - TrackEGammaDeltaR = cms.vdouble(0.12, 0.0, 0.0), - TrackMinPt = cms.double( 3.0 ) -) - -L1TkElectronsEllipticMatchCrystal = L1TkElectronsCrystal.clone( - TrackEGammaMatchType = cms.string("EllipticalCut"), - TrackEGammaDeltaEta = cms.vdouble(0.015, 0.025,1e10) -) - - - -#endcap -L1TkElectronsHGC=L1TkElectrons.clone( - L1EGammaInputTag = cms.InputTag("l1EGammaEEProducer","L1EGammaCollectionBXVWithCuts"), - IsoCut = cms.double(-0.1) -) - - -L1TkElectronsEllipticMatchHGC = L1TkElectronsHGC.clone( - TrackEGammaMatchType = cms.string("EllipticalCut"), - TrackEGammaDeltaEta = cms.vdouble(0.01, 0.01,1e10), - maxChi2IsoTracks = cms.double(100), - minNStubsIsoTracks = cms.int32(4), -) - - -L1TkIsoElectronsHGC=L1TkElectronsHGC.clone( - DRmax = cms.double(0.4), - DeltaZ = cms.double(1.0), - maxChi2IsoTracks = cms.double(100), - minNStubsIsoTracks = cms.int32(4), - IsoCut = cms.double(0.1) - ) - -L1TkElectronsLooseHGC = L1TkElectronsHGC.clone( - TrackEGammaDeltaPhi = cms.vdouble(0.07, 0.0, 0.0), - TrackEGammaDeltaR = cms.vdouble(0.12, 0.0, 0.0), - TrackMinPt = cms.double( 3.0 ) -) diff --git a/L1Trigger/L1TTrackMatch/python/L1TkEmParticleProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkEmParticleProducer_cfi.py deleted file mode 100644 index c6375eab11c36..0000000000000 --- a/L1Trigger/L1TTrackMatch/python/L1TkEmParticleProducer_cfi.py +++ /dev/null @@ -1,55 +0,0 @@ -import FWCore.ParameterSet.Config as cms -from L1Trigger.L1TTrackMatch.l1TkEmParticleProducer_cfi import l1TkEmParticleProducer - -L1TkPhotons = l1TkEmParticleProducer.clone( - label = "EG", # labels the collection of L1TkEmParticleProducer that is produced - # (not really needed actually) - L1EGammaInputTag = ("simCaloStage2Digis",""), - # When the standard sequences are used : - # - for the Run-1 algo, use ("l1extraParticles","NonIsolated") - # or ("l1extraParticles","Isolated") - # - for the "old stage-2" algo (2x2 clustering), use - # ("SLHCL1ExtraParticles","EGamma") or ("SLHCL1ExtraParticles","IsoEGamma") - # - for the new clustering algorithm of Jean-Baptiste et al, - # use ("SLHCL1ExtraParticlesNewClustering","IsoEGamma") or - # ("SLHCL1ExtraParticlesNewClustering","EGamma"). - ETmin = -1., # Only the L1EG objects that have ET > ETmin in GeV - # are considered. ETmin < 0 means that no cut is applied. - RelativeIsolation = True, # default = True. The isolation variable is relative if true, else absolute. - IsoCut = 0.23, # Cut on the (Trk-based) isolation: only the L1TkEmParticle for which - # the isolation is below RelIsoCut are written into - # the output collection. When RelIsoCut < 0, no cut is applied. - # When RelativeIsolation = False, IsoCut is in GeV. - # Determination of the isolation w.r.t. L1Tracks : - L1TrackInputTag = ("TTTracksFromTrackletEmulation", "Level1TTTracks"), - ZMAX = 25., # in cm - CHI2MAX = 100., - PTMINTRA = 2., # in GeV - DRmin = 0.07, - DRmax = 0.30, - PrimaryVtxConstrain = False, # default = False - # if set to True, the default isolation is the PV constrained one, where L1TkPrimaryVertex - # is used to constrain the tracks entering in the calculation of the isolation - # if set to False, the isolation is computed and stored, but not used - DeltaZMax = 0.6, # in cm. Used only to compute the isolation with PrimaryVtxConstrain - L1VertexInputTag = ("L1TkPrimaryVertex") -) - - -L1TkPhotonsTightIsol = L1TkPhotons.clone( - IsoCut = 0.10 -) - -#### Additional collections that right now only the menu team is using - to be renamed/redefined by the EGamma group -# The important change is the EG seed -> PhaseII instead of PhaseI - -L1TkPhotonsCrystal=L1TkPhotons.clone( - L1EGammaInputTag = ("L1EGammaClusterEmuProducer", ), - IsoCut = -0.1 -) - -L1TkPhotonsHGC=L1TkPhotons.clone( - L1EGammaInputTag = ("l1EGammaEEProducer","L1EGammaCollectionBXVWithCuts"), - IsoCut = -0.1 -) - diff --git a/L1Trigger/L1TTrackMatch/src/L1TkElectronTrackMatchAlgo.cc b/L1Trigger/L1TTrackMatch/src/L1TkElectronTrackMatchAlgo.cc deleted file mode 100644 index 5c9bde4246d46..0000000000000 --- a/L1Trigger/L1TTrackMatch/src/L1TkElectronTrackMatchAlgo.cc +++ /dev/null @@ -1,124 +0,0 @@ -// -*- C++ -*- -// -// -/**\class L1TkElectronTrackMatchAlgo - - Description: Algorithm to match L1EGamma oject with L1Track candidates - - Implementation: - [Notes on implementation] -*/ - -// system include files -#include -#include - -#include "DataFormats/Math/interface/deltaPhi.h" -#include "L1Trigger/L1TTrackMatch/interface/L1TkElectronTrackMatchAlgo.h" -namespace L1TkElectronTrackMatchAlgo { - - float constexpr max_eb_eta = 1.479; - float constexpr max_eb_z = 315.4; - float constexpr eb_rperp = 129.0; - // ------------ match EGamma and Track - void doMatch(l1t::EGammaBxCollection::const_iterator egIter, - const edm::Ptr& pTrk, - double& dph, - double& dr, - double& deta) { - GlobalPoint egPos = L1TkElectronTrackMatchAlgo::calorimeterPosition(egIter->phi(), egIter->eta(), egIter->energy()); - dph = L1TkElectronTrackMatchAlgo::deltaPhi(egPos, pTrk); - dr = L1TkElectronTrackMatchAlgo::deltaR(egPos, pTrk); - deta = L1TkElectronTrackMatchAlgo::deltaEta(egPos, pTrk); - } - // ------------ match EGamma and Track - void doMatchClusterET(l1t::EGammaBxCollection::const_iterator egIter, - const edm::Ptr& pTrk, - double& dph, - double& dr, - double& deta) { - GlobalPoint egPos = L1TkElectronTrackMatchAlgo::calorimeterPosition(egIter->phi(), egIter->eta(), egIter->energy()); - dph = L1TkElectronTrackMatchAlgo::deltaPhiClusterET(egIter, pTrk); - dr = L1TkElectronTrackMatchAlgo::deltaR(egPos, pTrk); - deta = L1TkElectronTrackMatchAlgo::deltaEta(egPos, pTrk); - } - // ------------ match EGamma and Track - void doMatch(const GlobalPoint& epos, const edm::Ptr& pTrk, double& dph, double& dr, double& deta) { - dph = L1TkElectronTrackMatchAlgo::deltaPhi(epos, pTrk); - dr = L1TkElectronTrackMatchAlgo::deltaR(epos, pTrk); - deta = L1TkElectronTrackMatchAlgo::deltaEta(epos, pTrk); - } - // --------------- calculate deltaR between Track and EGamma object - double deltaPhi(const GlobalPoint& epos, const edm::Ptr& pTrk) { - double er = epos.perp(); - double curv = pTrk->rInv(); - - double dphi_curv = (asin(er * curv / (2.0))); - double trk_phi_ecal = reco::deltaPhi(pTrk->momentum().phi(), dphi_curv); - - double dphi = reco::deltaPhi(trk_phi_ecal, epos.phi()); - return dphi; - } - // --------------- use cluster et to extrapolate tracks - double deltaPhiClusterET(l1t::EGammaBxCollection::const_iterator egIter, const edm::Ptr& pTrk) { - GlobalPoint epos = L1TkElectronTrackMatchAlgo::calorimeterPosition(egIter->phi(), egIter->eta(), egIter->energy()); - double er = epos.perp(); - double et = egIter->et(); - double pt = pTrk->momentum().perp(); - double curv = pTrk->rInv(); - - double dphi_curv = (asin(er * curv * pt / (2.0 * et))); - double trk_phi_ecal = reco::deltaPhi(pTrk->momentum().phi(), dphi_curv); - - double dphi = reco::deltaPhi(trk_phi_ecal, epos.phi()); - return dphi; - } - // --------------- calculate deltaPhi between Track and EGamma object - double deltaR(const GlobalPoint& epos, const edm::Ptr& pTrk) { - //double dPhi = std::abs(reco::deltaPhi(epos.phi(), pTrk->momentum().phi())); - double dPhi = L1TkElectronTrackMatchAlgo::deltaPhi(epos, pTrk); - double dEta = deltaEta(epos, pTrk); - return sqrt(dPhi * dPhi + dEta * dEta); - } - // --------------- calculate deltaEta between Track and EGamma object - double deltaEta(const GlobalPoint& epos, const edm::Ptr& pTrk) { - double corr_eta = 999.0; - double er = epos.perp(); - double ez = epos.z(); - double z0 = pTrk->POCA().z(); - double theta = 0.0; - if (ez - z0 >= 0) - theta = atan(er / std::abs(ez - z0)); - else - theta = M_PI - atan(er / std::abs(ez - z0)); - corr_eta = -1.0 * log(tan(theta / 2.0)); - double deleta = (corr_eta - pTrk->momentum().eta()); - return deleta; - } - // -------------- get Calorimeter position - GlobalPoint calorimeterPosition(double phi, double eta, double e) { - double x = 0.; - double y = 0.; - double z = 0.; - double depth = 0.89 * (7.7 + log(e)); - double theta = 2 * atan(exp(-1 * eta)); - double r = 0; - if (std::abs(eta) > max_eb_eta) { - double ecalZ = max_eb_z * std::abs(eta) / eta; - - r = ecalZ / cos(2 * atan(exp(-1 * eta))) + depth; - x = r * cos(phi) * sin(theta); - y = r * sin(phi) * sin(theta); - z = r * cos(theta); - } else { - double zface = sqrt(cos(theta) * cos(theta) / (1 - cos(theta) * cos(theta)) * eb_rperp * eb_rperp); - r = sqrt(eb_rperp * eb_rperp + zface * zface) + depth; - x = r * cos(phi) * sin(theta); - y = r * sin(phi) * sin(theta); - z = r * cos(theta); - } - GlobalPoint pos(x, y, z); - return pos; - } - -} // namespace L1TkElectronTrackMatchAlgo From 6548be43cb6864cc957b33cdbd24c389b1f1e06c Mon Sep 17 00:00:00 2001 From: sandeepbhowmik1 Date: Wed, 15 Jun 2022 13:57:26 +0300 Subject: [PATCH 29/66] replacing kPrimaryVertex with VertexWord (cherry picked from commit b8d0a58583000140da374be3182c45a136be9998) --- DataFormats/L1TParticleFlow/interface/HPSPFTau.h | 10 +++++----- DataFormats/L1TParticleFlow/src/HPSPFTau.cc | 4 ++-- DataFormats/L1TParticleFlow/src/classes_def.xml | 3 ++- DataFormats/L1Trigger/interface/VertexWord.h | 2 +- DataFormats/L1Trigger/src/classes_def.xml | 2 ++ .../Phase2L1Taus/interface/L1HPSPFTauBuilder.h | 6 +++--- L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc | 14 +++++++------- L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h | 4 ++-- L1Trigger/Phase2L1Taus/python/l1emulator_cff.py | 4 ++-- L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc | 4 ++-- .../Phase2L1Taus/test/produceHPSPFTaus_cfg.py | 4 ++-- 11 files changed, 30 insertions(+), 27 deletions(-) diff --git a/DataFormats/L1TParticleFlow/interface/HPSPFTau.h b/DataFormats/L1TParticleFlow/interface/HPSPFTau.h index 4859202b0c4e4..1de175bb66f58 100644 --- a/DataFormats/L1TParticleFlow/interface/HPSPFTau.h +++ b/DataFormats/L1TParticleFlow/interface/HPSPFTau.h @@ -5,7 +5,7 @@ #include "DataFormats/JetReco/interface/CaloJet.h" #include "DataFormats/Candidate/interface/LeafCandidate.h" // reco::LeafCandidate #include "DataFormats/Candidate/interface/Particle.h" // reco::Particle::LorentzVector -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "DataFormats/L1Trigger/interface/VertexWord.h" #include @@ -52,7 +52,7 @@ namespace l1t { const l1t::PFCandidateRefVector& sumPhotons() const { return sumPhotons_; } const l1t::PFCandidateRefVector& sumMuons() const { return sumMuons_; } - const l1t::TkPrimaryVertexRef& primaryVertex() const { return primaryVertex_; } + const l1t::VertexWordRef& primaryVertex() const { return primaryVertex_; } enum Kind { kUndefined, kOneProng0Pi0, kOneProng1Pi0, kThreeProng0Pi0, kThreeProng1Pi0 }; Kind tauType() const { return tauType_; } @@ -120,7 +120,7 @@ namespace l1t { void setSumPhotons(l1t::PFCandidateRefVector sumPhotons) { sumPhotons_ = sumPhotons; } void setSumMuons(l1t::PFCandidateRefVector sumMuons) { sumMuons_ = sumMuons; } - void setPrimaryVertex(l1t::TkPrimaryVertexRef primaryVertex) { primaryVertex_ = primaryVertex; } + void setPrimaryVertex(l1t::VertexWordRef primaryVertex) { primaryVertex_ = primaryVertex; } void setTauType(Kind tauType) { tauType_ = tauType; } @@ -176,7 +176,7 @@ namespace l1t { l1t::PFCandidateRefVector sumPhotons_; l1t::PFCandidateRefVector sumMuons_; - l1t::TkPrimaryVertexRef primaryVertex_; + l1t::VertexWordRef primaryVertex_; Kind tauType_; reco::Particle::LorentzVector stripP4_; @@ -208,7 +208,7 @@ namespace l1t { /// print to stream std::ostream& operator<<(std::ostream& os, const l1t::HPSPFTau& l1PFTau); -void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex); +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::VertexWordRef& primaryVertex); void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, float primaryVertexZ); #endif diff --git a/DataFormats/L1TParticleFlow/src/HPSPFTau.cc b/DataFormats/L1TParticleFlow/src/HPSPFTau.cc index a346c1b963943..0150060684503 100644 --- a/DataFormats/L1TParticleFlow/src/HPSPFTau.cc +++ b/DataFormats/L1TParticleFlow/src/HPSPFTau.cc @@ -60,8 +60,8 @@ ostream& operator<<(ostream& os, const l1t::HPSPFTau& l1PFTau) { return os; } -void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::TkPrimaryVertexRef& primaryVertex) { - float primaryVertexZ = (primaryVertex.isNonnull()) ? primaryVertex->zvertex() : 0.; +void printPFCand(ostream& os, const l1t::PFCandidate& l1PFCand, const l1t::VertexWordRef& primaryVertex) { + float primaryVertexZ = (primaryVertex.isNonnull()) ? primaryVertex->z0() : 0.; printPFCand(os, l1PFCand, primaryVertexZ); } diff --git a/DataFormats/L1TParticleFlow/src/classes_def.xml b/DataFormats/L1TParticleFlow/src/classes_def.xml index 21b4731abba14..b1ed9da86adda 100644 --- a/DataFormats/L1TParticleFlow/src/classes_def.xml +++ b/DataFormats/L1TParticleFlow/src/classes_def.xml @@ -53,7 +53,8 @@ - + + diff --git a/DataFormats/L1Trigger/interface/VertexWord.h b/DataFormats/L1Trigger/interface/VertexWord.h index 8d25f1f865a7a..ec8a6ecab4495 100644 --- a/DataFormats/L1Trigger/interface/VertexWord.h +++ b/DataFormats/L1Trigger/interface/VertexWord.h @@ -193,7 +193,7 @@ namespace l1t { }; typedef std::vector VertexWordCollection; - + typedef edm::Ref VertexWordRef; } // namespace l1t #endif diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 1b76b2b2819b4..045c3669354b9 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -295,6 +295,8 @@ + + diff --git a/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h index 0dca7074803d6..e79fdecb3f83a 100644 --- a/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h +++ b/L1Trigger/Phase2L1Taus/interface/L1HPSPFTauBuilder.h @@ -7,7 +7,7 @@ #include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" // l1t::HPSPFTau #include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef #include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "DataFormats/L1Trigger/interface/VertexWord.h" #include "CommonTools/Utils/interface/FormulaEvaluator.h" #include @@ -18,7 +18,7 @@ class L1HPSPFTauBuilder { void reset(); void setL1PFCandProductID(const edm::ProductID& l1PFCandProductID); - void setVertex(const l1t::TkPrimaryVertexRef& primaryVertex); + void setVertex(const l1t::VertexWordRef& primaryVertex); void setL1PFTauSeed(const l1t::PFCandidateRef& l1PFCandSeed); //void setL1PFTauSeed(const reco::CaloJetRef& l1Jet_seed); void setL1PFTauSeed(const reco::CaloJetRef& l1JetSeed, const std::vector& l1PFCands); @@ -62,7 +62,7 @@ class L1HPSPFTauBuilder { double l1PFTauSeedPhi_; double l1PFTauSeedZVtx_; double sumAllL1PFCandidatesPt_; - l1t::TkPrimaryVertexRef primaryVertex_; + l1t::VertexWordRef primaryVertex_; l1t::HPSPFTau l1PFTau_; reco::Particle::LorentzVector stripP4_; diff --git a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc index aaecd61bef1ff..259d0405ab289 100644 --- a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc +++ b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc @@ -30,7 +30,7 @@ HPSPFTauProducer::HPSPFTauProducer(const edm::ParameterSet& cfg) } srcL1Vertices_ = cfg.getParameter("srcL1Vertices"); if (!srcL1Vertices_.label().empty()) { - tokenL1Vertices_ = consumes>(srcL1Vertices_); + tokenL1Vertices_ = consumes(srcL1Vertices_); } deltaR2Cleaning_ = deltaRCleaning_ * deltaRCleaning_; @@ -58,14 +58,14 @@ void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) { edm::Handle l1PFCands; evt.getByToken(tokenL1PFCands_, l1PFCands); - l1t::TkPrimaryVertexRef primaryVertex; + l1t::VertexWordRef primaryVertex; float primaryVertex_z = 0.; if (!srcL1Vertices_.label().empty()) { - edm::Handle> vertices; + edm::Handle vertices; evt.getByToken(tokenL1Vertices_, vertices); if (!vertices->empty()) { - primaryVertex = l1t::TkPrimaryVertexRef(vertices, 0); - primaryVertex_z = primaryVertex->zvertex(); + primaryVertex = l1t::VertexWordRef(vertices, 0); + primaryVertex_z = primaryVertex->z0(); } } @@ -154,7 +154,7 @@ void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) { std::fabs(l1PFTau.leadChargedPFCand()->eta()) < maxLeadChargedPFCandEta_ && (srcL1Vertices_.label().empty() || (primaryVertex.isNonnull() && l1PFTau.leadChargedPFCand()->pfTrack().isNonnull() && - std::fabs(l1PFTau.leadChargedPFCand()->pfTrack()->vertex().z() - primaryVertex->zvertex()) < + std::fabs(l1PFTau.leadChargedPFCand()->pfTrack()->vertex().z() - primaryVertex->z0()) < maxLeadChargedPFCandDz_)) && l1PFTau.sumChargedIso() < maxChargedIso_ && l1PFTau.sumChargedIso() < maxChargedRelIso_ * l1PFTau.pt())) continue; @@ -230,7 +230,7 @@ void HPSPFTauProducer::fillDescriptions(edm::ConfigurationDescriptions& descript desc.add("maxSeedChargedPFCandEta", 2.4); desc.add("applyPreselection", false); desc.add("isolationConeSize", 0.4); - desc.add("srcL1Vertices", edm::InputTag("L1TkPrimaryVertex")); + desc.add("srcL1Vertices", edm::InputTag("L1VertexFinderEmulator", "l1verticesEmulation")); desc.add("maxChargedIso", 1000.0); { edm::ParameterSetDescription psd0; diff --git a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h index 572d07ac0fa9b..c22269d2b45f1 100644 --- a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h +++ b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.h @@ -13,7 +13,7 @@ #include "DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h" // l1t::HPSPFTauCollection #include "DataFormats/L1TParticleFlow/interface/PFCandidate.h" // l1t::PFCandidate, l1t::PFCandidateCollection, l1t::PFCandidateRef #include "DataFormats/JetReco/interface/CaloJet.h" -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "DataFormats/L1Trigger/interface/VertexWord.h" #include #include @@ -37,7 +37,7 @@ class HPSPFTauProducer : public edm::stream::EDProducer<> { edm::InputTag srcL1Jets_; edm::EDGetTokenT> tokenL1Jets_; edm::InputTag srcL1Vertices_; - edm::EDGetTokenT> tokenL1Vertices_; + edm::EDGetTokenT tokenL1Vertices_; std::vector signalQualityCutsDzCutDisabled_; std::vector isolationQualityCutsDzCutDisabled_; diff --git a/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py b/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py index f79f1cf2e177e..836be424a691b 100644 --- a/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py +++ b/L1Trigger/Phase2L1Taus/python/l1emulator_cff.py @@ -24,8 +24,8 @@ TTTrackAssociatorFromPixelDigis.TTTracks = cms.VInputTag( cms.InputTag(L1TRK_NAME, L1TRK_LABEL) ) l1emulator += TrackTriggerAssociatorTracks -from L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi import * -l1emulator += L1TkPrimaryVertex +from L1Trigger.VertexFinder.VertexProducer_cff import * +l1emulator += VertexProducer from Configuration.StandardSequences.SimL1Emulator_cff import * l1emulator += SimL1Emulator diff --git a/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc index 6a19072874a70..ea0d516d7c275 100644 --- a/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc +++ b/L1Trigger/Phase2L1Taus/src/L1HPSPFTauBuilder.cc @@ -50,7 +50,7 @@ void L1HPSPFTauBuilder::reset() { l1PFTauSeedPhi_ = 0.; l1PFTauSeedZVtx_ = 0.; sumAllL1PFCandidatesPt_ = 0.; - primaryVertex_ = l1t::TkPrimaryVertexRef(); + primaryVertex_ = l1t::VertexWordRef(); l1PFTau_ = l1t::HPSPFTau(); stripP4_ = reco::Particle::LorentzVector(0., 0., 0., 0.); @@ -87,7 +87,7 @@ void L1HPSPFTauBuilder::setL1PFCandProductID(const edm::ProductID& l1PFCandProdu l1PFCandProductID_ = l1PFCandProductID; } -void L1HPSPFTauBuilder::setVertex(const l1t::TkPrimaryVertexRef& primaryVertex) { primaryVertex_ = primaryVertex; } +void L1HPSPFTauBuilder::setVertex(const l1t::VertexWordRef& primaryVertex) { primaryVertex_ = primaryVertex; } void L1HPSPFTauBuilder::setL1PFTauSeed(const l1t::PFCandidateRef& l1PFCandSeed) { if (debug_) { diff --git a/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py b/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py index 61122214c3851..2b9b572b15d85 100644 --- a/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py +++ b/L1Trigger/Phase2L1Taus/test/produceHPSPFTaus_cfg.py @@ -126,8 +126,8 @@ 'drop *_*_*_*', 'keep *_l1ctLayer1_PF_*', 'keep *_l1ctLayer1_Puppi_*', - 'keep *_l1pfCandidates_PF_*', - 'keep *_l1pfCandidates_Puppi_*', + #'keep *_l1pfCandidates_PF_*', + #'keep *_l1pfCandidates_Puppi_*', 'keep *_l1pfProducer*_z0_*', 'keep *_pfTracksFromL1Tracks*_*_*', 'keep *_pfClustersFrom*_*_*', From 511f54a84d6a12638a6000656368e39def8666da Mon Sep 17 00:00:00 2001 From: Benjamin Date: Fri, 10 Jun 2022 16:57:58 +0200 Subject: [PATCH 30/66] remove olg eg content --- .../interface/L1TPhase2OuterTrackerTkMET.h | 4 +- .../L1Trigger/python/L1TPhase2Offline_cfi.py | 2 +- .../src/L1TPhase2OuterTrackerTkMET.cc | 6 +- .../L1TCorrelator/interface/TkEtMiss.h | 8 +- .../L1TCorrelator/interface/TkPrimaryVertex.h | 36 -- DataFormats/L1TCorrelator/src/TkEtMiss.cc | 2 +- DataFormats/L1TCorrelator/src/classes.h | 1 - DataFormats/L1TCorrelator/src/classes_def.xml | 11 +- .../python/L1Trigger_EventContent_cff.py | 11 - .../Configuration/python/SimL1Emulator_cff.py | 10 - .../plugins/L1TkFastVertexProducer.cc | 346 ------------------ .../plugins/L1TrackFastJetProducer.cc | 6 +- .../python/L1TkPrimaryVertexProducer_cfi.py | 44 --- .../test/L1TrackObjectNtupleMaker.cc | 20 +- .../test/L1TrackObjectNtupleMaker_cfg.py | 1 + L1Trigger/Phase2L1GMT/test/runGMT.py | 1 - .../VertexFinder/python/VertexProducer_cff.py | 4 +- 17 files changed, 29 insertions(+), 484 deletions(-) delete mode 100644 DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h delete mode 100644 L1Trigger/L1TTrackMatch/plugins/L1TkFastVertexProducer.cc delete mode 100644 L1Trigger/L1TTrackMatch/python/L1TkPrimaryVertexProducer_cfi.py diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2OuterTrackerTkMET.h b/DQMOffline/L1Trigger/interface/L1TPhase2OuterTrackerTkMET.h index f69bf0b7ff8cc..1ef4a1861bd4a 100644 --- a/DQMOffline/L1Trigger/interface/L1TPhase2OuterTrackerTkMET.h +++ b/DQMOffline/L1Trigger/interface/L1TPhase2OuterTrackerTkMET.h @@ -14,7 +14,7 @@ #include "DataFormats/Common/interface/DetSetVectorNew.h" #include "DataFormats/L1TrackTrigger/interface/TTTypes.h" // #include "DataFormats/L1TVertex/interface/Vertex.h" -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "DataFormats/L1Trigger/interface/VertexWord.h" class DQMStore; class L1TPhase2OuterTrackerTkMET : public DQMEDAnalyzer { @@ -39,7 +39,7 @@ class L1TPhase2OuterTrackerTkMET : public DQMEDAnalyzer { private: edm::ParameterSet conf_; const edm::ESGetToken m_topoToken; - edm::EDGetTokenT pvToken; + edm::EDGetTokenT pvToken; edm::EDGetTokenT > > ttTrackToken_; float maxZ0; // in cm diff --git a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py index c4c4893d7b986..3f0d360fc7ff4 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py @@ -6,7 +6,7 @@ OuterTrackerTkMET = DQMEDAnalyzer('L1TPhase2OuterTrackerTkMET', TopFolderName = cms.string('L1T/L1TPhase2/'), TTTracksTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), - L1VertexInputTag = cms.InputTag("L1TkPrimaryVertex"), + L1VertexInputTag = cms.InputTag("L1VertexFinderEmulator", "l1verticesEmulation"), maxZ0 = cms.double ( 15. ) , # in cm maxEta = cms.double ( 2.4 ) , chi2dofMax = cms.double( 10. ), diff --git a/DQMOffline/L1Trigger/src/L1TPhase2OuterTrackerTkMET.cc b/DQMOffline/L1Trigger/src/L1TPhase2OuterTrackerTkMET.cc index 0a8566bc785b1..709c2de2dcb4a 100644 --- a/DQMOffline/L1Trigger/src/L1TPhase2OuterTrackerTkMET.cc +++ b/DQMOffline/L1Trigger/src/L1TPhase2OuterTrackerTkMET.cc @@ -40,7 +40,7 @@ L1TPhase2OuterTrackerTkMET::L1TPhase2OuterTrackerTkMET(const edm::ParameterSet& topFolderName_ = conf_.getParameter("TopFolderName"); ttTrackToken_ = consumes > >(conf_.getParameter("TTTracksTag")); - pvToken = consumes(conf_.getParameter("L1VertexInputTag")); + pvToken = consumes(conf_.getParameter("L1VertexInputTag")); maxZ0 = conf_.getParameter("maxZ0"); DeltaZ = conf_.getParameter("DeltaZ"); @@ -64,7 +64,7 @@ L1TPhase2OuterTrackerTkMET::~L1TPhase2OuterTrackerTkMET() { // ------------ method called for each event ------------ void L1TPhase2OuterTrackerTkMET::analyze(const edm::Event& iEvent, const edm::EventSetup& iSetup) { // L1 Primaries - edm::Handle L1VertexHandle; + edm::Handle L1VertexHandle; iEvent.getByToken(pvToken, L1VertexHandle); edm::Handle > > TTTrackHandle; @@ -91,7 +91,7 @@ void L1TPhase2OuterTrackerTkMET::analyze(const edm::Event& iEvent, const edm::Ev double etTot_PU = 0; int nTracks_counter = 0; - float zVTX = L1VertexHandle->begin()->zvertex(); + float zVTX = L1VertexHandle->begin()->z0(); unsigned int tkCnt = 0; for (const auto& trackIter : *TTTrackHandle) { edm::Ptr > tempTrackPtr(TTTrackHandle, tkCnt++); /// Make the pointer diff --git a/DataFormats/L1TCorrelator/interface/TkEtMiss.h b/DataFormats/L1TCorrelator/interface/TkEtMiss.h index 59d255d4a2ec2..8fdcd13246938 100644 --- a/DataFormats/L1TCorrelator/interface/TkEtMiss.h +++ b/DataFormats/L1TCorrelator/interface/TkEtMiss.h @@ -3,7 +3,7 @@ #include "DataFormats/L1Trigger/interface/L1Candidate.h" #include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" +#include "DataFormats/L1Trigger/interface/VertexWord.h" namespace l1t { class TkEtMiss : public L1Candidate { @@ -15,7 +15,7 @@ namespace l1t { const double& etTotal, const double& etMissPU, const double& etTotalPU, - const edm::Ref& aVtxRef = edm::Ref(), + const edm::Ref& aVtxRef = edm::Ref(), int bx = 0); TkEtMiss(const LorentzVector& p4, @@ -37,7 +37,7 @@ namespace l1t { double etMissPU() const { return etMissPU_; } double etTotalPU() const { return etTotalPU_; } int bx() const { return bx_; } - const edm::Ref& vtxRef() const { return vtxRef_; } + const edm::Ref& vtxRef() const { return vtxRef_; } double etPhi() const { return etPhi_; } int etQual() const { return etQual_; } @@ -52,7 +52,7 @@ namespace l1t { double etTot_; double etMissPU_; double etTotalPU_; - edm::Ref vtxRef_; + edm::Ref vtxRef_; double etMiss_; double etPhi_; diff --git a/DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h b/DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h deleted file mode 100644 index 4981e387beae0..0000000000000 --- a/DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef DataFormatsL1TCorrelator_TkPrimaryVertex_h -#define DataFormatsL1TCorrelator_TkPrimaryVertex_h - -// Package: L1TCorrelator -// Class : TkPrimaryVertex - -// First version of a class for L1-zvertex -#include -#include "DataFormats/Common/interface/Ref.h" -#include "DataFormats/Common/interface/RefVector.h" - -namespace l1t { - - class TkPrimaryVertex { - public: - TkPrimaryVertex() : zvertex_(-999), sum_(-999) {} - - ~TkPrimaryVertex() {} - - TkPrimaryVertex(float z, float s) : zvertex_(z), sum_(s) {} - - float zvertex() const { return zvertex_; } - float sum() const { return sum_; } - - private: - float zvertex_; - float sum_; - }; - - typedef std::vector TkPrimaryVertexCollection; - typedef edm::Ref TkPrimaryVertexRef; - typedef edm::RefVector TkPrimaryVertexRefVector; - typedef std::vector TkPrimaryVertexVectorRef; - -} // namespace l1t -#endif diff --git a/DataFormats/L1TCorrelator/src/TkEtMiss.cc b/DataFormats/L1TCorrelator/src/TkEtMiss.cc index 70125a01ff372..c91bcb830baf1 100644 --- a/DataFormats/L1TCorrelator/src/TkEtMiss.cc +++ b/DataFormats/L1TCorrelator/src/TkEtMiss.cc @@ -9,7 +9,7 @@ TkEtMiss::TkEtMiss(const LorentzVector& p4, const double& etTotal, const double& etMissPU, const double& etTotalPU, - const edm::Ref& avtxRef, + const edm::Ref& avtxRef, int bx) : L1Candidate(p4), type_(type), diff --git a/DataFormats/L1TCorrelator/src/classes.h b/DataFormats/L1TCorrelator/src/classes.h index fd0aabbb89293..bf296c0e0d74f 100644 --- a/DataFormats/L1TCorrelator/src/classes.h +++ b/DataFormats/L1TCorrelator/src/classes.h @@ -14,7 +14,6 @@ // includes needed for the L1TrackTriggerObjects -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" #include "DataFormats/L1TCorrelator/interface/TkEtMiss.h" #include "DataFormats/L1TCorrelator/interface/TkEtMissFwd.h" diff --git a/DataFormats/L1TCorrelator/src/classes_def.xml b/DataFormats/L1TCorrelator/src/classes_def.xml index 2879196333e52..0685c6bc1356e 100644 --- a/DataFormats/L1TCorrelator/src/classes_def.xml +++ b/DataFormats/L1TCorrelator/src/classes_def.xml @@ -1,15 +1,8 @@ - - - - - - - - - + + diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 3691ffb2cc0a6..70cc49a0a6ec2 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -178,20 +178,9 @@ def _appendPhase2Digis(obj): 'keep *_L1EGammaClusterEmuProducer_*_*', 'keep *_L1VertexFinder_*_*', 'keep *_L1VertexFinderEmulator_*_*', - 'keep *_L1TkPrimaryVertex_*_*', 'keep *_L1TowerCalibration_*_*', 'keep *_L1CaloJet_*_*', 'keep *_L1CaloJetHTT_*_*', - 'keep *_L1TkElectronsCrystal_*_*', - 'keep *_L1TkElectronsLooseCrystal_*_*', - 'keep *_L1TkElectronsEllipticMatchCrystal_*_*', - 'keep *_L1TkIsoElectronsCrystal_*_*', - 'keep *_L1TkPhotonsCrystal_*_*', - 'keep *_L1TkElectronsHGC_*_*', - 'keep *_L1TkElectronsEllipticMatchHGC_*_*', - 'keep *_L1TkElectronsLooseHGC_*_*', - 'keep *_L1TkIsoElectronsHGC_*_*', - 'keep *_L1TkPhotonsHGC_*_*', 'keep *_pfClustersFromL1EGClusters_*_*', 'keep *_pfClustersFromCombinedCaloHCal_*_*', 'keep *_pfClustersFromCombinedCaloHF_*_*', diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index 30b29d14b0828..a0d32b5ce827b 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -131,16 +131,6 @@ _phase2_siml1emulator.add(L1GTTInputProducerExtended) _phase2_siml1emulator.add(L1VertexFinderEmulator) -# Tk + StandaloneObj, including L1TkPrimaryVertex -# ######################################################################## - -from L1Trigger.L1TTrackMatch.L1TkPrimaryVertexProducer_cfi import L1TkPrimaryVertex -from L1Trigger.L1TTrackMatch.L1TkElectronTrackProducer_cfi import L1TkElectronsCrystal, L1TkElectronsLooseCrystal, L1TkElectronsEllipticMatchCrystal, L1TkIsoElectronsCrystal, L1TkElectronsHGC, L1TkElectronsEllipticMatchHGC, L1TkIsoElectronsHGC, L1TkElectronsLooseHGC -from L1Trigger.L1TTrackMatch.L1TkEmParticleProducer_cfi import L1TkPhotonsCrystal, L1TkPhotonsHGC - -_phase2_siml1emulator.add(L1TkPrimaryVertex) - - # Emulated GMT Muons (Tk + Stub, Tk + MuonTFT, StandaloneMuon) # ######################################################################## from L1Trigger.Phase2L1GMT.gmt_cfi import * diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TkFastVertexProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TkFastVertexProducer.cc deleted file mode 100644 index 0b371c16e6efb..0000000000000 --- a/L1Trigger/L1TTrackMatch/plugins/L1TkFastVertexProducer.cc +++ /dev/null @@ -1,346 +0,0 @@ -// -*- C++ -*- -// -// -// Original Author: Emmanuelle Perez,40 1-A28,+41227671915, -// Created: Tue Nov 12 17:03:19 CET 2013 -// $Id$ -// -// -// system include files -#include -#include - -// user include files -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include "FWCore/Framework/interface/global/EDProducer.h" - -#include "FWCore/Framework/interface/Event.h" -#include "FWCore/Framework/interface/MakerMacros.h" -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/ESGetToken.h" -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DataFormats/L1TrackTrigger/interface/TTTypes.h" - -//////////////////////////// -// DETECTOR GEOMETRY HEADERS -#include "MagneticField/Engine/interface/MagneticField.h" - -#include "Geometry/Records/interface/TrackerTopologyRcd.h" -#include "DataFormats/TrackerCommon/interface/TrackerTopology.h" - -#include "DataFormats/L1TCorrelator/interface/TkPrimaryVertex.h" - -//////////////////////////// -// HepMC products -#include "DataFormats/HepMCCandidate/interface/GenParticle.h" -#include "SimDataFormats/GeneratorProducts/interface/HepMCProduct.h" -#include "DataFormats/Candidate/interface/Candidate.h" - -#include "TH1F.h" - -using namespace l1t; - -// -// class declaration -// - -class L1TkFastVertexProducer : public edm::global::EDProducer<> { -public: - typedef TTTrack L1TTTrackType; - typedef std::vector L1TTTrackCollectionType; - - explicit L1TkFastVertexProducer(const edm::ParameterSet&); - ~L1TkFastVertexProducer() override; - - static void fillDescriptions(edm::ConfigurationDescriptions& descriptions); - -private: - void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; - - // ----------member data --------------------------- - - float DeltaZ; // in cm - - const float zMax_; // in cm - const float chi2Max_; - const float pTMinTra_; // in GeV - const float pTMax_; // in GeV, saturation / truncation value - int highPtTracks_; // saturate or truncate - int nVtx_; // the number of vertices to return - const int nStubsmin_; // minimum number of stubs - const int nStubsPSmin_; // minimum number of stubs in PS modules - int nBinning_; // number of bins used in the temp histogram - bool monteCarloVertex_; // - //const StackedTrackerGeometry* theStackedGeometry; - const bool doPtComp_; - const bool doTightChi2_; - float trkPtTightChi2_; - float trkChi2dofTightChi2_; - int weight_; // weight (power) of pT 0 , 1, 2 - - constexpr static float xmin_ = -30; - constexpr static float xmax_ = +30; - - const edm::EDGetTokenT hepmcToken_; - const edm::EDGetTokenT > genparticleToken_; - const edm::EDGetTokenT > > trackToken_; - const edm::ESGetToken topoToken_; -}; - -// -// constants, enums and typedefs -// - -// -// static data member definitions -// - -// -// constructors and destructor -// -L1TkFastVertexProducer::L1TkFastVertexProducer(const edm::ParameterSet& iConfig) - : zMax_((float)iConfig.getParameter("ZMAX")), - chi2Max_((float)iConfig.getParameter("CHI2MAX")), - pTMinTra_((float)iConfig.getParameter("PTMINTRA")), - pTMax_((float)iConfig.getParameter("PTMAX")), - highPtTracks_(iConfig.getParameter("HighPtTracks")), - nVtx_(iConfig.getParameter("nVtx")), - nStubsmin_(iConfig.getParameter("nStubsmin")), - nStubsPSmin_(iConfig.getParameter("nStubsPSmin")), - nBinning_(iConfig.getParameter("nBinning")), - monteCarloVertex_(iConfig.getParameter("MonteCarloVertex")), - doPtComp_(iConfig.getParameter("doPtComp")), - doTightChi2_(iConfig.getParameter("doTightChi2")), - trkPtTightChi2_((float)iConfig.getParameter("trk_ptTightChi2")), - trkChi2dofTightChi2_((float)iConfig.getParameter("trk_chi2dofTightChi2")), - weight_(iConfig.getParameter("WEIGHT")), - hepmcToken_(consumes(iConfig.getParameter("HepMCInputTag"))), - genparticleToken_( - consumes >(iConfig.getParameter("GenParticleInputTag"))), - trackToken_(consumes > >( - iConfig.getParameter("L1TrackInputTag"))), - topoToken_(esConsumes(edm::ESInputTag("", ""))) { - produces(); -} - -L1TkFastVertexProducer::~L1TkFastVertexProducer() { - // do anything here that needs to be done at desctruction time - // (e.g. close files, deallocate resources etc.) -} - -// -// member functions -// - -// ------------ method called to produce the data ------------ -void L1TkFastVertexProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { - using namespace edm; - - auto result = std::make_unique(); - - // Tracker Topology - const TrackerTopology& tTopo = iSetup.getData(topoToken_); - - TH1F htmp("htmp", ";z (cm); Tracks", nBinning_, xmin_, xmax_); - TH1F htmp_weight("htmp_weight", ";z (cm); Tracks", nBinning_, xmin_, xmax_); - - // ---------------------------------------------------------------------- - - if (monteCarloVertex_) { - // MC info ... retrieve the zvertex - edm::Handle HepMCEvt; - iEvent.getByToken(hepmcToken_, HepMCEvt); - - edm::Handle > GenParticleHandle; - iEvent.getByToken(genparticleToken_, GenParticleHandle); - - const double mm = 0.1; - float zvtx_gen = -999; - - if (HepMCEvt.isValid()) { - // using HepMCEvt - - const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent(); - for (HepMC::GenEvent::vertex_const_iterator ivertex = MCEvt->vertices_begin(); ivertex != MCEvt->vertices_end(); - ++ivertex) { - bool hasParentVertex = false; - - // Loop over the parents looking to see if they are coming from a production vertex - for (HepMC::GenVertex::particle_iterator iparent = (*ivertex)->particles_begin(HepMC::parents); - iparent != (*ivertex)->particles_end(HepMC::parents); - ++iparent) - if ((*iparent)->production_vertex()) { - hasParentVertex = true; - break; - } - - // Reject those vertices with parent vertices - if (hasParentVertex) - continue; - // Get the position of the vertex - HepMC::FourVector pos = (*ivertex)->position(); - zvtx_gen = pos.z() * mm; - break; // there should be one single primary vertex - } // end loop over gen vertices - - } else if (GenParticleHandle.isValid()) { - for (const auto& genpart : *GenParticleHandle) { - int status = genpart.status(); - if (status != 3) - continue; - if (genpart.numberOfMothers() == 0) - continue; // the incoming hadrons - float part_zvertex = genpart.vz(); - zvtx_gen = part_zvertex; - break; // - } - } else { - throw cms::Exception("L1TkFastVertexProducer") - << "\nerror: try to retrieve the MC vertex (monteCarloVertex_ = True) " - << "\nbut the input file contains neither edm::HepMCProduct> nor vector. Exit" - << std::endl; - } - - TkPrimaryVertex genvtx(zvtx_gen, -999.); - - result->push_back(genvtx); - iEvent.put(std::move(result)); - return; - } - - edm::Handle L1TTTrackHandle; - iEvent.getByToken(trackToken_, L1TTTrackHandle); - - if (!L1TTTrackHandle.isValid()) { - throw cms::Exception("L1TkFastVertexProducer") - << "\nWarning: L1TkTrackCollection with not found in the event. Exit" << std::endl; - return; - } - - for (const auto& track : *L1TTTrackHandle) { - float z = track.POCA().z(); - float chi2 = track.chi2(); - float pt = track.momentum().perp(); - float eta = track.momentum().eta(); - - //.............................................................. - float wt = pow(pt, weight_); // calculating the weight for tks in as pt^0,pt^1 or pt^2 based on weight_ - - if (std::abs(z) > zMax_) - continue; - if (chi2 > chi2Max_) - continue; - if (pt < pTMinTra_) - continue; - - // saturation or truncation : - if (pTMax_ > 0 && pt > pTMax_) { - if (highPtTracks_ == 0) - continue; // ignore this track - if (highPtTracks_ == 1) - pt = pTMax_; // saturate - } - - // get the number of stubs and the number of stubs in PS layers - float nPS = 0.; // number of stubs in PS modules - float nstubs = 0; - - // get pointers to stubs associated to the L1 track - const std::vector >, TTStub > >& - theStubs = track.getStubRefs(); - - int tmp_trk_nstub = (int)theStubs.size(); - if (tmp_trk_nstub < 0) { - LogTrace("L1TkFastVertexProducer") - << " ... could not retrieve the vector of stubs in L1TkFastVertexProducer::SumPtVertex " << std::endl; - continue; - } - - // loop over the stubs - for (const auto& stub : theStubs) { - nstubs++; - bool isPS = false; - DetId detId(stub->getDetId()); - if (detId.det() == DetId::Detector::Tracker) { - if (detId.subdetId() == StripSubdetector::TOB && tTopo.tobLayer(detId) <= 3) - isPS = true; - else if (detId.subdetId() == StripSubdetector::TID && tTopo.tidRing(detId) <= 9) - isPS = true; - } - if (isPS) - nPS++; - } // end loop over stubs - if (nstubs < nStubsmin_) - continue; - if (nPS < nStubsPSmin_) - continue; - - // quality cuts from Louise S, based on the pt-stub compatibility (June 20, 2014) - int trk_nstub = (int)track.getStubRefs().size(); - float chi2dof = chi2 / (2 * trk_nstub - 4); - - if (doPtComp_) { - float trk_consistency = track.stubPtConsistency(); - if (trk_nstub == 4) { - if (std::abs(eta) < 2.2 && trk_consistency > 10) - continue; - else if (std::abs(eta) > 2.2 && chi2dof > 5.0) - continue; - } - } - if (doTightChi2_) { - if (pt > trkPtTightChi2_ && chi2dof > trkChi2dofTightChi2_) - continue; - } - - htmp.Fill(z); - htmp_weight.Fill(z, wt); // changed from "pt" to "wt" which is some power of pt (0,1 or 2) - - } // end loop over tracks - - // sliding windows... maximize bin i + i-1 + i+1 - - float zvtx_sliding; - float sigma_max; - int imax; - int nb = htmp.GetNbinsX(); - std::vector found; - found.reserve(nVtx_); - for (int ivtx = 0; ivtx < nVtx_; ivtx++) { - zvtx_sliding = -999; - sigma_max = -999; - imax = -999; - for (int i = 2; i <= nb - 1; i++) { - float a0 = htmp_weight.GetBinContent(i - 1); - float a1 = htmp_weight.GetBinContent(i); - float a2 = htmp_weight.GetBinContent(i + 1); - float sigma = a0 + a1 + a2; - if ((sigma > sigma_max) && (find(found.begin(), found.end(), i) == found.end())) { - sigma_max = sigma; - imax = i; - float z0 = htmp_weight.GetBinCenter(i - 1); - float z1 = htmp_weight.GetBinCenter(i); - float z2 = htmp_weight.GetBinCenter(i + 1); - zvtx_sliding = (a0 * z0 + a1 * z1 + a2 * z2) / sigma; - } - } - found.push_back(imax); - TkPrimaryVertex vtx4(zvtx_sliding, sigma_max); - result->push_back(vtx4); - } - - iEvent.put(std::move(result)); -} - -// ------------ method fills 'descriptions' with the allowed parameters for the module ------------ -void L1TkFastVertexProducer::fillDescriptions(edm::ConfigurationDescriptions& descriptions) { - //The following says we do not know what parameters are allowed so do no validation - // Please change this to state exactly what you do use, even if it is no parameters - edm::ParameterSetDescription desc; - desc.setUnknown(); - descriptions.addDefault(desc); -} - -//define this as a plug-in -DEFINE_FWK_MODULE(L1TkFastVertexProducer); diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc index a4abe6029e92d..b2c0cb4fa2eb5 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackFastJetProducer.cc @@ -123,13 +123,13 @@ void L1TrackFastJetProducer::produce(edm::Event& iEvent, const edm::EventSetup& // Tracker Topology const TrackerTopology& tTopo = iSetup.getData(tTopoToken_); - edm::Handle TkPrimaryVertexHandle; - iEvent.getByToken(pvToken_, TkPrimaryVertexHandle); + edm::Handle L1PrimaryVertexHandle; + iEvent.getByToken(pvToken_, L1PrimaryVertexHandle); fastjet::JetDefinition jet_def(fastjet::antikt_algorithm, coneSize_); std::vector JetInputs; - float recoVtx = TkPrimaryVertexHandle->begin()->z0(); + float recoVtx = L1PrimaryVertexHandle->begin()->z0(); unsigned int this_l1track = 0; for (iterL1Track = TTTrackHandle->begin(); iterL1Track != TTTrackHandle->end(); iterL1Track++) { this_l1track++; diff --git a/L1Trigger/L1TTrackMatch/python/L1TkPrimaryVertexProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TkPrimaryVertexProducer_cfi.py deleted file mode 100644 index 709b275f7822a..0000000000000 --- a/L1Trigger/L1TTrackMatch/python/L1TkPrimaryVertexProducer_cfi.py +++ /dev/null @@ -1,44 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -L1TkPrimaryVertex = cms.EDProducer('L1TkFastVertexProducer', - -# -# Default parameters used for the plots for the TP -# - HepMCInputTag = cms.InputTag("generator"), - GenParticleInputTag = cms.InputTag("genParticles",""), - L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation", "Level1TTTracks"), - ZMAX = cms.double ( 25. ) , # in cm - CHI2MAX = cms.double( 100. ), - PTMINTRA = cms.double( 2.), # PTMIN of L1Tracks, in GeV - nVtx = cms.int32( 10 ), # number of vertices to return - nStubsmin = cms.int32( 4 ) , # minimum number of stubs - nStubsPSmin = cms.int32( 3 ), # minimum number of stubs in PS modules - nBinning = cms.int32( 601 ), # number of bins for the temp histo (from -30 cm to + 30 cm) - PTMAX = cms.double( 50. ), # in GeV. When PTMAX > 0, tracks with PT above PTMAX are considered as - # mismeasured and are treated according to HighPtTracks below. - # When PTMAX < 0, no special treatment is done for high PT tracks. - # If PTMAX < 0, no saturation or truncation is done. - HighPtTracks = cms.int32( 0 ), # when = 0 : truncation. Tracks with PT above PTMAX are ignored - # when = 1 : saturation. Tracks with PT above PTMAX are set to PT=PTMAX. - MonteCarloVertex = cms.bool( False ), # when True: dont run the vxt finding algo but pick up the MC generated vtx - doPtComp = cms.bool( True ), # track-stubs PT compatibility cut - doTightChi2 = cms.bool( False ), # chi2dof < 5 for tracks with PT > 10 - trk_ptTightChi2 = cms.double(10.0), - trk_chi2dofTightChi2 = cms.double(5.0), - WEIGHT = cms.int32(1) # WEIGHT can be set to 0, 1 or 2 for unweighted, pT weighted - # or pT2 weighted tracks respectively. - -# -# Other working point which works better for H -> TauTau, -# cf talk by Moshan Ather, Dec 12, 2014: - -# WEIGHT = cms.int32(2), -# PTMAX = cms.double( 25. ), -# nStubsmin = cms.int32( 5 ), -# HighPtTracks = cms.int32( 1), -# doPtComp = cms.bool( False ), -# CHI2MAX = cms.double( 20 ) -# - -) diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc index eae50c80e2b7e..c8bef14845596 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc @@ -1272,12 +1272,12 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even iEvent.getByToken(GenParticleToken_, GenParticleHandle); //Vertex - edm::Handle L1TkPrimaryVertexHandle; - iEvent.getByToken(L1VertexToken_, L1TkPrimaryVertexHandle); + edm::Handle L1PrimaryVertexHandle; + iEvent.getByToken(L1VertexToken_, L1PrimaryVertexHandle); std::vector::const_iterator vtxIter; - edm::Handle L1TkPrimaryVertexEmuHandle; - iEvent.getByToken(L1VertexEmuToken_, L1TkPrimaryVertexEmuHandle); + edm::Handle L1PrimaryVertexEmuHandle; + iEvent.getByToken(L1VertexEmuToken_, L1PrimaryVertexEmuHandle); std::vector::const_iterator vtxEmuIter; // Track jets @@ -2368,21 +2368,21 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even } //end loop tracking particles trueTkMET = sqrt(trueTkMETx * trueTkMETx + trueTkMETy * trueTkMETy); - if (L1TkPrimaryVertexHandle.isValid()) { - for (vtxIter = L1TkPrimaryVertexHandle->begin(); vtxIter != L1TkPrimaryVertexHandle->end(); ++vtxIter) { + if (L1PrimaryVertexHandle.isValid()) { + for (vtxIter = L1PrimaryVertexHandle->begin(); vtxIter != L1PrimaryVertexHandle->end(); ++vtxIter) { m_pv_L1reco->push_back(vtxIter->z0()); m_pv_L1reco_sum->push_back(vtxIter->pt()); } } else - edm::LogWarning("DataNotFound") << "\nWarning: L1TkPrimaryVertexHandle not found" << std::endl; + edm::LogWarning("DataNotFound") << "\nWarning: L1PrimaryVertexHandle not found" << std::endl; - if (L1TkPrimaryVertexEmuHandle.isValid()) { - for (vtxEmuIter = L1TkPrimaryVertexEmuHandle->begin(); vtxEmuIter != L1TkPrimaryVertexEmuHandle->end(); + if (L1PrimaryVertexEmuHandle.isValid()) { + for (vtxEmuIter = L1PrimaryVertexEmuHandle->begin(); vtxEmuIter != L1PrimaryVertexEmuHandle->end(); ++vtxEmuIter) { m_pv_L1reco_emu->push_back(vtxEmuIter->z0()); } } else - edm::LogWarning("DataNotFound") << "\nWarning: L1TkPrimaryVertexEmuHandle not found" << std::endl; + edm::LogWarning("DataNotFound") << "\nWarning: L1PrimaryVertexEmuHandle not found" << std::endl; if (SaveTrackSums) { if (Displaced == "Prompt" || Displaced == "Both") { diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py index e902c0a7d2d33..4e3396cbed916 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker_cfg.py @@ -61,6 +61,7 @@ duplicateCheckMode = cms.untracked.string('noDuplicateCheck'), ) +process.source.inputCommands = cms.untracked.vstring("keep *","drop l1tTkPrimaryVertexs_L1TkPrimaryVertex__*") process.TFileService = cms.Service("TFileService", fileName = cms.string('GTTObjects_ttbar200PU.root'), closeFileFast = cms.untracked.bool(True)) diff --git a/L1Trigger/Phase2L1GMT/test/runGMT.py b/L1Trigger/Phase2L1GMT/test/runGMT.py index d11363e083f9b..cec51bb3cf1dd 100644 --- a/L1Trigger/Phase2L1GMT/test/runGMT.py +++ b/L1Trigger/Phase2L1GMT/test/runGMT.py @@ -127,7 +127,6 @@ # Path and EndPath definitions process.raw2digi_step = cms.Path(process.RawToDigi) process.L1TrackTrigger_step = cms.Path(process.L1TrackTrigger) -#process.pL1TkPrimaryVertex = cms.Path(process.L1TkPrimaryVertex) #process.pL1TkPhotonsCrystal = cms.Path(process.L1TkPhotonsCrystal) #process.pL1TkIsoElectronsCrystal = cms.Path(process.L1TkIsoElectronsCrystal) #process.pL1TkElectronsLooseCrystal = cms.Path(process.L1TkElectronsLooseCrystal) diff --git a/L1Trigger/VertexFinder/python/VertexProducer_cff.py b/L1Trigger/VertexFinder/python/VertexProducer_cff.py index f946fbb0f1390..e2aa8641a4148 100644 --- a/L1Trigger/VertexFinder/python/VertexProducer_cff.py +++ b/L1Trigger/VertexFinder/python/VertexProducer_cff.py @@ -53,13 +53,13 @@ # Minimum pt of tracks used to create vertex [GeV] VxMinTrackPt = cms.double(2.0), # Maximum pt of tracks used to create vertex [GeV] - VxMaxTrackPt = cms.double(50.0), + VxMaxTrackPt = cms.double(127.0), # When the track pt > VxMaxTrackPt, how should the tracks be considered # -1 = tracks are valid # 0 = tracks are mismeasured and ignored/truncated # 1 = tracks are mismeasured and saturate at VxMaxTrackPt # Option '0' was used for the TDR, but '1' is used for the firmware - VxMaxTrackPtBehavior = cms.int32(0), + VxMaxTrackPtBehavior = cms.int32(1), # Maximum chi2 of tracks used to create vertex VxMaxTrackChi2 = cms.double(100.), # Minimum number of stubs associated to a track From 8df19dd19a2b246467ce5dbedb94fe79eb891258 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 20 Jun 2022 15:35:26 +0200 Subject: [PATCH 31/66] code format --- .../interface/L1TPhase2MuonOffline.h | 66 ++-- .../L1Trigger/src/L1TPhase2MuonOffline.cc | 327 +++++++++--------- .../test/L1TrackObjectNtupleMaker.cc | 3 +- .../Phase2L1Taus/plugins/HPSPFTauProducer.cc | 2 +- 4 files changed, 198 insertions(+), 200 deletions(-) diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h index 114012c552d5b..ba2cc0959d765 100644 --- a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h @@ -8,7 +8,7 @@ * */ -// DataFormats +// DataFormats #include "DataFormats/L1Trigger/interface/Muon.h" #include "DataFormats/L1TMuonPhase2/interface/SAMuon.h" #include "DataFormats/L1TMuonPhase2/interface/MuonStub.h" @@ -20,7 +20,7 @@ #include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/Math/interface/deltaPhi.h" -// FWCore +// FWCore #include "FWCore/Framework/interface/Frameworkfwd.h" #include "FWCore/Framework/interface/ESHandle.h" #include "FWCore/Framework/interface/Event.h" @@ -62,18 +62,18 @@ class GenMuonGMTPair; // class L1TPhase2MuonOffline : public DQMEDAnalyzer { - public: +public: L1TPhase2MuonOffline(const edm::ParameterSet& ps); ~L1TPhase2MuonOffline() override; - - enum MuType { kSAMuon, kTkMuon, kNMuTypes }; + + enum MuType { kSAMuon, kTkMuon, kNMuTypes }; enum VarType { kPt, kEta, kPhi, kIso, kQual, kZ0, kD0, kNVarTypes }; enum EffType { kEffPt, kEffPhi, kEffEta, kEffTypes }; enum ResType { kResPt, kRes1OverPt, kResQOverPt, kResPhi, kResEta, kResCh, kNResTypes }; enum EtaRegion { kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf, kNEtaRegions }; enum QualLevel { kQualOpen, kQualDouble, kQualSingle, kNQualLevels }; - protected: +protected: void dqmBeginRun(const edm::Run& run, const edm::EventSetup& iSetup) override; void analyze(const edm::Event& e, const edm::EventSetup& c) override; @@ -82,18 +82,15 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { void bookResolutionHistos(DQMStore::IBooker& ibooker, MuType type); void bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) override; - //Fill Histos - void fillControlHistos(); + void fillControlHistos(); void fillEfficiencyHistos(); void fillResolutionHistos(); - private: // Cut and Matching void getMuonGmtPairs(edm::Handle& gmtCands); - // Handles and Tokens edm::EDGetTokenT gmtMuonToken_; edm::EDGetTokenT gmtTkMuonToken_; @@ -102,10 +99,10 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { edm::Handle gmtSAMuon_; edm::Handle gmtTkMuon_; edm::Handle> genparticles_; - + // PropagateToMuon muonpropagator_; - // vectors of enum values to loop over (and store quantities) + // vectors of enum values to loop over (and store quantities) const std::vector muonTypes_; const std::vector effTypes_; const std::vector resTypes_; @@ -124,7 +121,7 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { // config params std::string histFolder_; - std::vector cutsVPSet_; + std::vector cutsVPSet_; std::vector effVsPtBins_; std::vector effVsPhiBins_; @@ -135,10 +132,10 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { float maxGmtMuonDR_; // Helper methods - void matchMuonsToGen(std::vector genmus); + void matchMuonsToGen(std::vector genmus); std::vector getHistBinsEff(EffType eff); std::tuple getHistBinsRes(ResType res); - + // Keys for histogram maps /*typedef std::tuple histoKeyResType_; typedef std::tuple histoKeyEffType_; @@ -147,11 +144,11 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { // Histograms and histogram containers // std::map, MonitorElement*> efficiencyHistos_; // std::map, MonitorElement*> resolutionHistos_; - // TH1F* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; - // TH1F* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; - - MonitorElement* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; - MonitorElement* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + // TH1F* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + // TH1F* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + + MonitorElement* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; + MonitorElement* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; MonitorElement* resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]; MonitorElement* controlHistos_[kNMuTypes][kNVarTypes]; @@ -160,11 +157,11 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { std::vector gmtTkMuonPairs_; std::vector> cuts_; - float lsb_pt ; + float lsb_pt; float lsb_phi; float lsb_eta; - float lsb_z0 ; - float lsb_d0 ; + float lsb_z0; + float lsb_d0; }; // @@ -172,23 +169,23 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { // class GenMuonGMTPair { public: - GenMuonGMTPair(const reco::GenParticle* mu, const l1t::L1Candidate* gmtmu); + GenMuonGMTPair(const reco::GenParticle* mu, const l1t::L1Candidate* gmtmu); GenMuonGMTPair(const GenMuonGMTPair& muongmtPair); ~GenMuonGMTPair(){}; float dR(); - float pt() const { return mu_->pt(); }; - float eta() const { return mu_->eta(); }; - float phi() const { return mu_->phi(); }; + float pt() const { return mu_->pt(); }; + float eta() const { return mu_->eta(); }; + float phi() const { return mu_->phi(); }; int charge() const { return mu_->charge(); }; - // Now properties of the L1 candidate: - float gmtPt() const { return gmtmu_ ? gmtmu_->pt() : -1.; }; - float gmtEta() const { return gmtmu_ ? gmtEta_ : -5.; }; - float gmtPhi() const { return gmtmu_ ? gmtPhi_ : -5.; }; + // Now properties of the L1 candidate: + float gmtPt() const { return gmtmu_ ? gmtmu_->pt() : -1.; }; + float gmtEta() const { return gmtmu_ ? gmtEta_ : -5.; }; + float gmtPhi() const { return gmtmu_ ? gmtPhi_ : -5.; }; int gmtCharge() const { return gmtmu_ ? gmtmu_->charge() : -5; }; - int gmtQual() const { return gmtmu_ ? gmtmu_->hwQual() : -1; }; - + int gmtQual() const { return gmtmu_ ? gmtmu_->hwQual() : -1; }; + L1TPhase2MuonOffline::EtaRegion etaRegion() const; double getDeltaVar(const L1TPhase2MuonOffline::ResType) const; double getVar(const L1TPhase2MuonOffline::EffType) const; @@ -201,10 +198,9 @@ class GenMuonGMTPair { // Can be the coordinates from the 2nd muon station or from the vertex float gmtEta_; float gmtPhi_; - + float muEta_; float muPhi_; }; - #endif diff --git a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc index 7b96986f39166..6f39d2c1af8de 100644 --- a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc @@ -18,9 +18,7 @@ using namespace l1t; //__________RECO-GMT Muon Pair Helper Class____________________________ GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candidate* gmtmu) - : mu_(muon), gmtmu_(gmtmu) { - - + : mu_(muon), gmtmu_(gmtmu) { if (gmtmu) { gmtEta_ = gmtmu_->eta(); gmtPhi_ = gmtmu_->phi(); @@ -35,11 +33,10 @@ GenMuonGMTPair::GenMuonGMTPair(const reco::GenParticle* muon, const l1t::L1Candi muEta_ = 999.; muPhi_ = 999.; } - }; GenMuonGMTPair::GenMuonGMTPair(const GenMuonGMTPair& muonGmtPair) { - mu_ = muonGmtPair.mu_; + mu_ = muonGmtPair.mu_; gmtmu_ = muonGmtPair.gmtmu_; gmtEta_ = muonGmtPair.gmtEta_; @@ -93,44 +90,42 @@ double GenMuonGMTPair::getVar(const L1TPhase2MuonOffline::EffType type) const { } //__________DQM_base_class_______________________________________________ -L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : - gmtMuonToken_(consumes(ps.getParameter("gmtMuonToken"))), - gmtTkMuonToken_(consumes(ps.getParameter("gmtTkMuonToken"))), - genParticleToken_(consumes>(ps.getUntrackedParameter("genParticlesInputTag"))), - muonTypes_({kSAMuon, kTkMuon}), - effTypes_({kEffPt, kEffPhi, kEffEta}), - resTypes_({kResPt, kResQOverPt, kResPhi, kResEta}), - etaRegions_({kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf}), - qualLevels_({kQualOpen, kQualDouble, kQualSingle}), - resNames_({{kResPt, "pt"}, - {kRes1OverPt, "1overpt"}, - {kResQOverPt, "qoverpt"}, - {kResPhi, "phi"}, - {kResEta, "eta"}, - {kResCh, "charge"}}), - resLabels_({{kResPt, "(p_{T}^{L1} - p_{T}^{reco})/p_{T}^{reco}"}, - {kRes1OverPt, "(p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"}, - {kResQOverPt, "(q^{L1}*q^{reco}*p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"}, - {kResPhi, "#phi_{L1} - #phi_{reco}"}, - {kResEta, "#eta_{L1} - #eta_{reco}"}, - {kResCh, "charge^{L1} - charge^{reco}"}}), - etaNames_({{kEtaRegionAll, "etaMin0_etaMax2p4"}, - {kEtaRegionBmtf, "etaMin0_etaMax0p83"}, - {kEtaRegionOmtf, "etaMin0p83_etaMax1p24"}, - {kEtaRegionEmtf, "etaMin1p24_etaMax2p4"}}), - qualNames_({{kQualOpen, "qualOpen"}, - {kQualDouble, "qualDouble"}, - {kQualSingle, "qualSingle"}}), - muonNames_({{kSAMuon, "SAMuon"}, {kTkMuon, "TkMuon"}}), - histFolder_(ps.getUntrackedParameter("histFolder")), - cutsVPSet_(ps.getUntrackedParameter>("cuts")), - effVsPtBins_(ps.getUntrackedParameter>("efficiencyVsPtBins")), - effVsPhiBins_(ps.getUntrackedParameter>("efficiencyVsPhiBins")), - effVsEtaBins_(ps.getUntrackedParameter>("efficiencyVsEtaBins")), - maxGmtMuonDR_(0.3){ - +L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) + : gmtMuonToken_(consumes(ps.getParameter("gmtMuonToken"))), + gmtTkMuonToken_(consumes(ps.getParameter("gmtTkMuonToken"))), + genParticleToken_( + consumes>(ps.getUntrackedParameter("genParticlesInputTag"))), + muonTypes_({kSAMuon, kTkMuon}), + effTypes_({kEffPt, kEffPhi, kEffEta}), + resTypes_({kResPt, kResQOverPt, kResPhi, kResEta}), + etaRegions_({kEtaRegionAll, kEtaRegionBmtf, kEtaRegionOmtf, kEtaRegionEmtf}), + qualLevels_({kQualOpen, kQualDouble, kQualSingle}), + resNames_({{kResPt, "pt"}, + {kRes1OverPt, "1overpt"}, + {kResQOverPt, "qoverpt"}, + {kResPhi, "phi"}, + {kResEta, "eta"}, + {kResCh, "charge"}}), + resLabels_({{kResPt, "(p_{T}^{L1} - p_{T}^{reco})/p_{T}^{reco}"}, + {kRes1OverPt, "(p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"}, + {kResQOverPt, "(q^{L1}*q^{reco}*p_{T}^{reco} - p_{T}^{L1})/p_{T}^{L1}"}, + {kResPhi, "#phi_{L1} - #phi_{reco}"}, + {kResEta, "#eta_{L1} - #eta_{reco}"}, + {kResCh, "charge^{L1} - charge^{reco}"}}), + etaNames_({{kEtaRegionAll, "etaMin0_etaMax2p4"}, + {kEtaRegionBmtf, "etaMin0_etaMax0p83"}, + {kEtaRegionOmtf, "etaMin0p83_etaMax1p24"}, + {kEtaRegionEmtf, "etaMin1p24_etaMax2p4"}}), + qualNames_({{kQualOpen, "qualOpen"}, {kQualDouble, "qualDouble"}, {kQualSingle, "qualSingle"}}), + muonNames_({{kSAMuon, "SAMuon"}, {kTkMuon, "TkMuon"}}), + histFolder_(ps.getUntrackedParameter("histFolder")), + cutsVPSet_(ps.getUntrackedParameter>("cuts")), + effVsPtBins_(ps.getUntrackedParameter>("efficiencyVsPtBins")), + effVsPhiBins_(ps.getUntrackedParameter>("efficiencyVsPhiBins")), + effVsEtaBins_(ps.getUntrackedParameter>("efficiencyVsEtaBins")), + maxGmtMuonDR_(0.3) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::L1TPhase2MuonOffline()" << endl; - + // Get Muon constants lsb_pt = Phase2L1GMT::LSBpt; lsb_phi = Phase2L1GMT::LSBphi; @@ -150,7 +145,6 @@ L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) : } cuts_.emplace_back(std::make_pair(c.getUntrackedParameter("ptCut"), qLevel)); } - } //_____________________________________________________________________ @@ -160,9 +154,10 @@ void L1TPhase2MuonOffline::dqmBeginRun(const edm::Run& run, const edm::EventSetu edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::dqmBeginRun" << endl; } - //_____________________________________________________________________ -void L1TPhase2MuonOffline::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& run, const edm::EventSetup& iSetup) { +void L1TPhase2MuonOffline::bookHistograms(DQMStore::IBooker& ibooker, + const edm::Run& run, + const edm::EventSetup& iSetup) { edm::LogInfo("L1TPhase2MuonOFfline") << "L1TPhase2MuonOffline::bookHistograms" << endl; //book histos @@ -176,33 +171,30 @@ void L1TPhase2MuonOffline::bookHistograms(DQMStore::IBooker& ibooker, const edm: //_____________________________________________________________________ void L1TPhase2MuonOffline::analyze(const Event& iEvent, const EventSetup& eventSetup) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() " << endl; - - // COLLECT GEN MUONS + + // COLLECT GEN MUONS iEvent.getByToken(genParticleToken_, genparticles_); - + std::vector genmus; for (const reco::GenParticle& gen : *genparticles_) { - if (std::abs(gen.pdgId()) != 13) continue; + if (std::abs(gen.pdgId()) != 13) + continue; genmus.push_back(&gen); } - edm::LogInfo("L1TPhase2MuonOffline") << - "L1TPhase2MuonOffline::analyze() N of genmus: "<< genmus.size() << endl; + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() N of genmus: " << genmus.size() << endl; - // Collect both muon collection: + // Collect both muon collection: iEvent.getByToken(gmtMuonToken_, gmtSAMuon_); iEvent.getByToken(gmtTkMuonToken_, gmtTkMuon_); - - + // Fill Control histograms edm::LogInfo("L1TPhase2MuonOffline") << "Fill Control histograms for GMT Muons" << endl; - fillControlHistos(); - + fillControlHistos(); // Match each muon to a gen muon, if possible. - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() calling matchMuonsToGen() "<< endl; + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::analyze() calling matchMuonsToGen() " << endl; matchMuonsToGen(genmus); - - + // Fill efficiency and resolution once, matching has been done... fillEfficiencyHistos(); fillResolutionHistos(); @@ -212,151 +204,163 @@ void L1TPhase2MuonOffline::analyze(const Event& iEvent, const EventSetup& eventS //_____________________________________________________________________ void L1TPhase2MuonOffline::bookControlHistos(DQMStore::IBooker& ibooker, MuType mutype) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookControlHistos()" << endl; - - ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/control_variables"); - - controlHistos_[mutype][kPt] = ibooker.book1D(muonNames_[mutype]+"Pt" , "MuonPt; p_{T}" , 50, 0., 100.); - controlHistos_[mutype][kPhi] = ibooker.book1D(muonNames_[mutype]+"Phi" , "MuonPhi; #phi" , 66, -3.3, 3.3); - controlHistos_[mutype][kEta] = ibooker.book1D(muonNames_[mutype]+"Eta" , "MuonEta; #eta" , 50, -2.5, 2.5); - controlHistos_[mutype][kIso] = ibooker.book1D(muonNames_[mutype]+"Iso" , "MuonIso; RelIso" , 50, 0, 1.0); - controlHistos_[mutype][kQual] = ibooker.book1D(muonNames_[mutype]+"Qual", "MuonQual; Quality", 15, 0.5, 15.5); - controlHistos_[mutype][kZ0] = ibooker.book1D(muonNames_[mutype]+"Z0" , "MuonZ0; Z_{0}" , 50, 0, 50.0); - controlHistos_[mutype][kD0] = ibooker.book1D(muonNames_[mutype]+"D0" , "MuonD0; D_{0}" , 50, 0, 200.); + + ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/control_variables"); + + controlHistos_[mutype][kPt] = ibooker.book1D(muonNames_[mutype] + "Pt", "MuonPt; p_{T}", 50, 0., 100.); + controlHistos_[mutype][kPhi] = ibooker.book1D(muonNames_[mutype] + "Phi", "MuonPhi; #phi", 66, -3.3, 3.3); + controlHistos_[mutype][kEta] = ibooker.book1D(muonNames_[mutype] + "Eta", "MuonEta; #eta", 50, -2.5, 2.5); + controlHistos_[mutype][kIso] = ibooker.book1D(muonNames_[mutype] + "Iso", "MuonIso; RelIso", 50, 0, 1.0); + controlHistos_[mutype][kQual] = ibooker.book1D(muonNames_[mutype] + "Qual", "MuonQual; Quality", 15, 0.5, 15.5); + controlHistos_[mutype][kZ0] = ibooker.book1D(muonNames_[mutype] + "Z0", "MuonZ0; Z_{0}", 50, 0, 50.0); + controlHistos_[mutype][kD0] = ibooker.book1D(muonNames_[mutype] + "D0", "MuonD0; D_{0}", 50, 0, 200.); } void L1TPhase2MuonOffline::bookEfficiencyHistos(DQMStore::IBooker& ibooker, MuType mutype) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookEfficiencyHistos()" << endl; - - ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/nums_and_dens"); - + + ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/nums_and_dens"); + std::string histoname = ""; for (const auto eta : etaRegions_) { for (const auto q : qualLevels_) { histoname = "Eff_" + muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q]; - + auto histBins = getHistBinsEff(kEffPt); - efficiencyNum_[mutype][eta][q][kEffPt] = ibooker.book1D(histoname + "_Pt_Num", "MuonPt; p_{T} ;", histBins.size()-1, &histBins[0]); - efficiencyDen_[mutype][eta][q][kEffPt] = ibooker.book1D(histoname + "_Pt_Den", "MuonPt; p_{T} ;", histBins.size()-1, &histBins[0]); - + efficiencyNum_[mutype][eta][q][kEffPt] = + ibooker.book1D(histoname + "_Pt_Num", "MuonPt; p_{T} ;", histBins.size() - 1, &histBins[0]); + efficiencyDen_[mutype][eta][q][kEffPt] = + ibooker.book1D(histoname + "_Pt_Den", "MuonPt; p_{T} ;", histBins.size() - 1, &histBins[0]); + histBins = getHistBinsEff(kEffEta); - efficiencyNum_[mutype][eta][q][kEffEta] = ibooker.book1D(histoname + "_Eta_Num", "MuonEta; #eta ;", histBins.size()-1, &histBins[0]); - efficiencyDen_[mutype][eta][q][kEffEta] = ibooker.book1D(histoname + "_Eta_Den", "MuonEta; #eta ;", histBins.size()-1, &histBins[0]); - + efficiencyNum_[mutype][eta][q][kEffEta] = + ibooker.book1D(histoname + "_Eta_Num", "MuonEta; #eta ;", histBins.size() - 1, &histBins[0]); + efficiencyDen_[mutype][eta][q][kEffEta] = + ibooker.book1D(histoname + "_Eta_Den", "MuonEta; #eta ;", histBins.size() - 1, &histBins[0]); + histBins = getHistBinsEff(kEffPhi); - efficiencyNum_[mutype][eta][q][kEffPhi] = ibooker.book1D(histoname + "_Phi_Num", "MuonPhi; #phi ;", histBins.size()-1, &histBins[0]); - efficiencyDen_[mutype][eta][q][kEffPhi] = ibooker.book1D(histoname + "_Phi_Den", "MuonPhi; #phi ;", histBins.size()-1, &histBins[0]); - - } + efficiencyNum_[mutype][eta][q][kEffPhi] = + ibooker.book1D(histoname + "_Phi_Num", "MuonPhi; #phi ;", histBins.size() - 1, &histBins[0]); + efficiencyDen_[mutype][eta][q][kEffPhi] = + ibooker.book1D(histoname + "_Phi_Den", "MuonPhi; #phi ;", histBins.size() - 1, &histBins[0]); + } } } void L1TPhase2MuonOffline::bookResolutionHistos(DQMStore::IBooker& ibooker, MuType mutype) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::bookResolutionHistos()" << endl; - ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/resolution"); + ibooker.setCurrentFolder(histFolder_ + "/" + muonNames_[mutype] + "/resolution"); std::string histoname = ""; for (const auto eta : etaRegions_) { for (const auto q : qualLevels_) { - for (const auto var : resTypes_){ - histoname = "Res_" + muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q] + "_" + resNames_[var]; - auto nbins = std::get<0>(getHistBinsRes(var)); - auto xmin = std::get<1>(getHistBinsRes(var)); - auto xmax = std::get<2>(getHistBinsRes(var)); - resolutionHistos_[mutype][eta][q][var] = ibooker.book1D(histoname, resNames_[var] +";" + resLabels_[var], nbins, xmin, xmax); + for (const auto var : resTypes_) { + histoname = "Res_" + muonNames_[mutype] + "_" + etaNames_[eta] + "_" + qualNames_[q] + "_" + resNames_[var]; + auto nbins = std::get<0>(getHistBinsRes(var)); + auto xmin = std::get<1>(getHistBinsRes(var)); + auto xmax = std::get<2>(getHistBinsRes(var)); + resolutionHistos_[mutype][eta][q][var] = + ibooker.book1D(histoname, resNames_[var] + ";" + resLabels_[var], nbins, xmin, xmax); } } } } //____________________________________________________________________ -void L1TPhase2MuonOffline::fillControlHistos(){ - - for (auto& muIt : *gmtSAMuon_) { - controlHistos_[kSAMuon][kPt] ->Fill(lsb_pt * muIt.hwPt()); - controlHistos_[kSAMuon][kPhi] ->Fill(lsb_phi * muIt.hwPhi()); - controlHistos_[kSAMuon][kEta] ->Fill(lsb_eta * muIt.hwEta()); - controlHistos_[kSAMuon][kIso] ->Fill(muIt.hwIso()); +void L1TPhase2MuonOffline::fillControlHistos() { + for (auto& muIt : *gmtSAMuon_) { + controlHistos_[kSAMuon][kPt]->Fill(lsb_pt * muIt.hwPt()); + controlHistos_[kSAMuon][kPhi]->Fill(lsb_phi * muIt.hwPhi()); + controlHistos_[kSAMuon][kEta]->Fill(lsb_eta * muIt.hwEta()); + controlHistos_[kSAMuon][kIso]->Fill(muIt.hwIso()); controlHistos_[kSAMuon][kQual]->Fill(muIt.hwQual()); - controlHistos_[kSAMuon][kZ0] ->Fill(lsb_z0 * muIt.hwZ0()); - controlHistos_[kSAMuon][kD0] ->Fill(lsb_d0 * muIt.hwD0()); + controlHistos_[kSAMuon][kZ0]->Fill(lsb_z0 * muIt.hwZ0()); + controlHistos_[kSAMuon][kD0]->Fill(lsb_d0 * muIt.hwD0()); } - + for (auto& muIt : *gmtTkMuon_) { - controlHistos_[kTkMuon][kPt] ->Fill(lsb_pt * muIt.hwPt()); - controlHistos_[kTkMuon][kPhi] ->Fill(lsb_phi * muIt.hwPhi()); - controlHistos_[kTkMuon][kEta] ->Fill(lsb_eta * muIt.hwEta()); - controlHistos_[kTkMuon][kIso] ->Fill(muIt.hwIso()); + controlHistos_[kTkMuon][kPt]->Fill(lsb_pt * muIt.hwPt()); + controlHistos_[kTkMuon][kPhi]->Fill(lsb_phi * muIt.hwPhi()); + controlHistos_[kTkMuon][kEta]->Fill(lsb_eta * muIt.hwEta()); + controlHistos_[kTkMuon][kIso]->Fill(muIt.hwIso()); controlHistos_[kTkMuon][kQual]->Fill(muIt.hwQual()); - controlHistos_[kTkMuon][kZ0] ->Fill(lsb_z0 * muIt.hwZ0()); - controlHistos_[kTkMuon][kD0] ->Fill(lsb_d0 * muIt.hwD0()); - } + controlHistos_[kTkMuon][kZ0]->Fill(lsb_z0 * muIt.hwZ0()); + controlHistos_[kTkMuon][kD0]->Fill(lsb_d0 * muIt.hwD0()); + } } -void L1TPhase2MuonOffline::fillEfficiencyHistos(){ - - for (auto muIt : gmtSAMuonPairs_){ +void L1TPhase2MuonOffline::fillEfficiencyHistos() { + for (const auto& muIt : gmtSAMuonPairs_) { auto eta = muIt.etaRegion(); for (const auto var : effTypes_) { auto varToFill = muIt.getVar(var); - for (const auto& cut : cuts_){ - const auto gmtPtCut = cut.first; - const auto q = cut.second; - - efficiencyDen_[kSAMuon][eta][q][var]->Fill(varToFill) ; - if (muIt.gmtPt() < 0) continue; // gmt muon does not exits - - if (muIt.gmtQual() < q*4) continue; //quality requirements - if (var != kEffPt && muIt.gmtPt() < gmtPtCut) continue; // pt requirement - - efficiencyNum_[kSAMuon][eta][q][var]->Fill(varToFill); + for (const auto& cut : cuts_) { + const auto gmtPtCut = cut.first; + const auto q = cut.second; + + efficiencyDen_[kSAMuon][eta][q][var]->Fill(varToFill); + if (muIt.gmtPt() < 0) + continue; // gmt muon does not exits + + if (muIt.gmtQual() < q * 4) + continue; //quality requirements + if (var != kEffPt && muIt.gmtPt() < gmtPtCut) + continue; // pt requirement + + efficiencyNum_[kSAMuon][eta][q][var]->Fill(varToFill); } } } /// FOR TK MUONS - for (auto muIt : gmtTkMuonPairs_){ + for (const auto& muIt : gmtTkMuonPairs_) { auto eta = muIt.etaRegion(); for (const auto var : effTypes_) { auto varToFill = muIt.getVar(var); - for (const auto& cut : cuts_){ - const auto gmtPtCut = cut.first; - const auto q = cut.second; - - efficiencyDen_[kTkMuon][eta][q][var]->Fill(varToFill) ; - if (muIt.gmtPt() < 0) continue; // gmt muon does not exits - - if (muIt.gmtQual() < q*4) continue; //quality requirements - if (var != kEffPt && muIt.gmtPt() < gmtPtCut) continue; // pt requirement - - efficiencyNum_[kTkMuon][eta][q][var]->Fill(varToFill); + for (const auto& cut : cuts_) { + const auto gmtPtCut = cut.first; + const auto q = cut.second; + + efficiencyDen_[kTkMuon][eta][q][var]->Fill(varToFill); + if (muIt.gmtPt() < 0) + continue; // gmt muon does not exits + + if (muIt.gmtQual() < q * 4) + continue; //quality requirements + if (var != kEffPt && muIt.gmtPt() < gmtPtCut) + continue; // pt requirement + + efficiencyNum_[kTkMuon][eta][q][var]->Fill(varToFill); } } } - } -void L1TPhase2MuonOffline::fillResolutionHistos(){ - - for (auto muIt : gmtSAMuonPairs_){ - if (muIt.gmtPt() < 0) continue; - +void L1TPhase2MuonOffline::fillResolutionHistos() { + for (const auto& muIt : gmtSAMuonPairs_) { + if (muIt.gmtPt() < 0) + continue; + auto eta = muIt.etaRegion(); for (const auto q : qualLevels_) { - if (muIt.gmtQual() < q*4) continue; + if (muIt.gmtQual() < q * 4) + continue; for (const auto var : resTypes_) { - auto varToFill = muIt.getDeltaVar(var); - - resolutionHistos_[kSAMuon][eta][q][var]->Fill(varToFill) ; + auto varToFill = muIt.getDeltaVar(var); + + resolutionHistos_[kSAMuon][eta][q][var]->Fill(varToFill); } } } - - for (auto muIt : gmtTkMuonPairs_){ - if (muIt.gmtPt() < 0) continue; + + for (const auto& muIt : gmtTkMuonPairs_) { + if (muIt.gmtPt() < 0) + continue; auto eta = muIt.etaRegion(); for (const auto q : qualLevels_) { - if (muIt.gmtQual() < q*4) continue; + if (muIt.gmtQual() < q * 4) + continue; for (const auto var : resTypes_) { - auto varToFill = muIt.getDeltaVar(var); - - resolutionHistos_[kTkMuon][eta][q][var]->Fill(varToFill) ; + auto varToFill = muIt.getDeltaVar(var); + + resolutionHistos_[kTkMuon][eta][q][var]->Fill(varToFill); } } } @@ -367,19 +371,18 @@ void L1TPhase2MuonOffline::matchMuonsToGen(std::vector gmtTkMuonPairs_.clear(); edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() " << endl; - - - for (const reco::GenParticle * gen : genmus){ - edm::LogInfo("L1TPhase2MuonOffline") << "Looping on genmus: "<< gen << endl; + + for (const reco::GenParticle* gen : genmus) { + edm::LogInfo("L1TPhase2MuonOffline") << "Looping on genmus: " << gen << endl; GenMuonGMTPair pairBestCand(&(*gen), nullptr); - for (auto& muIt : *gmtSAMuon_) { + for (auto& muIt : *gmtSAMuon_) { GenMuonGMTPair pairTmpCand(&(*gen), &(muIt)); if ((pairTmpCand.dR() < maxGmtMuonDR_) && (pairTmpCand.dR() < pairBestCand.dR())) { pairBestCand = pairTmpCand; } } gmtSAMuonPairs_.emplace_back(pairBestCand); - + GenMuonGMTPair pairBestCand2(&(*gen), nullptr); for (auto& tkmuIt : *gmtTkMuon_) { GenMuonGMTPair pairTmpCand(&(*gen), &(tkmuIt)); @@ -387,15 +390,15 @@ void L1TPhase2MuonOffline::matchMuonsToGen(std::vector pairBestCand2 = pairTmpCand; } } - gmtTkMuonPairs_.emplace_back(pairBestCand2); - - } - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtSAMuons: " << gmtSAMuonPairs_.size()<< endl; - edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtTkMuons: " << gmtTkMuonPairs_.size()<< endl; + gmtTkMuonPairs_.emplace_back(pairBestCand2); + } + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtSAMuons: " + << gmtSAMuonPairs_.size() << endl; + edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() gmtTkMuons: " + << gmtTkMuonPairs_.size() << endl; edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::matchMuonsToGen() END " << endl; } - std::vector L1TPhase2MuonOffline::getHistBinsEff(EffType eff) { if (eff == kEffPt) { std::vector effVsPtBins(effVsPtBins_.begin(), effVsPtBins_.end()); diff --git a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc index c8bef14845596..b910c0b0dc739 100644 --- a/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc +++ b/L1Trigger/L1TTrackMatch/test/L1TrackObjectNtupleMaker.cc @@ -2377,8 +2377,7 @@ void L1TrackObjectNtupleMaker::analyze(const edm::Event& iEvent, const edm::Even edm::LogWarning("DataNotFound") << "\nWarning: L1PrimaryVertexHandle not found" << std::endl; if (L1PrimaryVertexEmuHandle.isValid()) { - for (vtxEmuIter = L1PrimaryVertexEmuHandle->begin(); vtxEmuIter != L1PrimaryVertexEmuHandle->end(); - ++vtxEmuIter) { + for (vtxEmuIter = L1PrimaryVertexEmuHandle->begin(); vtxEmuIter != L1PrimaryVertexEmuHandle->end(); ++vtxEmuIter) { m_pv_L1reco_emu->push_back(vtxEmuIter->z0()); } } else diff --git a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc index 259d0405ab289..e76c245d9c74f 100644 --- a/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc +++ b/L1Trigger/Phase2L1Taus/plugins/HPSPFTauProducer.cc @@ -154,7 +154,7 @@ void HPSPFTauProducer::produce(edm::Event& evt, const edm::EventSetup& es) { std::fabs(l1PFTau.leadChargedPFCand()->eta()) < maxLeadChargedPFCandEta_ && (srcL1Vertices_.label().empty() || (primaryVertex.isNonnull() && l1PFTau.leadChargedPFCand()->pfTrack().isNonnull() && - std::fabs(l1PFTau.leadChargedPFCand()->pfTrack()->vertex().z() - primaryVertex->z0()) < + std::fabs(l1PFTau.leadChargedPFCand()->pfTrack()->vertex().z() - primaryVertex->z0()) < maxLeadChargedPFCandDz_)) && l1PFTau.sumChargedIso() < maxChargedIso_ && l1PFTau.sumChargedIso() < maxChargedRelIso_ * l1PFTau.pt())) continue; From a5ce90d1c6416ac51e1d2e2109277fb777bad9b4 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Tue, 21 Jun 2022 09:39:53 +0200 Subject: [PATCH 32/66] fix DQM collections and other fixes --- DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py | 4 ++-- L1Trigger/Configuration/python/SimL1Emulator_cff.py | 4 ++-- L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py | 2 +- L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py | 4 ---- L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py | 3 +++ 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py index 3f0d360fc7ff4..dfd9ba626ffaf 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2Offline_cfi.py @@ -93,9 +93,9 @@ genParticlesInputTag = cms.untracked.InputTag("genParticles"), isParticleGun = cms.bool(False), objects = cms.PSet( - L1PF = cms.VInputTag("l1pfCandidates:PF",), + L1PF = cms.VInputTag("l1ctLayer1:PF",), L1PF_sel = cms.string("pt > 0"), - L1Puppi = cms.VInputTag("l1pfCandidates:Puppi",), + L1Puppi = cms.VInputTag("l1ctLayer1:Puppi",), L1Puppi_sel = cms.string("pt > 0"), ), diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index a0d32b5ce827b..77b0179775f7d 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -152,8 +152,8 @@ # make the input tags consistent with the choice L1VertexFinder above L1TrackJets.L1PVertexCollection = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) L1TrackJetsExtended.L1PVertexCollection = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) -L1TrackerEtMiss.L1VertexInputTag = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) -L1TrackerEtMissExtended.L1VertexInputTag = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) +#L1TrackerEtMiss.L1VertexInputTag = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) +#L1TrackerEtMissExtended.L1VertexInputTag = ("L1VertexFinder", L1VertexFinder.l1VertexCollectionName.value()) _phase2_siml1emulator.add(L1TrackJets) _phase2_siml1emulator.add(L1TrackJetsExtended) _phase2_siml1emulator.add(L1TrackFastJets) diff --git a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py index 6fe8100f603a2..c9c91248f9343 100644 --- a/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py +++ b/L1Trigger/L1CaloTrigger/python/Phase1L1TJetProducer_cfi.py @@ -18,7 +18,7 @@ 4.0, 4.083, 4.167, 4.25, 4.333, 4.417, 4.5, 4.583, 4.667, 4.75, 4.833, 4.917, 5.0) Phase1L1TJetProducer = cms.EDProducer('Phase1L1TJetProducer', - inputCollectionTag = cms.InputTag("l1pfCandidates", "Puppi"), + inputCollectionTag = cms.InputTag("l1ctLayer1", "Puppi"), etaBinning = caloEtaSegmentation, nBinsPhi = cms.uint32(72), phiLow = cms.double(-pi), diff --git a/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py b/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py index a1208663ba593..5a8e969bc8512 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/L1NNTauProducer_cff.py @@ -15,8 +15,6 @@ tausize = cms.double(0.1), maxtaus = cms.int32(5), nparticles = cms.int32(10), - HW = cms.bool(True), - debug = cms.bool(False), L1PFObjects = cms.InputTag("l1ctLayer1:Puppi"), #1pfCandidates:Puppi"),#l1pfCandidates NNFileName = cms.string("L1Trigger/Phase2L1ParticleFlow/data/tau_3layer_puppi.pb") ) @@ -27,8 +25,6 @@ tausize = cms.double(0.1), maxtaus = cms.int32(5), nparticles = cms.int32(10), - HW = cms.bool(True), - debug = cms.bool(False), L1PFObjects = cms.InputTag("l1ctLayer1:PF"),#l1pfCandidates NNFileName = cms.string("L1Trigger/Phase2L1ParticleFlow/data/tau_3layer.pb") ) diff --git a/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py b/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py index f16c314809d3c..19287245d4686 100644 --- a/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py +++ b/L1Trigger/Phase2L1ParticleFlow/python/l1pfJetMet_cff.py @@ -19,6 +19,9 @@ scPFL1PuppiCorrectedEmulator = _correctedJets.clone(jets = 'scPFL1PuppiEmulator', correctorDir = 'L1PuppiSC4EmuDeregJets') +from L1Trigger.Phase2L1ParticleFlow.L1MhtPfProducer_cfi import L1MhtPfProducer +scPFL1PuppiCorrectedEmulatorMHT = L1MhtPfProducer.clone() + l1PFJetsTask = cms.Task( l1ctLayer2Deregionizer, scPFL1PF, scPFL1Puppi, scPFL1PuppiEmulator, scPFL1PuppiCorrectedEmulator, scPFL1PuppiCorrectedEmulatorMHT ) From 205b3207ca445fbded068b3929f25e293fe89d6b Mon Sep 17 00:00:00 2001 From: Thiago Date: Sun, 26 Jun 2022 19:35:18 +0200 Subject: [PATCH 33/66] L1TkMuons from emulator 1/N --- .../python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py | 4 ++-- .../HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py | 4 ++-- .../python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py | 4 ++-- .../python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py | 4 ++-- .../HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py index b0d30c5711e10..4cbf7f2d6e5da 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from ..modules.hltL1TkMuons_cfi import * +#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1TkSingleMuFiltered22_cfi import * from ..modules.hltL3crIsoL1TkSingleMu22L3f24QL3pfecalIsoFiltered0p41_cfi import * from ..modules.hltL3crIsoL1TkSingleMu22L3f24QL3pfhcalIsoFiltered0p40_cfi import * @@ -135,7 +135,7 @@ hltL3crIsoL1TkSingleMu22L3f24QL3trkIsoRegionalNewFiltered0p07EcalHcalHgcalTrk + HLTEndSequence, cms.Task( - hltL1TkMuons, + #hltL1TkMuons, HGCalRecHit, HGCalUncalibRecHit, MeasurementTrackerEvent, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py index 28c41b6fd1b0e..a55ae797e21f9 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from ..modules.hltL1TkMuons_cfi import * +#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltDiMuon178RelTrkIsoFiltered0p4_cfi import * from ..modules.hltDiMuon178RelTrkIsoFiltered0p4DzFiltered0p2_cfi import * from ..modules.hltDoubleMuon7DZ1p0_cfi import * @@ -108,7 +108,7 @@ hltDiMuon178RelTrkIsoFiltered0p4DzFiltered0p2 + HLTEndSequence, cms.Task( - hltL1TkMuons, + #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py index 8e36eb1237235..359d30459b51f 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from ..modules.hltL1TkMuons_cfi import * +#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltDoubleMuon7DZ1p0_cfi import * from ..modules.hltL1TkDoubleMuFiltered7_cfi import * from ..modules.hltL1TkSingleMuFiltered15_cfi import * @@ -78,7 +78,7 @@ hltL3fL1DoubleMu155fFiltered37 + HLTEndSequence, cms.Task( - hltL1TkMuons, + #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py index aff2f12cb0dca..fa4a43a5f2afa 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from ..modules.hltL1TkMuons_cfi import * +#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1TkSingleMuFiltered22_cfi import * from ..modules.hltL3fL1TkSingleMu22L3Filtered50Q_cfi import * from ..modules.hltCsc2DRecHits_cfi import * @@ -72,7 +72,7 @@ hltL3fL1TkSingleMu22L3Filtered50Q + HLTEndSequence, cms.Task( - hltL1TkMuons, + #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py index 5dae3d4b3095f..ae0ace601331b 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -from ..modules.hltL1TkMuons_cfi import * +#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1SingleMuFiltered5_cfi import * from ..modules.hltL1TripleMuFiltered3_cfi import * from ..modules.hltL3fL1TkTripleMu533L31055DZFiltered0p2_cfi import * @@ -82,7 +82,7 @@ hltL3fL1TkTripleMu533L31055DZFiltered0p2 + HLTEndSequence, cms.Task( - hltL1TkMuons, + #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, From 292e0b5d2647e0687ea20af0a65d94b80d6b8daf Mon Sep 17 00:00:00 2001 From: Thiago Date: Sun, 26 Jun 2022 19:40:50 +0200 Subject: [PATCH 34/66] L1TkMuons from emulator 2/N --- .../python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py | 4 ++-- .../python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TkMuons_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py | 2 +- .../HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py | 2 +- .../hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py | 2 +- .../python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py | 4 ++-- .../python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py | 4 ++-- .../python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py | 2 +- .../python/HLT_75e33/modules/l1pfProducerHF_cfi.py | 2 +- .../python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py | 2 +- .../python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py index cb58a19785c2c..60cb4957f62f5 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py @@ -8,8 +8,8 @@ checkSC = cms.bool(False), inputTag1 = cms.InputTag("hltL1TkDoubleMuFiltered7"), inputTag2 = cms.InputTag("hltL1TkDoubleMuFiltered7"), - originTag1 = cms.VInputTag("hltL1TkMuons"), - originTag2 = cms.VInputTag("hltL1TkMuons"), + originTag1 = cms.VInputTag("L1TkMuons"), + originTag2 = cms.VInputTag("L1TkMuons"), saveTags = cms.bool(True), triggerType1 = cms.int32(-114), triggerType2 = cms.int32(-114) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py index 6cbbebd2ff0ed..78c5fe5e29e74 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("hltL1TkMuons"), + inputTag = cms.InputTag("L1TkMuons"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py index b4942d562a6aa..5660d6f6711a6 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("hltL1TkMuons"), + inputTag = cms.InputTag("L1TkMuons"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py index 75cb3c7f9f249..d7cb74cd1f28f 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py @@ -1,6 +1,6 @@ import FWCore.ParameterSet.Config as cms -hltL1TkMuons = cms.EDProducer("L1TkMuonProducer", +L1TkMuons = cms.EDProducer("L1TkMuonProducer", CHI2MAX = cms.double(100.0), DRmax = cms.double(0.5), ETABARRELOVERLAP = cms.double(0.83), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py index 206d9a9591f28..f480943a55742 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("hltL1TkMuons"), + inputTag = cms.InputTag("L1TkMuons"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py index aa122e1ad4d04..204aa745f1847 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("hltL1TkMuons"), + inputTag = cms.InputTag("L1TkMuons"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py index 9ef3d424b9e08..0e6d917ef3f3f 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("hltL1TkMuons"), + inputTag = cms.InputTag("L1TkMuons"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py index 1f8988e4badd2..3ed1a35162fb8 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py @@ -2,7 +2,7 @@ hltL2MuonSeedsFromL1TkMuon = cms.EDProducer("L2MuonSeedGeneratorFromL1TkMu", EtaMatchingBins = cms.vdouble(0.0, 2.5), - InputObjects = cms.InputTag("hltL1TkMuons"), + InputObjects = cms.InputTag("L1TkMuons"), L1MaxEta = cms.double(2.5), L1MinPt = cms.double(0.0), MatchDR = cms.vdouble(0.3), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py index d4b125537a2d0..9d6935b10648e 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py @@ -5,7 +5,7 @@ beamSpot = cms.InputTag("offlineBeamSpot"), deltaEta = cms.double(0.035), deltaPhi = cms.double(0.02), - input = cms.InputTag("hltL1TkMuons"), + input = cms.InputTag("L1TkMuons"), maxNRegions = cms.int32(10000), maxNVertices = cms.int32(1), measurementTrackerName = cms.InputTag(""), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py index 1a85cf6397526..a1ad21234fd07 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py @@ -5,7 +5,7 @@ MinN = cms.int32(3), inputTag1 = cms.InputTag("hltL1TripleMuFiltered3"), inputTag2 = cms.InputTag("hltL1TripleMuFiltered3"), - originTag1 = cms.VInputTag("hltL1TkMuons"), - originTag2 = cms.VInputTag("hltL1TkMuons"), + originTag1 = cms.VInputTag("L1TkMuons"), + originTag2 = cms.VInputTag("L1TkMuons"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py index 97e673d96a074..a4e2fddb9db4e 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py @@ -8,8 +8,8 @@ checkSC = cms.bool(False), inputTag1 = cms.InputTag("hltL1TripleMuFiltered3"), inputTag2 = cms.InputTag("hltL1TripleMuFiltered3"), - originTag1 = cms.VInputTag("hltL1TkMuons"), - originTag2 = cms.VInputTag("hltL1TkMuons"), + originTag1 = cms.VInputTag("L1TkMuons"), + originTag2 = cms.VInputTag("L1TkMuons"), saveTags = cms.bool(True), triggerType1 = cms.int32(-114), triggerType2 = cms.int32(-114) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py index f4c8b992abb34..88ca8763f9c5e 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py @@ -63,7 +63,7 @@ phiExtra = cms.double(0.0), phiSlices = cms.uint32(1) )), - tkMuons = cms.InputTag("hltL1TkMuons"), + tkMuons = cms.InputTag("L1TkMuons"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag("pfTracksFromL1TracksBarrel"), trkMaxChi2 = cms.double(15), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py index 445739acdd20f..af1bd6ba97838 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py @@ -71,7 +71,7 @@ phiSlices = cms.uint32(1) ) ), - tkMuons = cms.InputTag("hltL1TkMuons"), + tkMuons = cms.InputTag("L1TkMuons"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag(""), trkMaxChi2 = cms.double(15), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py index 12dcc9d8c997d..d917c7c2d0437 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py @@ -71,7 +71,7 @@ phiSlices = cms.uint32(1) ) ), - tkMuons = cms.InputTag("hltL1TkMuons"), + tkMuons = cms.InputTag("L1TkMuons"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag("pfTracksFromL1TracksHGCal"), trkMaxChi2 = cms.double(15), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py index d42b73f6718ba..8f43a22aa84a1 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py @@ -71,7 +71,7 @@ phiSlices = cms.uint32(1) ) ), - tkMuons = cms.InputTag("hltL1TkMuons"), + tkMuons = cms.InputTag("L1TkMuons"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag("pfTracksFromL1TracksHGCal"), trkMaxChi2 = cms.double(15), From 1ebec17d5b11ae461d9a256badf2eaab17e8e1bd Mon Sep 17 00:00:00 2001 From: Thiago Date: Sun, 26 Jun 2022 20:01:00 +0200 Subject: [PATCH 35/66] TkElectrons from emulator 3/N --- .../modules/L1TkEleDouble12Filter_cfi.py | 4 +-- .../modules/L1TkEleSingle25Filter_cfi.py | 4 +-- .../modules/L1TkEleSingle36Filter_cfi.py | 4 +-- .../modules/L1TkIsoEleSingle22Filter_cfi.py | 4 +-- .../modules/L1TkIsoEleSingle28Filter_cfi.py | 4 +-- .../tasks/l1tReconstructionTask_cfi.py | 25 ++++++++++++++----- 6 files changed, 29 insertions(+), 16 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleDouble12Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleDouble12Filter_cfi.py index 457dbf6cfd4d4..f6e8446d24393 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleDouble12Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleDouble12Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(0.453144, 1.26205, 0.0) ), TrkIsolation = cms.vdouble(99999.0, 99999.0), - inputTag1 = cms.InputTag("hltL1TkElectronsEllipticMatchCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkElectronsEllipticMatchHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEleEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEleEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle25Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle25Filter_cfi.py index 1513e5503e23c..54bfce10a4ad0 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle25Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle25Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(0.453144, 1.26205, 0.0) ), TrkIsolation = cms.vdouble(99999.0, 99999.0), - inputTag1 = cms.InputTag("hltL1TkElectronsEllipticMatchCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkElectronsEllipticMatchHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEleEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEleEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle36Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle36Filter_cfi.py index de5b51af3b872..ff8a821138455 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle36Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEleSingle36Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(0.453144, 1.26205, 0.0) ), TrkIsolation = cms.vdouble(99999.0, 99999.0), - inputTag1 = cms.InputTag("hltL1TkElectronsEllipticMatchCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkElectronsEllipticMatchHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEleEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEleEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle22Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle22Filter_cfi.py index 84ddedbec311b..32a9a3165b72e 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle22Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle22Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(0.266186, 1.25976, 0.0) ), TrkIsolation = cms.vdouble(0.12, 0.2), - inputTag1 = cms.InputTag("hltL1TkElectronsEllipticMatchCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkElectronsEllipticMatchHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEleEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEleEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle28Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle28Filter_cfi.py index 6f3032b542029..decc0dce01619 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle28Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEleSingle28Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(0.266186, 1.25976, 0.0) ), TrkIsolation = cms.vdouble(0.12, 0.2), - inputTag1 = cms.InputTag("hltL1TkElectronsEllipticMatchCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkElectronsEllipticMatchHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEleEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEleEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py index 76cd1dc2f5171..52dec08944127 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py @@ -3,6 +3,7 @@ from ..modules.L1EGammaClusterEmuProducer_cfi import * from ..modules.l1EGammaEEProducer_cfi import * from ..modules.l1NNTauProducerPuppi_cfi import * +<<<<<<< HEAD #from ..modules.l1pfCandidates_cfi import * #from ..modules.l1PFMetPuppi_cfi import * #from ..modules.l1pfProducerBarrel_cfi import * @@ -13,6 +14,18 @@ from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * #from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1TkPhotonsCrystal_cfi import * +======= +from ..modules.l1pfCandidates_cfi import * +from ..modules.l1PFMetPuppi_cfi import * +from ..modules.l1pfProducerBarrel_cfi import * +from ..modules.l1pfProducerHF_cfi import * +from ..modules.l1pfProducerHGCal_cfi import * +from ..modules.l1pfProducerHGCalNoTK_cfi import * +#from ..modules.hltL1TkElectronsEllipticMatchCrystal_cfi import * +#from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * +# from ..modules.hltL1TkMuons_cfi import * +# from ..modules.hltL1TkPhotonsCrystal_cfi import * +>>>>>>> 709fd70167c (TkElectrons from emulator 3/N) from ..modules.hltL1TkPhotonsHGC_cfi import * #from ..modules.L1TkPrimaryVertex_cfi import * #from ..modules.l1tSlwPFPuppiJets_cfi import * @@ -38,12 +51,12 @@ l1tReconstructionTask = cms.Task( L1EGammaClusterEmuProducer, - hltL1TkElectronsEllipticMatchCrystal, - hltL1TkElectronsEllipticMatchHGC, - #hltL1TkMuons, - hltL1TkPhotonsCrystal, - hltL1TkPhotonsHGC, - #L1TkPrimaryVertex, +# hltL1TkElectronsEllipticMatchCrystal, +# hltL1TkElectronsEllipticMatchHGC, +# hltL1TkMuons, +# hltL1TkPhotonsCrystal, +# hltL1TkPhotonsHGC, + L1TkPrimaryVertex, l1EGammaEEProducer, l1NNTauProducerPuppi, #l1PFMetPuppi, From f31bba4e586540e828c4b2e6c35c43d61161f970 Mon Sep 17 00:00:00 2001 From: Thiago Date: Sun, 26 Jun 2022 21:19:20 +0200 Subject: [PATCH 36/66] TkEm from emulator 4/N --- .../modules/L1TkEmDouble12Filter_cfi.py | 4 +-- .../modules/L1TkEmDouble24Filter_cfi.py | 4 +-- .../modules/L1TkEmSingle37Filter_cfi.py | 4 +-- .../modules/L1TkEmSingle51Filter_cfi.py | 4 +-- .../modules/L1TkIsoEmDouble12Filter_cfi.py | 4 +-- .../modules/L1TkIsoEmSingle22Filter_cfi.py | 4 +-- .../modules/L1TkIsoEmSingle36Filter_cfi.py | 4 +-- .../HLT_75e33/modules/ticlSeedingL1_cfi.py | 2 +- .../tasks/l1tReconstructionTask_cfi.py | 33 ++++++------------- 9 files changed, 25 insertions(+), 38 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble12Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble12Filter_cfi.py index 7c6c8c31a6b45..80f5e3692ae28 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble12Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble12Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(3.17445, 1.13219, 0.0) ), TrkIsolation = cms.vdouble(99999.0, 99999.0), - inputTag1 = cms.InputTag("hltL1TkPhotonsCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkPhotonsHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEmEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble24Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble24Filter_cfi.py index 6cc970bbe78e4..5125aed26da02 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble24Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmDouble24Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(3.17445, 1.13219, 0.0) ), TrkIsolation = cms.vdouble(99999.0, 99999.0), - inputTag1 = cms.InputTag("hltL1TkPhotonsCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkPhotonsHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEmEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle37Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle37Filter_cfi.py index 8bb7ee343e78b..970431ea7bcc7 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle37Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle37Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(3.17445, 1.13219, 0.0) ), TrkIsolation = cms.vdouble(99999.0, 99999.0), - inputTag1 = cms.InputTag("hltL1TkPhotonsCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkPhotonsHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEmEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle51Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle51Filter_cfi.py index dfbb9716b98ef..ea2245bd859cc 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle51Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkEmSingle51Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(3.17445, 1.13219, 0.0) ), TrkIsolation = cms.vdouble(99999.0, 99999.0), - inputTag1 = cms.InputTag("hltL1TkPhotonsCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkPhotonsHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEmEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmDouble12Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmDouble12Filter_cfi.py index a4102420e1354..8fc8ea5c3e488 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmDouble12Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmDouble12Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(2.11186, 1.15524, 0.0) ), TrkIsolation = cms.vdouble(0.35, 0.28), - inputTag1 = cms.InputTag("hltL1TkPhotonsCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkPhotonsHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEmEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle22Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle22Filter_cfi.py index 5e6582c579586..e68b839b68e15 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle22Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle22Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(2.11186, 1.15524, 0.0) ), TrkIsolation = cms.vdouble(0.35, 0.28), - inputTag1 = cms.InputTag("hltL1TkPhotonsCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkPhotonsHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEmEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle36Filter_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle36Filter_cfi.py index 9941bc881df2c..69df435e49c1d 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle36Filter_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/L1TkIsoEmSingle36Filter_cfi.py @@ -17,7 +17,7 @@ endcap = cms.vdouble(2.11186, 1.15524, 0.0) ), TrkIsolation = cms.vdouble(0.35, 0.28), - inputTag1 = cms.InputTag("hltL1TkPhotonsCrystal","EG"), - inputTag2 = cms.InputTag("hltL1TkPhotonsHGC","EG"), + inputTag1 = cms.InputTag("l1ctLayer1EG","L1TkEmEB"), + inputTag2 = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/ticlSeedingL1_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/ticlSeedingL1_cfi.py index 22f04311f5609..a4d98ad5715ca 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/ticlSeedingL1_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/ticlSeedingL1_cfi.py @@ -4,7 +4,7 @@ seedingPSet = cms.PSet( algo_verbosity = cms.int32(0), endcapScalings = cms.vdouble(3.17445, 1.13219, 0.0), - l1TkEmColl = cms.InputTag("hltL1TkPhotonsHGC","EG"), + l1TkEmColl = cms.InputTag("l1ctLayer1EG","L1TkEmEE"), maxAbsEta = cms.double(4.0), minAbsEta = cms.double(1.3), minPt = cms.double(5.0), diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py index 52dec08944127..e6d66a1a49de7 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py @@ -3,18 +3,6 @@ from ..modules.L1EGammaClusterEmuProducer_cfi import * from ..modules.l1EGammaEEProducer_cfi import * from ..modules.l1NNTauProducerPuppi_cfi import * -<<<<<<< HEAD -#from ..modules.l1pfCandidates_cfi import * -#from ..modules.l1PFMetPuppi_cfi import * -#from ..modules.l1pfProducerBarrel_cfi import * -#from ..modules.l1pfProducerHF_cfi import * -#from ..modules.l1pfProducerHGCal_cfi import * -#from ..modules.l1pfProducerHGCalNoTK_cfi import * -from ..modules.hltL1TkElectronsEllipticMatchCrystal_cfi import * -from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * -#from ..modules.hltL1TkMuons_cfi import * -from ..modules.hltL1TkPhotonsCrystal_cfi import * -======= from ..modules.l1pfCandidates_cfi import * from ..modules.l1PFMetPuppi_cfi import * from ..modules.l1pfProducerBarrel_cfi import * @@ -25,17 +13,16 @@ #from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * # from ..modules.hltL1TkMuons_cfi import * # from ..modules.hltL1TkPhotonsCrystal_cfi import * ->>>>>>> 709fd70167c (TkElectrons from emulator 3/N) -from ..modules.hltL1TkPhotonsHGC_cfi import * -#from ..modules.L1TkPrimaryVertex_cfi import * -#from ..modules.l1tSlwPFPuppiJets_cfi import * -#from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * -#from ..modules.pfClustersFromCombinedCaloHCal_cfi import * -#from ..modules.pfClustersFromCombinedCaloHF_cfi import * -#from ..modules.pfClustersFromHGC3DClusters_cfi import * -#from ..modules.pfClustersFromL1EGClusters_cfi import * -#from ..modules.pfTracksFromL1TracksBarrel_cfi import * -#from ..modules.pfTracksFromL1TracksHGCal_cfi import * +# from ..modules.hltL1TkPhotonsHGC_cfi import * +from ..modules.L1TkPrimaryVertex_cfi import * +from ..modules.l1tSlwPFPuppiJets_cfi import * +from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * +from ..modules.pfClustersFromCombinedCaloHCal_cfi import * +from ..modules.pfClustersFromCombinedCaloHF_cfi import * +from ..modules.pfClustersFromHGC3DClusters_cfi import * +from ..modules.pfClustersFromL1EGClusters_cfi import * +from ..modules.pfTracksFromL1TracksBarrel_cfi import * +from ..modules.pfTracksFromL1TracksHGCal_cfi import * from ..modules.simCaloStage2Layer1Digis_cfi import * from ..modules.simCscTriggerPrimitiveDigis_cfi import * from ..modules.simDtTriggerPrimitiveDigis_cfi import * From 55cf8c439572e929a094f4f23b314567835cae1d Mon Sep 17 00:00:00 2001 From: Thiago Date: Sun, 26 Jun 2022 21:29:23 +0200 Subject: [PATCH 37/66] Removing TkPrimaryVertex from HLT 5/N --- .../HLT_75e33/tasks/l1tReconstructionTask_cfi.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py index e6d66a1a49de7..d77d10b92377a 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py @@ -11,10 +11,10 @@ from ..modules.l1pfProducerHGCalNoTK_cfi import * #from ..modules.hltL1TkElectronsEllipticMatchCrystal_cfi import * #from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * -# from ..modules.hltL1TkMuons_cfi import * -# from ..modules.hltL1TkPhotonsCrystal_cfi import * -# from ..modules.hltL1TkPhotonsHGC_cfi import * -from ..modules.L1TkPrimaryVertex_cfi import * +#from ..modules.hltL1TkMuons_cfi import * +#from ..modules.hltL1TkPhotonsCrystal_cfi import * +#from ..modules.hltL1TkPhotonsHGC_cfi import * +#from ..modules.L1TkPrimaryVertex_cfi import * from ..modules.l1tSlwPFPuppiJets_cfi import * from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * from ..modules.pfClustersFromCombinedCaloHCal_cfi import * @@ -43,7 +43,7 @@ # hltL1TkMuons, # hltL1TkPhotonsCrystal, # hltL1TkPhotonsHGC, - L1TkPrimaryVertex, +# L1TkPrimaryVertex, l1EGammaEEProducer, l1NNTauProducerPuppi, #l1PFMetPuppi, From bf5c25e68ce3b1f569302fc12395ac944bd963c8 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Tue, 19 Jul 2022 10:23:47 +0200 Subject: [PATCH 38/66] Thiago's fix to L1TkPrimaryVertex and comment L1TkElectrons --- .../tasks/l1tReconstructionTask_cfi.py | 29 ++++++++++--------- .../Configuration/python/HLT_75e33_cff.py | 27 ++++++++--------- 2 files changed, 29 insertions(+), 27 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py index d77d10b92377a..1cdd84ea2fed8 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py @@ -3,26 +3,27 @@ from ..modules.L1EGammaClusterEmuProducer_cfi import * from ..modules.l1EGammaEEProducer_cfi import * from ..modules.l1NNTauProducerPuppi_cfi import * -from ..modules.l1pfCandidates_cfi import * -from ..modules.l1PFMetPuppi_cfi import * -from ..modules.l1pfProducerBarrel_cfi import * -from ..modules.l1pfProducerHF_cfi import * -from ..modules.l1pfProducerHGCal_cfi import * -from ..modules.l1pfProducerHGCalNoTK_cfi import * +#from ..modules.l1pfCandidates_cfi import * +#from ..modules.l1PFMetPuppi_cfi import * +#from ..modules.l1pfProducerBarrel_cfi import * +#from ..modules.l1pfProducerHF_cfi import * +#from ..modules.l1pfProducerHGCal_cfi import * +#from ..modules.l1pfProducerHGCalNoTK_cfi import * #from ..modules.hltL1TkElectronsEllipticMatchCrystal_cfi import * #from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * #from ..modules.hltL1TkMuons_cfi import * #from ..modules.hltL1TkPhotonsCrystal_cfi import * #from ..modules.hltL1TkPhotonsHGC_cfi import * #from ..modules.L1TkPrimaryVertex_cfi import * -from ..modules.l1tSlwPFPuppiJets_cfi import * -from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * -from ..modules.pfClustersFromCombinedCaloHCal_cfi import * -from ..modules.pfClustersFromCombinedCaloHF_cfi import * -from ..modules.pfClustersFromHGC3DClusters_cfi import * -from ..modules.pfClustersFromL1EGClusters_cfi import * -from ..modules.pfTracksFromL1TracksBarrel_cfi import * -from ..modules.pfTracksFromL1TracksHGCal_cfi import * +#from ..modules.l1tSlwPFPuppiJets_cfi import * +#from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * +#from ..modules.pfClustersFromCombinedCaloHCal_cfi import * +#from ..modules.pfClustersFromCombinedCaloHF_cfi import * +#from ..modules.pfClustersFromHGC3DClusters_cfi import * +#from ..modules.pfClustersFromL1EGClusters_cfi import * +#from ..modules.pfTracksFromL1TracksBarrel_cfi import * +#from ..modules.pfTracksFromL1TracksHGCal_cfi import * + from ..modules.simCaloStage2Layer1Digis_cfi import * from ..modules.simCscTriggerPrimitiveDigis_cfi import * from ..modules.simDtTriggerPrimitiveDigis_cfi import * diff --git a/HLTrigger/Configuration/python/HLT_75e33_cff.py b/HLTrigger/Configuration/python/HLT_75e33_cff.py index b96c0d9073b6d..01462352f3032 100644 --- a/HLTrigger/Configuration/python/HLT_75e33_cff.py +++ b/HLTrigger/Configuration/python/HLT_75e33_cff.py @@ -323,21 +323,21 @@ #del fragment.L1TkMuons #del fragment.L1TkPhotonsCrystal #del fragment.L1TkPhotonsHGC -del fragment.L1TkPrimaryVertex +#del fragment.L1TkPrimaryVertex del fragment.l1EGammaEEProducer del fragment.l1NNTauProducerPuppi -del fragment.l1PFMetPuppi -del fragment.l1pfCandidates -del fragment.l1pfProducerBarrel -del fragment.l1pfProducerHF -del fragment.l1pfProducerHGCal -del fragment.l1pfProducerHGCalNoTK -del fragment.pfClustersFromCombinedCaloHCal -del fragment.pfClustersFromCombinedCaloHF -del fragment.pfClustersFromHGC3DClusters -del fragment.pfClustersFromL1EGClusters -del fragment.pfTracksFromL1TracksBarrel -del fragment.pfTracksFromL1TracksHGCal +#del fragment.l1PFMetPuppi +#del fragment.l1pfCandidates +#del fragment.l1pfProducerBarrel +#del fragment.l1pfProducerHF +#del fragment.l1pfProducerHGCal +#del fragment.l1pfProducerHGCalNoTK +#del fragment.pfClustersFromCombinedCaloHCal +#del fragment.pfClustersFromCombinedCaloHF +#del fragment.pfClustersFromHGC3DClusters +#del fragment.pfClustersFromL1EGClusters +#del fragment.pfTracksFromL1TracksBarrel +#del fragment.pfTracksFromL1TracksHGCal del fragment.simCaloStage2Layer1Digis del fragment.simCscTriggerPrimitiveDigis del fragment.simDtTriggerPrimitiveDigis @@ -350,3 +350,4 @@ del fragment.simMuonGEMPadDigis del fragment.simOmtfDigis del fragment.simTwinMuxDigis + From 4d3e1351cd6a6ecf7220c62590325c8b4bb606d2 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 20 Jul 2022 13:04:10 +0200 Subject: [PATCH 39/66] First try of moving to new L1T MET --- .../HLTfilters/plugins/L1TEnergySumFilterT.h | 52 ++++++++++++++----- HLTrigger/HLTfilters/plugins/plugins.cc | 4 +- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h index ac51306dda5e9..596edbeb68aef 100644 --- a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h +++ b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h @@ -101,23 +101,49 @@ bool L1TEnergySumFilterT::hltFilter(edm::Event& iEvent, auto const& l1tSums = iEvent.getHandle(l1tSumToken_); + /// Thiago: this is now a bit ugly, because the fact that the object is HT or MHT + /// is now encoded on the fact that it is the 0th or 1st element in the vector. + /// + /* + l1t::EtSum HT = l1L1PFPhase1L1JetSums->at(0); + l1t::EtSum MHT = l1L1PFPhase1L1JetSums->at(1); + l1extra_.phase1PuppiHT = HT.pt(); + l1extra_.phase1PuppiMHTEt = MHT.pt(); + l1t::EtSum met = l1MetPF->at(0); + l1extra_.puppiMETEt = met.et(); + */ + int nSum(0); - for (auto iSum = l1tSums->begin(); iSum != l1tSums->end(); ++iSum) { - double offlinePt = 0.0; - // pt or sumEt? - if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMET or - l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMHT) { - offlinePt = offlineEnergySum(iSum->pt()); - } else if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFETT or - l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFHT) { - offlinePt = offlineEnergySum(iSum->sumEt()); - } - - if (offlinePt >= minPt_) { + double onlinePt(0.0); + double offlinePt(0.0); + auto iSum = l1tSums->begin(); + + + if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMET) { + // MET is index [0], and uses .et() method + onlinePt = iSum->et(); + } + if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFHT) { + // HT is index [0], and uses .pt() method + onlinePt = iSum->pt(); + } + if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMHT) { + // MHT is index [1], and uses .pt() method + ++iSum; + onlinePt = iSum->pt(); + } + if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFETT) { + // As of now, L1 doesn't support this object it seems. + } + + // Do the scaling + offlinePt = offlineEnergySum(onlinePt); + + // Add the passing element to the filterproduct. + if (offlinePt >= minPt_) { ++nSum; edm::Ref> ref(l1tSums, std::distance(l1tSums->begin(), iSum)); filterproduct.addObject(l1tSumType_, ref); - } } // return final filter decision diff --git a/HLTrigger/HLTfilters/plugins/plugins.cc b/HLTrigger/HLTfilters/plugins/plugins.cc index 56fb4d2a0e77f..1fdb4724cd639 100644 --- a/HLTrigger/HLTfilters/plugins/plugins.cc +++ b/HLTrigger/HLTfilters/plugins/plugins.cc @@ -73,8 +73,7 @@ typedef HLTSinglet HLTLevel1Muon; // filters for Phase-2 typedef L1TJetFilterT L1TJetFilter; typedef L1TJetFilterT L1TPFJetFilter; -typedef L1TEnergySumFilterT L1TEnergySumFilter; -typedef L1TEnergySumFilterT L1TPFEnergySumFilter; +typedef L1TEnergySumFilterT L1TEnergySumFilter; #include "HLTSmartSinglet.h" #include "HLTSmartSinglet.cc" @@ -187,7 +186,6 @@ DEFINE_FWK_MODULE(L1THPSPFTauFilter); DEFINE_FWK_MODULE(L1TJetFilter); DEFINE_FWK_MODULE(L1TPFJetFilter); DEFINE_FWK_MODULE(L1TEnergySumFilter); -DEFINE_FWK_MODULE(L1TPFEnergySumFilter); DEFINE_FWK_MODULE(HLTGlobalSumsPFMET); DEFINE_FWK_MODULE(HLTGlobalSumsCaloMET); From e9f0e56b8da75297244d235b422ec583a1083737 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 20 Jul 2022 13:15:15 +0200 Subject: [PATCH 40/66] New EtSum DataFormats for Phase-2 --- DataFormats/L1Trigger/interface/EtSum.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DataFormats/L1Trigger/interface/EtSum.h b/DataFormats/L1Trigger/interface/EtSum.h index 27f1fb2f2899f..8885638738d04 100644 --- a/DataFormats/L1Trigger/interface/EtSum.h +++ b/DataFormats/L1Trigger/interface/EtSum.h @@ -12,6 +12,11 @@ namespace l1t { typedef edm::Ref EtSumRef; typedef edm::RefVector EtSumRefVector; typedef std::vector EtSumVectorRef; + // Phase-2 + typedef std::vector EtSumP2Collection; + typedef edm::Ref EtSumP2Ref; + typedef edm::RefVector EtSumP2RefVector; + typedef std::vector EtSumVectorP2Ref; typedef ObjectRefBxCollection EtSumRefBxCollection; typedef ObjectRefPair EtSumRefPair; From 6103b6a4a2ee8b783a83585435543c2d090b197b Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 20 Jul 2022 13:32:40 +0200 Subject: [PATCH 41/66] Adding STORM infrastructure for std::vector --- .../interface/TriggerRefsCollections.h | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/DataFormats/HLTReco/interface/TriggerRefsCollections.h b/DataFormats/HLTReco/interface/TriggerRefsCollections.h index 28e1fc21ca78a..3313ec6dc6a35 100644 --- a/DataFormats/HLTReco/interface/TriggerRefsCollections.h +++ b/DataFormats/HLTReco/interface/TriggerRefsCollections.h @@ -95,6 +95,7 @@ namespace trigger { typedef l1t::HPSPFTauVectorRef VRl1thpspftau; typedef l1t::PFTauVectorRef VRl1tpftau; typedef l1t::PFTrackVectorRef VRl1tpftrack; + typedef l1t::EtSumVectorP2Ref VRl1tp2etsum; typedef std::vector VRpfjet; typedef std::vector VRpftau; @@ -160,6 +161,8 @@ namespace trigger { VRl1thpspftau l1thpspftauRefs_; Vids l1tpftrackIds_; VRl1tpftrack l1tpftrackRefs_; + Vids l1tp2etsumIds_; + VRl1tp2etsum l1tp2etsumRefs_; Vids pfjetIds_; VRpfjet pfjetRefs_; @@ -228,6 +231,8 @@ namespace trigger { l1thpspftauRefs_(), l1tpftrackIds_(), l1tpftrackRefs_(), + l1tp2etsumIds_(), + l1tp2etsumRefs_(), pfjetIds_(), pfjetRefs_(), @@ -294,6 +299,8 @@ namespace trigger { std::swap(l1thpspftauRefs_, other.l1thpspftauRefs_); std::swap(l1tpftrackIds_, other.l1tpftrackIds_); std::swap(l1tpftrackRefs_, other.l1tpftrackRefs_); + std::swap(l1tp2etsumIds_, other.l1tp2etsumIds_); + std::swap(l1tp2etsumRefs_, other.l1tp2etsumRefs_); std::swap(pfjetIds_, other.pfjetIds_); std::swap(pfjetRefs_, other.pfjetRefs_); @@ -411,6 +418,10 @@ namespace trigger { l1tpftrackIds_.push_back(id); l1tpftrackRefs_.push_back(ref); } + void addObject(int id, const l1t::EtSumP2Ref& ref) { + l1tp2etsumIds_.push_back(id); + l1tp2etsumRefs_.push_back(ref); + } void addObject(int id, const reco::PFJetRef& ref) { pfjetIds_.push_back(id); pfjetRefs_.push_back(ref); @@ -584,6 +595,12 @@ namespace trigger { l1tpftrackRefs_.insert(l1tpftrackRefs_.end(), refs.begin(), refs.end()); return l1tpftrackIds_.size(); } + size_type addObjects(const Vids& ids, const VRl1tp2etsum& refs) { + assert(ids.size() == refs.size()); + l1tp2etsumIds_.insert(l1tp2etsumIds_.end(), ids.begin(), ids.end()); + l1tp2etsumRefs_.insert(l1tp2etsumRefs_.end(), refs.begin(), refs.end()); + return l1tp2etsumIds_.size(); + } size_type addObjects(const Vids& ids, const VRpfjet& refs) { assert(ids.size() == refs.size()); @@ -1516,6 +1533,41 @@ namespace trigger { return; } + void getObjects(Vids& ids, VRl1tp2etsum& refs) const { getObjects(ids, refs, 0, l1tp2etsumIds_.size()); } + void getObjects(Vids& ids, VRl1tp2etsum& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tp2etsumIds_.size()); + const size_type n(end - begin); + ids.resize(n); + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + ids[j] = l1tp2etsumIds_[i]; + refs[j] = l1tp2etsumRefs_[i]; + ++j; + } + } + void getObjects(int id, VRl1tp2etsum& refs) const { getObjects(id, refs, 0, l1tp2etsumIds_.size()); } + void getObjects(int id, VRl1tp2etsum& refs, size_type begin, size_type end) const { + assert(begin <= end); + assert(end <= l1tp2etsumIds_.size()); + size_type n(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tp2etsumIds_[i]) { + ++n; + } + } + refs.resize(n); + size_type j(0); + for (size_type i = begin; i != end; ++i) { + if (id == l1tp2etsumIds_[i]) { + refs[j] = l1tp2etsumRefs_[i]; + ++j; + } + } + return; + } + void getObjects(Vids& ids, VRpfjet& refs) const { getObjects(ids, refs, 0, pfjetIds_.size()); } void getObjects(Vids& ids, VRpfjet& refs, size_type begin, size_type end) const { assert(begin <= end); @@ -1732,6 +1784,10 @@ namespace trigger { const Vids& l1tpftrackIds() const { return l1tpftrackIds_; } const VRl1tpftrack& l1tpftrackRefs() const { return l1tpftrackRefs_; } + size_type l1tp2etsumSize() const { return l1tp2etsumIds_.size(); } + const Vids& l1tp2etsumIds() const { return l1tp2etsumIds_; } + const VRl1tetsum& l1tp2etsumRefs() const { return l1tp2etsumRefs_; } + size_type l1ttauSize() const { return l1ttauIds_.size(); } const Vids& l1ttauIds() const { return l1ttauIds_; } const VRl1ttau& l1ttauRefs() const { return l1ttauRefs_; } From 0debcd12aff65f152979727a56284de443fc4dae Mon Sep 17 00:00:00 2001 From: Thiago Date: Mon, 1 Aug 2022 18:15:25 +0200 Subject: [PATCH 42/66] WIP of moving to new L1T MET --- .../HLTReco/interface/TriggerEventWithRefs.h | 22 +++++++++++++++++++ .../interface/TriggerRefsCollections.h | 2 +- DataFormats/HLTReco/src/classes_def.xml | 12 ++++++---- DataFormats/L1Trigger/src/classes_def.xml | 6 +++++ .../HLTfilters/plugins/L1TEnergySumFilterT.h | 4 +++- 5 files changed, 40 insertions(+), 6 deletions(-) diff --git a/DataFormats/HLTReco/interface/TriggerEventWithRefs.h b/DataFormats/HLTReco/interface/TriggerEventWithRefs.h index 3711959e1ee99..a99105a311d6f 100644 --- a/DataFormats/HLTReco/interface/TriggerEventWithRefs.h +++ b/DataFormats/HLTReco/interface/TriggerEventWithRefs.h @@ -60,6 +60,7 @@ namespace trigger { size_type l1tpftau_; size_type l1thpspftau_; size_type l1tpftrack_; + size_type l1tp2etsum_; size_type l1ttau_; size_type l1tetsum_; @@ -93,6 +94,7 @@ namespace trigger { l1tpftau_(0), l1thpspftau_(0), l1tpftrack_(0), + l1tp2etsum_(0), l1ttau_(0), l1tetsum_(0) { filterTag_ = edm::InputTag().encode(); @@ -125,6 +127,7 @@ namespace trigger { size_type l1tpftau, size_type l1thpspftau, size_type l1tpftrack, + size_type l1tp2etsum, size_type l1ttau, size_type l1tetsum) : filterTag_(filterTag.encode()), @@ -155,6 +158,7 @@ namespace trigger { l1tpftau_(l1tpftau), l1thpspftau_(l1thpspftau), l1tpftrack_(l1tpftrack), + l1tp2etsum_(l1tp2etsum), l1ttau_(l1ttau), l1tetsum_(l1tetsum) {} }; @@ -207,6 +211,7 @@ namespace trigger { addObjects(tfowr.l1tpftauIds(), tfowr.l1tpftauRefs()), addObjects(tfowr.l1thpspftauIds(), tfowr.l1thpspftauRefs()), addObjects(tfowr.l1tpftrackIds(), tfowr.l1tpftrackRefs()), + addObjects(tfowr.l1tp2etsumIds(), tfowr.l1tp2etsumRefs()), addObjects(tfowr.l1ttauIds(), tfowr.l1ttauRefs()), addObjects(tfowr.l1tetsumIds(), tfowr.l1tetsumRefs())) @@ -392,6 +397,12 @@ namespace trigger { return std::pair(begin, end); } + std::pair l1tp2etsumSlice(size_type filter) const { + const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1tp2etsum_); + const size_type end(filterObjects_.at(filter).l1tp2etsum_); + return std::pair(begin, end); + } + std::pair l1ttauSlice(size_type filter) const { const size_type begin(filter == 0 ? 0 : filterObjects_.at(filter - 1).l1ttau_); const size_type end(filterObjects_.at(filter).l1ttau_); @@ -704,6 +715,17 @@ namespace trigger { TriggerRefsCollections::getObjects(id, l1tpftrack, begin, end); } + void getObjects(size_type filter, Vids& ids, VRl1tp2etsum& l1tp2etsum) const { + const size_type begin(l1tp2etsumSlice(filter).first); + const size_type end(l1tp2etsumSlice(filter).second); + TriggerRefsCollections::getObjects(ids, l1tp2etsum, begin, end); + } + void getObjects(size_type filter, int id, VRl1tp2etsum& l1tp2etsum) const { + const size_type begin(l1tp2etsumSlice(filter).first); + const size_type end(l1tp2etsumSlice(filter).second); + TriggerRefsCollections::getObjects(id, l1tp2etsum, begin, end); + } + void getObjects(size_type filter, Vids& ids, VRl1ttau& l1ttau) const { const size_type begin(l1ttauSlice(filter).first); const size_type end(l1ttauSlice(filter).second); diff --git a/DataFormats/HLTReco/interface/TriggerRefsCollections.h b/DataFormats/HLTReco/interface/TriggerRefsCollections.h index 3313ec6dc6a35..673fc84ae8583 100644 --- a/DataFormats/HLTReco/interface/TriggerRefsCollections.h +++ b/DataFormats/HLTReco/interface/TriggerRefsCollections.h @@ -1786,7 +1786,7 @@ namespace trigger { size_type l1tp2etsumSize() const { return l1tp2etsumIds_.size(); } const Vids& l1tp2etsumIds() const { return l1tp2etsumIds_; } - const VRl1tetsum& l1tp2etsumRefs() const { return l1tp2etsumRefs_; } + const VRl1tp2etsum& l1tp2etsumRefs() const { return l1tp2etsumRefs_; } size_type l1ttauSize() const { return l1ttauIds_.size(); } const Vids& l1ttauIds() const { return l1ttauIds_; } diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index 95851e8815c51..359ebb8d1ce4e 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -42,14 +42,16 @@ - + + - + + @@ -66,7 +68,8 @@ - + + @@ -74,7 +77,8 @@ - + + diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 045c3669354b9..0fd97a17634f2 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -64,6 +64,12 @@ + + + + + + diff --git a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h index 596edbeb68aef..34c1f1523d97a 100644 --- a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h +++ b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h @@ -118,7 +118,9 @@ bool L1TEnergySumFilterT::hltFilter(edm::Event& iEvent, double offlinePt(0.0); auto iSum = l1tSums->begin(); - + // The correct way of doing this would be using the EtSumHelper class. + // However, it doesn't support std::vector, only the + // older BXVector collection. if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMET) { // MET is index [0], and uses .et() method onlinePt = iSum->et(); From 36667329b9f2ac8ce95974230f75175225243e6f Mon Sep 17 00:00:00 2001 From: Thiago Date: Tue, 2 Aug 2022 16:16:09 +0200 Subject: [PATCH 43/66] L1T seeds based on l1t::EtSum now working --- .../HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py | 2 +- .../python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py | 2 +- .../python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py index c4af8a782dee1..f3920c390c004 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT400offMaxEta2p4_cfi.py @@ -6,5 +6,5 @@ theScalings = cms.vdouble(50.0182, 1.0961, 0) ), TypeOfSum = cms.string('HT'), - inputTag = cms.InputTag("Phase1L1TJetSumsProducer9x9","Sums") + inputTag = cms.InputTag("Phase1L1TJetSumsProducer","Sums") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py index 1e367ab1aaa64..f77ed4f39945d 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiHT450off_cfi.py @@ -6,5 +6,5 @@ theScalings = cms.vdouble(50.0182, 1.0961, 0) ), TypeOfSum = cms.string('HT'), - inputTag = cms.InputTag("Phase1L1TJetSumsProducer9x9","Sums") + inputTag = cms.InputTag("Phase1L1TJetSumsProducer","Sums") ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py index 04781ba4336a3..20c890015f049 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1tPFPuppiMET220off_cfi.py @@ -1,10 +1,10 @@ import FWCore.ParameterSet.Config as cms -l1tPFPuppiMET220off = cms.EDFilter("L1TPFEnergySumFilter", +l1tPFPuppiMET220off = cms.EDFilter("L1TEnergySumFilter", MinPt = cms.double(220.0), Scalings = cms.PSet( theScalings = cms.vdouble(54.2859, 1.39739, 0) ), TypeOfSum = cms.string('MET'), - inputTag = cms.InputTag("l1PFMet") + inputTag = cms.InputTag("L1MetPfProducer") ) From 1f730ad8f1015104f57fda6b9a85feee75e261c2 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 3 Aug 2022 14:15:45 +0200 Subject: [PATCH 44/66] First changes to L1TTkMuon --- .../HLTfilters/plugins/L1TTkMuonFilter.cc | 21 ++++++++++--------- .../HLTfilters/plugins/L1TTkMuonFilter.h | 12 +++++------ 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index 339bedecfadc4..9d25883ce700d 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -28,10 +28,11 @@ // namespace { - bool isDupMuon(const l1t::TkMuonRef& muon, const std::vector& existing) { + bool isDupMuon(const l1t::TrackerMuonRef& muon, const std::vector& existing) { for (const auto& exist : existing) { //it is our understanding that there is an exact eta phi match //and we should not be concerned with numerical precision + // FIXME: should this use hardware or physics pt? if (reco::deltaR2(*muon, *exist) <= 0) { return true; } @@ -43,7 +44,7 @@ namespace { L1TTkMuonFilter::L1TTkMuonFilter(const edm::ParameterSet& iConfig) : HLTFilter(iConfig), l1TkMuonTag_(iConfig.getParameter("inputTag")), - tkMuonToken_(consumes(l1TkMuonTag_)), + tkMuonToken_(consumes(l1TkMuonTag_)), qualityCut_(iConfig.getParameter("qualities")) { min_Pt_ = iConfig.getParameter("MinPt"); min_N_ = iConfig.getParameter("MinN"); @@ -105,27 +106,27 @@ bool L1TTkMuonFilter::hltFilter(edm::Event& iEvent, // Specific filter code // get hold of products from Event - Handle tkMuons; + Handle tkMuons; iEvent.getByToken(tkMuonToken_, tkMuons); //it looks rather slow to get the added muons back out of the filterproduct //so we just make a vector of passing and then add them all at the end - std::vector passingMuons; + std::vector passingMuons; auto atrkmuons(tkMuons->begin()); auto otrkmuons(tkMuons->end()); - TkMuonCollection::const_iterator itkMuon; + l1t::TrackerMuonCollection::const_iterator itkMuon; for (itkMuon = atrkmuons; itkMuon != otrkmuons; itkMuon++) { - double offlinePt = this->TkMuonOfflineEt(itkMuon->pt(), itkMuon->eta()); + double offlinePt = this->TkMuonOfflineEt(itkMuon->phPt(), itkMuon->phEta()); bool passesQual = !applyQuality_ || qualityCut_(*itkMuon); - if (passesQual && offlinePt >= min_Pt_ && itkMuon->eta() <= max_Eta_ && itkMuon->eta() >= min_Eta_) { - l1t::TkMuonRef ref(l1t::TkMuonRef(tkMuons, distance(atrkmuons, itkMuon))); + if (passesQual && offlinePt >= min_Pt_ && itkMuon->phEta() <= max_Eta_ && itkMuon->phEta() >= min_Eta_) { + l1t::TrackerMuonRef ref(l1t::TrackerMuonRef(tkMuons, distance(atrkmuons, itkMuon))); if (!applyDuplicateRemoval_ || !isDupMuon(ref, passingMuons)) { passingMuons.push_back(ref); } } } for (const auto& muon : passingMuons) { - filterproduct.addObject(trigger::TriggerObjectType::TriggerL1TkMu, muon); + // TEMP filterproduct.addObject(trigger::TriggerObjectType::TriggerL1TkMu, muon); } // return with final filter decision @@ -145,7 +146,7 @@ L1TTkMuonFilter::MuonQualityCut::MuonQualityCut(const edm::ParameterSet& iConfig } } -bool L1TTkMuonFilter::MuonQualityCut::operator()(const l1t::TkMuon& muon) const { +bool L1TTkMuonFilter::MuonQualityCut::operator()(const l1t::TrackerMuon& muon) const { const auto& qualities = allowedQualities_.find(muon.muonDetector()); if (qualities != allowedQualities_.end()) { return std::binary_search(qualities->second.begin(), qualities->second.end(), muon.quality()); diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h index f011045b7e836..4c67f65574d5f 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h @@ -6,7 +6,7 @@ * * This class is an HLTFilter (-> EDFilter) implementing a very basic * HLT trigger acting on TkMuon candidates - * + * 2022-08-01: moving from TkMuon to TrackerMuon * * * \author Simone Gennai @@ -14,8 +14,7 @@ */ #include "HLTrigger/HLTcore/interface/HLTFilter.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" // // class declaration @@ -34,7 +33,7 @@ class L1TTkMuonFilter : public HLTFilter { class MuonQualityCut { public: MuonQualityCut(const edm::ParameterSet&); - bool operator()(const l1t::TkMuon&) const; + bool operator()(const l1t::TrackerMuon&) const; static void fillPSetDescription(edm::ParameterSetDescription& desc); static edm::ParameterSetDescription makePSetDescription(); @@ -42,9 +41,8 @@ class L1TTkMuonFilter : public HLTFilter { std::unordered_map> allowedQualities_; }; - edm::InputTag l1TkMuonTag_; //input tag for L1 Tk Muon product - typedef std::vector TkMuonCollection; - edm::EDGetTokenT tkMuonToken_; // token identifying product containing L1 TkMuons + edm::InputTag l1TkMuonTag_; //input tag for L1 TrackerMuon product + edm::EDGetTokenT tkMuonToken_; // token identifying product containing L1 TrackerMuons double min_Pt_; // min pt cut int min_N_; // min number of candidates above pT cut From cf91f20a4bac3906759222de8e80beb6f810c884 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 3 Aug 2022 15:20:24 +0200 Subject: [PATCH 45/66] L1TTkMuonFilter.cc almost ready --- .../HLTfilters/plugins/L1TTkMuonFilter.cc | 37 +++++++++++++------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index 9d25883ce700d..c20247d894c1f 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -32,8 +32,9 @@ namespace { for (const auto& exist : existing) { //it is our understanding that there is an exact eta phi match //and we should not be concerned with numerical precision - // FIXME: should this use hardware or physics pt? - if (reco::deltaR2(*muon, *exist) <= 0) { + // DISCUSS: should this use hardware or physics pt? + // For the time being we use hardware pt, because this is just for a duplicate check. + if (reco::deltaR2(muon->hwEta(), muon->hwPhi(), exist->hwEta(), exist->hwPhi()) <= 0) { return true; } } @@ -72,7 +73,7 @@ void L1TTkMuonFilter::fillDescriptions(edm::ConfigurationDescriptions& descripti desc.add("MaxEta", 5.0); desc.add("MinN", 1); desc.add("inputTag", edm::InputTag("L1TkMuons")); - desc.add("applyQuality", true); + desc.add("applyQuality", false); desc.add("applyDuplicateRemoval", true); desc.add("qualities", MuonQualityCut::makePSetDescription()); @@ -147,22 +148,34 @@ L1TTkMuonFilter::MuonQualityCut::MuonQualityCut(const edm::ParameterSet& iConfig } bool L1TTkMuonFilter::MuonQualityCut::operator()(const l1t::TrackerMuon& muon) const { - const auto& qualities = allowedQualities_.find(muon.muonDetector()); - if (qualities != allowedQualities_.end()) { - return std::binary_search(qualities->second.begin(), qualities->second.end(), muon.quality()); - } else { - return true; //if qualities for that detector is not specified, we return true + bool passesQuality(false); + + // If we didn't load any qualities from the config file, that means we don't care. + // So we set passesQuality to true. + if(allowedQualities_.empty()) { + passesQuality = true; + return passesQuality; + } + + // The muonDetector() method is not available for TrackerMuon (it was available in TkMuon), + // so for the time being we just take the union of all quality vectors for all muon detectors. + for (const auto& detQuality: allowedQualities_) { + passesQuality = std::binary_search(detQuality.second.begin(), + detQuality.second.end(), + muon.hwQual()); } + + return passesQuality; } void L1TTkMuonFilter::MuonQualityCut::fillPSetDescription(edm::ParameterSetDescription& desc) { edm::ParameterSetDescription detQualDesc; - detQualDesc.add>("detectors", {3}); - detQualDesc.add>("qualities", {11, 13, 14, 15}); + detQualDesc.add>("detectors", {-99}); + detQualDesc.add>("qualities", {-99, -99, -99}); std::vector detQualDefaults; edm::ParameterSet detQualDefault; - detQualDefault.addParameter>("detectors", {3}); - detQualDefault.addParameter>("qualities", {11, 13, 14, 15}); + detQualDefault.addParameter>("detectors", {-99}); + detQualDefault.addParameter>("qualities", {-99, -99, -99}); detQualDefaults.push_back(detQualDefault); desc.addVPSet("values", detQualDesc, detQualDefaults); } From 080a33185923f230e3c3e4ce26c213c62b27f7bb Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 3 Aug 2022 18:20:44 +0200 Subject: [PATCH 46/66] Migrating DataFormats/HLTReco to TrackerMuon --- .../HLTReco/interface/TriggerRefsCollections.h | 10 ++++++---- DataFormats/HLTReco/src/classes.h | 3 +-- DataFormats/HLTReco/src/classes_def.xml | 12 ++++++++++++ 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/DataFormats/HLTReco/interface/TriggerRefsCollections.h b/DataFormats/HLTReco/interface/TriggerRefsCollections.h index 673fc84ae8583..633fb15e23079 100644 --- a/DataFormats/HLTReco/interface/TriggerRefsCollections.h +++ b/DataFormats/HLTReco/interface/TriggerRefsCollections.h @@ -44,8 +44,7 @@ #include "DataFormats/L1Trigger/interface/Jet.h" #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/EtSum.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "DataFormats/L1TCorrelator/interface/TkElectron.h" #include "DataFormats/L1TCorrelator/interface/TkElectronFwd.h" #include "DataFormats/L1TCorrelator/interface/TkEm.h" @@ -88,7 +87,10 @@ namespace trigger { typedef l1t::EtSumVectorRef VRl1tetsum; /* Phase-2 */ - typedef l1t::TkMuonVectorRef VRl1ttkmuon; + // This is a std::vector, + // and should be called TrackerMuonVectorRef upstream. + // The L1T group should be made aware of that + typedef l1t::TrackerMuonRefVector VRl1ttkmuon; typedef l1t::TkElectronVectorRef VRl1ttkele; typedef l1t::TkEmVectorRef VRl1ttkem; typedef l1t::PFJetVectorRef VRl1tpfjet; @@ -390,7 +392,7 @@ namespace trigger { } /* Phase-2 */ - void addObject(int id, const l1t::TkMuonRef& ref) { + void addObject(int id, const l1t::TrackerMuonRef& ref) { l1ttkmuonIds_.push_back(id); l1ttkmuonRefs_.push_back(ref); } diff --git a/DataFormats/HLTReco/src/classes.h b/DataFormats/HLTReco/src/classes.h index c95d97d0e81ee..158d69e8bc8b5 100644 --- a/DataFormats/HLTReco/src/classes.h +++ b/DataFormats/HLTReco/src/classes.h @@ -12,8 +12,7 @@ #include "DataFormats/Candidate/interface/CompositeCandidate.h" #include "DataFormats/Candidate/interface/CompositeCandidateFwd.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "DataFormats/L1TCorrelator/interface/TkElectron.h" #include "DataFormats/L1TCorrelator/interface/TkElectronFwd.h" #include "DataFormats/L1TCorrelator/interface/TkEm.h" diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index 359ebb8d1ce4e..fa1ffb1e203fb 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -43,7 +43,11 @@ +<<<<<<< HEAD +======= + +>>>>>>> 8d2f19a06de (Migrating DataFormats/HLTReco to TrackerMuon) @@ -51,7 +55,11 @@ +<<<<<<< HEAD +======= + +>>>>>>> 8d2f19a06de (Migrating DataFormats/HLTReco to TrackerMuon) @@ -78,7 +86,11 @@ +<<<<<<< HEAD +======= + +>>>>>>> 8d2f19a06de (Migrating DataFormats/HLTReco to TrackerMuon) From d097cfe81ba689bfeac115038055995372088113 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 3 Aug 2022 21:25:58 +0200 Subject: [PATCH 47/66] Moving whole HLT infrastructure to use TrackerMuon --- DataFormats/L1TMuonPhase2/src/classes_def.xml | 3 +- .../interface/TriggerSummaryProducerAOD.h | 4 +- .../HLTcore/plugins/HLTEventAnalyzerRAW.cc | 2 +- .../plugins/TriggerSummaryAnalyzerRAW.cc | 4 +- .../plugins/TriggerSummaryProducerAOD.cc | 6 +-- .../plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc | 46 ++++--------------- .../plugins/HLT2L1TkMuonL1TkMuonMuRefDR.h | 10 ++-- HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc | 40 ++++++++-------- .../Muon/plugins/HLTMuonTrkL1TkMuFilter.cc | 2 +- .../Muon/plugins/HLTMuonTrkL1TkMuFilter.h | 3 +- 10 files changed, 44 insertions(+), 76 deletions(-) diff --git a/DataFormats/L1TMuonPhase2/src/classes_def.xml b/DataFormats/L1TMuonPhase2/src/classes_def.xml index 0425108cccf9e..b20feacd4c091 100644 --- a/DataFormats/L1TMuonPhase2/src/classes_def.xml +++ b/DataFormats/L1TMuonPhase2/src/classes_def.xml @@ -14,7 +14,8 @@ - + + diff --git a/HLTrigger/HLTcore/interface/TriggerSummaryProducerAOD.h b/HLTrigger/HLTcore/interface/TriggerSummaryProducerAOD.h index 653b84f4ec5a4..3b6b6feabc4f3 100644 --- a/HLTrigger/HLTcore/interface/TriggerSummaryProducerAOD.h +++ b/HLTrigger/HLTcore/interface/TriggerSummaryProducerAOD.h @@ -46,7 +46,7 @@ #include "DataFormats/JetReco/interface/PFJetCollection.h" #include "DataFormats/TauReco/interface/PFTauFwd.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "DataFormats/L1TCorrelator/interface/TkElectron.h" #include "DataFormats/L1TCorrelator/interface/TkEm.h" #include "DataFormats/L1TParticleFlow/interface/PFJet.h" @@ -210,7 +210,7 @@ class TriggerSummaryProducerAOD : public edm::global::EDProducer<> { edm::GetterOfProducts getL1TJetParticleCollection_; edm::GetterOfProducts getL1TTauParticleCollection_; edm::GetterOfProducts getL1TEtSumParticleCollection_; - edm::GetterOfProducts getL1TTkMuonCollection_; + edm::GetterOfProducts getL1TTkMuonCollection_; edm::GetterOfProducts getL1TTkElectronCollection_; edm::GetterOfProducts getL1TTkEmCollection_; edm::GetterOfProducts getL1TPFJetCollection_; diff --git a/HLTrigger/HLTcore/plugins/HLTEventAnalyzerRAW.cc b/HLTrigger/HLTcore/plugins/HLTEventAnalyzerRAW.cc index 89e074e733edd..9eefd731c4269 100644 --- a/HLTrigger/HLTcore/plugins/HLTEventAnalyzerRAW.cc +++ b/HLTrigger/HLTcore/plugins/HLTEventAnalyzerRAW.cc @@ -37,7 +37,7 @@ #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/EtSum.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "DataFormats/L1TCorrelator/interface/TkElectron.h" #include "DataFormats/L1TCorrelator/interface/TkEm.h" #include "DataFormats/L1TParticleFlow/interface/PFJet.h" diff --git a/HLTrigger/HLTcore/plugins/TriggerSummaryAnalyzerRAW.cc b/HLTrigger/HLTcore/plugins/TriggerSummaryAnalyzerRAW.cc index f54922401ca8b..65c4d1a240d3a 100644 --- a/HLTrigger/HLTcore/plugins/TriggerSummaryAnalyzerRAW.cc +++ b/HLTrigger/HLTcore/plugins/TriggerSummaryAnalyzerRAW.cc @@ -164,7 +164,7 @@ void TriggerSummaryAnalyzerRAW::analyze(edm::StreamID, const edm::Event& iEvent, /* Phase-2 */ const unsigned int nL1TTkMuon(handle->l1ttkmuonSlice(iFO).second - handle->l1ttkmuonSlice(iFO).first); if (nL1TTkMuon > 0) - LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTkMuon: " << nL1TTkMuon; + LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTrackerMuon: " << nL1TTkMuon; const unsigned int nL1TTkEle(handle->l1ttkeleSlice(iFO).second - handle->l1ttkeleSlice(iFO).first); if (nL1TTkEle > 0) @@ -216,7 +216,7 @@ void TriggerSummaryAnalyzerRAW::analyze(edm::StreamID, const edm::Event& iEvent, LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTau: " << handle->l1ttauSize() << endl; LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TEtSum: " << handle->l1tetsumSize() << endl; /* Phase-2 */ - LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTkMuon: " << handle->l1ttkmuonSize() << endl; + LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTrackerMuon:" << handle->l1ttkmuonSize() << endl; LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTkEle: " << handle->l1ttkeleSize() << endl; LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TTkEm: " << handle->l1ttkemSize() << endl; LogVerbatim("TriggerSummaryAnalyzerRAW") << " L1TPFJet: " << handle->l1tpfjetSize() << endl; diff --git a/HLTrigger/HLTcore/plugins/TriggerSummaryProducerAOD.cc b/HLTrigger/HLTcore/plugins/TriggerSummaryProducerAOD.cc index bac8eb0f3a350..e57c63229029d 100644 --- a/HLTrigger/HLTcore/plugins/TriggerSummaryProducerAOD.cc +++ b/HLTrigger/HLTcore/plugins/TriggerSummaryProducerAOD.cc @@ -48,7 +48,7 @@ #include "DataFormats/L1Trigger/interface/Tau.h" #include "DataFormats/L1Trigger/interface/EtSum.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "DataFormats/L1TCorrelator/interface/TkElectron.h" #include "DataFormats/L1TCorrelator/interface/TkEm.h" #include "DataFormats/L1TParticleFlow/interface/PFJet.h" @@ -147,7 +147,7 @@ TriggerSummaryProducerAOD::TriggerSummaryProducerAOD(const edm::ParameterSet& ps getL1TTauParticleCollection_ = edm::GetterOfProducts(productMatch, this); getL1TEtSumParticleCollection_ = edm::GetterOfProducts(productMatch, this); - getL1TTkMuonCollection_ = edm::GetterOfProducts(productMatch, this); + getL1TTkMuonCollection_ = edm::GetterOfProducts(productMatch, this); getL1TTkElectronCollection_ = edm::GetterOfProducts(productMatch, this); getL1TTkEmCollection_ = edm::GetterOfProducts(productMatch, this); getL1TPFJetCollection_ = edm::GetterOfProducts(productMatch, this); @@ -363,7 +363,7 @@ void TriggerSummaryProducerAOD::produce(edm::StreamID, edm::Event& iEvent, const fillTriggerObjectCollections( toc, offset, tags, keys, iEvent, getL1TEtSumParticleCollection_, collectionTagsEvent); /// - fillTriggerObjectCollections( + fillTriggerObjectCollections( toc, offset, tags, keys, iEvent, getL1TTkMuonCollection_, collectionTagsEvent); fillTriggerObjectCollections( toc, offset, tags, keys, iEvent, getL1TTkElectronCollection_, collectionTagsEvent); diff --git a/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc b/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc index 2362d615495bc..77373a03f0883 100644 --- a/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc +++ b/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc @@ -3,14 +3,12 @@ #include "DataFormats/Common/interface/Handle.h" #include "DataFormats/Common/interface/Ref.h" #include "DataFormats/HLTReco/interface/TriggerFilterObjectWithRefs.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "DataFormats/Math/interface/deltaR.h" #include "FWCore/Framework/interface/MakerMacros.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" #include "FWCore/ParameterSet/interface/ParameterSet.h" #include "HLTrigger/HLTcore/interface/defaultModuleLabel.h" -#include "L1Trigger/L1TMuon/interface/MicroGMTConfiguration.h" #include "HLT2L1TkMuonL1TkMuonMuRefDR.h" @@ -47,8 +45,8 @@ void HLT2L1TkMuonL1TkMuonMuRefDR::fillDescriptions(edm::ConfigurationDescription } bool HLT2L1TkMuonL1TkMuonMuRefDR::getCollections(edm::Event& iEvent, - std::vector& coll1, - std::vector& coll2, + std::vector& coll1, + std::vector& coll2, trigger::TriggerFilterObjectWithRefs& filterproduct) const { edm::Handle handle1, handle2; if (iEvent.getByToken(inputToken1_, handle1) and iEvent.getByToken(inputToken2_, handle2)) { @@ -97,37 +95,11 @@ bool HLT2L1TkMuonL1TkMuonMuRefDR::getCollections(edm::Event& iEvent, return false; } -std::pair HLT2L1TkMuonL1TkMuonMuRefDR::convertEtaPhi(l1t::TkMuonRef& tkmu) const { - float muRefEta = 0.; - float muRefPhi = 0.; - - if (tkmu->muonDetector() != emtfRegion_) { - if (tkmu->muRef().isNull()) - return std::make_pair(muRefEta, muRefPhi); - - muRefEta = tkmu->muRef()->hwEta() * etaScale_; - muRefPhi = static_cast(l1t::MicroGMTConfiguration::calcGlobalPhi( - tkmu->muRef()->hwPhi(), tkmu->muRef()->trackFinderType(), tkmu->muRef()->processor())); - muRefPhi = muRefPhi * phiScale_; - } else { - if (tkmu->emtfTrk().isNull()) - return std::make_pair(muRefEta, muRefPhi); - - muRefEta = tkmu->emtfTrk()->Eta(); - muRefPhi = angle_units::operators::convertDegToRad(tkmu->emtfTrk()->Phi_glob()); - } - muRefPhi = reco::reduceRange(muRefPhi); - - return std::make_pair(muRefEta, muRefPhi); -} - -bool HLT2L1TkMuonL1TkMuonMuRefDR::computeDR(edm::Event& iEvent, l1t::TkMuonRef& r1, l1t::TkMuonRef& r2) const { +bool HLT2L1TkMuonL1TkMuonMuRefDR::computeDR(edm::Event& iEvent, l1t::TrackerMuonRef& r1, l1t::TrackerMuonRef& r2) const { if (minDR_ < 0.) return true; - auto [eta1, phi1] = convertEtaPhi(r1); - auto [eta2, phi2] = convertEtaPhi(r2); - return (reco::deltaR2(eta1, phi1, eta2, phi2) > minDR_ * minDR_); + return (reco::deltaR2(r1->phEta(), r1->phPhi(), r2->phEta(), r2->phPhi()) > minDR_ * minDR_); } // ------------ method called to produce the data ------------ @@ -139,13 +111,13 @@ bool HLT2L1TkMuonL1TkMuonMuRefDR::hltFilter(edm::Event& iEvent, // this HLT filter, and place it in the Event. bool accept(false); - std::vector coll1; - std::vector coll2; + std::vector coll1; + std::vector coll2; if (getCollections(iEvent, coll1, coll2, filterproduct)) { int n(0); - l1t::TkMuonRef r1; - l1t::TkMuonRef r2; + l1t::TrackerMuonRef r1; + l1t::TrackerMuonRef r2; for (unsigned int i1 = 0; i1 != coll1.size(); i1++) { r1 = coll1[i1]; diff --git a/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.h b/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.h index 3d190919008a7..729181cb053e7 100644 --- a/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.h +++ b/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.h @@ -7,8 +7,7 @@ #include "HLTrigger/HLTcore/interface/HLTFilter.h" #include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include #include @@ -29,11 +28,10 @@ class HLT2L1TkMuonL1TkMuonMuRefDR : public HLTFilter { const edm::EventSetup&, trigger::TriggerFilterObjectWithRefs& filterproduct) const override; bool getCollections(edm::Event& iEvent, - std::vector& coll1, - std::vector& coll2, + std::vector& coll1, + std::vector& coll2, trigger::TriggerFilterObjectWithRefs& filterproduct) const; - bool computeDR(edm::Event& iEvent, l1t::TkMuonRef& c1, l1t::TkMuonRef& c2) const; - std::pair convertEtaPhi(l1t::TkMuonRef& tkmu) const; + bool computeDR(edm::Event& iEvent, l1t::TrackerMuonRef& c1, l1t::TrackerMuonRef& c2) const; private: // configuration diff --git a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc index 05f918aa9f8c2..fea56d41569a3 100644 --- a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc +++ b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc @@ -13,8 +13,7 @@ #include "DataFormats/EgammaCandidates/interface/ElectronFwd.h" #include "DataFormats/RecoCandidate/interface/RecoChargedCandidate.h" #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "DataFormats/L1TParticleFlow/interface/PFTau.h" #include "DataFormats/L1TParticleFlow/interface/HPSPFTau.h" #include "DataFormats/L1TParticleFlow/interface/HPSPFTauFwd.h" @@ -131,7 +130,7 @@ HLTDoubletDZ::HLTDoublet {} template <> -HLTDoubletDZ::HLTDoubletDZ(const edm::ParameterSet& iConfig) +HLTDoubletDZ::HLTDoubletDZ(const edm::ParameterSet& iConfig) : HLTFilter(iConfig), originTag1_(iConfig.template getParameter>("originTag1")), originTag2_(iConfig.template getParameter>("originTag2")), @@ -431,17 +430,16 @@ bool HLTDoubletDZ::compu } template <> -bool HLTDoubletDZ::computeDZ(edm::Event& iEvent, - l1t::TkMuonRef& r1, - l1t::TkMuonRef& r2) const { - const l1t::TkMuon& candidate1(*r1); - const l1t::TkMuon& candidate2(*r2); - if (reco::deltaR(candidate1, candidate2) < minDR_) +bool HLTDoubletDZ::computeDZ(edm::Event& iEvent, + l1t::TrackerMuonRef& r1, + l1t::TrackerMuonRef& r2) const { + if (reco::deltaR2(r1->phEta(), r1->phPhi(), + r2->phEta(), r2->phPhi()) < minDR_ * minDR_) return false; - // We don't care about minPixHitsForDZ_ with the L1TkMuons, + // We don't care about minPixHitsForDZ_ with the L1TTrackerMuons, // especially because the pixel does not participate in the L1T - if (std::abs(candidate1.trkzVtx() - candidate2.trkzVtx()) > maxDZ_) + if (std::abs(r1->phZ0() - r2->phZ0()) > maxDZ_) return false; return true; @@ -514,25 +512,25 @@ bool HLTDoubletDZ::hltFilter(edm::Event& iEvent, return accept; } -/// Special instantiation for L1TkMuon -/// L1TkMuon are *not* RecoCandidates, therefore they don't implement superCluster() +/// Special instantiation for L1TTrackerMuon +/// L1TTrackerMuon are *not* RecoCandidates, therefore they don't implement superCluster() /// They are LeafCandidates instead template <> -bool HLTDoubletDZ::hltFilter(edm::Event& iEvent, - const edm::EventSetup& iSetup, - trigger::TriggerFilterObjectWithRefs& filterproduct) const { +bool HLTDoubletDZ::hltFilter(edm::Event& iEvent, + const edm::EventSetup& iSetup, + trigger::TriggerFilterObjectWithRefs& filterproduct) const { // All HLT filters must create and fill an HLT filter object, // recording any reconstructed physics objects satisfying (or not) // this HLT filter, and place it in the Event. bool accept(false); - std::vector coll1; - std::vector coll2; + std::vector coll1; + std::vector coll2; if (getCollections(iEvent, coll1, coll2, filterproduct)) { int n(0); - l1t::TkMuonRef r1; - l1t::TkMuonRef r2; + l1t::TrackerMuonRef r1; + l1t::TrackerMuonRef r2; for (unsigned int i1 = 0; i1 != coll1.size(); i1++) { r1 = coll1[i1]; @@ -652,7 +650,7 @@ typedef HLTDoubletDZ HLT2ElectronMuo typedef HLTDoubletDZ HLT2PhotonPhotonDZ; typedef HLTDoubletDZ HLT2MuonPhotonDZ; typedef HLTDoubletDZ HLT2PhotonMuonDZ; -typedef HLTDoubletDZ HLT2L1TkMuonL1TkMuonDZ; +typedef HLTDoubletDZ HLT2L1TkMuonL1TkMuonDZ; typedef HLTDoubletDZ HLT2L1PFTauL1PFTauDZ; typedef HLTDoubletDZ HLT2L1HPSPFTauL1HPSPFTauDZ; diff --git a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc index 2107461f6688f..44a29f4fcb63d 100644 --- a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc +++ b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.cc @@ -70,7 +70,7 @@ bool HLTMuonTrkL1TkMuFilter::hltFilter(edm::Event& iEvent, << "Both input collection must be aligned and represent same physical muon objects"; edm::Handle previousLevelCands; - std::vector vl1cands; + std::vector vl1cands; bool check_l1match = true; if (m_previousCandTag == edm::InputTag("")) diff --git a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h index bc145acc4ca59..f8d0ebda7a4c1 100644 --- a/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h +++ b/HLTrigger/Muon/plugins/HLTMuonTrkL1TkMuFilter.h @@ -5,8 +5,7 @@ #include "DataFormats/RecoCandidate/interface/RecoChargedCandidateFwd.h" #include "DataFormats/MuonReco/interface/MuonFwd.h" #include "DataFormats/MuonReco/interface/MuonSelectors.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" namespace edm { class ConfigurationDescriptions; From 4aab56833b524d96f790422cf6f5a6d19e72401d Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 3 Aug 2022 21:50:34 +0200 Subject: [PATCH 48/66] Update L2MuonSeedGeneratorFromL1TkMu to use TrackerMuons --- .../plugins/L2MuonSeedGeneratorFromL1TkMu.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc b/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc index b3768cdb06a34..a091db54d14d2 100644 --- a/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc +++ b/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc @@ -31,8 +31,7 @@ #include "DataFormats/GeometrySurface/interface/BoundCylinder.h" #include "DataFormats/Math/interface/deltaR.h" #include "DataFormats/L1Trigger/interface/Muon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuon.h" -#include "DataFormats/L1TCorrelator/interface/TkMuonFwd.h" +#include "DataFormats/L1TMuonPhase2/interface/TrackerMuon.h" #include "CLHEP/Vector/ThreeVector.h" #include "Geometry/CommonDetUnit/interface/GeomDetEnumerators.h" @@ -64,7 +63,7 @@ class L2MuonSeedGeneratorFromL1TkMu : public edm::stream::EDProducer<> { private: edm::InputTag source_; - edm::EDGetTokenT muCollToken_; + edm::EDGetTokenT muCollToken_; edm::InputTag offlineSeedLabel_; edm::EDGetTokenT> offlineSeedToken_; @@ -105,7 +104,7 @@ class L2MuonSeedGeneratorFromL1TkMu : public edm::stream::EDProducer<> { // constructors L2MuonSeedGeneratorFromL1TkMu::L2MuonSeedGeneratorFromL1TkMu(const edm::ParameterSet &iConfig) : source_(iConfig.getParameter("InputObjects")), - muCollToken_(consumes(source_)), + muCollToken_(consumes(source_)), propagatorName_(iConfig.getParameter("Propagator")), l1MinPt_(iConfig.getParameter("L1MinPt")), l1MaxEta_(iConfig.getParameter("L1MaxEta")), @@ -170,7 +169,7 @@ void L2MuonSeedGeneratorFromL1TkMu::produce(edm::Event &iEvent, const edm::Event auto output = std::make_unique(); - edm::Handle muColl; + edm::Handle muColl; iEvent.getByToken(muCollToken_, muColl); LogDebug(metname) << "Number of muons " << muColl->size() << endl; From a0ebbb86ceb36d48d038f0bee98f345995906682 Mon Sep 17 00:00:00 2001 From: Thiago Date: Wed, 3 Aug 2022 22:05:06 +0200 Subject: [PATCH 49/66] Change all modules to use L1TkMuonsGmt --- .../python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py | 4 ++-- .../python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py | 2 +- .../python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py | 2 +- .../HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py | 2 +- .../hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py | 2 +- .../python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py | 4 ++-- .../python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py | 4 ++-- .../python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py | 2 +- .../python/HLT_75e33/modules/l1pfProducerHF_cfi.py | 2 +- .../python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py | 2 +- .../python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py | 2 +- 14 files changed, 17 insertions(+), 17 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py index 60cb4957f62f5..11f8e64440b97 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltDoubleMuon7DZ1p0_cfi.py @@ -8,8 +8,8 @@ checkSC = cms.bool(False), inputTag1 = cms.InputTag("hltL1TkDoubleMuFiltered7"), inputTag2 = cms.InputTag("hltL1TkDoubleMuFiltered7"), - originTag1 = cms.VInputTag("L1TkMuons"), - originTag2 = cms.VInputTag("L1TkMuons"), + originTag1 = cms.VInputTag("L1TkMuonsGmt"), + originTag2 = cms.VInputTag("L1TkMuonsGmt"), saveTags = cms.bool(True), triggerType1 = cms.int32(-114), triggerType2 = cms.int32(-114) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py index 78c5fe5e29e74..d1bce20ec2006 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1SingleMuFiltered5_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("L1TkMuons"), + inputTag = cms.InputTag("L1TkMuonsGmt"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py index 5660d6f6711a6..7acf98ae3655c 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkDoubleMuFiltered7_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("L1TkMuons"), + inputTag = cms.InputTag("L1TkMuonsGmt"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py index f480943a55742..f8862e10f50e5 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered15_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("L1TkMuons"), + inputTag = cms.InputTag("L1TkMuonsGmt"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py index 204aa745f1847..99108cb17273d 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkSingleMuFiltered22_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("L1TkMuons"), + inputTag = cms.InputTag("L1TkMuonsGmt"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py index 0e6d917ef3f3f..3d1718f2cd993 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TripleMuFiltered3_cfi.py @@ -10,6 +10,6 @@ endcap = cms.vdouble(0.864715, 1.03215, 0.0), overlap = cms.vdouble(0.920897, 1.03712, 0.0) ), - inputTag = cms.InputTag("L1TkMuons"), + inputTag = cms.InputTag("L1TkMuonsGmt"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py index 3ed1a35162fb8..ff8be9e59bbfc 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL2MuonSeedsFromL1TkMuon_cfi.py @@ -2,7 +2,7 @@ hltL2MuonSeedsFromL1TkMuon = cms.EDProducer("L2MuonSeedGeneratorFromL1TkMu", EtaMatchingBins = cms.vdouble(0.0, 2.5), - InputObjects = cms.InputTag("L1TkMuons"), + InputObjects = cms.InputTag("L1TkMuonsGmt"), L1MaxEta = cms.double(2.5), L1MinPt = cms.double(0.0), MatchDR = cms.vdouble(0.3), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py index 9d6935b10648e..0205710351542 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltPhase2L3FromL1TkMuonPixelTracksTrackingRegions_cfi.py @@ -5,7 +5,7 @@ beamSpot = cms.InputTag("offlineBeamSpot"), deltaEta = cms.double(0.035), deltaPhi = cms.double(0.02), - input = cms.InputTag("L1TkMuons"), + input = cms.InputTag("L1TkMuonsGmt"), maxNRegions = cms.int32(10000), maxNVertices = cms.int32(1), measurementTrackerName = cms.InputTag(""), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py index a1ad21234fd07..0bc8dd735d208 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DR0_cfi.py @@ -5,7 +5,7 @@ MinN = cms.int32(3), inputTag1 = cms.InputTag("hltL1TripleMuFiltered3"), inputTag2 = cms.InputTag("hltL1TripleMuFiltered3"), - originTag1 = cms.VInputTag("L1TkMuons"), - originTag2 = cms.VInputTag("L1TkMuons"), + originTag1 = cms.VInputTag("L1TkMuonsGmt"), + originTag2 = cms.VInputTag("L1TkMuonsGmt"), saveTags = cms.bool(True) ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py index a4e2fddb9db4e..28c78d10bf16e 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTripleMuon3DZ1p0_cfi.py @@ -8,8 +8,8 @@ checkSC = cms.bool(False), inputTag1 = cms.InputTag("hltL1TripleMuFiltered3"), inputTag2 = cms.InputTag("hltL1TripleMuFiltered3"), - originTag1 = cms.VInputTag("L1TkMuons"), - originTag2 = cms.VInputTag("L1TkMuons"), + originTag1 = cms.VInputTag("L1TkMuonsGmt"), + originTag2 = cms.VInputTag("L1TkMuonsGmt"), saveTags = cms.bool(True), triggerType1 = cms.int32(-114), triggerType2 = cms.int32(-114) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py index 88ca8763f9c5e..924acbbe4b455 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerBarrel_cfi.py @@ -63,7 +63,7 @@ phiExtra = cms.double(0.0), phiSlices = cms.uint32(1) )), - tkMuons = cms.InputTag("L1TkMuons"), + tkMuons = cms.InputTag("L1TkMuonsGmt"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag("pfTracksFromL1TracksBarrel"), trkMaxChi2 = cms.double(15), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py index af1bd6ba97838..ffcea8722ab6f 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHF_cfi.py @@ -71,7 +71,7 @@ phiSlices = cms.uint32(1) ) ), - tkMuons = cms.InputTag("L1TkMuons"), + tkMuons = cms.InputTag("L1TkMuonsGmt"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag(""), trkMaxChi2 = cms.double(15), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py index d917c7c2d0437..d742988b72480 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCalNoTK_cfi.py @@ -71,7 +71,7 @@ phiSlices = cms.uint32(1) ) ), - tkMuons = cms.InputTag("L1TkMuons"), + tkMuons = cms.InputTag("L1TkMuonsGmt"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag("pfTracksFromL1TracksHGCal"), trkMaxChi2 = cms.double(15), diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py index 8f43a22aa84a1..b38c9969aeb98 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/l1pfProducerHGCal_cfi.py @@ -71,7 +71,7 @@ phiSlices = cms.uint32(1) ) ), - tkMuons = cms.InputTag("L1TkMuons"), + tkMuons = cms.InputTag("L1TkMuonsGmt"), trackRegionMode = cms.string('atCalo'), tracks = cms.InputTag("pfTracksFromL1TracksHGCal"), trkMaxChi2 = cms.double(15), From 9de2c3a892c8b2ee75adf552497274d6c53e3b90 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 8 Aug 2022 11:57:59 +0200 Subject: [PATCH 50/66] change muon format --- DataFormats/HLTReco/src/classes_def.xml | 27 +++++++------------ DataFormats/L1TMuonPhase2/interface/SAMuon.h | 9 +++++++ .../L1TMuonPhase2/interface/TrackerMuon.h | 9 +++++++ 3 files changed, 28 insertions(+), 17 deletions(-) diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index fa1ffb1e203fb..7c683ec816624 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -41,25 +41,20 @@ + - -<<<<<<< HEAD - -======= + + ->>>>>>> 8d2f19a06de (Migrating DataFormats/HLTReco to TrackerMuon) - -<<<<<<< HEAD - -======= + + ->>>>>>> 8d2f19a06de (Migrating DataFormats/HLTReco to TrackerMuon) @@ -76,8 +71,9 @@ - - + + + @@ -85,12 +81,9 @@ - -<<<<<<< HEAD - -======= + + ->>>>>>> 8d2f19a06de (Migrating DataFormats/HLTReco to TrackerMuon) diff --git a/DataFormats/L1TMuonPhase2/interface/SAMuon.h b/DataFormats/L1TMuonPhase2/interface/SAMuon.h index b5158b8174fdc..6c7ce1992ea00 100644 --- a/DataFormats/L1TMuonPhase2/interface/SAMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/SAMuon.h @@ -8,6 +8,7 @@ #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h" #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "L1Trigger/Phase2L1GMT/interface/Constants.h" namespace l1t { @@ -31,6 +32,14 @@ namespace l1t { const uint hwBeta() const { return hwBeta_; } void setBeta(uint beta) { hwBeta_ = beta; } + // For HLT + const double phZ0() const { return Phase2L1GMT::LSBSAz0*hwZ0();} + const double phD0() const { return Phase2L1GMT::LSBSAd0*hwD0();} + const double phPt() const { return Phase2L1GMT::LSBpt*hwPt();} + const double phEta() const { return Phase2L1GMT::LSBeta*hwEta();} + const double phPhi() const { return Phase2L1GMT::LSBphi*hwPhi();} + const int phCharge() const {return pow(-1,hwCharge()); } + const uint64_t word() const { return word_; } void setWord(uint64_t word) { word_ = word; } void print() const; diff --git a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h index 6732a5230788c..d90dc0b5452e2 100644 --- a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h @@ -9,6 +9,7 @@ #include "DataFormats/L1TMuon/interface/RegionalMuonCandFwd.h" #include "DataFormats/L1TMuonPhase2/interface/MuonStub.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "L1Trigger/Phase2L1GMT/interface/Constants.h" namespace l1t { @@ -44,6 +45,14 @@ namespace l1t { void setHwIsoSum(int isoSum) { hwIsoSum_ = isoSum; } void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; } + // For HLT + const double phZ0() const { return Phase2L1GMT::LSBGTz0*hwZ0();} + const double phD0() const { return Phase2L1GMT::LSBGTd0*hwD0();} + const double phPt() const { return Phase2L1GMT::LSBpt*hwPt();} + const double phEta() const { return Phase2L1GMT::LSBeta*hwEta();} + const double phPhi() const { return Phase2L1GMT::LSBphi*hwPhi();} + const int phCharge() const {return pow(-1,hwCharge()); } + const std::array word() const { return word_; } void setWord(std::array word) { word_ = word; } void print() const; From b1a99749b19c4cc61fedbe031c300954176f91b9 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 8 Aug 2022 12:14:31 +0200 Subject: [PATCH 51/66] code format --- .../interface/TriggerRefsCollections.h | 2 +- .../HLTReco/src/classes_def.xml.generated | 118 ++++++++++++++++++ DataFormats/L1TMuonPhase2/interface/SAMuon.h | 14 +-- .../L1TMuonPhase2/interface/TrackerMuon.h | 12 +- .../plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc | 4 +- HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc | 12 +- .../HLTfilters/plugins/L1TEnergySumFilterT.h | 22 ++-- .../HLTfilters/plugins/L1TTkMuonFilter.cc | 8 +- .../HLTfilters/plugins/L1TTkMuonFilter.h | 2 +- 9 files changed, 155 insertions(+), 39 deletions(-) create mode 100644 DataFormats/HLTReco/src/classes_def.xml.generated diff --git a/DataFormats/HLTReco/interface/TriggerRefsCollections.h b/DataFormats/HLTReco/interface/TriggerRefsCollections.h index 633fb15e23079..73ba440151d8b 100644 --- a/DataFormats/HLTReco/interface/TriggerRefsCollections.h +++ b/DataFormats/HLTReco/interface/TriggerRefsCollections.h @@ -90,7 +90,7 @@ namespace trigger { // This is a std::vector, // and should be called TrackerMuonVectorRef upstream. // The L1T group should be made aware of that - typedef l1t::TrackerMuonRefVector VRl1ttkmuon; + typedef l1t::TrackerMuonRefVector VRl1ttkmuon; typedef l1t::TkElectronVectorRef VRl1ttkele; typedef l1t::TkEmVectorRef VRl1ttkem; typedef l1t::PFJetVectorRef VRl1tpfjet; diff --git a/DataFormats/HLTReco/src/classes_def.xml.generated b/DataFormats/HLTReco/src/classes_def.xml.generated new file mode 100644 index 0000000000000..7c683ec816624 --- /dev/null +++ b/DataFormats/HLTReco/src/classes_def.xml.generated @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DataFormats/L1TMuonPhase2/interface/SAMuon.h b/DataFormats/L1TMuonPhase2/interface/SAMuon.h index 6c7ce1992ea00..5f1a42fd00637 100644 --- a/DataFormats/L1TMuonPhase2/interface/SAMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/SAMuon.h @@ -32,13 +32,13 @@ namespace l1t { const uint hwBeta() const { return hwBeta_; } void setBeta(uint beta) { hwBeta_ = beta; } - // For HLT - const double phZ0() const { return Phase2L1GMT::LSBSAz0*hwZ0();} - const double phD0() const { return Phase2L1GMT::LSBSAd0*hwD0();} - const double phPt() const { return Phase2L1GMT::LSBpt*hwPt();} - const double phEta() const { return Phase2L1GMT::LSBeta*hwEta();} - const double phPhi() const { return Phase2L1GMT::LSBphi*hwPhi();} - const int phCharge() const {return pow(-1,hwCharge()); } + // For HLT + const double phZ0() const { return Phase2L1GMT::LSBSAz0 * hwZ0(); } + const double phD0() const { return Phase2L1GMT::LSBSAd0 * hwD0(); } + const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } + const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } + const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } + const int phCharge() const { return pow(-1, hwCharge()); } const uint64_t word() const { return word_; } void setWord(uint64_t word) { word_ = word; } diff --git a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h index d90dc0b5452e2..5756178b87287 100644 --- a/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h +++ b/DataFormats/L1TMuonPhase2/interface/TrackerMuon.h @@ -46,12 +46,12 @@ namespace l1t { void setHwIsoSumAp(int isoSum) { hwIsoSumAp_ = isoSum; } // For HLT - const double phZ0() const { return Phase2L1GMT::LSBGTz0*hwZ0();} - const double phD0() const { return Phase2L1GMT::LSBGTd0*hwD0();} - const double phPt() const { return Phase2L1GMT::LSBpt*hwPt();} - const double phEta() const { return Phase2L1GMT::LSBeta*hwEta();} - const double phPhi() const { return Phase2L1GMT::LSBphi*hwPhi();} - const int phCharge() const {return pow(-1,hwCharge()); } + const double phZ0() const { return Phase2L1GMT::LSBGTz0 * hwZ0(); } + const double phD0() const { return Phase2L1GMT::LSBGTd0 * hwD0(); } + const double phPt() const { return Phase2L1GMT::LSBpt * hwPt(); } + const double phEta() const { return Phase2L1GMT::LSBeta * hwEta(); } + const double phPhi() const { return Phase2L1GMT::LSBphi * hwPhi(); } + const int phCharge() const { return pow(-1, hwCharge()); } const std::array word() const { return word_; } void setWord(std::array word) { word_ = word; } diff --git a/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc b/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc index 77373a03f0883..1765bc272c441 100644 --- a/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc +++ b/HLTrigger/HLTfilters/plugins/HLT2L1TkMuonL1TkMuonMuRefDR.cc @@ -95,7 +95,9 @@ bool HLT2L1TkMuonL1TkMuonMuRefDR::getCollections(edm::Event& iEvent, return false; } -bool HLT2L1TkMuonL1TkMuonMuRefDR::computeDR(edm::Event& iEvent, l1t::TrackerMuonRef& r1, l1t::TrackerMuonRef& r2) const { +bool HLT2L1TkMuonL1TkMuonMuRefDR::computeDR(edm::Event& iEvent, + l1t::TrackerMuonRef& r1, + l1t::TrackerMuonRef& r2) const { if (minDR_ < 0.) return true; diff --git a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc index fea56d41569a3..9068a7d5302e5 100644 --- a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc +++ b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc @@ -431,10 +431,9 @@ bool HLTDoubletDZ::compu template <> bool HLTDoubletDZ::computeDZ(edm::Event& iEvent, - l1t::TrackerMuonRef& r1, - l1t::TrackerMuonRef& r2) const { - if (reco::deltaR2(r1->phEta(), r1->phPhi(), - r2->phEta(), r2->phPhi()) < minDR_ * minDR_) + l1t::TrackerMuonRef& r1, + l1t::TrackerMuonRef& r2) const { + if (reco::deltaR2(r1->phEta(), r1->phPhi(), r2->phEta(), r2->phPhi()) < minDR_ * minDR_) return false; // We don't care about minPixHitsForDZ_ with the L1TTrackerMuons, @@ -516,9 +515,8 @@ bool HLTDoubletDZ::hltFilter(edm::Event& iEvent, /// L1TTrackerMuon are *not* RecoCandidates, therefore they don't implement superCluster() /// They are LeafCandidates instead template <> -bool HLTDoubletDZ::hltFilter(edm::Event& iEvent, - const edm::EventSetup& iSetup, - trigger::TriggerFilterObjectWithRefs& filterproduct) const { +bool HLTDoubletDZ::hltFilter( + edm::Event& iEvent, const edm::EventSetup& iSetup, trigger::TriggerFilterObjectWithRefs& filterproduct) const { // All HLT filters must create and fill an HLT filter object, // recording any reconstructed physics objects satisfying (or not) // this HLT filter, and place it in the Event. diff --git a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h index 34c1f1523d97a..10ac88260ecf5 100644 --- a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h +++ b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h @@ -122,20 +122,20 @@ bool L1TEnergySumFilterT::hltFilter(edm::Event& iEvent, // However, it doesn't support std::vector, only the // older BXVector collection. if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMET) { - // MET is index [0], and uses .et() method - onlinePt = iSum->et(); + // MET is index [0], and uses .et() method + onlinePt = iSum->et(); } if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFHT) { - // HT is index [0], and uses .pt() method - onlinePt = iSum->pt(); + // HT is index [0], and uses .pt() method + onlinePt = iSum->pt(); } if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMHT) { - // MHT is index [1], and uses .pt() method - ++iSum; - onlinePt = iSum->pt(); + // MHT is index [1], and uses .pt() method + ++iSum; + onlinePt = iSum->pt(); } if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFETT) { - // As of now, L1 doesn't support this object it seems. + // As of now, L1 doesn't support this object it seems. } // Do the scaling @@ -143,9 +143,9 @@ bool L1TEnergySumFilterT::hltFilter(edm::Event& iEvent, // Add the passing element to the filterproduct. if (offlinePt >= minPt_) { - ++nSum; - edm::Ref> ref(l1tSums, std::distance(l1tSums->begin(), iSum)); - filterproduct.addObject(l1tSumType_, ref); + ++nSum; + edm::Ref> ref(l1tSums, std::distance(l1tSums->begin(), iSum)); + filterproduct.addObject(l1tSumType_, ref); } // return final filter decision diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index c20247d894c1f..f28ff2f00ce82 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -152,17 +152,15 @@ bool L1TTkMuonFilter::MuonQualityCut::operator()(const l1t::TrackerMuon& muon) c // If we didn't load any qualities from the config file, that means we don't care. // So we set passesQuality to true. - if(allowedQualities_.empty()) { + if (allowedQualities_.empty()) { passesQuality = true; return passesQuality; } // The muonDetector() method is not available for TrackerMuon (it was available in TkMuon), // so for the time being we just take the union of all quality vectors for all muon detectors. - for (const auto& detQuality: allowedQualities_) { - passesQuality = std::binary_search(detQuality.second.begin(), - detQuality.second.end(), - muon.hwQual()); + for (const auto& detQuality : allowedQualities_) { + passesQuality = std::binary_search(detQuality.second.begin(), detQuality.second.end(), muon.hwQual()); } return passesQuality; diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h index 4c67f65574d5f..e33e272b76cdf 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.h @@ -41,7 +41,7 @@ class L1TTkMuonFilter : public HLTFilter { std::unordered_map> allowedQualities_; }; - edm::InputTag l1TkMuonTag_; //input tag for L1 TrackerMuon product + edm::InputTag l1TkMuonTag_; //input tag for L1 TrackerMuon product edm::EDGetTokenT tkMuonToken_; // token identifying product containing L1 TrackerMuons double min_Pt_; // min pt cut From 17ec54c30da949214e4a303b98ceaf49359153cf Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 8 Aug 2022 15:01:17 +0200 Subject: [PATCH 52/66] clang warning --- HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc | 3 --- 1 file changed, 3 deletions(-) diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index f28ff2f00ce82..b47b4c8e33ab8 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -126,9 +126,6 @@ bool L1TTkMuonFilter::hltFilter(edm::Event& iEvent, } } } - for (const auto& muon : passingMuons) { - // TEMP filterproduct.addObject(trigger::TriggerObjectType::TriggerL1TkMu, muon); - } // return with final filter decision const bool accept(static_cast(passingMuons.size()) >= min_N_); From 18a540a02b41c2a94d1dc011c302bda3388961d8 Mon Sep 17 00:00:00 2001 From: Thiago Tomei Date: Fri, 12 Aug 2022 18:54:41 -0300 Subject: [PATCH 53/66] Update InputTag of hltL1TEGammaHGCFilteredCollectionProducer To address new collections from L1T emulator --- .../modules/hltL1TEGammaHGCFilteredCollectionProducer_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TEGammaHGCFilteredCollectionProducer_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TEGammaHGCFilteredCollectionProducer_cfi.py index ff87ba056dfe8..8c3afbada49d6 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TEGammaHGCFilteredCollectionProducer_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TEGammaHGCFilteredCollectionProducer_cfi.py @@ -2,7 +2,7 @@ hltL1TEGammaHGCFilteredCollectionProducer = cms.EDProducer("L1TEGammaFilteredCollectionProducer", applyQual = cms.bool(True), - inputTag = cms.InputTag("l1EGammaEEProducer","L1EGammaCollectionBXVWithCuts"), + inputTag = cms.InputTag("l1ctLayer1EG","L1EgEE"), maxBX = cms.int32(1), minBX = cms.int32(-1), minPt = cms.double(5.0), From fb2bed14bb1e6886642027013e1a57edfd3702f3 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Mon, 15 Aug 2022 11:29:49 +0200 Subject: [PATCH 54/66] adriano's comments --- .../interface/L1TPhase2MuonOffline.h | 36 ++---- .../python/L1TPhase2MuonOffline_cfi.py | 2 + .../L1Trigger/src/L1TPhase2MuonOffline.cc | 9 +- .../HLTReco/src/classes_def.xml.generated | 118 ------------------ .../plugins/L1TrackerEtMissProducer.cc | 8 +- 5 files changed, 18 insertions(+), 155 deletions(-) delete mode 100644 DataFormats/HLTReco/src/classes_def.xml.generated diff --git a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h index ba2cc0959d765..f93b2bf368c52 100644 --- a/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h +++ b/DQMOffline/L1Trigger/interface/L1TPhase2MuonOffline.h @@ -39,7 +39,6 @@ #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" // Common tools -//#include "MuonAnalysis/MuonAssociators/interface/PropagateToMuon.h" #include "TrackingTools/TransientTrack/interface/TransientTrack.h" #include "TrackingTools/TransientTrack/interface/TrackTransientTrack.h" #include "TrackingTools/TransientTrack/interface/TransientTrackBuilder.h" @@ -120,33 +119,20 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { std::map muonNames_; // config params - std::string histFolder_; - std::vector cutsVPSet_; + const std::string histFolder_; + const std::vector cutsVPSet_; - std::vector effVsPtBins_; - std::vector effVsPhiBins_; - std::vector effVsEtaBins_; + const std::vector effVsPtBins_; + const std::vector effVsPhiBins_; + const std::vector effVsEtaBins_; - bool useAtVtxCoord_; - bool isParticleGun_; - float maxGmtMuonDR_; + const double maxGmtMuonDR_; // Helper methods void matchMuonsToGen(std::vector genmus); std::vector getHistBinsEff(EffType eff); std::tuple getHistBinsRes(ResType res); - // Keys for histogram maps - /*typedef std::tuple histoKeyResType_; - typedef std::tuple histoKeyEffType_; - typedef std::tuple histoKeyVarType_; - */ - // Histograms and histogram containers - // std::map, MonitorElement*> efficiencyHistos_; - // std::map, MonitorElement*> resolutionHistos_; - // TH1F* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; - // TH1F* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; - MonitorElement* efficiencyNum_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; MonitorElement* efficiencyDen_[kNMuTypes][kNEtaRegions][kNQualLevels][kEffTypes]; MonitorElement* resolutionHistos_[kNMuTypes][kNEtaRegions][kNQualLevels][kNResTypes]; @@ -157,11 +143,11 @@ class L1TPhase2MuonOffline : public DQMEDAnalyzer { std::vector gmtTkMuonPairs_; std::vector> cuts_; - float lsb_pt; - float lsb_phi; - float lsb_eta; - float lsb_z0; - float lsb_d0; + float lsb_pt = Phase2L1GMT::LSBpt; + float lsb_phi = Phase2L1GMT::LSBphi; + float lsb_eta = Phase2L1GMT::LSBeta; + float lsb_z0 = Phase2L1GMT::LSBSAz0; + float lsb_d0 = Phase2L1GMT::LSBSAd0; }; // diff --git a/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py index 953ccf5075056..994e1f48587dd 100644 --- a/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py +++ b/DQMOffline/L1Trigger/python/L1TPhase2MuonOffline_cfi.py @@ -47,6 +47,8 @@ efficiencyVsPhiBins = cms.untracked.vdouble(effVsPhiBins), efficiencyVsEtaBins = cms.untracked.vdouble(effVsEtaBins), efficiencyVsVtxBins = cms.untracked.vdouble(effVsVtxBins), + + maxDR = cms.untracked.double(0.3), ) diff --git a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc index 6f39d2c1af8de..b63eb050abab3 100644 --- a/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc +++ b/DQMOffline/L1Trigger/src/L1TPhase2MuonOffline.cc @@ -123,16 +123,9 @@ L1TPhase2MuonOffline::L1TPhase2MuonOffline(const ParameterSet& ps) effVsPtBins_(ps.getUntrackedParameter>("efficiencyVsPtBins")), effVsPhiBins_(ps.getUntrackedParameter>("efficiencyVsPhiBins")), effVsEtaBins_(ps.getUntrackedParameter>("efficiencyVsEtaBins")), - maxGmtMuonDR_(0.3) { + maxGmtMuonDR_(ps.getUntrackedParameter("maxDR")) { edm::LogInfo("L1TPhase2MuonOffline") << "L1TPhase2MuonOffline::L1TPhase2MuonOffline()" << endl; - // Get Muon constants - lsb_pt = Phase2L1GMT::LSBpt; - lsb_phi = Phase2L1GMT::LSBphi; - lsb_eta = Phase2L1GMT::LSBeta; - lsb_z0 = Phase2L1GMT::LSBSAz0; - lsb_d0 = Phase2L1GMT::LSBSAd0; - for (const auto& c : cutsVPSet_) { const auto qCut = c.getUntrackedParameter("qualCut"); QualLevel qLevel = kQualOpen; diff --git a/DataFormats/HLTReco/src/classes_def.xml.generated b/DataFormats/HLTReco/src/classes_def.xml.generated deleted file mode 100644 index 7c683ec816624..0000000000000 --- a/DataFormats/HLTReco/src/classes_def.xml.generated +++ /dev/null @@ -1,118 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index ab031e65ff838..e3e368ada50da 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -39,10 +39,10 @@ class L1TrackerEtMissProducer : public edm::global::EDProducer<> { // ----------member data --------------------------- const edm::EDGetTokenT trackToken_; const edm::EDGetTokenT vtxAssocTrackToken_; - std::string L1MetCollectionName; - float maxPt_; // in GeV - int highPtTracks_; // saturate or truncate - bool debug_; + const std::string L1MetCollectionName; + const float maxPt_; // in GeV + const int highPtTracks_; // saturate or truncate + const bool debug_; }; // constructor From 7d34786bc6be958f422337b974e629e0f739fe9b Mon Sep 17 00:00:00 2001 From: Thiago Tomei Date: Wed, 17 Aug 2022 17:47:41 -0300 Subject: [PATCH 55/66] Update BuildFile.xml --- DataFormats/HLTReco/BuildFile.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/DataFormats/HLTReco/BuildFile.xml b/DataFormats/HLTReco/BuildFile.xml index 6e4c24de1329c..4329d740f10e2 100644 --- a/DataFormats/HLTReco/BuildFile.xml +++ b/DataFormats/HLTReco/BuildFile.xml @@ -11,6 +11,7 @@ + From cf2e7fac32328a2025e8920cee65a0e8f20b1f5b Mon Sep 17 00:00:00 2001 From: Thiago Tomei Date: Wed, 17 Aug 2022 17:48:57 -0300 Subject: [PATCH 56/66] Update BuildFile.xml --- HLTrigger/HLTcore/plugins/BuildFile.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/HLTrigger/HLTcore/plugins/BuildFile.xml b/HLTrigger/HLTcore/plugins/BuildFile.xml index 5b524a1fc1a9b..00f86179be846 100644 --- a/HLTrigger/HLTcore/plugins/BuildFile.xml +++ b/HLTrigger/HLTcore/plugins/BuildFile.xml @@ -9,6 +9,7 @@ + From 4001553db4be13f4effce7a77310fced03afa3a6 Mon Sep 17 00:00:00 2001 From: Thiago Tomei Date: Wed, 17 Aug 2022 17:49:42 -0300 Subject: [PATCH 57/66] Update BuildFile.xml --- HLTrigger/HLTfilters/plugins/BuildFile.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/HLTrigger/HLTfilters/plugins/BuildFile.xml b/HLTrigger/HLTfilters/plugins/BuildFile.xml index 0fa5752dc1a6c..d776b8fec9d3c 100644 --- a/HLTrigger/HLTfilters/plugins/BuildFile.xml +++ b/HLTrigger/HLTfilters/plugins/BuildFile.xml @@ -14,6 +14,7 @@ + From eaa14475f9317f76b9ab5ffe0970a8906e5262a8 Mon Sep 17 00:00:00 2001 From: Thiago Tomei Date: Wed, 17 Aug 2022 17:56:56 -0300 Subject: [PATCH 58/66] Update classes_def.xml Remove intermediate versions of DataFormats/HLTReco/src/classes_def.xml --- DataFormats/HLTReco/src/classes_def.xml | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/DataFormats/HLTReco/src/classes_def.xml b/DataFormats/HLTReco/src/classes_def.xml index 7c683ec816624..c0da653aa6527 100644 --- a/DataFormats/HLTReco/src/classes_def.xml +++ b/DataFormats/HLTReco/src/classes_def.xml @@ -43,18 +43,16 @@ - - - + + - - - + + @@ -71,9 +69,8 @@ - - - + + @@ -81,9 +78,8 @@ - - - + + From e782cbb18cbb66a5e7d5bdb94b986298257a445e Mon Sep 17 00:00:00 2001 From: Thiago Tomei Date: Wed, 17 Aug 2022 18:03:14 -0300 Subject: [PATCH 59/66] Update L1TTkMuonFilter.cc Remove unneeded extra object, add once again the objects to the filterproduct. --- HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index b47b4c8e33ab8..36bcb5edabf97 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -120,13 +120,16 @@ bool L1TTkMuonFilter::hltFilter(edm::Event& iEvent, double offlinePt = this->TkMuonOfflineEt(itkMuon->phPt(), itkMuon->phEta()); bool passesQual = !applyQuality_ || qualityCut_(*itkMuon); if (passesQual && offlinePt >= min_Pt_ && itkMuon->phEta() <= max_Eta_ && itkMuon->phEta() >= min_Eta_) { - l1t::TrackerMuonRef ref(l1t::TrackerMuonRef(tkMuons, distance(atrkmuons, itkMuon))); + l1t::TrackerMuonRef ref(tkMuons, distance(atrkmuons, itkMuon)); if (!applyDuplicateRemoval_ || !isDupMuon(ref, passingMuons)) { passingMuons.push_back(ref); } } } - + for (const auto& muon : passingMuons) { + filterproduct.addObject(trigger::TriggerObjectType::TriggerL1TkMu, muon); + } + // return with final filter decision const bool accept(static_cast(passingMuons.size()) >= min_N_); return accept; From 7662e95b3df05059362cef808debc9c667b21055 Mon Sep 17 00:00:00 2001 From: Thiago Tomei Date: Wed, 17 Aug 2022 18:06:45 -0300 Subject: [PATCH 60/66] Update hltTriggerSummaryAOD_cfi.py As of this round, the L1T emulator is run previously (in the "HLT" step) and with modules with different tags ("L1Tk*"). We adapt the hltTriggerSummaryAOD to these conditions. This can, of course, be revisited later. --- .../python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py index 27073fa207160..d31392edeefc5 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py @@ -2,7 +2,7 @@ hltTriggerSummaryAOD = cms.EDProducer( "TriggerSummaryProducerAOD", throw = cms.bool( False ), - processName = cms.string( "@" ), - moduleLabelPatternsToMatch = cms.vstring( 'hlt*' ), + processName = cms.string( "HLT" ), + moduleLabelPatternsToMatch = cms.vstring( 'hlt*','L1Tk*' ), moduleLabelPatternsToSkip = cms.vstring( ) ) From 5f68a0ac445b16ab65362deb0d1e53904edc6987 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Thu, 18 Aug 2022 14:12:59 +0200 Subject: [PATCH 61/66] code-format --- HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index 36bcb5edabf97..c0919194d5cea 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -129,7 +129,7 @@ bool L1TTkMuonFilter::hltFilter(edm::Event& iEvent, for (const auto& muon : passingMuons) { filterproduct.addObject(trigger::TriggerObjectType::TriggerL1TkMu, muon); } - + // return with final filter decision const bool accept(static_cast(passingMuons.size()) >= min_N_); return accept; From 4a48d24309a1248e4e660297052fc38656e8bcd7 Mon Sep 17 00:00:00 2001 From: Thiago Date: Thu, 18 Aug 2022 17:28:48 +0200 Subject: [PATCH 62/66] Addressing second round of comments --- HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h | 12 ++++++++++-- HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc | 5 ++--- HLTrigger/Muon/plugins/BuildFile.xml | 1 + RecoMuon/L2MuonSeedGenerator/plugins/BuildFile.xml | 1 + .../plugins/L2MuonSeedGeneratorFromL1TkMu.cc | 5 ++--- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h index 10ac88260ecf5..353e5bcae78f0 100644 --- a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h +++ b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h @@ -112,10 +112,12 @@ bool L1TEnergySumFilterT::hltFilter(edm::Event& iEvent, l1t::EtSum met = l1MetPF->at(0); l1extra_.puppiMETEt = met.et(); */ + if (l1tSums->size() < 1) { + throw cms::Exception("BadCollectionSize") << "l1tSums should have size() >= 1"; + } int nSum(0); double onlinePt(0.0); - double offlinePt(0.0); auto iSum = l1tSums->begin(); // The correct way of doing this would be using the EtSumHelper class. @@ -131,15 +133,21 @@ bool L1TEnergySumFilterT::hltFilter(edm::Event& iEvent, } if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMHT) { // MHT is index [1], and uses .pt() method + if (l1tSums->size() < 2) { + throw cms::Exception("BadCollectionSize") + << "If we want trigger::TriggerObjectType::TriggerL1PFMHT, l1tSums should have size() >= 2"; + } ++iSum; onlinePt = iSum->pt(); } if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFETT) { // As of now, L1 doesn't support this object it seems. + throw cms::Exception("UnsupportedType") + << "As of now, L1 doesn't support trigger::TriggerObjectType::TriggerL1PFETT"; } // Do the scaling - offlinePt = offlineEnergySum(onlinePt); + auto const offlinePt = offlineEnergySum(onlinePt); // Add the passing element to the filterproduct. if (offlinePt >= minPt_) { diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index c0919194d5cea..2cf6d0f84d99c 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -153,14 +153,13 @@ bool L1TTkMuonFilter::MuonQualityCut::operator()(const l1t::TrackerMuon& muon) c // If we didn't load any qualities from the config file, that means we don't care. // So we set passesQuality to true. if (allowedQualities_.empty()) { - passesQuality = true; - return passesQuality; + return true; } // The muonDetector() method is not available for TrackerMuon (it was available in TkMuon), // so for the time being we just take the union of all quality vectors for all muon detectors. for (const auto& detQuality : allowedQualities_) { - passesQuality = std::binary_search(detQuality.second.begin(), detQuality.second.end(), muon.hwQual()); + passesQuality |= std::binary_search(detQuality.second.begin(), detQuality.second.end(), muon.hwQual()); } return passesQuality; diff --git a/HLTrigger/Muon/plugins/BuildFile.xml b/HLTrigger/Muon/plugins/BuildFile.xml index 05bcb2db2d0da..0fb574044b932 100644 --- a/HLTrigger/Muon/plugins/BuildFile.xml +++ b/HLTrigger/Muon/plugins/BuildFile.xml @@ -4,6 +4,7 @@ + diff --git a/RecoMuon/L2MuonSeedGenerator/plugins/BuildFile.xml b/RecoMuon/L2MuonSeedGenerator/plugins/BuildFile.xml index 82a42fcffa6eb..eda34c6dead26 100644 --- a/RecoMuon/L2MuonSeedGenerator/plugins/BuildFile.xml +++ b/RecoMuon/L2MuonSeedGenerator/plugins/BuildFile.xml @@ -2,6 +2,7 @@ + diff --git a/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc b/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc index a091db54d14d2..59be316190f33 100644 --- a/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc +++ b/RecoMuon/L2MuonSeedGenerator/plugins/L2MuonSeedGeneratorFromL1TkMu.cc @@ -104,7 +104,7 @@ class L2MuonSeedGeneratorFromL1TkMu : public edm::stream::EDProducer<> { // constructors L2MuonSeedGeneratorFromL1TkMu::L2MuonSeedGeneratorFromL1TkMu(const edm::ParameterSet &iConfig) : source_(iConfig.getParameter("InputObjects")), - muCollToken_(consumes(source_)), + muCollToken_(consumes(source_)), propagatorName_(iConfig.getParameter("Propagator")), l1MinPt_(iConfig.getParameter("L1MinPt")), l1MaxEta_(iConfig.getParameter("L1MaxEta")), @@ -169,8 +169,7 @@ void L2MuonSeedGeneratorFromL1TkMu::produce(edm::Event &iEvent, const edm::Event auto output = std::make_unique(); - edm::Handle muColl; - iEvent.getByToken(muCollToken_, muColl); + auto const muColl = iEvent.getHandle(muCollToken_); LogDebug(metname) << "Number of muons " << muColl->size() << endl; edm::Handle> offlineSeedHandle; From aef00e14f74e9ca9b932c5623f3ba01dae7e79ae Mon Sep 17 00:00:00 2001 From: Thiago Date: Thu, 18 Aug 2022 17:29:35 +0200 Subject: [PATCH 63/66] Removing commented lines and cfi.py file of deprecated module --- .../HLT_75e33/modules/hltL1TkMuons_cfi.py | 49 ------------------- .../paths/HLT_IsoMu24_FromL1TkMuon_cfi.py | 2 - ...soVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py | 2 - .../paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py | 2 - .../paths/HLT_Mu50_FromL1TkMuon_cfi.py | 2 - ..._30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py | 2 - ...30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py | 2 - ..._45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py | 2 - ...40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py | 2 - .../HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py | 2 - .../HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py | 2 - .../paths/L1T_DoubleTkMuon_15_7_cfi.py | 2 - ...PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py | 2 - .../paths/L1T_PFPuppiHT450off_cfi.py | 2 - .../paths/L1T_SingleTkMuon_22_cfi.py | 2 - .../paths/L1T_TripleTkMuon_5_3_3_cfi.py | 2 - ...clPFClusteringForEgammaL1SeededTask_cfi.py | 2 - ...clPFClusteringForEgammaUnseededTask_cfi.py | 4 -- .../HLT_75e33/tasks/hgcalLocalRecoTask_cfi.py | 2 - .../tasks/l1tReconstructionTask_cfi.py | 40 --------------- .../particleFlowSuperClusteringTask_cfi.py | 2 - 21 files changed, 129 deletions(-) delete mode 100644 HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py deleted file mode 100644 index d7cb74cd1f28f..0000000000000 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltL1TkMuons_cfi.py +++ /dev/null @@ -1,49 +0,0 @@ -import FWCore.ParameterSet.Config as cms - -L1TkMuons = cms.EDProducer("L1TkMuonProducer", - CHI2MAX = cms.double(100.0), - DRmax = cms.double(0.5), - ETABARRELOVERLAP = cms.double(0.83), - ETAMAX = cms.double(5.0), - ETAMIN = cms.double(0), - ETAOVERLAPENDCAP = cms.double(1.24), - L1BMTFInputTag = cms.InputTag("simKBmtfDigis","BMTF"), - L1EMTFInputTag = cms.InputTag("simEmtfDigis","EMTF"), - L1EMTFTrackCollectionInputTag = cms.InputTag("simEmtfDigis"), - L1OMTFInputTag = cms.InputTag("simOmtfDigis","OMTF"), - L1TrackInputTag = cms.InputTag("TTTracksFromTrackletEmulation","Level1TTTracks"), - PTMINTRA = cms.double(2.0), - ZMAX = cms.double(25.0), - applyQualityCuts = cms.bool(True), - bmtfMatchAlgoVersion = cms.string('TP'), - correctGMTPropForTkZ = cms.bool(True), - do_relax_factors = cms.bool(True), - emtfMatchAlgoVersion = cms.string('MAnTra'), - emtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_boundaries.root'), - emtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_phi_q99.root'), - emtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_theta_q99.root'), - final_window_factor = cms.double(0.5), - initial_window_factor = cms.double(0.0), - mantra_bmtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_barrel/matching_windows_boundaries.root'), - mantra_bmtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_barrel/matching_windows_phi_q99.root'), - mantra_bmtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_barrel/matching_windows_theta_q99.root'), - mantra_emtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_boundaries.root'), - mantra_emtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_phi_q99.root'), - mantra_emtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_endcap/matching_windows_theta_q99.root'), - mantra_n_trk_par = cms.int32(4), - mantra_omtfcorr_boundaries = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_overlap/matching_windows_boundaries.root'), - mantra_omtfcorr_phi_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_overlap/matching_windows_phi_q99.root'), - mantra_omtfcorr_theta_windows = cms.FileInPath('L1Trigger/L1TMuon/data/MAnTra_data/matching_windows_overlap/matching_windows_theta_q99.root'), - max_trk_aeta = cms.double(2.5), - max_trk_chi2 = cms.double(100.0), - min_trk_nstubs = cms.int32(4), - min_trk_p = cms.double(3.5), - nStubsmin = cms.int32(4), - n_trk_par = cms.int32(4), - omtfMatchAlgoVersion = cms.string('MAnTra'), - pt_end_relax = cms.double(6.0), - pt_start_relax = cms.double(2.0), - use5ParameterFit = cms.bool(False), - useRegionEtaMatching = cms.bool(True), - useTPMatchWindows = cms.bool(True) -) diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py index 4cbf7f2d6e5da..5e7148ad37ab5 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_IsoMu24_FromL1TkMuon_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1TkSingleMuFiltered22_cfi import * from ..modules.hltL3crIsoL1TkSingleMu22L3f24QL3pfecalIsoFiltered0p41_cfi import * from ..modules.hltL3crIsoL1TkSingleMu22L3f24QL3pfhcalIsoFiltered0p40_cfi import * @@ -135,7 +134,6 @@ hltL3crIsoL1TkSingleMu22L3f24QL3trkIsoRegionalNewFiltered0p07EcalHcalHgcalTrk + HLTEndSequence, cms.Task( - #hltL1TkMuons, HGCalRecHit, HGCalUncalibRecHit, MeasurementTrackerEvent, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py index a55ae797e21f9..2568c0779b2f2 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_FromL1TkMuon_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltDiMuon178RelTrkIsoFiltered0p4_cfi import * from ..modules.hltDiMuon178RelTrkIsoFiltered0p4DzFiltered0p2_cfi import * from ..modules.hltDoubleMuon7DZ1p0_cfi import * @@ -108,7 +107,6 @@ hltDiMuon178RelTrkIsoFiltered0p4DzFiltered0p2 + HLTEndSequence, cms.Task( - #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py index 359d30459b51f..fa55599f0ad49 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu37_Mu27_FromL1TkMuon_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltDoubleMuon7DZ1p0_cfi import * from ..modules.hltL1TkDoubleMuFiltered7_cfi import * from ..modules.hltL1TkSingleMuFiltered15_cfi import * @@ -78,7 +77,6 @@ hltL3fL1DoubleMu155fFiltered37 + HLTEndSequence, cms.Task( - #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py index fa4a43a5f2afa..a00cba3bdb2d1 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_Mu50_FromL1TkMuon_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1TkSingleMuFiltered22_cfi import * from ..modules.hltL3fL1TkSingleMu22L3Filtered50Q_cfi import * from ..modules.hltCsc2DRecHits_cfi import * @@ -72,7 +71,6 @@ hltL3fL1TkSingleMu22L3Filtered50Q + HLTEndSequence, cms.Task( - #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py index d6d89d7ef9137..cb17730cf49be 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4_cfi.py @@ -11,7 +11,6 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepCSVSequencePFPuppiModEta2p4_cfi import * @@ -20,7 +19,6 @@ HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepCSV_2p4 = cms.Path( HLTBeginSequence + -# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py index 983c693953407..20fe3ab382a2e 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py @@ -11,7 +11,6 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepFlavourSequencePFPuppiModEta2p4_cfi import * @@ -20,7 +19,6 @@ HLT_PFHT200PT30_QuadPFPuppiJet_70_40_30_30_TriplePFPuppiBTagDeepFlavour_2p4 = cms.Path( HLTBeginSequence + -# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py index b054d18f2ba41..c6a36347edcf8 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4_cfi.py @@ -13,7 +13,6 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepCSVSequencePFPuppiModEta2p4_cfi import * @@ -22,7 +21,6 @@ HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepCSV_2p4 = cms.Path( HLTBeginSequence + -# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py index f493c0cb163ac..fe959a79637a0 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4_cfi.py @@ -13,7 +13,6 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTBtagDeepFlavourSequencePFPuppiModEta2p4_cfi import * @@ -22,7 +21,6 @@ HLT_PFHT330PT30_QuadPFPuppiJet_75_60_45_40_TriplePFPuppiBTagDeepFlavour_2p4 = cms.Path( HLTBeginSequence + -# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py index 8cd4576ab20b0..400cd9d02d87f 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_PFPuppiHT1070_cfi.py @@ -2,7 +2,6 @@ from ..modules.hltPFPuppiHT_cfi import * from ..modules.hltPFPuppiHT1070_cfi import * -#from ..modules.l1tPFPuppiHT_cfi import * from ..modules.l1tPFPuppiHT450off_cfi import * from ..sequences.HLTAK4PFPuppiJetsReconstruction_cfi import * from ..sequences.HLTBeginSequence_cfi import * @@ -11,7 +10,6 @@ HLT_PFPuppiHT1070 = cms.Path( HLTBeginSequence + -# l1tPFPuppiHT + l1tPFPuppiHT450off + HLTParticleFlowSequence + HLTAK4PFPuppiJetsReconstruction + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py index ae0ace601331b..837671ab8ab64 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/HLT_TriMu_10_5_5_DZ_FromL1TkMuon_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1SingleMuFiltered5_cfi import * from ..modules.hltL1TripleMuFiltered3_cfi import * from ..modules.hltL3fL1TkTripleMu533L31055DZFiltered0p2_cfi import * @@ -82,7 +81,6 @@ hltL3fL1TkTripleMu533L31055DZFiltered0p2 + HLTEndSequence, cms.Task( - #hltL1TkMuons, MeasurementTrackerEvent, hltCsc2DRecHits, hltCscSegments, diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_DoubleTkMuon_15_7_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_DoubleTkMuon_15_7_cfi.py index 3ca9103f968c5..defa5a7be673c 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_DoubleTkMuon_15_7_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_DoubleTkMuon_15_7_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltDoubleMuon7DZ1p0_cfi import * from ..modules.hltL1TkDoubleMuFiltered7_cfi import * from ..modules.hltL1TkSingleMuFiltered15_cfi import * @@ -9,7 +8,6 @@ L1T_DoubleTkMuon_15_7 = cms.Path( HLTBeginSequence + -# hltL1TkMuons + hltL1TkDoubleMuFiltered7 + hltL1TkSingleMuFiltered15 + hltDoubleMuon7DZ1p0 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py index 934d59492ea05..aa28a06dcb266 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4_cfi.py @@ -5,13 +5,11 @@ from ..modules.l1t4PFPuppiJet25OnlineMaxEta2p4_cfi import * from ..modules.l1t4PFPuppiJet40offMaxEta2p4_cfi import * from ..modules.l1tPFPuppiHT400offMaxEta2p4_cfi import * -#from ..modules.l1tPFPuppiHT_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTEndSequence_cfi import * L1T_PFHT400PT30_QuadPFPuppiJet_70_55_40_40_2p4 = cms.Path( HLTBeginSequence + -# l1tPFPuppiHT + l1tPFPuppiHT400offMaxEta2p4 + l1t1PFPuppiJet70offMaxEta2p4 + l1t2PFPuppiJet55offMaxEta2p4 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py index 06d596d03fe94..b3fbd809aede9 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_PFPuppiHT450off_cfi.py @@ -1,13 +1,11 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.l1tPFPuppiHT_cfi import * from ..modules.l1tPFPuppiHT450off_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTEndSequence_cfi import * L1T_PFPuppiHT450off = cms.Path( HLTBeginSequence + -# l1tPFPuppiHT + l1tPFPuppiHT450off + HLTEndSequence ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_SingleTkMuon_22_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_SingleTkMuon_22_cfi.py index f5b4beb61d529..344602fcd36f4 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_SingleTkMuon_22_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_SingleTkMuon_22_cfi.py @@ -1,13 +1,11 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1TkSingleMuFiltered22_cfi import * from ..sequences.HLTBeginSequence_cfi import * from ..sequences.HLTEndSequence_cfi import * L1T_SingleTkMuon_22 = cms.Path( HLTBeginSequence + -# hltL1TkMuons + hltL1TkSingleMuFiltered22 + HLTEndSequence ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_TripleTkMuon_5_3_3_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_TripleTkMuon_5_3_3_cfi.py index 7a9da1aaf4953..6d1606d7fa462 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_TripleTkMuon_5_3_3_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/paths/L1T_TripleTkMuon_5_3_3_cfi.py @@ -1,6 +1,5 @@ import FWCore.ParameterSet.Config as cms -#from ..modules.hltL1TkMuons_cfi import * from ..modules.hltL1SingleMuFiltered5_cfi import * from ..modules.hltL1TripleMuFiltered3_cfi import * from ..modules.hltTripleMuon3DR0_cfi import * @@ -10,7 +9,6 @@ L1T_TripleTkMuon_5_3_3 = cms.Path( HLTBeginSequence + -# hltL1TkMuons + hltL1TripleMuFiltered3 + hltL1SingleMuFiltered5 + hltTripleMuon3DZ1p0 + diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaL1SeededTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaL1SeededTask_cfi.py index aaaf9cb26eb32..bbf4fba111b37 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaL1SeededTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaL1SeededTask_cfi.py @@ -13,7 +13,6 @@ from ..modules.particleFlowRecHitHGCL1Seeded_cfi import * from ..modules.particleFlowSuperClusterHGCalFromTICLL1Seeded_cfi import * from ..modules.ticlLayerTileProducerL1Seeded_cfi import * -#from ..modules.ticlMultiClustersFromTrackstersMergeL1Seeded_cfi import * from ..modules.ticlSeedingL1_cfi import * from ..modules.ticlTrackstersEML1_cfi import * @@ -31,7 +30,6 @@ particleFlowRecHitHGCL1Seeded, particleFlowSuperClusterHGCalFromTICLL1Seeded, ticlLayerTileProducerL1Seeded, - #ticlMultiClustersFromTrackstersMergeL1Seeded, ticlSeedingL1, ticlTrackstersEML1 ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaUnseededTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaUnseededTask_cfi.py index 4d9434ca3890a..87e5a8dfc34c1 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaUnseededTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/HLTHgcalTiclPFClusteringForEgammaUnseededTask_cfi.py @@ -12,8 +12,6 @@ from ..modules.particleFlowRecHitHGC_cfi import * from ..modules.particleFlowSuperClusterHGCalFromTICLUnseeded_cfi import * from ..modules.ticlLayerTileProducer_cfi import * -#from ..modules.ticlMultiClustersFromTrackstersEMForEgamma_cfi import * -#from ..modules.ticlMultiClustersFromTrackstersHADForEgamma_cfi import * from ..modules.ticlSeedingGlobal_cfi import * from ..modules.ticlTrackstersEMForEgamma_cfi import * from ..modules.ticlTrackstersHADForEgamma_cfi import * @@ -31,8 +29,6 @@ particleFlowRecHitHGC, particleFlowSuperClusterHGCalFromTICLUnseeded, ticlLayerTileProducer, -# ticlMultiClustersFromTrackstersEMForEgamma, -# ticlMultiClustersFromTrackstersHADForEgamma, ticlSeedingGlobal, ticlTrackstersEMForEgamma, ticlTrackstersHADForEgamma diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/hgcalLocalRecoTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/hgcalLocalRecoTask_cfi.py index 81db48377a725..b268e3e5bace5 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/hgcalLocalRecoTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/hgcalLocalRecoTask_cfi.py @@ -4,7 +4,6 @@ from ..modules.HGCalRecHit_cfi import * from ..modules.HGCalUncalibRecHit_cfi import * from ..modules.particleFlowClusterHGCal_cfi import * -#from ..modules.particleFlowClusterHGCalFromMultiCl_cfi import * from ..modules.particleFlowRecHitHGC_cfi import * hgcalLocalRecoTask = cms.Task( @@ -12,6 +11,5 @@ HGCalUncalibRecHit, hgcalLayerClusters, particleFlowClusterHGCal, -# particleFlowClusterHGCalFromMultiCl, particleFlowRecHitHGC ) diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py index 1cdd84ea2fed8..9dbe93bc599ef 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/l1tReconstructionTask_cfi.py @@ -3,26 +3,6 @@ from ..modules.L1EGammaClusterEmuProducer_cfi import * from ..modules.l1EGammaEEProducer_cfi import * from ..modules.l1NNTauProducerPuppi_cfi import * -#from ..modules.l1pfCandidates_cfi import * -#from ..modules.l1PFMetPuppi_cfi import * -#from ..modules.l1pfProducerBarrel_cfi import * -#from ..modules.l1pfProducerHF_cfi import * -#from ..modules.l1pfProducerHGCal_cfi import * -#from ..modules.l1pfProducerHGCalNoTK_cfi import * -#from ..modules.hltL1TkElectronsEllipticMatchCrystal_cfi import * -#from ..modules.hltL1TkElectronsEllipticMatchHGC_cfi import * -#from ..modules.hltL1TkMuons_cfi import * -#from ..modules.hltL1TkPhotonsCrystal_cfi import * -#from ..modules.hltL1TkPhotonsHGC_cfi import * -#from ..modules.L1TkPrimaryVertex_cfi import * -#from ..modules.l1tSlwPFPuppiJets_cfi import * -#from ..modules.l1tSlwPFPuppiJetsCorrected_cfi import * -#from ..modules.pfClustersFromCombinedCaloHCal_cfi import * -#from ..modules.pfClustersFromCombinedCaloHF_cfi import * -#from ..modules.pfClustersFromHGC3DClusters_cfi import * -#from ..modules.pfClustersFromL1EGClusters_cfi import * -#from ..modules.pfTracksFromL1TracksBarrel_cfi import * -#from ..modules.pfTracksFromL1TracksHGCal_cfi import * from ..modules.simCaloStage2Layer1Digis_cfi import * from ..modules.simCscTriggerPrimitiveDigis_cfi import * @@ -39,28 +19,8 @@ l1tReconstructionTask = cms.Task( L1EGammaClusterEmuProducer, -# hltL1TkElectronsEllipticMatchCrystal, -# hltL1TkElectronsEllipticMatchHGC, -# hltL1TkMuons, -# hltL1TkPhotonsCrystal, -# hltL1TkPhotonsHGC, -# L1TkPrimaryVertex, l1EGammaEEProducer, l1NNTauProducerPuppi, - #l1PFMetPuppi, - #l1pfCandidates, - #l1pfProducerBarrel, - #l1pfProducerHF, - #l1pfProducerHGCal, - #l1pfProducerHGCalNoTK, - #l1tSlwPFPuppiJets, - #l1tSlwPFPuppiJetsCorrected, - #pfClustersFromCombinedCaloHCal, - #pfClustersFromCombinedCaloHF, - #pfClustersFromHGC3DClusters, - #pfClustersFromL1EGClusters, - #pfTracksFromL1TracksBarrel, - #pfTracksFromL1TracksHGCal, simCaloStage2Layer1Digis, simCscTriggerPrimitiveDigis, simDtTriggerPrimitiveDigis, diff --git a/HLTrigger/Configuration/python/HLT_75e33/tasks/particleFlowSuperClusteringTask_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/tasks/particleFlowSuperClusteringTask_cfi.py index e5f5f1586557f..d73e8ad6c4ab8 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/tasks/particleFlowSuperClusteringTask_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/tasks/particleFlowSuperClusteringTask_cfi.py @@ -2,10 +2,8 @@ from ..modules.particleFlowSuperClusterECAL_cfi import * from ..modules.particleFlowSuperClusterHGCal_cfi import * -#from ..modules.particleFlowSuperClusterHGCalFromMultiCl_cfi import * particleFlowSuperClusteringTask = cms.Task( particleFlowSuperClusterECAL, particleFlowSuperClusterHGCal, -# particleFlowSuperClusterHGCalFromMultiCl ) From 5e891a83ba1321baf220fda40153c586b40f6f6f Mon Sep 17 00:00:00 2001 From: ccaillol Date: Fri, 19 Aug 2022 09:36:54 +0200 Subject: [PATCH 64/66] try to fix failed tests --- .../python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py index d31392edeefc5..28722e4589268 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py @@ -3,6 +3,6 @@ hltTriggerSummaryAOD = cms.EDProducer( "TriggerSummaryProducerAOD", throw = cms.bool( False ), processName = cms.string( "HLT" ), - moduleLabelPatternsToMatch = cms.vstring( 'hlt*','L1Tk*' ), + moduleLabelPatternsToMatch = cms.vstring( 'hlt*'), moduleLabelPatternsToSkip = cms.vstring( ) ) From 338d63c616c621afd28f277d431a067c222d7389 Mon Sep 17 00:00:00 2001 From: ccaillol Date: Fri, 19 Aug 2022 16:26:13 +0200 Subject: [PATCH 65/66] andrea's comments --- .../modules/hltTriggerSummaryAOD_cfi.py | 2 +- HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc | 6 +- .../HLTfilters/plugins/L1TEnergySumFilterT.h | 6 +- .../HLTfilters/plugins/L1TTkMuonFilter.cc | 3 +- .../plugins/L1TrackerEtMissProducer.cc | 4 +- .../python/L1TrackSelectionProducer_cfi.py | 66 +++++++++---------- .../python/L1TrackerEtMissProducer_cfi.py | 18 ++--- 7 files changed, 48 insertions(+), 57 deletions(-) diff --git a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py index 28722e4589268..53e10468205a3 100644 --- a/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py +++ b/HLTrigger/Configuration/python/HLT_75e33/modules/hltTriggerSummaryAOD_cfi.py @@ -3,6 +3,6 @@ hltTriggerSummaryAOD = cms.EDProducer( "TriggerSummaryProducerAOD", throw = cms.bool( False ), processName = cms.string( "HLT" ), - moduleLabelPatternsToMatch = cms.vstring( 'hlt*'), + moduleLabelPatternsToMatch = cms.vstring( 'hlt*','L1Tk*'), moduleLabelPatternsToSkip = cms.vstring( ) ) diff --git a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc index 9068a7d5302e5..05e21f2258494 100644 --- a/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc +++ b/HLTrigger/HLTfilters/plugins/HLTDoubletDZ.cc @@ -433,14 +433,14 @@ template <> bool HLTDoubletDZ::computeDZ(edm::Event& iEvent, l1t::TrackerMuonRef& r1, l1t::TrackerMuonRef& r2) const { - if (reco::deltaR2(r1->phEta(), r1->phPhi(), r2->phEta(), r2->phPhi()) < minDR_ * minDR_) - return false; - // We don't care about minPixHitsForDZ_ with the L1TTrackerMuons, // especially because the pixel does not participate in the L1T if (std::abs(r1->phZ0() - r2->phZ0()) > maxDZ_) return false; + if (reco::deltaR2(r1->phEta(), r1->phPhi(), r2->phEta(), r2->phPhi()) < minDR_ * minDR_) + return false; + return true; } diff --git a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h index 353e5bcae78f0..4c27c57e1af85 100644 --- a/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h +++ b/HLTrigger/HLTfilters/plugins/L1TEnergySumFilterT.h @@ -126,12 +126,10 @@ bool L1TEnergySumFilterT::hltFilter(edm::Event& iEvent, if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMET) { // MET is index [0], and uses .et() method onlinePt = iSum->et(); - } - if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFHT) { + } else if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFHT) { // HT is index [0], and uses .pt() method onlinePt = iSum->pt(); - } - if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMHT) { + } else if (l1tSumType_ == trigger::TriggerObjectType::TriggerL1PFMHT) { // MHT is index [1], and uses .pt() method if (l1tSums->size() < 2) { throw cms::Exception("BadCollectionSize") diff --git a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc index 2cf6d0f84d99c..ee96668e92a24 100644 --- a/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc +++ b/HLTrigger/HLTfilters/plugins/L1TTkMuonFilter.cc @@ -148,14 +148,13 @@ L1TTkMuonFilter::MuonQualityCut::MuonQualityCut(const edm::ParameterSet& iConfig } bool L1TTkMuonFilter::MuonQualityCut::operator()(const l1t::TrackerMuon& muon) const { - bool passesQuality(false); - // If we didn't load any qualities from the config file, that means we don't care. // So we set passesQuality to true. if (allowedQualities_.empty()) { return true; } + bool passesQuality(false); // The muonDetector() method is not available for TrackerMuon (it was available in TkMuon), // so for the time being we just take the union of all quality vectors for all muon detectors. for (const auto& detQuality : allowedQualities_) { diff --git a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc index e3e368ada50da..26354dc81a3e6 100644 --- a/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc +++ b/L1Trigger/L1TTrackMatch/plugins/L1TrackerEtMissProducer.cc @@ -31,7 +31,7 @@ class L1TrackerEtMissProducer : public edm::global::EDProducer<> { typedef edm::RefVector L1TTTrackRefCollectionType; explicit L1TrackerEtMissProducer(const edm::ParameterSet&); - ~L1TrackerEtMissProducer() override; + ~L1TrackerEtMissProducer() override = default; private: void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override; @@ -57,8 +57,6 @@ L1TrackerEtMissProducer::L1TrackerEtMissProducer(const edm::ParameterSet& iConfi produces(L1MetCollectionName); } -L1TrackerEtMissProducer::~L1TrackerEtMissProducer() {} - void L1TrackerEtMissProducer::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const { using namespace edm; diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py index 9be5ca92b8e42..b353b1b68a933 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py @@ -7,47 +7,43 @@ l1VerticesEmulationInputTag = cms.InputTag("L1VertexFinderEmulator", "l1verticesEmulation"), outputCollectionName = cms.string("Level1TTTracksSelected"), cutSet = cms.PSet( - ptMin = cms.double(2.0), # pt must be greater than this value, [GeV] - absEtaMax = cms.double(2.4), # absolute value of eta must be less than this value - absZ0Max = cms.double(15.0), # z0 must be less than this value, [cm] - nStubsMin = cms.int32(4), # number of stubs must be greater than or equal to this value - nPSStubsMin = cms.int32(0), # the number of stubs in the PS Modules must be greater than or equal to this value - - reducedBendChi2Max = cms.double(2.25), # bend chi2 must be less than this value - reducedChi2RZMax = cms.double(5.0), # chi2rz/dof must be less than this value - reducedChi2RPhiMax = cms.double(20.0), # chi2rphi/dof must be less than this value - - #deltaZMaxEtaBounds = cms.vdouble(0.0, absEtaMax.value), # these values define the bin boundaries in |eta| - #deltaZMax = cms.vdouble(0.5), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] - deltaZMaxEtaBounds = cms.vdouble(0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4), # these values define the bin boundaries in |eta| - deltaZMax = cms.vdouble(0.37, 0.50, 0.60, 0.75, 1.00, 1.60), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] + ptMin = 2.0, # pt must be greater than this value, [GeV] + absEtaMax = 2.4, # absolute value of eta must be less than this value + absZ0Max = 15.0, # z0 must be less than this value, [cm] + nStubsMin = 4, # number of stubs must be greater than or equal to this value + nPSStubsMin = 0, # the number of stubs in the PS Modules must be greater than or equal to this value + + reducedBendChi2Max = 2.25, # bend chi2 must be less than this value + reducedChi2RZMax = 5.0, # chi2rz/dof must be less than this value + reducedChi2RPhiMax = 20.0, # chi2rphi/dof must be less than this value + + deltaZMaxEtaBounds = [0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4], # these values define the bin boundaries in |eta| + deltaZMax = cms.vdouble[0.37, 0.50, 0.60, 0.75, 1.00, 1.60], # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] ), - useDisplacedTracksDeltaZOverride = cms.double(-1.0), # override the deltaZ cut value for displaced tracks - processSimulatedTracks = cms.bool(True), # return selected tracks after cutting on the floating point values - processEmulatedTracks = cms.bool(True), # return selected tracks after cutting on the bitwise emulated values - debug = cms.int32(0) # Verbosity levels: 0, 1, 2, 3, 4 + useDisplacedTracksDeltaZOverride = -1.0, # override the deltaZ cut value for displaced tracks + processSimulatedTracks = True, # return selected tracks after cutting on the floating point values + processEmulatedTracks = True, # return selected tracks after cutting on the bitwise emulated values + debug = 0 # Verbosity levels: 0, 1, 2, 3, 4 ) L1TrackSelectionProducerExtended = L1TrackSelectionProducer.clone( - l1TracksInputTag = cms.InputTag("L1GTTInputProducerExtended","Level1TTTracksExtendedConverted"), - outputCollectionName = cms.string("Level1TTTracksExtendedSelected"), + l1TracksInputTag = ("L1GTTInputProducerExtended","Level1TTTracksExtendedConverted"), + outputCollectionName = "Level1TTTracksExtendedSelected", cutSet = cms.PSet( - ptMin = cms.double(3.0), # pt must be greater than this value, [GeV] - absEtaMax = cms.double(2.4), # absolute value of eta must be less than this value - absZ0Max = cms.double(15.0), # z0 must be less than this value, [cm] - nStubsMin = cms.int32(4), # number of stubs must be greater than or equal to this value - nPSStubsMin = cms.int32(0), # the number of stubs in the PS Modules must be greater than or equal to this value - - reducedBendChi2Max = cms.double(2.4), # bend chi2 must be less than this value - reducedChi2RZMax = cms.double(10.0), # chi2rz/dof must be less than this value - reducedChi2RPhiMax = cms.double(40.0), # chi2rphi/dof must be less than this value - - #deltaZMaxEtaBounds = cms.vdouble(0.0, absEtaMax.value), # these values define the bin boundaries in |eta| - #deltaZMax = cms.vdouble(0.5), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] - deltaZMaxEtaBounds = cms.vdouble(0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4), # these values define the bin boundaries in |eta| - deltaZMax = cms.vdouble(3.0, 3.0, 3.0, 3.0, 3.0, 3.0), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] + ptMin = 3.0, # pt must be greater than this value, [GeV] + absEtaMax = 2.4, # absolute value of eta must be less than this value + absZ0Max = 15.0, # z0 must be less than this value, [cm] + nStubsMin = 4, # number of stubs must be greater than or equal to this value + nPSStubsMin = 0, # the number of stubs in the PS Modules must be greater than or equal to this value + + reducedBendChi2Max = 2.4, # bend chi2 must be less than this value + reducedChi2RZMax = 10.0, # chi2rz/dof must be less than this value + reducedChi2RPhiMax = 40.0, # chi2rphi/dof must be less than this value + + deltaZMaxEtaBounds = [0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4], # these values define the bin boundaries in |eta| + deltaZMax = [3.0, 3.0, 3.0, 3.0, 3.0, 3.0], # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] ), - useDisplacedTracksDeltaZOverride = cms.double(3.0), # Use promt/displaced tracks + useDisplacedTracksDeltaZOverride = 3.0, # Use promt/displaced tracks ) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py index 3501098763fbb..9340e5281990b 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -3,20 +3,20 @@ from L1Trigger.L1TTrackMatch.L1TrackSelectionProducer_cfi import L1TrackSelectionProducer, L1TrackSelectionProducerExtended L1TrackerEtMiss = cms.EDProducer('L1TrackerEtMissProducer', - L1TrackInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value()), - L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), - L1MetCollectionName = cms.string("L1TrackerEtMiss"), - maxPt = cms.double( -10. ), # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as + L1TrackInputTag = ("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value()), + L1TrackAssociatedInputTag = ("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), + L1MetCollectionName = "L1TrackerEtMiss", + maxPt = -10. , # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. # When maxPt < 0, no special treatment is done for high PT tracks. - highPtTracks = cms.int32( 1 ), # when = 0 : truncation. Tracks with PT above maxPt are ignored + highPtTracks = 1 , # when = 0 : truncation. Tracks with PT above maxPt are ignored # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. # When maxPt < 0, no special treatment is done for high PT tracks. - debug = cms.bool(False) + debug = False ) L1TrackerEtMissExtended = L1TrackerEtMiss.clone( #NOT OPTIMIZED, STUDIED, OR USED - L1TrackInputTag = cms.InputTag("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value()), - L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value() + "Associated"), - L1MetCollectionName = cms.string("L1TrackerExtendedEtMiss"), + L1TrackInputTag = ("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value()), + L1TrackAssociatedInputTag = ("L1TrackSelectionProducerExtended", L1TrackSelectionProducerExtended.outputCollectionName.value() + "Associated"), + L1MetCollectionName = "L1TrackerExtendedEtMiss", ) From f6c5d02e18f03e70fc6f95a58c8e0782770d356e Mon Sep 17 00:00:00 2001 From: ccaillol Date: Fri, 19 Aug 2022 21:48:03 +0200 Subject: [PATCH 66/66] fix cfi --- .../python/L1TrackSelectionProducer_cfi.py | 58 +++++++++---------- .../python/L1TrackerEtMissProducer_cfi.py | 12 ++-- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py index b353b1b68a933..823a998f85c08 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackSelectionProducer_cfi.py @@ -7,43 +7,43 @@ l1VerticesEmulationInputTag = cms.InputTag("L1VertexFinderEmulator", "l1verticesEmulation"), outputCollectionName = cms.string("Level1TTTracksSelected"), cutSet = cms.PSet( - ptMin = 2.0, # pt must be greater than this value, [GeV] - absEtaMax = 2.4, # absolute value of eta must be less than this value - absZ0Max = 15.0, # z0 must be less than this value, [cm] - nStubsMin = 4, # number of stubs must be greater than or equal to this value - nPSStubsMin = 0, # the number of stubs in the PS Modules must be greater than or equal to this value - - reducedBendChi2Max = 2.25, # bend chi2 must be less than this value - reducedChi2RZMax = 5.0, # chi2rz/dof must be less than this value - reducedChi2RPhiMax = 20.0, # chi2rphi/dof must be less than this value - - deltaZMaxEtaBounds = [0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4], # these values define the bin boundaries in |eta| - deltaZMax = cms.vdouble[0.37, 0.50, 0.60, 0.75, 1.00, 1.60], # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] + ptMin = cms.double(2.0), # pt must be greater than this value, [GeV] + absEtaMax = cms.double(2.4), # absolute value of eta must be less than this value + absZ0Max = cms.double(15.0), # z0 must be less than this value, [cm] + nStubsMin = cms.int32(4), # number of stubs must be greater than or equal to this value + nPSStubsMin = cms.int32(0), # the number of stubs in the PS Modules must be greater than or equal to this value + + reducedBendChi2Max = cms.double(2.25), # bend chi2 must be less than this value + reducedChi2RZMax = cms.double(5.0), # chi2rz/dof must be less than this value + reducedChi2RPhiMax = cms.double(20.0), # chi2rphi/dof must be less than this value + + deltaZMaxEtaBounds = cms.vdouble(0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4), # these values define the bin boundaries in |eta| + deltaZMax = cms.vdouble(0.37, 0.50, 0.60, 0.75, 1.00, 1.60), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] ), - useDisplacedTracksDeltaZOverride = -1.0, # override the deltaZ cut value for displaced tracks - processSimulatedTracks = True, # return selected tracks after cutting on the floating point values - processEmulatedTracks = True, # return selected tracks after cutting on the bitwise emulated values - debug = 0 # Verbosity levels: 0, 1, 2, 3, 4 + useDisplacedTracksDeltaZOverride = cms.double(-1.0), # override the deltaZ cut value for displaced tracks + processSimulatedTracks = cms.bool(True), # return selected tracks after cutting on the floating point values + processEmulatedTracks = cms.bool(True), # return selected tracks after cutting on the bitwise emulated values + debug = cms.int32(0) # Verbosity levels: 0, 1, 2, 3, 4 ) L1TrackSelectionProducerExtended = L1TrackSelectionProducer.clone( l1TracksInputTag = ("L1GTTInputProducerExtended","Level1TTTracksExtendedConverted"), outputCollectionName = "Level1TTTracksExtendedSelected", cutSet = cms.PSet( - ptMin = 3.0, # pt must be greater than this value, [GeV] - absEtaMax = 2.4, # absolute value of eta must be less than this value - absZ0Max = 15.0, # z0 must be less than this value, [cm] - nStubsMin = 4, # number of stubs must be greater than or equal to this value - nPSStubsMin = 0, # the number of stubs in the PS Modules must be greater than or equal to this value - - reducedBendChi2Max = 2.4, # bend chi2 must be less than this value - reducedChi2RZMax = 10.0, # chi2rz/dof must be less than this value - reducedChi2RPhiMax = 40.0, # chi2rphi/dof must be less than this value - - deltaZMaxEtaBounds = [0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4], # these values define the bin boundaries in |eta| - deltaZMax = [3.0, 3.0, 3.0, 3.0, 3.0, 3.0], # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] + ptMin = cms.double(3.0), # pt must be greater than this value, [GeV] + absEtaMax = cms.double(2.4), # absolute value of eta must be less than this value + absZ0Max = cms.double(15.0), # z0 must be less than this value, [cm] + nStubsMin = cms.int32(4), # number of stubs must be greater than or equal to this value + nPSStubsMin = cms.int32(0), # the number of stubs in the PS Modules must be greater than or equal to this value + + reducedBendChi2Max = cms.double(2.4), # bend chi2 must be less than this value + reducedChi2RZMax = cms.double(10.0), # chi2rz/dof must be less than this value + reducedChi2RPhiMax = cms.double(40.0), # chi2rphi/dof must be less than this value + + deltaZMaxEtaBounds = cms.vdouble(0.0, 0.7, 1.0, 1.2, 1.6, 2.0, 2.4), # these values define the bin boundaries in |eta| + deltaZMax = cms.vdouble(3.0, 3.0, 3.0, 3.0, 3.0, 3.0), # delta z must be less than these values, there will be one less value here than in deltaZMaxEtaBounds, [cm] ), - useDisplacedTracksDeltaZOverride = 3.0, # Use promt/displaced tracks + useDisplacedTracksDeltaZOverride = cms.double(3.0), # Use promt/displaced tracks ) diff --git a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py index 9340e5281990b..288fe91848569 100644 --- a/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py +++ b/L1Trigger/L1TTrackMatch/python/L1TrackerEtMissProducer_cfi.py @@ -3,16 +3,16 @@ from L1Trigger.L1TTrackMatch.L1TrackSelectionProducer_cfi import L1TrackSelectionProducer, L1TrackSelectionProducerExtended L1TrackerEtMiss = cms.EDProducer('L1TrackerEtMissProducer', - L1TrackInputTag = ("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value()), - L1TrackAssociatedInputTag = ("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), - L1MetCollectionName = "L1TrackerEtMiss", - maxPt = -10. , # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as + L1TrackInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value()), + L1TrackAssociatedInputTag = cms.InputTag("L1TrackSelectionProducer", L1TrackSelectionProducer.outputCollectionName.value() + "Associated"), + L1MetCollectionName = cms.string("L1TrackerEtMiss"), + maxPt = cms.double(-10.) , # in GeV. When maxPt > 0, tracks with PT above maxPt are considered as # mismeasured and are treated according to highPtTracks below. # When maxPt < 0, no special treatment is done for high PT tracks. - highPtTracks = 1 , # when = 0 : truncation. Tracks with PT above maxPt are ignored + highPtTracks = cms.int32(1) , # when = 0 : truncation. Tracks with PT above maxPt are ignored # when = 1 : saturation. Tracks with PT above maxPt are set to PT=maxPt. # When maxPt < 0, no special treatment is done for high PT tracks. - debug = False + debug = cms.bool(False) ) L1TrackerEtMissExtended = L1TrackerEtMiss.clone( #NOT OPTIMIZED, STUDIED, OR USED