diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc index 1395fd3f06323..534aafa1b976c 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc @@ -20,7 +20,7 @@ namespace l1t { for (auto imu = muons->begin(); imu != muons->end(); imu++) { if (imu->processor() + 1 == board_id) { uint32_t firstWord(0), lastWord(0); - RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_, false); + RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_, false, false); payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1 payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1 } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc index 9869cf3afde81..9486ec686f16d 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc @@ -67,7 +67,7 @@ namespace l1t { RegionalMuonCand muCand; RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman, false); + muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman, false, false); if (muCand.hwPt() == 0) { continue; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc index 7502f812e1f3d..8b9444f412f1e 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc @@ -45,6 +45,9 @@ namespace l1t { if (fed == 1402) { auto gmt_in_packer = static_pointer_cast( PackerFactory::get()->make("stage2::RegionalMuonGMTPacker")); + if (fw >= 0x8010000) { + gmt_in_packer->setUseOmtfDisplacementInfo(); + } if (fw >= 0x8000000) { gmt_in_packer->setUseEmtfLooseShowers(); } @@ -103,6 +106,9 @@ namespace l1t { // input muons on links 36-71 auto gmt_in_unp = static_pointer_cast( UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker")); + if (fw >= 0x8010000) { + gmt_in_unp->setUseEmtfDisplacementInfo(); + } if (fw >= 0x8000000) { gmt_in_unp->setUseEmtfLooseShowers(); } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc index aa53e9c9c6de5..c52c72c103a62 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc @@ -108,7 +108,8 @@ namespace l1t { uint32_t msw{0}; uint32_t lsw{0}; - RegionalMuonRawDigiTranslator::generatePackedDataWords(mu, lsw, msw, isKbmtf_, useEmtfDisplacementInfo_); + RegionalMuonRawDigiTranslator::generatePackedDataWords( + mu, lsw, msw, isKbmtf_, useOmtfDisplacementInfo_, useEmtfDisplacementInfo_); buf.at(frameIdx++) = lsw; buf.at(frameIdx++) = msw; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h index e2458d12de75b..6900897b57eb2 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h @@ -15,6 +15,7 @@ namespace l1t { public: Blocks pack(const edm::Event&, const PackerTokens*) override; void setIsKbmtf() { isKbmtf_ = true; }; + void setUseOmtfDisplacementInfo() { useOmtfDisplacementInfo_ = true; }; void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; }; void setUseEmtfNominalTightShowers() { useEmtfNominalTightShowers_ = true; }; void setUseEmtfLooseShowers() { useEmtfLooseShowers_ = true; }; @@ -42,6 +43,7 @@ namespace l1t { static constexpr size_t wordsPerBx_ = 6; // number of 32 bit words per BX bool isKbmtf_{false}; + bool useOmtfDisplacementInfo_{false}; bool useEmtfDisplacementInfo_{false}; bool useEmtfNominalTightShowers_{false}; bool useEmtfLooseShowers_{false}; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc index da2036a46492a..6251276b417a2 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc @@ -109,8 +109,14 @@ namespace l1t { RegionalMuonCand mu; mu.setMuIdx(nWord / 2); - RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isKbmtf_, useEmtfDisplacementInfo_); + RegionalMuonRawDigiTranslator::fillRegionalMuonCand(mu, + raw_data_00_31, + raw_data_32_63, + processor, + trackFinder, + isKbmtf_, + useOmtfDisplacementInfo_, + useEmtfDisplacementInfo_); LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " qual " << mu.hwQual() << " sign " << mu.hwSign() << " sign valid " diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h index 514f360c15992..d8726a40c0855 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h @@ -11,6 +11,7 @@ namespace l1t { public: bool unpack(const Block& block, UnpackerCollections* coll) override; void setIsKbmtf() { isKbmtf_ = true; } + void setUseOmtfDisplacementInfo() { useOmtfDisplacementInfo_ = true; } void setUseEmtfDisplacementInfo() { useEmtfDisplacementInfo_ = true; } void setUseEmtfNominalTightShowers() { useEmtfNominalTightShowers_ = true; } void setUseEmtfLooseShowers() { useEmtfLooseShowers_ = true; } @@ -20,6 +21,7 @@ namespace l1t { static constexpr unsigned bxzs_enable_shift_ = 1; bool isKbmtf_{false}; + bool useOmtfDisplacementInfo_{false}; bool useEmtfDisplacementInfo_{false}; bool useEmtfNominalTightShowers_{false}; bool useEmtfLooseShowers_{false}; diff --git a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h index b24752464843b..7bea8dbcfc195 100644 --- a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h @@ -13,9 +13,15 @@ namespace l1t { int proc, tftype tf, bool isKbmtf, + bool useOmtfDisplacementInfo, + bool useEmtfDisplacementInfo); + static void fillRegionalMuonCand(RegionalMuonCand& mu, + uint64_t dataword, + int proc, + tftype tf, + bool isKbmtf, + bool useOmtfDisplacementInfo, bool useEmtfDisplacementInfo); - static void fillRegionalMuonCand( - RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isKbmtf, bool useEmtfDisplacementInfo); static bool fillRegionalMuonShower(RegionalMuonShower& muShower, std::vector bxPayload, int proc, @@ -26,13 +32,17 @@ namespace l1t { uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, bool isKbmtf, + bool useOmtfDisplacementInfo, bool useEmtfDisplacementInfo); static void generatePackedShowerPayload(const RegionalMuonShower& shower, std::array& payload, bool useEmtfNominalTightShowers, bool useEmtfLooseShowers); - static uint64_t generate64bitDataWord(const RegionalMuonCand& mu, bool isKbmtf, bool useEmtfDisplacementInfo); - static int generateRawTrkAddress(const RegionalMuonCand&, bool isKalman); + static uint64_t generate64bitDataWord(const RegionalMuonCand& mu, + bool isKbmtf, + bool useOmtfDisplacementInfo, + bool useEmtfDisplacementInfo); + static int generateRawTrkAddress(const RegionalMuonCand&, bool isKalman, bool useOmtfDisplacementInfo); static constexpr unsigned ptMask_ = 0x1FF; static constexpr unsigned ptShift_ = 0; @@ -53,6 +63,7 @@ namespace l1t { static constexpr unsigned emtfDxyShift_ = 29; static constexpr unsigned ptUnconstrainedMask_ = 0xFF; static constexpr unsigned bmtfPtUnconstrainedShift_ = 23; + static constexpr unsigned kOmtfPtUnconstrainedShift_ = 18; static constexpr unsigned emtfPtUnconstrainedShift_ = 20; static constexpr unsigned trackAddressMask_ = 0x1FFFFFFF; static constexpr unsigned trackAddressShift_ = 2; diff --git a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc index dde0b668e7ae0..5a76890c021a4 100644 --- a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc @@ -7,6 +7,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& const int proc, const tftype tf, const bool isKbmtf, + const bool useOmtfDisplacementInfo, const bool useEmtfDisplacementInfo) { // translations as defined in DN-15-017 mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_); @@ -87,11 +88,15 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu.setTrackSubAddress(RegionalMuonCand::kBX, (rawTrackAddress >> emtfTrAddrBxShift_) & emtfTrAddrBxMask_); } } else if (tf == omtf_neg || tf == omtf_pos) { - mu.setTrackSubAddress(RegionalMuonCand::kLayers, - (rawTrackAddress >> omtfTrAddrLayersShift_) & omtfTrAddrLayersMask_); - mu.setTrackSubAddress(RegionalMuonCand::kZero, 0); - mu.setTrackSubAddress(RegionalMuonCand::kWeight, - (rawTrackAddress >> omtfTrAddrWeightShift_) & omtfTrAddrWeightMask_); + if (useOmtfDisplacementInfo) { // In Run-3 2024 we receive displaced muon information from OMTF + mu.setHwPtUnconstrained((raw_data_32_63 >> kOmtfPtUnconstrainedShift_) & ptUnconstrainedMask_); + } else { + mu.setTrackSubAddress(RegionalMuonCand::kLayers, + (rawTrackAddress >> omtfTrAddrLayersShift_) & omtfTrAddrLayersMask_); + mu.setTrackSubAddress(RegionalMuonCand::kZero, 0); + mu.setTrackSubAddress(RegionalMuonCand::kWeight, + (rawTrackAddress >> omtfTrAddrWeightShift_) & omtfTrAddrWeightMask_); + } } else { std::map trackAddr; trackAddr[0] = rawTrackAddress; @@ -107,6 +112,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& const int proc, const tftype tf, const bool isKbmtf, + const bool useOmtfDisplacementInfo, const bool useEmtfDisplacementInfo) { fillRegionalMuonCand(mu, (uint32_t)(dataword & 0xFFFFFFFF), @@ -114,6 +120,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& proc, tf, isKbmtf, + useOmtfDisplacementInfo, useEmtfDisplacementInfo); } @@ -166,6 +173,7 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, const bool isKbmtf, + const bool useOmtfDisplacementInfo, const bool useEmtfDisplacementInfo) { int abs_eta = mu.hwEta(); if (abs_eta < 0) { @@ -181,13 +189,15 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM (mu.hwPhi() < 0) << phiSignShift_; // generate the raw track address from the subaddresses - int rawTrkAddr = generateRawTrkAddress(mu, isKbmtf); + int rawTrkAddr = generateRawTrkAddress(mu, isKbmtf, useOmtfDisplacementInfo); raw_data_32_63 = mu.hwSign() << signShift_ | mu.hwSignValid() << signValidShift_ | (rawTrkAddr & trackAddressMask_) << trackAddressShift_; if (isKbmtf && mu.trackFinderType() == bmtf) { raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << bmtfPtUnconstrainedShift_ | (mu.hwDXY() & dxyMask_) << bmtfDxyShift_; + } else if (useOmtfDisplacementInfo && (mu.trackFinderType() == omtf_pos || mu.trackFinderType() == omtf_neg)) { + raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << kOmtfPtUnconstrainedShift_; } else if (useEmtfDisplacementInfo && (mu.trackFinderType() == emtf_pos || mu.trackFinderType() == emtf_neg)) { raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << emtfPtUnconstrainedShift_ | (mu.hwDXY() & dxyMask_) << emtfDxyShift_; @@ -196,15 +206,18 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu, const bool isKbmtf, + const bool useOmtfDisplacementInfo, const bool useEmtfDisplacementInfo) { uint32_t lsw; uint32_t msw; - generatePackedDataWords(mu, lsw, msw, isKbmtf, useEmtfDisplacementInfo); + generatePackedDataWords(mu, lsw, msw, isKbmtf, useOmtfDisplacementInfo, useEmtfDisplacementInfo); return (((uint64_t)msw) << 32) + lsw; } -int l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(const RegionalMuonCand& mu, const bool isKalman) { +int l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(const RegionalMuonCand& mu, + const bool isKalman, + const bool useOmtfDisplacementInfo) { int tf = mu.trackFinderType(); int rawTrkAddr = 0; if (tf == bmtf) { @@ -253,7 +266,7 @@ int l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(const RegionalMuon << " subaddresses. Check the data format. Setting track address to 0."; rawTrkAddr = 0; } - } else if (tf == omtf_neg || tf == omtf_pos) { + } else if ((tf == omtf_neg || tf == omtf_pos) && !useOmtfDisplacementInfo) { // protection against a track address map with the wrong size if (mu.trackAddress().size() == RegionalMuonCand::kNumOmtfSubAddr) { rawTrkAddr = (mu.trackSubAddress(RegionalMuonCand::kLayers) & omtfTrAddrLayersMask_) << omtfTrAddrLayersShift_ | diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index 16fa689038228..533ebb3a20239 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -65,7 +65,7 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan } l1upgradetfmuon_.tfMuonDecodedTrAdd.push_back(decoded_track_address); l1upgradetfmuon_.tfMuonHwTrAdd.push_back( - l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it, isRun3_)); + l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it, isRun3_, isRun3_)); l1upgradetfmuon_.nTfMuons++; } }