From 73eefa6740ffb9b3c3a405b1377497913a848e2d Mon Sep 17 00:00:00 2001 From: Zhenbin Wu Date: Sun, 7 Apr 2024 18:12:20 -0500 Subject: [PATCH 1/6] Fix bugs in phi conversion for FwdMuons --- .../plugins/Phase2L1TGMTFwdMuonTranslator.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc index ba53e5793df32..804436a6c441a 100644 --- a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc +++ b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc @@ -159,10 +159,16 @@ SAMuon Phase2L1TGMTFwdMuonTranslator::Convertl1tMuon(const l1t::RegionalMuonCand if (!isDisplaced && mu.hwPt() > 0) pt = round(mu.hwPt() * 0.5 / LSBpt); // Phase-1 LSB 0.5GeV if (isDisplaced && mu.hwPtUnconstrained() > 0) - pt = round(mu.hwPtUnconstrained() * 0.5 / LSBpt); // Phase-1 LSB 0.5GeV + pt = round(mu.hwPtUnconstrained() * 1.0 / LSBpt); // Phase-1 LSB 1.0GeV!! constexpr double p1phiLSB = 2 * M_PI / 576; - ap_int phi = round(mu.hwPhi() * p1phiLSB / LSBphi); // Phase-1 LSB (2*pi/576) + // From the uGMTConfiguration of OMTF. OMTF send in local phi!! + // all others correspond to 60 degree sectors = 96 in int-scale + int globPhi = mu.processor() *96 + mu.hwPhi(); + // first processor starts at CMS phi = 15 degrees (24 in int)... Handle wrap-around with %. Add 576 to make sure the number is positive + globPhi = (globPhi + 600) % 576; + ap_int phi = round(globPhi* p1phiLSB / LSBphi); // Phase-1 LSB (2*pi/576) + ap_int eta = round(mu.hwEta() * 0.010875 / LSBeta); // Phase-1 LSB 0.010875 // FIXME: Below are not well defined in phase1 GMT @@ -235,7 +241,7 @@ void Phase2L1TGMTFwdMuonTranslator::associateStubs(l1t::SAMuon& mu, const l1t::M SAMuon Phase2L1TGMTFwdMuonTranslator::ConvertEMTFTrack(const l1t::phase2::EMTFTrack& track, const int bx_) { // Convert EMTF Phi and Theta to Global Phi and Eta float track_phi = - emtf::phase2::tp::calcPhiGlobRadFromLoc(track.sector(), emtf::phase2::tp::calcPhiLocDegFromInt(track.modelPhi())); + emtf::phase2::tp::calcPhiGlobRadFromLoc(track.sector(), emtf::phase2::tp::calcPhiLocRadFromInt(track.modelPhi())); float track_theta = emtf::phase2::tp::calcThetaRadFromInt(track.modelEta()); float track_eta = -1 * std::log(std::tan(track_theta / 2)); From 81915a9d038adf26f1759a7bea069b5fc9d3c78c Mon Sep 17 00:00:00 2001 From: Santiago Date: Tue, 9 Apr 2024 13:41:23 +0200 Subject: [PATCH 2/6] OMTF config fix to use the Phase-2 configuration --- .../Configuration/python/SimL1Emulator_cff.py | 4 +++- .../python/fakeOmtfParamsPhase2_cff.py | 20 +++++++++++++++++++ .../python/simOmtfPhase2Digis_extrapol_cfi.py | 3 +++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index 2df1301616392..60cb69f83f658 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -130,7 +130,9 @@ # Overlap and EndCap Muon Track Finder # ######################################################################## -from L1Trigger.L1TMuonOverlapPhase2.simOmtfPhase2Digis_cfi import * +from L1Trigger.L1TMuonOverlapPhase2.fakeOmtfParamsPhase2_cff import * +from L1Trigger.L1TMuonOverlapPhase2.simOmtfPhase2Digis_extrapol_cfi import * +_phase2_siml1emulator.add(omtfConfigurationPhase2) _phase2_siml1emulator.add(simOmtfPhase2Digis) from L1Trigger.L1TMuonEndCapPhase2.simCscTriggerPrimitiveDigisForEMTF_cfi import * diff --git a/L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py b/L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py new file mode 100644 index 0000000000000..ab7066fb6cd84 --- /dev/null +++ b/L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py @@ -0,0 +1,20 @@ +import FWCore.ParameterSet.Config as cms + +omtfParamsSource = cms.ESSource( + "EmptyESSource", + recordName = cms.string('L1TMuonOverlapParamsRcd'), + iovIsRunNotTime = cms.bool(True), + firstValid = cms.vuint32(1) +) + +###OMTF ESProducer. Fills CondFormats from XML files. +omtfParamsPhase2 = cms.ESProducer( + "L1TMuonOverlapPhase1ParamsESProducer", + patternsXMLFiles = cms.VPSet( + cms.PSet(patternsXMLFile = cms.FileInPath("L1Trigger/L1TMuon/data/omtf_config/Patterns_ExtraplMB1nadMB2DTQualAndEtaFixedP_ValueP1Scale_t20_v1_SingleMu_iPt_and_OneOverPt_classProb17_recalib2_minDP0.xml")), + ), + configXMLFile = cms.FileInPath("L1Trigger/L1TMuon/data/omtf_config/hwToLogicLayer_0x0209.xml"), +) + + +omtfConfigurationPhase2=cms.Task(omtfParamsSource, omtfParamsPhase2) \ No newline at end of file diff --git a/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py b/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py index 0b9cd6f7fd4c8..43f869364ae73 100644 --- a/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py +++ b/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py @@ -45,6 +45,9 @@ useStubQualInExtr = cms.bool(True), useEndcapStubsRInExtr = cms.bool(True), useFloatingPointExtrapolation = cms.bool(False), + + ## XML / PATTERNS file: + patternsXMLFile = cms.FileInPath("L1Trigger/L1TMuon/data/omtf_config/Patterns_ExtraplMB1nadMB2DTQualAndEtaFixedP_ValueP1Scale_t20_v1_SingleMu_iPt_and_OneOverPt_classProb17_recalib2_minDP0.xml"), extrapolFactorsFilename = cms.FileInPath("L1Trigger/L1TMuon/data/omtf_config/ExtrapolationFactors_ExtraplMB1nadMB2DTQual_ValueP1Scale_t20.xml"), sorterType = cms.string("byLLH"), From f8f2fefe13f1cece8f4376e1be059ce28104cc82 Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 10 Apr 2024 16:07:45 +0200 Subject: [PATCH 3/6] fix conversion units in the convertL1Muon for the OMTF, minimal changes in the OMTF configs --- L1Trigger/Configuration/python/SimL1Emulator_cff.py | 3 ++- .../L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py | 3 --- .../python/simOmtfPhase2Digis_extrapol_cfi.py | 3 ++- .../Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc | 5 +++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/L1Trigger/Configuration/python/SimL1Emulator_cff.py b/L1Trigger/Configuration/python/SimL1Emulator_cff.py index 60cb69f83f658..6d304f05e727d 100644 --- a/L1Trigger/Configuration/python/SimL1Emulator_cff.py +++ b/L1Trigger/Configuration/python/SimL1Emulator_cff.py @@ -132,7 +132,8 @@ # ######################################################################## from L1Trigger.L1TMuonOverlapPhase2.fakeOmtfParamsPhase2_cff import * from L1Trigger.L1TMuonOverlapPhase2.simOmtfPhase2Digis_extrapol_cfi import * -_phase2_siml1emulator.add(omtfConfigurationPhase2) +#_phase2_siml1emulator.add(omtfParamsSource) +_phase2_siml1emulator.add(omtfParamsPhase2) _phase2_siml1emulator.add(simOmtfPhase2Digis) from L1Trigger.L1TMuonEndCapPhase2.simCscTriggerPrimitiveDigisForEMTF_cfi import * diff --git a/L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py b/L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py index ab7066fb6cd84..421e4becc9d33 100644 --- a/L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py +++ b/L1Trigger/L1TMuonOverlapPhase2/python/fakeOmtfParamsPhase2_cff.py @@ -15,6 +15,3 @@ ), configXMLFile = cms.FileInPath("L1Trigger/L1TMuon/data/omtf_config/hwToLogicLayer_0x0209.xml"), ) - - -omtfConfigurationPhase2=cms.Task(omtfParamsSource, omtfParamsPhase2) \ No newline at end of file diff --git a/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py b/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py index 43f869364ae73..141fd8c3094f7 100644 --- a/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py +++ b/L1Trigger/L1TMuonOverlapPhase2/python/simOmtfPhase2Digis_extrapol_cfi.py @@ -8,7 +8,8 @@ srcCSC = cms.InputTag('simCscTriggerPrimitiveDigis','MPCSORTED'), srcRPC = cms.InputTag('simMuonRPCDigis'), srcDTPhPhase2 = cms.InputTag('dtTriggerPhase2PrimitiveDigis'), - + srcDTThPhase2 = cms.InputTag('dtTriggerPhase2PrimitiveDigis'), + dumpResultToXML = cms.bool(False), dumpDetailedResultToXML = cms.bool(False), XMLDumpFileName = cms.string("TestEvents.xml"), diff --git a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc index 804436a6c441a..1005cc7f6ba7d 100644 --- a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc +++ b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc @@ -161,10 +161,11 @@ SAMuon Phase2L1TGMTFwdMuonTranslator::Convertl1tMuon(const l1t::RegionalMuonCand if (isDisplaced && mu.hwPtUnconstrained() > 0) pt = round(mu.hwPtUnconstrained() * 1.0 / LSBpt); // Phase-1 LSB 1.0GeV!! + // BEWARE: THIS CONVERSION IS ONLY VALID FOR OMTF constexpr double p1phiLSB = 2 * M_PI / 576; // From the uGMTConfiguration of OMTF. OMTF send in local phi!! - // all others correspond to 60 degree sectors = 96 in int-scale - int globPhi = mu.processor() *96 + mu.hwPhi(); + // all others correspond to 120 degree sectors = 192 in int-scale + int globPhi = mu.processor() *192 + mu.hwPhi(); // first processor starts at CMS phi = 15 degrees (24 in int)... Handle wrap-around with %. Add 576 to make sure the number is positive globPhi = (globPhi + 600) % 576; ap_int phi = round(globPhi* p1phiLSB / LSBphi); // Phase-1 LSB (2*pi/576) From 994eb884c815d064064ec985cb421398117326cc Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 10 Apr 2024 16:36:31 +0200 Subject: [PATCH 4/6] code format changes --- .../Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc index 1005cc7f6ba7d..7f9d6993c9985 100644 --- a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc +++ b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc @@ -161,14 +161,14 @@ SAMuon Phase2L1TGMTFwdMuonTranslator::Convertl1tMuon(const l1t::RegionalMuonCand if (isDisplaced && mu.hwPtUnconstrained() > 0) pt = round(mu.hwPtUnconstrained() * 1.0 / LSBpt); // Phase-1 LSB 1.0GeV!! - // BEWARE: THIS CONVERSION IS ONLY VALID FOR OMTF + // BEWARE: THIS CONVERSION IS ONLY VALID FOR OMTF constexpr double p1phiLSB = 2 * M_PI / 576; // From the uGMTConfiguration of OMTF. OMTF send in local phi!! // all others correspond to 120 degree sectors = 192 in int-scale - int globPhi = mu.processor() *192 + mu.hwPhi(); + int globPhi = mu.processor() * 192 + mu.hwPhi(); // first processor starts at CMS phi = 15 degrees (24 in int)... Handle wrap-around with %. Add 576 to make sure the number is positive globPhi = (globPhi + 600) % 576; - ap_int phi = round(globPhi* p1phiLSB / LSBphi); // Phase-1 LSB (2*pi/576) + ap_int phi = round(globPhi * p1phiLSB / LSBphi); // Phase-1 LSB (2*pi/576) ap_int eta = round(mu.hwEta() * 0.010875 / LSBeta); // Phase-1 LSB 0.010875 From a7017ebcc1744ae130e7e9593256bd596056e724 Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 10 Apr 2024 18:11:52 +0200 Subject: [PATCH 5/6] store all the OMTF candidates if hwPtUnconstrained() > 0 --- .../plugins/Phase2L1TGMTFwdMuonTranslator.cc | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc index 7f9d6993c9985..4ddc7f756003d 100644 --- a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc +++ b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc @@ -100,19 +100,19 @@ void Phase2L1TGMTFwdMuonTranslator::produce(edm::Event& iEvent, const edm::Event // Since OMTF is using Phase-1 LSB, will convert to SAMuon locally // We should move to passing words in future l1t::SAMuon samuon; - if (mu.hwPt() > 0) + if (mu.hwPt() > 0) { samuon = Convertl1tMuon(mu, 0); - else if (mu.hwPtUnconstrained() > 0) //Assume exculsive, need double check - samuon = Convertl1tMuon(mu, 0, true); - - //now associate the stubs - associateStubs(samuon, stubs); - - // Add To Collections - if (mu.hwPt() > 0) + //now associate the stubs + associateStubs(samuon, stubs); prompt.push_back(samuon); - else if (mu.hwPtUnconstrained() > 0) + } + if (mu.hwPtUnconstrained() > 0) //Assume exculsive, need double check + { + samuon = Convertl1tMuon(mu, 0, true); + //now associate the stubs + associateStubs(samuon, stubs); displaced.push_back(samuon); + } } // Convert EMTF++ Tracks to SAMuons From 3610ca393aafd095933fcdce774741971b68ca1d Mon Sep 17 00:00:00 2001 From: Santiago Date: Wed, 10 Apr 2024 18:18:02 +0200 Subject: [PATCH 6/6] remove old comment --- L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc index 4ddc7f756003d..4d8d1f72ccec0 100644 --- a/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc +++ b/L1Trigger/Phase2L1GMT/plugins/Phase2L1TGMTFwdMuonTranslator.cc @@ -106,7 +106,7 @@ void Phase2L1TGMTFwdMuonTranslator::produce(edm::Event& iEvent, const edm::Event associateStubs(samuon, stubs); prompt.push_back(samuon); } - if (mu.hwPtUnconstrained() > 0) //Assume exculsive, need double check + if (mu.hwPtUnconstrained() > 0) { samuon = Convertl1tMuon(mu, 0, true); //now associate the stubs