From e3371cdf1ae57cb6be15afbec270c66235f0be10 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Fri, 24 May 2019 16:47:34 +0200 Subject: [PATCH 01/37] uGMT adapted for KBMTF muons The BMTF with the Kalman filter sends inverted track addresses, the uGMT cancel-out unit has been adapted for this. In this commit it has also been configured to use the new mode and pick barrel muons from the KBMTF collection. --- .../L1TMuon/interface/MicroGMTCancelOutUnit.h | 13 +- L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc | 26 +- .../L1TMuon/python/simGmtStage2Digis_cfi.py | 5 +- .../L1TMuon/src/MicroGMTCancelOutUnit.cc | 248 ++++++++++++------ 4 files changed, 205 insertions(+), 87 deletions(-) diff --git a/L1Trigger/L1TMuon/interface/MicroGMTCancelOutUnit.h b/L1Trigger/L1TMuon/interface/MicroGMTCancelOutUnit.h index c13747b9bdf16..5e722ea920ae7 100644 --- a/L1Trigger/L1TMuon/interface/MicroGMTCancelOutUnit.h +++ b/L1Trigger/L1TMuon/interface/MicroGMTCancelOutUnit.h @@ -8,7 +8,7 @@ #include "L1Trigger/L1TMuon/interface/MicroGMTLUTFactories.h" namespace l1t { - enum cancelmode { tracks, coordinate }; + enum cancelmode { tracks, kftracks, coordinate }; class MicroGMTCancelOutUnit { public: @@ -29,9 +29,18 @@ namespace l1t { void getCoordinateCancelBits(std::vector>&, std::vector>&); /// Compares all muons from coll1 with all muons from coll2 and sets the cancel-bits based on track addresses - void getTrackAddrCancelBits(std::vector>&, + void getTrackAddrCancelBits(cancelmode, + std::vector>&, std::vector>&); + /// Do the track address-based cancel-out for the original BMTF algorithm + void getTrackAddrCancelBitsOrigBMTF(std::vector>&, + std::vector>&); + + /// Do the track address-based cancel-out for the BMTF algorithm using the Kalman Filter + void getTrackAddrCancelBitsKfBMTF(std::vector>&, + std::vector>&); + std::shared_ptr m_boPosMatchQualLUT; std::shared_ptr m_boNegMatchQualLUT; std::shared_ptr m_foPosMatchQualLUT; diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc index 775b4cc15b954..d30a99cdb814f 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc @@ -118,6 +118,7 @@ class L1TMuonProducer : public edm::stream::EDProducer<> { MicroGMTIsolationUnit m_isolationUnit; MicroGMTCancelOutUnit m_cancelOutUnit; std::ofstream m_debugOut; + l1t::cancelmode m_bmtfCancelMode; l1t::cancelmode m_emtfCancelMode; edm::EDGetTokenT m_barrelTfInputToken; @@ -138,7 +139,9 @@ class L1TMuonProducer : public edm::stream::EDProducer<> { // constructors and destructor // L1TMuonProducer::L1TMuonProducer(const edm::ParameterSet& iConfig) - : m_debugOut("test/debug/iso_debug.dat"), m_emtfCancelMode(cancelmode::coordinate) { + : m_debugOut("test/debug/iso_debug.dat"), + m_bmtfCancelMode(cancelmode::tracks), + m_emtfCancelMode(cancelmode::coordinate) { // edm::InputTag barrelTfInputTag = iConfig.getParameter("barrelTFInput"); // edm::InputTag overlapTfInputTag = iConfig.getParameter("overlapTFInput"); // edm::InputTag forwardTfInputTag = iConfig.getParameter("forwardTFInput"); @@ -153,8 +156,13 @@ L1TMuonProducer::L1TMuonProducer(const edm::ParameterSet& iConfig) m_bxMax = iConfig.getParameter("bxMax"); m_autoCancelMode = iConfig.getParameter("autoCancelMode"); - if (!m_autoCancelMode && iConfig.getParameter("emtfCancelMode").find("tracks") == 0) { - m_emtfCancelMode = cancelmode::tracks; + if (!m_autoCancelMode) { + if (iConfig.getParameter("bmtfCancelMode").find("kftracks") == 0) { + m_bmtfCancelMode = cancelmode::kftracks; + } + if (iConfig.getParameter("emtfCancelMode").find("tracks") == 0) { + m_emtfCancelMode = cancelmode::tracks; + } } m_barrelTfInputToken = consumes(m_barrelTfInputTag); @@ -266,7 +274,7 @@ void L1TMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) splitAndConvertMuons(omtfMuons, internMuonsOmtfPos, internMuonsOmtfNeg, omtfPosWedges, omtfNegWedges, bx); // cancel out within the track finders: - m_cancelOutUnit.setCancelOutBits(bmtfWedges, tftype::bmtf, cancelmode::tracks); + m_cancelOutUnit.setCancelOutBits(bmtfWedges, tftype::bmtf, m_bmtfCancelMode); m_cancelOutUnit.setCancelOutBits(omtfPosWedges, tftype::omtf_pos, cancelmode::coordinate); m_cancelOutUnit.setCancelOutBits(omtfNegWedges, tftype::omtf_neg, cancelmode::coordinate); m_cancelOutUnit.setCancelOutBits(emtfPosWedges, tftype::emtf_pos, m_emtfCancelMode); @@ -560,8 +568,14 @@ void L1TMuonProducer::beginRun(edm::Run const& run, edm::EventSetup const& iSetu m_isolationUnit.initialise(microGMTParamsHelper.get()); m_cancelOutUnit.initialise(microGMTParamsHelper.get()); - if (m_autoCancelMode && microGMTParamsHelper->fwVersion() > 0x5000000) { - m_emtfCancelMode = cancelmode::tracks; + if (m_autoCancelMode) { + if (microGMTParamsHelper->fwVersion() >= 0x5010000) { + m_bmtfCancelMode = cancelmode::kftracks; + } + // TODO: No decision yet on when to use EMTF track addresses for cancel-out. + // if (microGMTParamsHelper->fwVersion() > 0x5000000) { + // m_emtfCancelMode = cancelmode::tracks; + // } } } diff --git a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py index 8437714485899..c3cd68641eea8 100644 --- a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py +++ b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py @@ -7,7 +7,7 @@ ) simGmtStage2Digis = cms.EDProducer('L1TMuonProducer', - barrelTFInput = cms.InputTag("simBmtfDigis", "BMTF"), + barrelTFInput = cms.InputTag("simKBmtfDigis", "BMTF"), overlapTFInput = cms.InputTag("simOmtfDigis", "OMTF"), forwardTFInput = cms.InputTag("simEmtfDigis", "EMTF"), #triggerTowerInput = cms.InputTag("simGmtCaloSumDigis", "TriggerTower2x2s"), @@ -15,7 +15,8 @@ autoBxRange = cms.bool(True), # if True the output BX range is calculated from the inputs and 'bxMin' and 'bxMax' are ignored bxMin = cms.int32(-2), bxMax = cms.int32(2), - autoCancelMode = cms.bool(False), # if True the cancel out methods are configured depending on the FW version number and 'emtfCancelMode' is ignored + autoCancelMode = cms.bool(False), # if True the cancel out methods are configured depending on the FW version number and 'bmtfCancelMode'&'emtfCancelMode' are ignored + bmtfCancelMode = cms.string("kftracks"), # 'tracks' or 'kftracks' (when using the Run-3 BMTF) emtfCancelMode = cms.string("coordinate") # 'tracks' or 'coordinate' ) diff --git a/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc b/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc index 0a852a76d4da1..58bf1f6d194e9 100644 --- a/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc +++ b/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc @@ -57,7 +57,7 @@ namespace l1t { if (mode == cancelmode::coordinate) { getCoordinateCancelBits(coll2, coll1); // in case of a tie coll1 muon wins } else { - getTrackAddrCancelBits(coll1, coll2); + getTrackAddrCancelBits(mode, coll1, coll2); } coll1.clear(); @@ -92,7 +92,7 @@ namespace l1t { if (mode == cancelmode::coordinate) { getCoordinateCancelBits(coll1, coll2); } else { - getTrackAddrCancelBits(coll1, coll2); + getTrackAddrCancelBits(mode, coll1, coll2); } coll1.clear(); coll2.clear(); @@ -127,7 +127,7 @@ namespace l1t { if (mode == cancelmode::coordinate) { getCoordinateCancelBits(coll1, coll2); } else { - getTrackAddrCancelBits(coll1, coll2); + getTrackAddrCancelBits(mode, coll1, coll2); } coll1.clear(); coll2.clear(); @@ -194,86 +194,18 @@ namespace l1t { } } - void MicroGMTCancelOutUnit::getTrackAddrCancelBits(std::vector>& coll1, + void MicroGMTCancelOutUnit::getTrackAddrCancelBits(cancelmode mode, + std::vector>& coll1, std::vector>& coll2) { if (coll1.empty() || coll2.empty()) { return; } // Address based cancel out for BMTF if ((*coll1.begin())->trackFinderType() == tftype::bmtf && (*coll2.begin())->trackFinderType() == tftype::bmtf) { - for (auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) { - std::map trkAddr_w1 = (*mu_w1)->origin().trackAddress(); - int wheelNum_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelNum]; - int wheelSide_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelSide]; - std::vector stations_w1; - stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat1]); - stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat2]); - stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat3]); - stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat4]); - //std::cout << "Track address 1: wheelSide (1 == negative side): " << wheelSide_w1 << ", wheelNum: " << wheelNum_w1 << ", stations1234: 0x" << hex << stations_w1[0] << stations_w1[1] << stations_w1[2] << stations_w1[3] << dec << std::endl; - - for (auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) { - std::map trkAddr_w2 = (*mu_w2)->origin().trackAddress(); - int wheelNum_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelNum]; - int wheelSide_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelSide]; - std::vector stations_w2; - stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat1]); - stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat2]); - stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat3]); - stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat4]); - //std::cout << "Track address 2: wheelSide (1 == negative side): " << wheelSide_w2 << ", wheelNum: " << wheelNum_w2 << ", stations1234: 0x" << hex << stations_w2[0] << stations_w2[1] << stations_w2[2] << stations_w2[3] << dec << std::endl; - - int nMatchedStations = 0; - // search for duplicates in stations 2-4 - for (int i = 1; i < 4; ++i) { - if (wheelSide_w1 == wheelSide_w2) { // both tracks are on the same detector side - if (wheelNum_w1 == wheelNum_w2) { // both tracks have the same reference wheel - if ((stations_w1[i] == 0x0 && stations_w2[i] == 0x2) || - (stations_w1[i] == 0x1 && stations_w2[i] == 0x3) || - (stations_w1[i] == 0x4 && stations_w2[i] == 0x0) || - (stations_w1[i] == 0x5 && stations_w2[i] == 0x1) || - (stations_w1[i] == 0x8 && stations_w2[i] == 0xA) || - (stations_w1[i] == 0x9 && stations_w2[i] == 0xB) || - (stations_w1[i] == 0xC && stations_w2[i] == 0x8) || - (stations_w1[i] == 0xD && stations_w2[i] == 0x9)) { - ++nMatchedStations; - } - } else if (wheelNum_w1 == wheelNum_w2 - 1) { // track 2 is one wheel higher than track 1 - if ((stations_w1[i] == 0x0 && stations_w2[i] == 0xA) || - (stations_w1[i] == 0x1 && stations_w2[i] == 0xB) || - (stations_w1[i] == 0x4 && stations_w2[i] == 0x8) || - (stations_w1[i] == 0x5 && stations_w2[i] == 0x9)) { - ++nMatchedStations; - } - } else if (wheelNum_w1 == wheelNum_w2 + 1) { // track 2 is one wheel lower than track 1 - if ((stations_w1[i] == 0x8 && stations_w2[i] == 0x2) || - (stations_w1[i] == 0x9 && stations_w2[i] == 0x3) || - (stations_w1[i] == 0xC && stations_w2[i] == 0x0) || - (stations_w1[i] == 0xD && stations_w2[i] == 0x1)) { - ++nMatchedStations; - } - } - } else { - if (wheelNum_w1 == 0 && - wheelNum_w2 == 0) { // both tracks are on either side of the central wheel (+0 and -0) - if ((stations_w1[i] == 0x8 && stations_w2[i] == 0xA) || - (stations_w1[i] == 0x9 && stations_w2[i] == 0xB) || - (stations_w1[i] == 0xC && stations_w2[i] == 0x8) || - (stations_w1[i] == 0xD && stations_w2[i] == 0x9)) { - ++nMatchedStations; - } - } - } - } - //std::cout << "Shared hits found: " << nMatchedStations << std::endl; - if (nMatchedStations > 0) { - if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) { - (*mu_w2)->setHwCancelBit(1); - } else { - (*mu_w1)->setHwCancelBit(1); - } - } - } + if (mode == cancelmode::tracks) { + getTrackAddrCancelBitsOrigBMTF(coll1, coll2); + } else if (mode == cancelmode::kftracks) { + getTrackAddrCancelBitsKfBMTF(coll1, coll2); } // Address based cancel out for EMTF } else if (((*coll1.begin())->trackFinderType() == tftype::emtf_pos && @@ -337,4 +269,166 @@ namespace l1t { } } + void MicroGMTCancelOutUnit::getTrackAddrCancelBitsOrigBMTF(std::vector>& coll1, + std::vector>& coll2) { + for (auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) { + std::map trkAddr_w1 = (*mu_w1)->origin().trackAddress(); + int wheelNum_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelNum]; + int wheelSide_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelSide]; + std::vector stations_w1; + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat1]); + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat2]); + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat3]); + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat4]); + //std::cout << "Track address 1: wheelSide (1 == negative side): " << wheelSide_w1 << ", wheelNum: " << wheelNum_w1 << ", stations1234: 0x" << hex << stations_w1[0] << stations_w1[1] << stations_w1[2] << stations_w1[3] << dec << std::endl; + + for (auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) { + std::map trkAddr_w2 = (*mu_w2)->origin().trackAddress(); + int wheelNum_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelNum]; + int wheelSide_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelSide]; + std::vector stations_w2; + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat1]); + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat2]); + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat3]); + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat4]); + //std::cout << "Track address 2: wheelSide (1 == negative side): " << wheelSide_w2 << ", wheelNum: " << wheelNum_w2 << ", stations1234: 0x" << hex << stations_w2[0] << stations_w2[1] << stations_w2[2] << stations_w2[3] << dec << std::endl; + + int nMatchedStations = 0; + // search for duplicates in stations 2-4 + for (int i = 1; i < 4; ++i) { + if (wheelSide_w1 == wheelSide_w2) { // both tracks are on the same detector side + if (wheelNum_w1 == wheelNum_w2) { // both tracks have the same reference wheel + if ((stations_w1[i] == 0x0 && stations_w2[i] == 0x2) || + (stations_w1[i] == 0x1 && stations_w2[i] == 0x3) || + (stations_w1[i] == 0x4 && stations_w2[i] == 0x0) || + (stations_w1[i] == 0x5 && stations_w2[i] == 0x1) || + (stations_w1[i] == 0x8 && stations_w2[i] == 0xA) || + (stations_w1[i] == 0x9 && stations_w2[i] == 0xB) || + (stations_w1[i] == 0xC && stations_w2[i] == 0x8) || + (stations_w1[i] == 0xD && stations_w2[i] == 0x9)) { + ++nMatchedStations; + } + } else if (wheelNum_w1 == wheelNum_w2 - 1) { // track 2 is one wheel higher than track 1 + if ((stations_w1[i] == 0x0 && stations_w2[i] == 0xA) || + (stations_w1[i] == 0x1 && stations_w2[i] == 0xB) || + (stations_w1[i] == 0x4 && stations_w2[i] == 0x8) || + (stations_w1[i] == 0x5 && stations_w2[i] == 0x9)) { + ++nMatchedStations; + } + } else if (wheelNum_w1 == wheelNum_w2 + 1) { // track 2 is one wheel lower than track 1 + if ((stations_w1[i] == 0x8 && stations_w2[i] == 0x2) || + (stations_w1[i] == 0x9 && stations_w2[i] == 0x3) || + (stations_w1[i] == 0xC && stations_w2[i] == 0x0) || + (stations_w1[i] == 0xD && stations_w2[i] == 0x1)) { + ++nMatchedStations; + } + } + } else { + if (wheelNum_w1 == 0 && + wheelNum_w2 == 0) { // both tracks are on either side of the central wheel (+0 and -0) + if ((stations_w1[i] == 0x8 && stations_w2[i] == 0xA) || + (stations_w1[i] == 0x9 && stations_w2[i] == 0xB) || + (stations_w1[i] == 0xC && stations_w2[i] == 0x8) || + (stations_w1[i] == 0xD && stations_w2[i] == 0x9)) { + ++nMatchedStations; + } + } + } + } + //std::cout << "Shared hits found: " << nMatchedStations << std::endl; + if (nMatchedStations > 0) { + if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) { + (*mu_w2)->setHwCancelBit(1); + } else { + (*mu_w1)->setHwCancelBit(1); + } + } + } + } + } + + void MicroGMTCancelOutUnit::getTrackAddrCancelBitsKfBMTF(std::vector>& coll1, + std::vector>& coll2) { + for (auto mu_w1 = coll1.begin(); mu_w1 != coll1.end(); ++mu_w1) { + std::map trkAddr_w1 = (*mu_w1)->origin().trackAddress(); + int wheelNum_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelNum]; + int wheelSide_w1 = trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kWheelSide]; + std::vector stations_w1; + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat1]); + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat2]); + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat3]); + stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat4]); + //std::cout << "Track address 1: wheelSide (1 == negative side): " << wheelSide_w1 << ", wheelNum: " << wheelNum_w1 << ", stations1234: 0x" << hex << stations_w1[0] << stations_w1[1] << stations_w1[2] << stations_w1[3] << dec << std::endl; + + for (auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) { + std::map trkAddr_w2 = (*mu_w2)->origin().trackAddress(); + int wheelNum_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelNum]; + int wheelSide_w2 = trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kWheelSide]; + std::vector stations_w2; + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat1]); + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat2]); + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat3]); + stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat4]); + //std::cout << "Track address 2: wheelSide (1 == negative side): " << wheelSide_w2 << ", wheelNum: " << wheelNum_w2 << ", stations1234: 0x" << hex << stations_w2[0] << stations_w2[1] << stations_w2[2] << stations_w2[3] << dec << std::endl; + + int nMatchedStations = 0; + // search for duplicates in stations 2-4 + for (int i = 1; i < 4; ++i) { + if (wheelSide_w1 == wheelSide_w2) { // both tracks are on the same detector side + if (wheelNum_w1 == wheelNum_w2) { // both tracks have the same reference wheel + if ((stations_w1[i] == 0x2 && stations_w2[i] == 0x0) || + (stations_w1[i] == 0x3 && stations_w2[i] == 0x1) || + (stations_w1[i] == 0x0 && stations_w2[i] == 0x4) || + (stations_w1[i] == 0x1 && stations_w2[i] == 0x5) || + (stations_w1[i] == 0xA && stations_w2[i] == 0x8) || + (stations_w1[i] == 0xB && stations_w2[i] == 0x9) || + (stations_w1[i] == 0x8 && stations_w2[i] == 0xC) || + (stations_w1[i] == 0x9 && stations_w2[i] == 0xD)) { + ++nMatchedStations; + } + } else if (wheelNum_w1 == wheelNum_w2 - 1) { // track 2 is one wheel higher than track 1 + if ((stations_w1[i] == 0xA && stations_w2[i] == 0x0) || + (stations_w1[i] == 0xB && stations_w2[i] == 0x1) || + (stations_w1[i] == 0x8 && stations_w2[i] == 0x4) || + (stations_w1[i] == 0x9 && stations_w2[i] == 0x5)) { + ++nMatchedStations; + } + } else if (wheelNum_w1 == wheelNum_w2 + 1) { // track 2 is one wheel lower than track 1 + if ((stations_w1[i] == 0x2 && stations_w2[i] == 0x8) || + (stations_w1[i] == 0x3 && stations_w2[i] == 0x9) || + (stations_w1[i] == 0x0 && stations_w2[i] == 0xC) || + (stations_w1[i] == 0x1 && stations_w2[i] == 0xD)) { + ++nMatchedStations; + } + } + } else { // If one muon in 0+ and one muon in 0- (0+ and 0- are physically the same wheel), however wheel 0 is not split in kalman algorithm + if (wheelNum_w1 == 0 && wheelNum_w2 == 1) { + if ((stations_w1[i] == 0xA && stations_w2[1] == 0x0) || + (stations_w1[i] == 0xB && stations_w2[1] == 0x1) || + (stations_w1[i] == 0x8 && stations_w2[1] == 0x4) || + (stations_w1[i] == 0x9 && stations_w2[1] == 0x5)) { + ++nMatchedStations; + } + } else if (wheelNum_w1 == 1 && wheelNum_w2 == 0) { + if ((stations_w1[i] == 0x2 && stations_w2[1] == 0x8) || + (stations_w1[i] == 0x3 && stations_w2[1] == 0x9) || + (stations_w1[i] == 0x0 && stations_w2[1] == 0xC) || + (stations_w1[i] == 0x1 && stations_w2[1] == 0xD)) { + ++nMatchedStations; + } + } + } + } + //std::cout << "Shared hits found: " << nMatchedStations << std::endl; + if (nMatchedStations > 0) { + if ((*mu_w1)->origin().hwQual() >= (*mu_w2)->origin().hwQual()) { + (*mu_w2)->setHwCancelBit(1); + } else { + (*mu_w1)->setHwCancelBit(1); + } + } + } + } + } + } // namespace l1t From 9e5c39b8dff65476c4351a516746046a4ed0c12e Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Tue, 25 Feb 2020 11:13:51 +0100 Subject: [PATCH 02/37] Exposing displaced quantities in internal GMT muon --- L1Trigger/L1TMuon/interface/GMTInternalMuon.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/L1Trigger/L1TMuon/interface/GMTInternalMuon.h b/L1Trigger/L1TMuon/interface/GMTInternalMuon.h index a3bad4f600573..f56139232570f 100644 --- a/L1Trigger/L1TMuon/interface/GMTInternalMuon.h +++ b/L1Trigger/L1TMuon/interface/GMTInternalMuon.h @@ -43,6 +43,8 @@ namespace l1t { const RegionalMuonCand& origin() const { return m_regional; }; inline const int hwPt() const { return m_regional.hwPt(); }; + inline const int hwPtUnconstrained() const { return m_regional.hwPt2(); }; + inline const int hwDXY() const { return m_regional.hwDXY(); }; inline const int hwLocalPhi() const { return m_regional.hwPhi(); }; inline const int hwEta() const { return m_regional.hwEta(); }; inline const int hwSign() const { return m_regional.hwSign(); }; From 434e749e9f1de834ee0fda782a956ccde72c3483 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Tue, 25 Feb 2020 11:37:12 +0100 Subject: [PATCH 03/37] Fixed equality operator for regional muon cand --- DataFormats/L1TMuon/src/RegionalMuonCand.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DataFormats/L1TMuon/src/RegionalMuonCand.cc b/DataFormats/L1TMuon/src/RegionalMuonCand.cc index 51e85c3a9613a..856fadc8d18fb 100644 --- a/DataFormats/L1TMuon/src/RegionalMuonCand.cc +++ b/DataFormats/L1TMuon/src/RegionalMuonCand.cc @@ -25,9 +25,10 @@ namespace l1t { } bool RegionalMuonCand::operator==(const RegionalMuonCand& rhs) const { - return m_hwPt == rhs.hwPt() && m_hwPhi == rhs.hwPhi() && m_hwEta == rhs.hwEta() && m_hwHF == (bool)rhs.hwHF() && - m_hwSign == rhs.hwSign() && m_hwSignValid == rhs.hwSignValid() && m_hwQuality == rhs.hwQual() && - m_link == rhs.link() && m_processor == rhs.processor() && m_trackFinder == rhs.trackFinderType() && + return m_hwPt == rhs.hwPt() && m_hwPt2 == rhs.hwPt2() && m_hwDXY == rhs.hwDXY() && m_hwPhi == rhs.hwPhi() && + m_hwEta == rhs.hwEta() && m_hwHF == (bool)rhs.hwHF() && m_hwSign == rhs.hwSign() && + m_hwSignValid == rhs.hwSignValid() && m_hwQuality == rhs.hwQual() && m_link == rhs.link() && + m_processor == rhs.processor() && m_trackFinder == rhs.trackFinderType() && m_trackAddress == rhs.trackAddress(); } From 13cca0b94a9fed7b9f2cbc487d64f2fb16a1f4b7 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Tue, 25 Feb 2020 12:03:08 +0100 Subject: [PATCH 04/37] Including displacement in muon data format --- DataFormats/L1Trigger/interface/Muon.h | 20 +++++++++++++++++--- DataFormats/L1Trigger/src/Muon.cc | 23 +++++++++++++++++------ DataFormats/L1Trigger/src/classes_def.xml | 3 ++- 3 files changed, 36 insertions(+), 10 deletions(-) diff --git a/DataFormats/L1Trigger/interface/Muon.h b/DataFormats/L1Trigger/interface/Muon.h index d5a5227539202..715835cf109d8 100644 --- a/DataFormats/L1Trigger/interface/Muon.h +++ b/DataFormats/L1Trigger/interface/Muon.h @@ -40,7 +40,9 @@ namespace l1t { int hwEtaAtVtx = 0, int hwPhiAtVtx = 0, double etaAtVtx = 0., - double phiAtVtx = 0.); + double phiAtVtx = 0., + int ptUnconstrained = 0, + int dXY = 0); Muon(const PolarLorentzVector& p4, int pt = 0, @@ -60,9 +62,11 @@ namespace l1t { int hwEtaAtVtx = 0, int hwPhiAtVtx = 0, double etaAtVtx = 0., - double phiAtVtx = 0.); + double phiAtVtx = 0., + int ptUnconstrained = 0, + int dXY = 0); - ~Muon() override; + ~Muon(); // set values inline void setHwCharge(int charge) { hwCharge_ = charge; }; @@ -80,6 +84,9 @@ namespace l1t { inline void setHwDEtaExtra(int dEta) { hwDEtaExtra_ = dEta; }; inline void setHwRank(int rank) { hwRank_ = rank; }; + inline void setHwPtUnconstrained(int hwPtUnconstrained) { hwPtUnconstrained_ = hwPtUnconstrained; }; + inline void setHwDXY(int hwDXY) { hwDXY_ = hwDXY; }; + inline void setDebug(bool debug) { debug_ = debug; }; // methods to retrieve values @@ -98,6 +105,9 @@ namespace l1t { inline int hwDEtaExtra() const { return hwDEtaExtra_; }; inline int hwRank() const { return hwRank_; }; + inline int hwPtUnconstrained() const { return hwPtUnconstrained_; }; + inline int hwDXY() const { return hwDXY_; }; + inline bool debug() const { return debug_; }; virtual bool operator==(const l1t::Muon& rhs) const; @@ -122,6 +132,10 @@ namespace l1t { int hwPhiAtVtx_; double etaAtVtx_; double phiAtVtx_; + + // displacement information + int hwPtUnconstrained_; + int hwDXY_; }; } // namespace l1t diff --git a/DataFormats/L1Trigger/src/Muon.cc b/DataFormats/L1Trigger/src/Muon.cc index b7d946aa46495..6a4471807ce21 100644 --- a/DataFormats/L1Trigger/src/Muon.cc +++ b/DataFormats/L1Trigger/src/Muon.cc @@ -14,7 +14,9 @@ l1t::Muon::Muon() hwEtaAtVtx_(0), hwPhiAtVtx_(0), etaAtVtx_(0.), - phiAtVtx_(0.) {} + phiAtVtx_(0.), + hwPtUnconstrained_(0), + hwDXY_(0) {} l1t::Muon::Muon(const LorentzVector& p4, int pt, @@ -34,7 +36,9 @@ l1t::Muon::Muon(const LorentzVector& p4, int hwEtaAtVtx, int hwPhiAtVtx, double etaAtVtx, - double phiAtVtx) + double phiAtVtx, + int ptUnconstrained, + int dXY) : L1Candidate(p4, pt, eta, phi, qual, iso), hwCharge_(charge), hwChargeValid_(chargeValid), @@ -48,7 +52,9 @@ l1t::Muon::Muon(const LorentzVector& p4, hwEtaAtVtx_(hwEtaAtVtx), hwPhiAtVtx_(hwPhiAtVtx), etaAtVtx_(etaAtVtx), - phiAtVtx_(phiAtVtx) {} + phiAtVtx_(phiAtVtx), + hwPtUnconstrained_(ptUnconstrained), + hwDXY_(dXY) {} l1t::Muon::Muon(const PolarLorentzVector& p4, int pt, @@ -68,7 +74,9 @@ l1t::Muon::Muon(const PolarLorentzVector& p4, int hwEtaAtVtx, int hwPhiAtVtx, double etaAtVtx, - double phiAtVtx) + double phiAtVtx, + int ptUnconstrained, + int dXY) : L1Candidate(p4, pt, eta, phi, qual, iso), hwCharge_(charge), hwChargeValid_(chargeValid), @@ -82,12 +90,15 @@ l1t::Muon::Muon(const PolarLorentzVector& p4, hwEtaAtVtx_(hwEtaAtVtx), hwPhiAtVtx_(hwPhiAtVtx), etaAtVtx_(etaAtVtx), - phiAtVtx_(phiAtVtx) {} + phiAtVtx_(phiAtVtx), + hwPtUnconstrained_(ptUnconstrained), + hwDXY_(dXY) {} l1t::Muon::~Muon() {} bool l1t::Muon::operator==(const l1t::Muon& rhs) const { return l1t::L1Candidate::operator==(static_cast(rhs)) && hwCharge_ == rhs.hwCharge() && hwChargeValid_ == rhs.hwChargeValid() && tfMuonIndex_ == rhs.tfMuonIndex() && - hwEtaAtVtx_ == rhs.hwEtaAtVtx() && hwPhiAtVtx_ == rhs.hwPhiAtVtx(); + hwEtaAtVtx_ == rhs.hwEtaAtVtx() && hwPhiAtVtx_ == rhs.hwPhiAtVtx() && + hwPtUnconstrained_ == rhs.hwPtUnconstrained() && hwDXY_ == rhs.hwDXY(); } diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index 176410f97ba06..d91e87bba66d1 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -80,7 +80,8 @@ - + + From 1db4a7780c43354dd3b3a3f1fb7c0630f874e0b7 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Tue, 25 Feb 2020 15:04:18 +0100 Subject: [PATCH 05/37] Forwarding muon displacement to Global Trigger --- L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc index d30a99cdb814f..c2d09f063ca35 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc @@ -340,17 +340,18 @@ void L1TMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) mu->hwIsoSum(), mu->hwDPhi(), mu->hwDEta(), - mu->hwRank()}; + mu->hwRank(), + MicroGMTConfiguration::calcMuonHwEtaExtra(outMu), + MicroGMTConfiguration::calcMuonHwPhiExtra(outMu), // set the coordinates at the vertex + MicroGMTConfiguration::calcMuonEtaExtra(outMu), + MicroGMTConfiguration::calcMuonPhiExtra(outMu), // set the coordinates at the vertex + mu->hwPtUnconstrained(), + mu->hwDXY()}; if (mu->hwSignValid()) { outMu.setCharge(1 - 2 * mu->hwSign()); } else { outMu.setCharge(0); } - // set the coordinates at the vertex - outMu.setHwEtaAtVtx(MicroGMTConfiguration::calcMuonHwEtaExtra(outMu)); - outMu.setHwPhiAtVtx(MicroGMTConfiguration::calcMuonHwPhiExtra(outMu)); - outMu.setEtaAtVtx(MicroGMTConfiguration::calcMuonEtaExtra(outMu)); - outMu.setPhiAtVtx(MicroGMTConfiguration::calcMuonPhiExtra(outMu)); m_debugOut << mu->hwCaloPhi() << " " << mu->hwCaloEta() << std::endl; outMuons->push_back(bx, outMu); } @@ -569,7 +570,7 @@ void L1TMuonProducer::beginRun(edm::Run const& run, edm::EventSetup const& iSetu m_cancelOutUnit.initialise(microGMTParamsHelper.get()); if (m_autoCancelMode) { - if (microGMTParamsHelper->fwVersion() >= 0x5010000) { + if (microGMTParamsHelper->fwVersion() >= 0x6000000) { m_bmtfCancelMode = cancelmode::kftracks; } // TODO: No decision yet on when to use EMTF track addresses for cancel-out. From f2b20c1deb09d5de7b732ba4bfaa1e331568014c Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 16 May 2019 15:53:36 +0200 Subject: [PATCH 06/37] Added raw track addresses to L1UpgradeTfMuon branch of L1TNtuples The original field with track addresses was filled with incorrect or incomplete values for most TFs. Using static function from RegionalMuonRawDigiTranslator that I factored out in order to generate the raw track address. --- .../interface/RegionalMuonRawDigiTranslator.h | 1 + .../src/RegionalMuonRawDigiTranslator.cc | 26 ++++++++++++------- .../L1AnalysisL1UpgradeTfMuonDataFormat.h | 2 ++ .../src/L1AnalysisL1UpgradeTfMuon.cc | 24 +++++++++++------ 4 files changed, 35 insertions(+), 18 deletions(-) diff --git a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h index bf59aa4a15083..fb5a240f9829c 100644 --- a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h @@ -10,6 +10,7 @@ namespace l1t { static void fillRegionalMuonCand(RegionalMuonCand&, uint64_t, int, tftype); static void generatePackedDataWords(const RegionalMuonCand&, uint32_t&, uint32_t&); static uint64_t generate64bitDataWord(const RegionalMuonCand&); + static int generateRawTrkAddress(const RegionalMuonCand&); static const unsigned ptMask_ = 0x1FF; static const unsigned ptShift_ = 0; diff --git a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc index e3681954067d5..f9b27a6ba5798 100644 --- a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc @@ -102,6 +102,21 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM (mu.hwPhi() < 0) << phiSignShift_; // generate the raw track address from the subaddresses + int rawTrkAddr = generateRawTrkAddress(mu); + + raw_data_32_63 = mu.hwSign() << signShift_ | mu.hwSignValid() << signValidShift_ | + (rawTrkAddr & trackAddressMask_) << trackAddressShift_; +} + +uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu) { + uint32_t lsw; + uint32_t msw; + + generatePackedDataWords(mu, lsw, msw); + return (((uint64_t)msw) << 32) + lsw; +} + +int l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(const RegionalMuonCand& mu) { int tf = mu.trackFinderType(); int rawTrkAddr = 0; if (tf == bmtf) { @@ -168,14 +183,5 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM rawTrkAddr = mu.trackAddress().at(0); } - raw_data_32_63 = mu.hwSign() << signShift_ | mu.hwSignValid() << signValidShift_ | - (rawTrkAddr & trackAddressMask_) << trackAddressShift_; -} - -uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu) { - uint32_t lsw; - uint32_t msw; - - generatePackedDataWords(mu, lsw, msw); - return (((uint64_t)msw) << 32) + lsw; + return rawTrkAddr; } diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h index a17065400a8aa..4e2f5e4c5c783 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h @@ -1,6 +1,7 @@ #ifndef __L1Analysis_L1AnalysisL1UpgradeTfMuonDataFormat_H__ #define __L1Analysis_L1AnalysisL1UpgradeTfMuonDataFormat_H__ +#include "L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h" #include namespace L1Analysis { @@ -41,6 +42,7 @@ namespace L1Analysis { std::vector tfMuonBx; std::vector tfMuonWh; std::vector tfMuonTrAdd; + std::vector tfMuonRawTrAdd; }; } // namespace L1Analysis #endif diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index db7d9e6805143..3e088991ffc35 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -24,14 +24,22 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrackFinderType.push_back(it->trackFinderType()); l1upgradetfmuon_.tfMuonHwHF.push_back(it->hwHF()); l1upgradetfmuon_.tfMuonBx.push_back(ibx); - std::map trAdd; - trAdd = it->trackAddress(); - int wheel = pow(-1, trAdd[0]) * trAdd[1]; - l1upgradetfmuon_.tfMuonWh.push_back(wheel); - l1upgradetfmuon_.tfMuonTrAdd.push_back(trAdd[2]); - l1upgradetfmuon_.tfMuonTrAdd.push_back(trAdd[3]); - l1upgradetfmuon_.tfMuonTrAdd.push_back(trAdd[4]); - l1upgradetfmuon_.tfMuonTrAdd.push_back(trAdd[5]); + if (it->trackFinderType() == l1t::tftype::bmtf) { + int detSide = it->trackSubAddress(l1t::RegionalMuonCand::kWheelSide); + int wheelNum = it->trackSubAddress(l1t::RegionalMuonCand::kWheelNum); + int stat1 = it->trackSubAddress(l1t::RegionalMuonCand::kStat1); + int stat2 = it->trackSubAddress(l1t::RegionalMuonCand::kStat2); + int stat3 = it->trackSubAddress(l1t::RegionalMuonCand::kStat3); + int stat4 = it->trackSubAddress(l1t::RegionalMuonCand::kStat4); + + int wheel = pow(-1, detSide) * wheelNum; + l1upgradetfmuon_.tfMuonWh.push_back(wheel); + l1upgradetfmuon_.tfMuonTrAdd.push_back(stat1); + l1upgradetfmuon_.tfMuonTrAdd.push_back(stat2); + l1upgradetfmuon_.tfMuonTrAdd.push_back(stat3); + l1upgradetfmuon_.tfMuonTrAdd.push_back(stat4); + } + l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it)); l1upgradetfmuon_.nTfMuons++; } From eb4b164d605a1922bd513153c565eac5a4ed0f96 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 16 May 2019 15:53:36 +0200 Subject: [PATCH 07/37] Put L1 TF track addresses into map in L1TNtuple May make the interface to get them more clear. --- .../L1AnalysisL1UpgradeTfMuonDataFormat.h | 6 ++++- .../src/L1AnalysisL1UpgradeTfMuon.cc | 22 +++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h index 4e2f5e4c5c783..cd31418cd46ca 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h @@ -3,6 +3,7 @@ #include "L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h" #include +#include namespace L1Analysis { struct L1AnalysisL1UpgradeTfMuonDataFormat { @@ -25,6 +26,8 @@ namespace L1Analysis { tfMuonBx.clear(); tfMuonWh.clear(); tfMuonTrAdd.clear(); + tfMuonDecodedTrAdd.clear(); + tfMuonRawTrAdd.clear(); } unsigned short int nTfMuons; @@ -42,7 +45,8 @@ namespace L1Analysis { std::vector tfMuonBx; std::vector tfMuonWh; std::vector tfMuonTrAdd; - std::vector tfMuonRawTrAdd; + std::vector> tfMuonDecodedTrAdd; + std::vector tfMuonRawTrAdd; }; } // namespace L1Analysis #endif diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index 3e088991ffc35..f4db52b64ee19 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -24,6 +24,7 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrackFinderType.push_back(it->trackFinderType()); l1upgradetfmuon_.tfMuonHwHF.push_back(it->hwHF()); l1upgradetfmuon_.tfMuonBx.push_back(ibx); + std::map decoded_track_address; if (it->trackFinderType() == l1t::tftype::bmtf) { int detSide = it->trackSubAddress(l1t::RegionalMuonCand::kWheelSide); int wheelNum = it->trackSubAddress(l1t::RegionalMuonCand::kWheelNum); @@ -38,7 +39,28 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrAdd.push_back(stat2); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat3); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat4); + + decoded_track_address["wheel"] = wheel; + decoded_track_address["station1"] = stat1; + decoded_track_address["station2"] = stat2; + decoded_track_address["station3"] = stat3; + decoded_track_address["station4"] = stat4; + } else if (it->trackFinderType() == l1t::omtf_neg || it->trackFinderType() == l1t::omtf_pos) { + decoded_track_address["kLayers"] = it->trackSubAddress(l1t::RegionalMuonCand::kLayers); + decoded_track_address["kWeight"] = it->trackSubAddress(l1t::RegionalMuonCand::kWeight); + } else if (it->trackFinderType() == l1t::emtf_neg || it->trackFinderType() == l1t::emtf_pos) { + decoded_track_address["kME1Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Seg); + decoded_track_address["kME1Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Ch); + decoded_track_address["kME2Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Seg); + decoded_track_address["kME2Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Ch); + decoded_track_address["kME3Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Seg); + decoded_track_address["kME3Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Ch); + decoded_track_address["kME4Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Seg); + decoded_track_address["kME4Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Ch); + decoded_track_address["kTrkNum"] = it->trackSubAddress(l1t::RegionalMuonCand::kTrkNum); + decoded_track_address["kBX"] = it->trackSubAddress(l1t::RegionalMuonCand::kBX); } + l1upgradetfmuon_.tfMuonDecodedTrAdd.push_back(decoded_track_address); l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it)); l1upgradetfmuon_.nTfMuons++; From 08a0670911f46490af8a247e2032dc6b373689b5 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 23 May 2019 19:41:26 +0200 Subject: [PATCH 08/37] Renamed tfMuonRawTrAdd to tfMuonHwTrAdd This makes us a bit more consistent with the other fields. --- .../interface/L1AnalysisL1UpgradeTfMuonDataFormat.h | 4 ++-- L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h index cd31418cd46ca..68966443187ae 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h @@ -27,7 +27,7 @@ namespace L1Analysis { tfMuonWh.clear(); tfMuonTrAdd.clear(); tfMuonDecodedTrAdd.clear(); - tfMuonRawTrAdd.clear(); + tfMuonHwTrAdd.clear(); } unsigned short int nTfMuons; @@ -46,7 +46,7 @@ namespace L1Analysis { std::vector tfMuonWh; std::vector tfMuonTrAdd; std::vector> tfMuonDecodedTrAdd; - std::vector tfMuonRawTrAdd; + std::vector tfMuonHwTrAdd; }; } // namespace L1Analysis #endif diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index f4db52b64ee19..4bb09bebb66d1 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -61,7 +61,7 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan decoded_track_address["kBX"] = it->trackSubAddress(l1t::RegionalMuonCand::kBX); } l1upgradetfmuon_.tfMuonDecodedTrAdd.push_back(decoded_track_address); - l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it)); + l1upgradetfmuon_.tfMuonHwTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it)); l1upgradetfmuon_.nTfMuons++; } From 868539d729ebc8453c3dcf3c85130e8b196d0d2a Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 23 May 2019 19:48:30 +0200 Subject: [PATCH 09/37] Raw track address in L1TNtuple fits into short --- .../L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h index 68966443187ae..eb1105d2ff8b3 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h @@ -46,7 +46,7 @@ namespace L1Analysis { std::vector tfMuonWh; std::vector tfMuonTrAdd; std::vector> tfMuonDecodedTrAdd; - std::vector tfMuonHwTrAdd; + std::vector tfMuonHwTrAdd; }; } // namespace L1Analysis #endif From f1e5d35fe0ae12fb3e947021c21889471b5615de Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 5 Mar 2020 15:37:05 +0100 Subject: [PATCH 10/37] Unpackers for BMTF, uGMT, and uGT adapted for Kalman muons --- .../BMTFUnpackerOutput.cc | 9 +- .../implementations_stage2/GMTSetup.cc | 12 +- .../IntermediateMuonUnpacker.cc | 3 +- .../implementations_stage2/MuonUnpacker.cc | 13 +- .../RegionalMuonGMTUnpacker.cc | 4 +- .../RegionalMuonGMTUnpacker.h | 3 + .../L1TMuon/interface/MuonRawDigiTranslator.h | 54 ++++--- .../interface/RegionalMuonRawDigiTranslator.h | 107 ++++++------- .../L1TMuon/src/MuonRawDigiTranslator.cc | 144 ++++++++++++++---- .../src/RegionalMuonRawDigiTranslator.cc | 32 ++-- 10 files changed, 255 insertions(+), 126 deletions(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc index aaaa30b1491db..14837f49fc6df 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc @@ -65,19 +65,18 @@ namespace l1t { } RegionalMuonCand muCand; - RegionalMuonRawDigiTranslator::fillRegionalMuonCand(muCand, raw_first, raw_secnd, processor, tftype::bmtf); + RegionalMuonRawDigiTranslator::fillRegionalMuonCand( + muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman); if (muCand.hwQual() == 0) continue; - muCand.setLink(48 + processor); //the link corresponds to the uGMT input if (isKalman) { - muCand.setHwPt2((raw_secnd >> 23) & 0xFF); - muCand.setHwDXY((raw_secnd >> 2) & 0x3); LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi() << " diplacedPt = " << muCand.hwPt2(); - } else + } else { LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi(); + } res->push_back(ibx, muCand); diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc index 7a747cb8a0aec..56ef3d0cdcab7 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc @@ -1,9 +1,11 @@ +#include "FWCore/Framework/interface/stream/EDProducerBase.h" #include "FWCore/Utilities/interface/InputTag.h" #include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h" #include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h" #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h" +#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.h" @@ -71,9 +73,15 @@ namespace l1t { // MP7 input link numbers are represented by even numbers starting from 0 (iLink=link*2) // input muons on links 36-71 - auto gmt_in_unp = UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker"); - for (int iLink = 72; iLink < 144; iLink += 2) + auto gmt_in_unp = static_pointer_cast( + UnpackerFactory::get()->make("stage2::RegionalMuonGMTUnpacker")); + if (fw >= 0x6000000) { + gmt_in_unp->setKalmanAlgoTrue(); + } + + for (int iLink = 72; iLink < 144; iLink += 2) { res[iLink] = gmt_in_unp; + } // MP7 output link numbers are represented by odd numbers (oLink=link*2+1) // internal muons on links 24-31 diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc index c93c01ed3a809..949ccfea8378a 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc @@ -120,7 +120,8 @@ namespace l1t { // The intermediate muons of the uGMT (FED number 1402) do not // have coordinates estimated at the vertex in the RAW data. // The corresponding bits are set to zero. - MuonRawDigiTranslator::fillMuon(mu, raw_data_00_31, raw_data_32_63, 1402, getAlgoVersion()); + MuonRawDigiTranslator::fillMuon( + mu, 0, raw_data_00_31, raw_data_32_63, 1402, getAlgoVersion(), nWord / 2, true); LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " iso " << mu.hwIso() << " qual " << mu.hwQual() << " charge " << mu.hwCharge() diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc index dacd7194f6680..885126b8b343a 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc @@ -54,13 +54,15 @@ namespace l1t { } void MuonUnpacker::unpackBx(int bx, const std::vector& payload, unsigned int startIdx) { - unsigned int i = startIdx; + unsigned int i = startIdx + 2; // Only words 2-5 are "standard" muon words. // Check if there are enough words left in the payload - if (i + nWords_ <= payload.size()) { - for (unsigned nWord = 0; nWord < nWords_; nWord += 2) { + if (startIdx + nWords_ <= payload.size()) { + for (unsigned nWord = 2; nWord < nWords_; nWord += 2) { // Only words 2-5 are "standard" muon words. + uint32_t raw_data_spare = payload[startIdx + 1]; uint32_t raw_data_00_31 = payload[i++]; uint32_t raw_data_32_63 = payload[i++]; - LogDebug("L1T") << "raw_data_00_31 = 0x" << hex << raw_data_00_31 << " raw_data_32_63 = 0x" << raw_data_32_63; + LogDebug("L1T") << "raw_data_spare = 0x" << hex << raw_data_spare << "raw_data_00_31 = 0x" << raw_data_00_31 + << " raw_data_32_63 = 0x" << raw_data_32_63; // skip empty muons (hwPt == 0) if (((raw_data_00_31 >> l1t::MuonRawDigiTranslator::ptShift_) & l1t::MuonRawDigiTranslator::ptMask_) == 0) { LogDebug("L1T") << "Muon hwPt zero. Skip."; @@ -69,7 +71,8 @@ namespace l1t { Muon mu; - MuonRawDigiTranslator::fillMuon(mu, raw_data_00_31, raw_data_32_63, fed_, getAlgoVersion()); + MuonRawDigiTranslator::fillMuon( + mu, raw_data_spare, raw_data_00_31, raw_data_32_63, fed_, getAlgoVersion(), nWord / 2); LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " iso " << mu.hwIso() << " qual " << mu.hwQual() << " charge " << mu.hwCharge() diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc index 224b32a4cc744..c513ad52fb3c5 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc @@ -102,11 +102,11 @@ namespace l1t { RegionalMuonCand mu; RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - mu, raw_data_00_31, raw_data_32_63, processor, trackFinder); + mu, raw_data_00_31, raw_data_32_63, processor, trackFinder, isKalman_); LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " qual " << mu.hwQual() << " sign " << mu.hwSign() << " sign valid " - << mu.hwSignValid(); + << mu.hwSignValid() << " unconstrained pT " << mu.hwPt2(); res->push_back(bx, mu); } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h index 97374feef25f6..97e7683109526 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h @@ -10,10 +10,13 @@ namespace l1t { class RegionalMuonGMTUnpacker : public Unpacker { public: bool unpack(const Block& block, UnpackerCollections* coll) override; + void setKalmanAlgoTrue() { isKalman_ = true; } private: static constexpr unsigned nWords_ = 6; // every link transmits 6 words (3 muons) per bx static constexpr unsigned bxzs_enable_shift_ = 1; + + bool isKalman_{false}; }; } // namespace stage2 } // namespace l1t diff --git a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h index d9fb39fb1e3b5..eb4e60101695e 100644 --- a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h @@ -6,30 +6,44 @@ namespace l1t { class MuonRawDigiTranslator { public: - static void fillMuon(Muon&, uint32_t, uint32_t, int, unsigned int); - static void fillMuon(Muon&, uint64_t, int, unsigned int); + static void fillMuon(Muon&, uint32_t, uint32_t, uint32_t, int, unsigned int, int, bool); + static void fillMuon(Muon&, uint32_t, uint64_t, int, unsigned int, int, bool); + static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonCoordinatesRun3( + Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx); + static void fillIntermediateMuonCoordinatesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); static void generatePackedDataWords(const Muon&, uint32_t&, uint32_t&); static uint64_t generate64bitDataWord(const Muon&); static int calcHwEta(const uint32_t&, const unsigned, const unsigned); - static const unsigned ptMask_ = 0x1FF; - static const unsigned ptShift_ = 10; - static const unsigned qualMask_ = 0xF; - static const unsigned qualShift_ = 19; - static const unsigned absEtaMask_ = 0xFF; - static const unsigned absEtaShift_ = 21; - static const unsigned absEtaAtVtxShift_ = 23; - static const unsigned etaSignShift_ = 29; - static const unsigned etaAtVtxSignShift_ = 31; - static const unsigned phiMask_ = 0x3FF; - static const unsigned phiShift_ = 11; - static const unsigned phiAtVtxShift_ = 0; - static const unsigned chargeShift_ = 2; - static const unsigned chargeValidShift_ = 3; - static const unsigned tfMuonIndexMask_ = 0x7F; - static const unsigned tfMuonIndexShift_ = 4; - static const unsigned isoMask_ = 0x3; - static const unsigned isoShift_ = 0; + static constexpr unsigned ptMask_ = 0x1FF; + static constexpr unsigned ptShift_ = 10; + static constexpr unsigned qualMask_ = 0xF; + static constexpr unsigned qualShift_ = 19; + static constexpr unsigned absEtaMask_ = 0xFF; + static constexpr unsigned absEtaShift_ = 21; + static constexpr unsigned absEtaAtVtxShift_ = 23; + static constexpr unsigned etaSignShift_ = 29; + static constexpr unsigned etaAtVtxSignShift_ = 31; + static constexpr unsigned phiMask_ = 0x3FF; + static constexpr unsigned phiShift_ = 11; + static constexpr unsigned phiAtVtxShift_ = 0; + static constexpr unsigned chargeShift_ = 2; + static constexpr unsigned chargeValidShift_ = 3; + static constexpr unsigned tfMuonIndexMask_ = 0x7F; + static constexpr unsigned tfMuonIndexShift_ = 4; + static constexpr unsigned isoMask_ = 0x3; + static constexpr unsigned isoShift_ = 0; + static constexpr unsigned dxyMask_ = 0x3; + static constexpr unsigned dxyShift_ = 30; + static constexpr unsigned ptUnconstrainedMask_ = 0xFF; + static constexpr unsigned ptUnconstrainedShift_ = 21; + static constexpr unsigned ptUnconstrainedIntermedidateShift_ = 0; + static constexpr unsigned absEtaMu1Shift_ = 12; // For Run-3 + static constexpr unsigned etaMu1SignShift_ = 20; // For Run-3 + static constexpr unsigned absEtaMu2Shift_ = 21; // For Run-3 + static constexpr unsigned etaMu2SignShift_ = 29; // For Run-3 }; } // namespace l1t diff --git a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h index fb5a240f9829c..f09c2905411d0 100644 --- a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h @@ -6,64 +6,69 @@ namespace l1t { class RegionalMuonRawDigiTranslator { public: - static void fillRegionalMuonCand(RegionalMuonCand&, uint32_t, uint32_t, int, tftype); - static void fillRegionalMuonCand(RegionalMuonCand&, uint64_t, int, tftype); + static void fillRegionalMuonCand( + RegionalMuonCand& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isKalman); + static void fillRegionalMuonCand(RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isKalman); static void generatePackedDataWords(const RegionalMuonCand&, uint32_t&, uint32_t&); static uint64_t generate64bitDataWord(const RegionalMuonCand&); static int generateRawTrkAddress(const RegionalMuonCand&); - static const unsigned ptMask_ = 0x1FF; - static const unsigned ptShift_ = 0; - static const unsigned qualMask_ = 0xF; - static const unsigned qualShift_ = 9; - static const unsigned absEtaMask_ = 0xFF; - static const unsigned absEtaShift_ = 13; - static const unsigned etaSignShift_ = 21; - static const unsigned hfMask_ = 0x1; - static const unsigned hfShift_ = 22; - static const unsigned absPhiMask_ = 0x7F; - static const unsigned absPhiShift_ = 23; - static const unsigned phiSignShift_ = 30; - static const unsigned signShift_ = 0; - static const unsigned signValidShift_ = 1; - static const unsigned trackAddressMask_ = 0x1FFFFFFF; - static const unsigned trackAddressShift_ = 2; + static constexpr unsigned ptMask_ = 0x1FF; + static constexpr unsigned ptShift_ = 0; + static constexpr unsigned qualMask_ = 0xF; + static constexpr unsigned qualShift_ = 9; + static constexpr unsigned absEtaMask_ = 0xFF; + static constexpr unsigned absEtaShift_ = 13; + static constexpr unsigned etaSignShift_ = 21; + static constexpr unsigned hfMask_ = 0x1; + static constexpr unsigned hfShift_ = 22; + static constexpr unsigned absPhiMask_ = 0x7F; + static constexpr unsigned absPhiShift_ = 23; + static constexpr unsigned phiSignShift_ = 30; + static constexpr unsigned signShift_ = 0; + static constexpr unsigned signValidShift_ = 1; + static constexpr unsigned dxyMask_ = 0x3; + static constexpr unsigned dxyShift_ = 18; + static constexpr unsigned ptUnconstrainedMask_ = 0xFF; + static constexpr unsigned ptUnconstrainedShift_ = 23; + static constexpr unsigned trackAddressMask_ = 0x1FFFFFFF; + static constexpr unsigned trackAddressShift_ = 2; // relative shifts within track address - static const unsigned bmtfTrAddrSegSelMask_ = 0xF; - static const unsigned bmtfTrAddrSegSelShift_ = 21; - static const unsigned bmtfTrAddrDetSideShift_ = 20; - static const unsigned bmtfTrAddrWheelMask_ = 0x3; - static const unsigned bmtfTrAddrWheelShift_ = 18; - static const unsigned bmtfTrAddrStat1Mask_ = 0x3; - static const unsigned bmtfTrAddrStat1Shift_ = 14; - static const unsigned bmtfTrAddrStat2Mask_ = 0xF; - static const unsigned bmtfTrAddrStat2Shift_ = 10; - static const unsigned bmtfTrAddrStat3Mask_ = 0xF; - static const unsigned bmtfTrAddrStat3Shift_ = 6; - static const unsigned bmtfTrAddrStat4Mask_ = 0xF; - static const unsigned bmtfTrAddrStat4Shift_ = 2; + static constexpr unsigned bmtfTrAddrSegSelMask_ = 0xF; + static constexpr unsigned bmtfTrAddrSegSelShift_ = 21; + static constexpr unsigned bmtfTrAddrDetSideShift_ = 20; + static constexpr unsigned bmtfTrAddrWheelMask_ = 0x3; + static constexpr unsigned bmtfTrAddrWheelShift_ = 18; + static constexpr unsigned bmtfTrAddrStat1Mask_ = 0x3; + static constexpr unsigned bmtfTrAddrStat1Shift_ = 14; + static constexpr unsigned bmtfTrAddrStat2Mask_ = 0xF; + static constexpr unsigned bmtfTrAddrStat2Shift_ = 10; + static constexpr unsigned bmtfTrAddrStat3Mask_ = 0xF; + static constexpr unsigned bmtfTrAddrStat3Shift_ = 6; + static constexpr unsigned bmtfTrAddrStat4Mask_ = 0xF; + static constexpr unsigned bmtfTrAddrStat4Shift_ = 2; - static const unsigned emtfTrAddrMe1SegShift_ = 0; - static const unsigned emtfTrAddrMe1ChShift_ = 1; - static const unsigned emtfTrAddrMe1ChMask_ = 0x7; - static const unsigned emtfTrAddrMe2SegShift_ = 4; - static const unsigned emtfTrAddrMe2ChShift_ = 5; - static const unsigned emtfTrAddrMe2ChMask_ = 0x7; - static const unsigned emtfTrAddrMe3SegShift_ = 8; - static const unsigned emtfTrAddrMe3ChShift_ = 9; - static const unsigned emtfTrAddrMe3ChMask_ = 0x7; - static const unsigned emtfTrAddrMe4SegShift_ = 12; - static const unsigned emtfTrAddrMe4ChShift_ = 13; - static const unsigned emtfTrAddrMe4ChMask_ = 0x7; - static const unsigned emtfTrAddrTrkNumShift_ = 16; - static const unsigned emtfTrAddrTrkNumMask_ = 0x3; - static const unsigned emtfTrAddrBxShift_ = 18; - static const unsigned emtfTrAddrBxMask_ = 0x7FF; + static constexpr unsigned emtfTrAddrMe1SegShift_ = 0; + static constexpr unsigned emtfTrAddrMe1ChShift_ = 1; + static constexpr unsigned emtfTrAddrMe1ChMask_ = 0x7; + static constexpr unsigned emtfTrAddrMe2SegShift_ = 4; + static constexpr unsigned emtfTrAddrMe2ChShift_ = 5; + static constexpr unsigned emtfTrAddrMe2ChMask_ = 0x7; + static constexpr unsigned emtfTrAddrMe3SegShift_ = 8; + static constexpr unsigned emtfTrAddrMe3ChShift_ = 9; + static constexpr unsigned emtfTrAddrMe3ChMask_ = 0x7; + static constexpr unsigned emtfTrAddrMe4SegShift_ = 12; + static constexpr unsigned emtfTrAddrMe4ChShift_ = 13; + static constexpr unsigned emtfTrAddrMe4ChMask_ = 0x7; + static constexpr unsigned emtfTrAddrTrkNumShift_ = 16; + static constexpr unsigned emtfTrAddrTrkNumMask_ = 0x3; + static constexpr unsigned emtfTrAddrBxShift_ = 18; + static constexpr unsigned emtfTrAddrBxMask_ = 0x7FF; - static const unsigned omtfTrAddrLayersShift_ = 0; - static const unsigned omtfTrAddrLayersMask_ = 0x3FFFF; - static const unsigned omtfTrAddrWeightShift_ = 18; - static const unsigned omtfTrAddrWeightMask_ = 0x1F; + static constexpr unsigned omtfTrAddrLayersShift_ = 0; + static constexpr unsigned omtfTrAddrLayersMask_ = 0x3FFFF; + static constexpr unsigned omtfTrAddrWeightShift_ = 18; + static constexpr unsigned omtfTrAddrWeightMask_ = 0x1F; }; } // namespace l1t diff --git a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc index 631ab338c1cb8..c1e594bb8e5a5 100644 --- a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc @@ -1,8 +1,14 @@ #include "TMath.h" #include "L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h" -void l1t::MuonRawDigiTranslator::fillMuon( - Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int fed, unsigned int fw) { +void l1t::MuonRawDigiTranslator::fillMuon(Muon& mu, + uint32_t raw_data_spare, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63, + int fed, + unsigned int fw, + int muInBx, + bool intermediateMuon = false) { int hwPt = (raw_data_00_31 >> ptShift_) & ptMask_; if (hwPt > 0) { mu.setHwPt(hwPt); @@ -16,35 +22,25 @@ void l1t::MuonRawDigiTranslator::fillMuon( // The position of the eta and phi coordinates in the RAW data changed between the 2016 run and the 2017 run. // Eta and phi at the muon system are replaced by eta and phi at the vertex // Eta and phi at the muon system are moved to spare bits + // In Run-3 we have displacement information. + // To make room for these data the raw eta value was moved to the second "spare" word which we will have to treat separately // The uGMT (FED 1402) or uGT (FED 1404) FW versions are used to determine the era. - if ((fed == 1402 && fw < 0x4010000) || (fed == 1404 && fw < 0x10A6)) { - // coordinates at the muon system are in 2016 where in 2017 eta and phi at the vertex are - mu.setHwEta(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_)); - mu.setHwPhi((raw_data_00_31 >> phiAtVtxShift_) & phiMask_); - - // set the coordiantes at vertex to be the same as the coordinates at the muon system - mu.setHwEtaAtVtx(mu.hwEta()); - mu.setHwPhiAtVtx(mu.hwPhi()); - // deltas are 0 - mu.setHwDEtaExtra(0); - mu.setHwDPhiExtra(0); + if (fed == 1402 && intermediateMuon) { + if (fw < 0x4010000) { + fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63); + } else if (fw < 0x6000000) { + fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); + } else { + fillIntermediateMuonCoordinatesRun3(mu, raw_data_00_31, raw_data_32_63); + } } else { - // coordinates at the muon system - mu.setHwEta(calcHwEta(raw_data_32_63, absEtaShift_, etaSignShift_)); - mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_); - - // coordinates at the vertex - mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_)); - mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_); - // deltas - mu.setHwDEtaExtra(mu.hwEtaAtVtx() - mu.hwEta()); - int dPhi = mu.hwPhiAtVtx() - mu.hwPhi(); - if (mu.hwCharge() == 1 && dPhi > 0) { - dPhi -= 576; - } else if (mu.hwCharge() == 0 && dPhi < 0) { - dPhi += 576; + if ((fed == 1402 && fw < 0x4010000) || (fed == 1404 && fw < 0x10A6)) { + fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63); + } else if ((fed == 1402 && fw < 0x6000000) || (fed == 1404 && fw < 0x1120)) { + fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); + } else { + fillMuonCoordinatesRun3(mu, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx); } - mu.setHwDPhiExtra(dPhi); } math::PtEtaPhiMLorentzVector vec{(mu.hwPt() - 1) * 0.5, mu.hwEta() * 0.010875, mu.hwPhi() * 0.010908, 0.0}; @@ -64,8 +60,96 @@ void l1t::MuonRawDigiTranslator::fillMuon( } } -void l1t::MuonRawDigiTranslator::fillMuon(Muon& mu, uint64_t dataword, int fed, unsigned int fw) { - fillMuon(mu, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), fed, fw); +void l1t::MuonRawDigiTranslator::fillMuon(Muon& mu, + uint32_t raw_data_spare, + uint64_t dataword, + int fed, + unsigned int fw, + int muInBx, + bool intermediateMuon = false) { + fillMuon(mu, + raw_data_spare, + (uint32_t)(dataword & 0xFFFFFFFF), + (uint32_t)((dataword >> 32) & 0xFFFFFFFF), + fed, + fw, + muInBx, + intermediateMuon); +} + +void l1t::MuonRawDigiTranslator::fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63) { + // coordinates at the muon system are in 2016 where in 2017 eta and phi at the vertex are + mu.setHwEta(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_)); + mu.setHwPhi((raw_data_00_31 >> phiAtVtxShift_) & phiMask_); + + // set the coordiantes at vertex to be the same as the coordinates at the muon system + mu.setHwEtaAtVtx(mu.hwEta()); + mu.setHwPhiAtVtx(mu.hwPhi()); + // deltas are 0 + mu.setHwDEtaExtra(0); + mu.setHwDPhiExtra(0); +} + +void l1t::MuonRawDigiTranslator::fillMuonCoordinatesFrom2017(Muon& mu, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63) { + // coordinates at the muon system + mu.setHwEta(calcHwEta(raw_data_32_63, absEtaShift_, etaSignShift_)); + mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_); + + // coordinates at the vertex + mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_)); + mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_); + // deltas + mu.setHwDEtaExtra(mu.hwEtaAtVtx() - mu.hwEta()); + int dPhi = mu.hwPhiAtVtx() - mu.hwPhi(); + if (mu.hwCharge() == 1 && dPhi > 0) { + dPhi -= 576; + } else if (mu.hwCharge() == 0 && dPhi < 0) { + dPhi += 576; + } + mu.setHwDPhiExtra(dPhi); +} + +void l1t::MuonRawDigiTranslator::fillMuonCoordinatesRun3( + Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx) { + // coordinates at the muon system + // Where to find the raw eta depends on which muon we're looking at + if (muInBx == 1) { + mu.setHwEta(calcHwEta(raw_data_spare, absEtaMu1Shift_, etaMu1SignShift_)); + } else if (muInBx == 2) { + mu.setHwEta(calcHwEta(raw_data_spare, absEtaMu2Shift_, etaMu2SignShift_)); + } else { + // TODO: Log an error? + } + mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_); + + // coordinates at the vertex + mu.setHwEtaAtVtx(calcHwEta(raw_data_00_31, absEtaAtVtxShift_, etaAtVtxSignShift_)); + mu.setHwPhiAtVtx((raw_data_00_31 >> phiAtVtxShift_) & phiMask_); + // deltas + mu.setHwDEtaExtra(mu.hwEtaAtVtx() - mu.hwEta()); + int dPhi = mu.hwPhiAtVtx() - mu.hwPhi(); + if (mu.hwCharge() == 1 && dPhi > 0) { + dPhi -= 576; + } else if (mu.hwCharge() == 0 && dPhi < 0) { + dPhi += 576; + } + mu.setHwDPhiExtra(dPhi); + + // displacement information + mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_); + mu.setHwPtUnconstrained((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_); +} + +void l1t::MuonRawDigiTranslator::fillIntermediateMuonCoordinatesRun3(Muon& mu, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63) { + fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); + + // displacement information + mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_); + mu.setHwPtUnconstrained((raw_data_00_31 >> ptUnconstrainedIntermedidateShift_) & ptUnconstrainedMask_); } void l1t::MuonRawDigiTranslator::generatePackedDataWords(const Muon& mu, diff --git a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc index f9b27a6ba5798..40a17e3aca2f3 100644 --- a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc @@ -2,7 +2,7 @@ #include "L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h" void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( - RegionalMuonCand& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf) { + RegionalMuonCand& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isKalman) { // translations as defined in DN-15-017 mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_); mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_); @@ -41,10 +41,23 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( mu.setTrackSubAddress(RegionalMuonCand::kWheelSide, detSide); mu.setTrackSubAddress(RegionalMuonCand::kWheelNum, wheelNum); - mu.setTrackSubAddress(RegionalMuonCand::kStat1, statAddr1); - mu.setTrackSubAddress(RegionalMuonCand::kStat2, statAddr2); - mu.setTrackSubAddress(RegionalMuonCand::kStat3, statAddr3); - mu.setTrackSubAddress(RegionalMuonCand::kStat4, statAddr4); + if (!isKalman) { // The Run-2 standard configuration + mu.setTrackSubAddress(RegionalMuonCand::kStat1, statAddr1); + mu.setTrackSubAddress(RegionalMuonCand::kStat2, statAddr2); + mu.setTrackSubAddress(RegionalMuonCand::kStat3, statAddr3); + mu.setTrackSubAddress(RegionalMuonCand::kStat4, statAddr4); + } else { + // For Run-3 track address encoding has changed as the Kalman Filter tracks from outside in. + // As a result station assignment is inverted + // (i.e. the field that contained the station 1 information for Run-2 now contains station 4 information and so on.) + mu.setTrackSubAddress(RegionalMuonCand::kStat1, statAddr4); + mu.setTrackSubAddress(RegionalMuonCand::kStat2, statAddr3); + mu.setTrackSubAddress(RegionalMuonCand::kStat3, statAddr2); + mu.setTrackSubAddress(RegionalMuonCand::kStat4, statAddr1); + // Additionally we now have displacement information from the BMTF + mu.setHwPt2((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_); + mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_); + } mu.setTrackSubAddress(RegionalMuonCand::kSegSelStat1, 0); mu.setTrackSubAddress(RegionalMuonCand::kSegSelStat2, 0); mu.setTrackSubAddress(RegionalMuonCand::kSegSelStat3, 0); @@ -78,11 +91,10 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( mu.setDataword(raw_data_32_63, raw_data_00_31); } -void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand(RegionalMuonCand& mu, - uint64_t dataword, - int proc, - tftype tf) { - fillRegionalMuonCand(mu, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), proc, tf); +void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( + RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isKalman) { + fillRegionalMuonCand( + mu, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), proc, tf, isKalman); } void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalMuonCand& mu, From 74f5c24dcd6872fd34cb8fc8cbd0e4589dbfd404 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 5 Mar 2020 17:14:54 +0100 Subject: [PATCH 11/37] Enabled switching of cancel-out algo based on FW version --- L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py index c3cd68641eea8..78cef4c3ca141 100644 --- a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py +++ b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py @@ -15,7 +15,7 @@ autoBxRange = cms.bool(True), # if True the output BX range is calculated from the inputs and 'bxMin' and 'bxMax' are ignored bxMin = cms.int32(-2), bxMax = cms.int32(2), - autoCancelMode = cms.bool(False), # if True the cancel out methods are configured depending on the FW version number and 'bmtfCancelMode'&'emtfCancelMode' are ignored + autoCancelMode = cms.bool(True), # if True the cancel out methods are configured depending on the FW version number and 'bmtfCancelMode'&'emtfCancelMode' are ignored bmtfCancelMode = cms.string("kftracks"), # 'tracks' or 'kftracks' (when using the Run-3 BMTF) emtfCancelMode = cms.string("coordinate") # 'tracks' or 'coordinate' ) From 6ee6f6b8b20b79057ea69e428aa85e1011db4352 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Mon, 23 Mar 2020 11:41:25 +0100 Subject: [PATCH 12/37] Zero pT indicates empty muon. Co-Authored-By: panoskatsoulis --- .../plugins/implementations_stage2/BMTFUnpackerOutput.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc index 14837f49fc6df..153638dabae21 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc @@ -68,7 +68,7 @@ namespace l1t { RegionalMuonRawDigiTranslator::fillRegionalMuonCand( muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman); - if (muCand.hwQual() == 0) + if (muCand.hwPt() == 0) continue; if (isKalman) { From 702afee2c2493f580a134e52f78f9a991f3b4ac2 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Fri, 27 Mar 2020 15:45:14 +0100 Subject: [PATCH 13/37] Added physical unconstrained pT to muon data format. --- DataFormats/L1Trigger/interface/Muon.h | 9 +++++++-- DataFormats/L1Trigger/src/Muon.cc | 16 +++++++++++----- DataFormats/L1Trigger/src/classes_def.xml | 2 +- L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc | 1 + L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc | 1 + 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/DataFormats/L1Trigger/interface/Muon.h b/DataFormats/L1Trigger/interface/Muon.h index 715835cf109d8..2b5e421046261 100644 --- a/DataFormats/L1Trigger/interface/Muon.h +++ b/DataFormats/L1Trigger/interface/Muon.h @@ -41,7 +41,8 @@ namespace l1t { int hwPhiAtVtx = 0, double etaAtVtx = 0., double phiAtVtx = 0., - int ptUnconstrained = 0, + int hwPtUnconstrained = 0, + double ptUnconstrained = 0., int dXY = 0); Muon(const PolarLorentzVector& p4, @@ -63,7 +64,8 @@ namespace l1t { int hwPhiAtVtx = 0, double etaAtVtx = 0., double phiAtVtx = 0., - int ptUnconstrained = 0, + int hwPtUnconstrained = 0, + double ptUnconstrained = 0., int dXY = 0); ~Muon(); @@ -85,6 +87,7 @@ namespace l1t { inline void setHwRank(int rank) { hwRank_ = rank; }; inline void setHwPtUnconstrained(int hwPtUnconstrained) { hwPtUnconstrained_ = hwPtUnconstrained; }; + inline void setPtUnconstrained(double ptUnconstrained) { ptUnconstrained_ = ptUnconstrained; }; inline void setHwDXY(int hwDXY) { hwDXY_ = hwDXY; }; inline void setDebug(bool debug) { debug_ = debug; }; @@ -106,6 +109,7 @@ namespace l1t { inline int hwRank() const { return hwRank_; }; inline int hwPtUnconstrained() const { return hwPtUnconstrained_; }; + inline double ptUnconstrained() const { return ptUnconstrained_; }; inline int hwDXY() const { return hwDXY_; }; inline bool debug() const { return debug_; }; @@ -135,6 +139,7 @@ namespace l1t { // displacement information int hwPtUnconstrained_; + double ptUnconstrained_; int hwDXY_; }; diff --git a/DataFormats/L1Trigger/src/Muon.cc b/DataFormats/L1Trigger/src/Muon.cc index 6a4471807ce21..bdb1905885b2a 100644 --- a/DataFormats/L1Trigger/src/Muon.cc +++ b/DataFormats/L1Trigger/src/Muon.cc @@ -16,6 +16,7 @@ l1t::Muon::Muon() etaAtVtx_(0.), phiAtVtx_(0.), hwPtUnconstrained_(0), + ptUnconstrained_(0.), hwDXY_(0) {} l1t::Muon::Muon(const LorentzVector& p4, @@ -37,7 +38,8 @@ l1t::Muon::Muon(const LorentzVector& p4, int hwPhiAtVtx, double etaAtVtx, double phiAtVtx, - int ptUnconstrained, + int hwPtUnconstrained, + double ptUnconstrained, int dXY) : L1Candidate(p4, pt, eta, phi, qual, iso), hwCharge_(charge), @@ -53,7 +55,8 @@ l1t::Muon::Muon(const LorentzVector& p4, hwPhiAtVtx_(hwPhiAtVtx), etaAtVtx_(etaAtVtx), phiAtVtx_(phiAtVtx), - hwPtUnconstrained_(ptUnconstrained), + hwPtUnconstrained_(hwPtUnconstrained), + ptUnconstrained_(ptUnconstrained), hwDXY_(dXY) {} l1t::Muon::Muon(const PolarLorentzVector& p4, @@ -75,7 +78,8 @@ l1t::Muon::Muon(const PolarLorentzVector& p4, int hwPhiAtVtx, double etaAtVtx, double phiAtVtx, - int ptUnconstrained, + int hwPtUnconstrained, + double ptUnconstrained, int dXY) : L1Candidate(p4, pt, eta, phi, qual, iso), hwCharge_(charge), @@ -91,7 +95,8 @@ l1t::Muon::Muon(const PolarLorentzVector& p4, hwPhiAtVtx_(hwPhiAtVtx), etaAtVtx_(etaAtVtx), phiAtVtx_(phiAtVtx), - hwPtUnconstrained_(ptUnconstrained), + hwPtUnconstrained_(hwPtUnconstrained), + ptUnconstrained_(ptUnconstrained), hwDXY_(dXY) {} l1t::Muon::~Muon() {} @@ -100,5 +105,6 @@ bool l1t::Muon::operator==(const l1t::Muon& rhs) const { return l1t::L1Candidate::operator==(static_cast(rhs)) && hwCharge_ == rhs.hwCharge() && hwChargeValid_ == rhs.hwChargeValid() && tfMuonIndex_ == rhs.tfMuonIndex() && hwEtaAtVtx_ == rhs.hwEtaAtVtx() && hwPhiAtVtx_ == rhs.hwPhiAtVtx() && - hwPtUnconstrained_ == rhs.hwPtUnconstrained() && hwDXY_ == rhs.hwDXY(); + hwPtUnconstrained_ == rhs.hwPtUnconstrained() && ptUnconstrained_ == rhs.ptUnconstrained() && + hwDXY_ == rhs.hwDXY(); } diff --git a/DataFormats/L1Trigger/src/classes_def.xml b/DataFormats/L1Trigger/src/classes_def.xml index d91e87bba66d1..8fc148869af6f 100644 --- a/DataFormats/L1Trigger/src/classes_def.xml +++ b/DataFormats/L1Trigger/src/classes_def.xml @@ -81,7 +81,7 @@ - + diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc index c2d09f063ca35..998b1ff25c72f 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc @@ -346,6 +346,7 @@ void L1TMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) MicroGMTConfiguration::calcMuonEtaExtra(outMu), MicroGMTConfiguration::calcMuonPhiExtra(outMu), // set the coordinates at the vertex mu->hwPtUnconstrained(), + (mu->hwPtUnconstrained() - 1) * 0.5, mu->hwDXY()}; if (mu->hwSignValid()) { outMu.setCharge(1 - 2 * mu->hwSign()); diff --git a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc index c1e594bb8e5a5..dcab1a96a6865 100644 --- a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc @@ -140,6 +140,7 @@ void l1t::MuonRawDigiTranslator::fillMuonCoordinatesRun3( // displacement information mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_); mu.setHwPtUnconstrained((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_); + mu.setPtUnconstrained((mu.hwPtUnconstrained() - 1) * 0.5); } void l1t::MuonRawDigiTranslator::fillIntermediateMuonCoordinatesRun3(Muon& mu, From 0002ea58896cb79104555a315cdf018e46987d6e Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Fri, 27 Mar 2020 15:46:36 +0100 Subject: [PATCH 14/37] Fixed indentation --- .../plugins/implementations_stage2/BMTFUnpackerOutput.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc index 153638dabae21..62c45fa15ea3d 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc @@ -68,8 +68,9 @@ namespace l1t { RegionalMuonRawDigiTranslator::fillRegionalMuonCand( muCand, raw_first, raw_secnd, processor, tftype::bmtf, isKalman); - if (muCand.hwPt() == 0) + if (muCand.hwPt() == 0) { continue; + } if (isKalman) { LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi() From 23244f234b107008fc7edc9cc48a16b520498a9a Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Fri, 27 Mar 2020 16:17:48 +0100 Subject: [PATCH 15/37] Added displacement quantities at GMT output to L1TNtuples --- .../L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h | 6 ++++++ L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc | 3 +++ 2 files changed, 9 insertions(+) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h index e5978d6e2853b..82168330c0e31 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeDataFormat.h @@ -105,11 +105,13 @@ namespace L1Analysis { nMuons = 0; muonEt.clear(); + muonEtUnconstrained.clear(); muonEta.clear(); muonPhi.clear(); muonEtaAtVtx.clear(); muonPhiAtVtx.clear(); muonIEt.clear(); + muonIEtUnconstrained.clear(); muonIEta.clear(); muonIPhi.clear(); muonIEtaAtVtx.clear(); @@ -119,6 +121,7 @@ namespace L1Analysis { muonChg.clear(); muonIso.clear(); muonQual.clear(); + muonDxy.clear(); muonTfMuonIdx.clear(); muonBx.clear(); @@ -188,11 +191,13 @@ namespace L1Analysis { unsigned short int nMuons; std::vector muonEt; + std::vector muonEtUnconstrained; std::vector muonEta; std::vector muonPhi; std::vector muonEtaAtVtx; std::vector muonPhiAtVtx; std::vector muonIEt; + std::vector muonIEtUnconstrained; std::vector muonIEta; std::vector muonIPhi; std::vector muonIEtaAtVtx; @@ -202,6 +207,7 @@ namespace L1Analysis { std::vector muonChg; std::vector muonIso; std::vector muonQual; + std::vector muonDxy; std::vector muonTfMuonIdx; std::vector muonBx; diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc index 6a8c3d1540601..e037ce0e76339 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1Upgrade.cc @@ -96,11 +96,13 @@ void L1Analysis::L1AnalysisL1Upgrade::SetMuon(const edm::Handlept() > 0) { l1upgrade_.muonEt.push_back(it->et()); + l1upgrade_.muonEtUnconstrained.push_back(it->ptUnconstrained()); l1upgrade_.muonEta.push_back(it->eta()); l1upgrade_.muonPhi.push_back(it->phi()); l1upgrade_.muonEtaAtVtx.push_back(it->etaAtVtx()); l1upgrade_.muonPhiAtVtx.push_back(it->phiAtVtx()); l1upgrade_.muonIEt.push_back(it->hwPt()); + l1upgrade_.muonIEtUnconstrained.push_back(it->hwPtUnconstrained()); l1upgrade_.muonIEta.push_back(it->hwEta()); l1upgrade_.muonIPhi.push_back(it->hwPhi()); l1upgrade_.muonIEtaAtVtx.push_back(it->hwEtaAtVtx()); @@ -110,6 +112,7 @@ void L1Analysis::L1AnalysisL1Upgrade::SetMuon(const edm::Handlecharge()); l1upgrade_.muonIso.push_back(it->hwIso()); l1upgrade_.muonQual.push_back(it->hwQual()); + l1upgrade_.muonDxy.push_back(it->hwDXY()); l1upgrade_.muonTfMuonIdx.push_back(it->tfMuonIndex()); l1upgrade_.muonBx.push_back(ibx); l1upgrade_.nMuons++; From be04ebf6f88a465c76fb5e688c02d83805c0624b Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 2 Apr 2020 12:01:22 +0200 Subject: [PATCH 16/37] Reverting change of barrel input collection for uGMT This should be configured based on eras in the future. --- L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py index 78cef4c3ca141..26e5562aa1397 100644 --- a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py +++ b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py @@ -7,7 +7,7 @@ ) simGmtStage2Digis = cms.EDProducer('L1TMuonProducer', - barrelTFInput = cms.InputTag("simKBmtfDigis", "BMTF"), + barrelTFInput = cms.InputTag("simBmtfDigis", "BMTF"), overlapTFInput = cms.InputTag("simOmtfDigis", "OMTF"), forwardTFInput = cms.InputTag("simEmtfDigis", "EMTF"), #triggerTowerInput = cms.InputTag("simGmtCaloSumDigis", "TriggerTower2x2s"), @@ -15,7 +15,7 @@ autoBxRange = cms.bool(True), # if True the output BX range is calculated from the inputs and 'bxMin' and 'bxMax' are ignored bxMin = cms.int32(-2), bxMax = cms.int32(2), - autoCancelMode = cms.bool(True), # if True the cancel out methods are configured depending on the FW version number and 'bmtfCancelMode'&'emtfCancelMode' are ignored + autoCancelMode = cms.bool(True), # if True the cancel out methods are configured depending on the FW version number and 'bmtfCancelMode' + 'emtfCancelMode' are ignored bmtfCancelMode = cms.string("kftracks"), # 'tracks' or 'kftracks' (when using the Run-3 BMTF) emtfCancelMode = cms.string("coordinate") # 'tracks' or 'coordinate' ) From 6f456a4b21ca5af21488b6755135f113c8986483 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Wed, 8 Apr 2020 17:57:30 +0200 Subject: [PATCH 17/37] Make unpacker code more readable (and fix a bug) In the MuonUnpacker the wrong overloaded function was being called, this is fixed now. In the process I also rewrote my earlier attempt, it should be more readable now. --- .../IntermediateMuonUnpacker.cc | 3 +- .../implementations_stage2/MuonUnpacker.cc | 2 +- .../L1TMuon/interface/MuonRawDigiTranslator.h | 26 ++-- .../L1TMuon/src/MuonRawDigiTranslator.cc | 131 +++++++++--------- 4 files changed, 86 insertions(+), 76 deletions(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc index 949ccfea8378a..f72ea5205db2c 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.cc @@ -120,8 +120,7 @@ namespace l1t { // The intermediate muons of the uGMT (FED number 1402) do not // have coordinates estimated at the vertex in the RAW data. // The corresponding bits are set to zero. - MuonRawDigiTranslator::fillMuon( - mu, 0, raw_data_00_31, raw_data_32_63, 1402, getAlgoVersion(), nWord / 2, true); + MuonRawDigiTranslator::fillIntermediateMuon(mu, raw_data_00_31, raw_data_32_63, getAlgoVersion()); LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " iso " << mu.hwIso() << " qual " << mu.hwQual() << " charge " << mu.hwCharge() diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc index 885126b8b343a..1c1b12021aa07 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.cc @@ -61,7 +61,7 @@ namespace l1t { uint32_t raw_data_spare = payload[startIdx + 1]; uint32_t raw_data_00_31 = payload[i++]; uint32_t raw_data_32_63 = payload[i++]; - LogDebug("L1T") << "raw_data_spare = 0x" << hex << raw_data_spare << "raw_data_00_31 = 0x" << raw_data_00_31 + LogDebug("L1T") << "raw_data_spare = 0x" << hex << raw_data_spare << " raw_data_00_31 = 0x" << raw_data_00_31 << " raw_data_32_63 = 0x" << raw_data_32_63; // skip empty muons (hwPt == 0) if (((raw_data_00_31 >> l1t::MuonRawDigiTranslator::ptShift_) & l1t::MuonRawDigiTranslator::ptMask_) == 0) { diff --git a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h index eb4e60101695e..28e907c0dfc36 100644 --- a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h @@ -6,16 +6,18 @@ namespace l1t { class MuonRawDigiTranslator { public: - static void fillMuon(Muon&, uint32_t, uint32_t, uint32_t, int, unsigned int, int, bool); - static void fillMuon(Muon&, uint32_t, uint64_t, int, unsigned int, int, bool); - static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); - static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); - static void fillMuonCoordinatesRun3( - Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx); - static void fillIntermediateMuonCoordinatesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuon(Muon& mu, + uint32_t raw_data_spare, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63, + int fed, + unsigned int fw, + int muInBx); + static void fillMuon(Muon& mu, uint32_t raw_data_spare, uint64_t dataword, int fed, unsigned int fw, int muInBx); + static void fillIntermediateMuon(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, unsigned int fw); static void generatePackedDataWords(const Muon&, uint32_t&, uint32_t&); static uint64_t generate64bitDataWord(const Muon&); - static int calcHwEta(const uint32_t&, const unsigned, const unsigned); + static int calcHwEta(const uint32_t& raw, const unsigned absEtaShift, const unsigned etaSignShift); static constexpr unsigned ptMask_ = 0x1FF; static constexpr unsigned ptShift_ = 10; @@ -44,6 +46,14 @@ namespace l1t { static constexpr unsigned etaMu1SignShift_ = 20; // For Run-3 static constexpr unsigned absEtaMu2Shift_ = 21; // For Run-3 static constexpr unsigned etaMu2SignShift_ = 29; // For Run-3 + + private: + static void fillMuonStableQuantities(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonCoordinatesRun3( + Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx); + static void fillIntermediateMuonCoordinatesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); }; } // namespace l1t diff --git a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc index dcab1a96a6865..fb18c76011f5c 100644 --- a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc @@ -7,74 +7,75 @@ void l1t::MuonRawDigiTranslator::fillMuon(Muon& mu, uint32_t raw_data_32_63, int fed, unsigned int fw, - int muInBx, - bool intermediateMuon = false) { - int hwPt = (raw_data_00_31 >> ptShift_) & ptMask_; - if (hwPt > 0) { - mu.setHwPt(hwPt); - mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_); - mu.setHwIso((raw_data_32_63 >> isoShift_) & isoMask_); - // charge is coded as -1^chargeBit - mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0x1); - mu.setHwChargeValid((raw_data_32_63 >> chargeValidShift_) & 0x1); - mu.setTfMuonIndex((raw_data_32_63 >> tfMuonIndexShift_) & tfMuonIndexMask_); - - // The position of the eta and phi coordinates in the RAW data changed between the 2016 run and the 2017 run. - // Eta and phi at the muon system are replaced by eta and phi at the vertex - // Eta and phi at the muon system are moved to spare bits - // In Run-3 we have displacement information. - // To make room for these data the raw eta value was moved to the second "spare" word which we will have to treat separately - // The uGMT (FED 1402) or uGT (FED 1404) FW versions are used to determine the era. - if (fed == 1402 && intermediateMuon) { - if (fw < 0x4010000) { - fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63); - } else if (fw < 0x6000000) { - fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); - } else { - fillIntermediateMuonCoordinatesRun3(mu, raw_data_00_31, raw_data_32_63); - } - } else { - if ((fed == 1402 && fw < 0x4010000) || (fed == 1404 && fw < 0x10A6)) { - fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63); - } else if ((fed == 1402 && fw < 0x6000000) || (fed == 1404 && fw < 0x1120)) { - fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); - } else { - fillMuonCoordinatesRun3(mu, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx); - } - } - - math::PtEtaPhiMLorentzVector vec{(mu.hwPt() - 1) * 0.5, mu.hwEta() * 0.010875, mu.hwPhi() * 0.010908, 0.0}; - mu.setP4(vec); - // generate a muon at the vertex to extract the physical eta and phi coordinates - math::PtEtaPhiMLorentzVector vecAtVtx{ - (mu.hwPt() - 1) * 0.5, mu.hwEtaAtVtx() * 0.010875, mu.hwPhiAtVtx() * 0.010908, 0.0}; - Muon muAtVtx; - muAtVtx.setP4(vecAtVtx); - mu.setEtaAtVtx(muAtVtx.eta()); - mu.setPhiAtVtx(muAtVtx.phi()); - if (mu.hwChargeValid()) { - mu.setCharge(1 - 2 * mu.hwCharge()); - } else { - mu.setCharge(0); - } + int muInBx) { + // Need the hw charge to properly compute dPhi + mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0x1); + + // The position of the eta and phi coordinates in the RAW data changed between the 2016 run and the 2017 run. + // Eta and phi at the muon system are replaced by eta and phi at the vertex + // Eta and phi at the muon system are moved to spare bits + // In Run-3 we have displacement information. + // To make room for these data the raw eta value was moved to the second "spare" word which we will have to treat separately + // The uGMT (FED 1402) or uGT (FED 1404) FW versions are used to determine the era. + if ((fed == 1402 && fw < 0x4010000) || (fed == 1404 && fw < 0x10A6)) { + fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63); + } else if ((fed == 1402 && fw < 0x6000000) || (fed == 1404 && fw < 0x1120)) { + fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); + } else { + fillMuonCoordinatesRun3(mu, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx); } + + // Fill pT, qual, iso, charge, index bits, coordinates at vtx + fillMuonStableQuantities(mu, raw_data_00_31, raw_data_32_63); } -void l1t::MuonRawDigiTranslator::fillMuon(Muon& mu, - uint32_t raw_data_spare, - uint64_t dataword, - int fed, - unsigned int fw, - int muInBx, - bool intermediateMuon = false) { - fillMuon(mu, - raw_data_spare, - (uint32_t)(dataword & 0xFFFFFFFF), - (uint32_t)((dataword >> 32) & 0xFFFFFFFF), - fed, - fw, - muInBx, - intermediateMuon); +void l1t::MuonRawDigiTranslator::fillIntermediateMuon(Muon& mu, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63, + unsigned int fw) { + // Need the hw charge to properly compute dPhi + mu.setHwCharge((raw_data_32_63 >> chargeShift_) & 0x1); + + if (fw < 0x4010000) { + fillMuonCoordinates2016(mu, raw_data_00_31, raw_data_32_63); + } else if (fw < 0x6000000) { + fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); + } else { + fillIntermediateMuonCoordinatesRun3(mu, raw_data_00_31, raw_data_32_63); + } + + // Fill pT, qual, iso, charge, index bits, coordinates at vtx + fillMuonStableQuantities(mu, raw_data_00_31, raw_data_32_63); +} + +void l1t::MuonRawDigiTranslator::fillMuonStableQuantities(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63) { + mu.setHwPt((raw_data_00_31 >> ptShift_) & ptMask_); + mu.setHwQual((raw_data_00_31 >> qualShift_) & qualMask_); + mu.setHwIso((raw_data_32_63 >> isoShift_) & isoMask_); + // charge is coded as -1^chargeBit + mu.setHwChargeValid((raw_data_32_63 >> chargeValidShift_) & 0x1); + mu.setTfMuonIndex((raw_data_32_63 >> tfMuonIndexShift_) & tfMuonIndexMask_); + if (mu.hwChargeValid()) { + mu.setCharge(1 - 2 * mu.hwCharge()); + } else { + mu.setCharge(0); + } + + math::PtEtaPhiMLorentzVector vec{(mu.hwPt() - 1) * 0.5, mu.hwEta() * 0.010875, mu.hwPhi() * 0.010908, 0.0}; + mu.setP4(vec); + // generate a muon at the vertex to extract the physical eta and phi coordinates + math::PtEtaPhiMLorentzVector vecAtVtx{ + (mu.hwPt() - 1) * 0.5, mu.hwEtaAtVtx() * 0.010875, mu.hwPhiAtVtx() * 0.010908, 0.0}; + Muon muAtVtx; + muAtVtx.setP4(vecAtVtx); + mu.setEtaAtVtx(muAtVtx.eta()); + mu.setPhiAtVtx(muAtVtx.phi()); +} + +void l1t::MuonRawDigiTranslator::fillMuon( + Muon& mu, uint32_t raw_data_spare, uint64_t dataword, int fed, unsigned int fw, int muInBx) { + fillMuon( + mu, raw_data_spare, (uint32_t)(dataword & 0xFFFFFFFF), (uint32_t)((dataword >> 32) & 0xFFFFFFFF), fed, fw, muInBx); } void l1t::MuonRawDigiTranslator::fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63) { From 815caa745168ddb67b5d7d85aab449c97caf4776 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 16 Apr 2020 12:33:43 +0200 Subject: [PATCH 18/37] Guarding against negative unconstrained pT Also add displacement information to uGMT intermediate muons and light refactoring for clarity. --- .../L1TMuon/interface/MuonRawDigiTranslator.h | 4 +-- L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc | 29 ++++++++++++++----- .../L1TMuon/src/MuonRawDigiTranslator.cc | 18 +++++++----- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h index 28e907c0dfc36..55f91d8508961 100644 --- a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h @@ -51,9 +51,9 @@ namespace l1t { static void fillMuonStableQuantities(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); - static void fillMuonCoordinatesRun3( + static void fillMuonQuantitiesRun3( Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx); - static void fillIntermediateMuonCoordinatesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillIntermediateMuonQuantitiesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); }; } // namespace l1t diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc index 998b1ff25c72f..07b75d8ede758 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc @@ -340,14 +340,21 @@ void L1TMuonProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) mu->hwIsoSum(), mu->hwDPhi(), mu->hwDEta(), - mu->hwRank(), - MicroGMTConfiguration::calcMuonHwEtaExtra(outMu), - MicroGMTConfiguration::calcMuonHwPhiExtra(outMu), // set the coordinates at the vertex - MicroGMTConfiguration::calcMuonEtaExtra(outMu), - MicroGMTConfiguration::calcMuonPhiExtra(outMu), // set the coordinates at the vertex - mu->hwPtUnconstrained(), - (mu->hwPtUnconstrained() - 1) * 0.5, - mu->hwDXY()}; + mu->hwRank()}; + + // Set coordinates at the vertex + outMu.setHwEtaAtVtx(MicroGMTConfiguration::calcMuonHwEtaExtra(outMu)); + outMu.setHwPhiAtVtx(MicroGMTConfiguration::calcMuonHwPhiExtra(outMu)); + outMu.setEtaAtVtx(MicroGMTConfiguration::calcMuonEtaExtra(outMu)); + outMu.setPhiAtVtx(MicroGMTConfiguration::calcMuonPhiExtra(outMu)); + + // Set displacement information + int hwPtUnconstrained{mu->hwPtUnconstrained()}; + outMu.setPtUnconstrained(hwPtUnconstrained == 0 ? 0 + : (hwPtUnconstrained - 1) * 0.5); // Don't want negative pT. + outMu.setHwPtUnconstrained(hwPtUnconstrained); + outMu.setHwDXY(mu->hwDXY()); + if (mu->hwSignValid()) { outMu.setCharge(1 - 2 * mu->hwSign()); } else { @@ -440,6 +447,12 @@ void L1TMuonProducer::addMuonsToCollections(MicroGMTConfiguration::InterMuonList mu->hwDPhi(), mu->hwDEta(), mu->hwRank()}; + + int hwPtUnconstrained{mu->hwPtUnconstrained()}; + outMu.setPtUnconstrained(hwPtUnconstrained == 0 ? 0 : (hwPtUnconstrained - 1) * 0.5); // Don't want negative pT. + outMu.setHwPtUnconstrained(hwPtUnconstrained); + outMu.setHwDXY(mu->hwDXY()); + if (mu->hwSignValid()) { outMu.setCharge(1 - 2 * mu->hwSign()); } else { diff --git a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc index fb18c76011f5c..44ca904a2a615 100644 --- a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc @@ -22,7 +22,7 @@ void l1t::MuonRawDigiTranslator::fillMuon(Muon& mu, } else if ((fed == 1402 && fw < 0x6000000) || (fed == 1404 && fw < 0x1120)) { fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); } else { - fillMuonCoordinatesRun3(mu, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx); + fillMuonQuantitiesRun3(mu, raw_data_spare, raw_data_00_31, raw_data_32_63, muInBx); } // Fill pT, qual, iso, charge, index bits, coordinates at vtx @@ -41,10 +41,10 @@ void l1t::MuonRawDigiTranslator::fillIntermediateMuon(Muon& mu, } else if (fw < 0x6000000) { fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); } else { - fillIntermediateMuonCoordinatesRun3(mu, raw_data_00_31, raw_data_32_63); + fillIntermediateMuonQuantitiesRun3(mu, raw_data_00_31, raw_data_32_63); } - // Fill pT, qual, iso, charge, index bits, coordinates at vtx + // Fill pT, qual, iso, charge, index bits, phys. coordinates at vtx & unconstrained pT fillMuonStableQuantities(mu, raw_data_00_31, raw_data_32_63); } @@ -70,6 +70,9 @@ void l1t::MuonRawDigiTranslator::fillMuonStableQuantities(Muon& mu, uint32_t raw muAtVtx.setP4(vecAtVtx); mu.setEtaAtVtx(muAtVtx.eta()); mu.setPhiAtVtx(muAtVtx.phi()); + + int hwPtUnconstrained{mu.hwPtUnconstrained()}; + mu.setPtUnconstrained(hwPtUnconstrained == 0 ? 0 : (hwPtUnconstrained - 1) * 0.5); // Don't want negative pT. } void l1t::MuonRawDigiTranslator::fillMuon( @@ -112,7 +115,7 @@ void l1t::MuonRawDigiTranslator::fillMuonCoordinatesFrom2017(Muon& mu, mu.setHwDPhiExtra(dPhi); } -void l1t::MuonRawDigiTranslator::fillMuonCoordinatesRun3( +void l1t::MuonRawDigiTranslator::fillMuonQuantitiesRun3( Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx) { // coordinates at the muon system // Where to find the raw eta depends on which muon we're looking at @@ -141,12 +144,11 @@ void l1t::MuonRawDigiTranslator::fillMuonCoordinatesRun3( // displacement information mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_); mu.setHwPtUnconstrained((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_); - mu.setPtUnconstrained((mu.hwPtUnconstrained() - 1) * 0.5); } -void l1t::MuonRawDigiTranslator::fillIntermediateMuonCoordinatesRun3(Muon& mu, - uint32_t raw_data_00_31, - uint32_t raw_data_32_63) { +void l1t::MuonRawDigiTranslator::fillIntermediateMuonQuantitiesRun3(Muon& mu, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63) { fillMuonCoordinatesFrom2017(mu, raw_data_00_31, raw_data_32_63); // displacement information From 3a68cf53d7a2f129288148dca410598e3973bc76 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Wed, 22 Apr 2020 18:32:23 +0200 Subject: [PATCH 19/37] Renamed pt2 member of regional muon DF to ptUnconstrained --- DQM/L1TMonitor/interface/L1TStage2BMTF.h | 6 +- .../interface/L1TStage2RegionalMuonCandComp.h | 6 +- DQM/L1TMonitor/src/L1TStage2BMTF.cc | 5 +- .../src/L1TStage2RegionalMuonCandComp.cc | 32 ++-- .../L1TMuon/interface/RegionalMuonCand.h | 12 +- DataFormats/L1TMuon/src/RegionalMuonCand.cc | 4 +- DataFormats/L1TMuon/src/classes_def.xml | 3 +- .../BMTFUnpackerOutput.cc | 2 +- .../RegionalMuonGMTUnpacker.cc | 2 +- L1Trigger/L1TMuon/interface/GMTInternalMuon.h | 2 +- .../src/RegionalMuonRawDigiTranslator.cc | 2 +- .../src/L1TMuonBarrelKalmanAlgo.cc | 2 +- .../src/L1TMuonBarrelKalmanSectorProcessor.cc | 6 +- .../test/kalmanTools/kmtfAnalysis.py | 140 +++++++++--------- .../test/kalmanTools/validation.py | 32 ++-- 15 files changed, 126 insertions(+), 130 deletions(-) diff --git a/DQM/L1TMonitor/interface/L1TStage2BMTF.h b/DQM/L1TMonitor/interface/L1TStage2BMTF.h index 61abcbcc01a0f..a77c03b05cb55 100644 --- a/DQM/L1TMonitor/interface/L1TStage2BMTF.h +++ b/DQM/L1TMonitor/interface/L1TStage2BMTF.h @@ -4,7 +4,7 @@ /* * \file L1TStage2BMTF.h * \Author Esmaeel Eskandari Tadavani - * \December 2015 + * \December 2015 */ // system requirements @@ -33,7 +33,7 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" // dqm requirements -#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "FWCore/Framework/interface/Frameworkfwd.h" @@ -95,7 +95,7 @@ class L1TStage2BMTF : public DQMEDAnalyzer { MonitorElement* bmtf_hwQual_bx; MonitorElement* bmtf_hwDXY; - MonitorElement* bmtf_hwPt2; + MonitorElement* bmtf_hwPtUnconstrained; /* MonitorElement* bmtf_twinmuxInput_PhiBX; */ /* MonitorElement* bmtf_twinmuxInput_PhiPhi; */ diff --git a/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h b/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h index ffbb09b4f10fc..d312f8b640ecf 100644 --- a/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h +++ b/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h @@ -4,7 +4,7 @@ #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" @@ -95,7 +95,7 @@ class L1TStage2RegionalMuonCandComp : public DQMEDAnalyzer { MonitorElement* muColl1TrkAddrSize; MonitorElement* muColl1TrkAddr; MonitorElement* muColl1hwDXY; - MonitorElement* muColl1hwPt2; + MonitorElement* muColl1hwPtUnconstrained; MonitorElement* muColl2BxRange; MonitorElement* muColl2nMu; @@ -112,7 +112,7 @@ class L1TStage2RegionalMuonCandComp : public DQMEDAnalyzer { MonitorElement* muColl2TrkAddrSize; MonitorElement* muColl2TrkAddr; MonitorElement* muColl2hwDXY; - MonitorElement* muColl2hwPt2; + MonitorElement* muColl2hwPtUnconstrained; }; #endif diff --git a/DQM/L1TMonitor/src/L1TStage2BMTF.cc b/DQM/L1TMonitor/src/L1TStage2BMTF.cc index 1c14e4031c1ec..8af2d0730a9f0 100644 --- a/DQM/L1TMonitor/src/L1TStage2BMTF.cc +++ b/DQM/L1TMonitor/src/L1TStage2BMTF.cc @@ -80,7 +80,8 @@ void L1TStage2BMTF::bookHistograms(DQMStore::IBooker& ibooker, const edm::Run& i bmtf_hwQual_bx->setTitle("; HW Quality; BX"); bmtf_hwDXY = ibooker.book1D(histoPrefix + "_hwDXY", "HW DXY", 4, 0, 4); - bmtf_hwPt2 = ibooker.book1D(histoPrefix + "_hwPt2", "HW p_{T}2", 512, -0.5, 511.5); + bmtf_hwPtUnconstrained = + ibooker.book1D(histoPrefix + "_hwPtUnconstrained", "HW p_{T} unconstrained", 512, -0.5, 511.5); // bmtf_twinmuxInput_PhiBX = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiBX" , "TwinMux Input Phi BX" , 5, -2.5, 2.5); // bmtf_twinmuxInput_PhiPhi = ibooker.book1D(histoPrefix+"_twinmuxInput_PhiPhi" , "TwinMux Input Phi HW Phi" , 201, -100.5, 100.5); @@ -136,7 +137,7 @@ void L1TStage2BMTF::analyze(const edm::Event& eve, const edm::EventSetup& eveSet bmtf_proc->Fill(itMuon->processor()); bmtf_hwDXY->Fill(itMuon->hwDXY()); - bmtf_hwPt2->Fill(itMuon->hwPt2()); + bmtf_hwPtUnconstrained->Fill(itMuon->hwPtUnconstrained()); if (fabs(bmtfMuon->getLastBX() - bmtfMuon->getFirstBX()) > 3) { bmtf_wedge_bx->Fill(itMuon->processor(), itBX); diff --git a/DQM/L1TMonitor/src/L1TStage2RegionalMuonCandComp.cc b/DQM/L1TMonitor/src/L1TStage2RegionalMuonCandComp.cc index 9fa3271af4b5e..95f05d94d2734 100644 --- a/DQM/L1TMonitor/src/L1TStage2RegionalMuonCandComp.cc +++ b/DQM/L1TMonitor/src/L1TStage2RegionalMuonCandComp.cc @@ -82,7 +82,7 @@ void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker, summary->setBinLabel(TRACKADDRBAD, "track address mismatch", 1); if (isBmtf) { summary->setBinLabel(DXYBAD, "DXY mismatch", 1); - summary->setBinLabel(PT2BAD, "P_{T}2 mismatch", 1); + summary->setBinLabel(PT2BAD, "P_{T} unconstrained mismatch", 1); } int nbinsNum = 14; @@ -111,7 +111,7 @@ void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker, errorSummaryNum->setBinLabel(RTRACKADDR, "track address mismatch", 1); if (isBmtf) { errorSummaryNum->setBinLabel(RDXY, "DXY mismatch", 1); - errorSummaryNum->setBinLabel(RPT2, "P_{T}2 mismatch", 1); + errorSummaryNum->setBinLabel(RPT2, "P_{T} unconstrained mismatch", 1); } // Change the label for those bins that will be ignored @@ -198,9 +198,12 @@ void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker, if (isBmtf) { muColl1hwDXY = ibooker.book1D("muhwDXYColl1", (muonColl1Title + " HW DXY" + trkAddrIgnoreText).c_str(), 4, 0, 4); muColl1hwDXY->setAxisTitle("Hardware DXY", 1); - muColl1hwPt2 = - ibooker.book1D("muhwPt2Coll1", (muonColl1Title + "HW p_{T}2" + trkAddrIgnoreText).c_str(), 512, -0.5, 511.5); - muColl1hwPt2->setAxisTitle("Hardware P_{T}2", 1); + muColl1hwPtUnconstrained = ibooker.book1D("muhwPtUnconstrainedColl1", + (muonColl1Title + "HW p_{T} unconstrained" + trkAddrIgnoreText).c_str(), + 512, + -0.5, + 511.5); + muColl1hwPtUnconstrained->setAxisTitle("Hardware P_{T} unconstrained", 1); } muColl2BxRange = ibooker.book1D("muBxRangeColl2", (muonColl2Title + " mismatching BX range").c_str(), 11, -5.5, 5.5); @@ -266,9 +269,12 @@ void L1TStage2RegionalMuonCandComp::bookHistograms(DQMStore::IBooker& ibooker, if (isBmtf) { muColl2hwDXY = ibooker.book1D("muhwDXYColl2", (muonColl2Title + " HW DXY" + trkAddrIgnoreText).c_str(), 4, 0, 4); muColl2hwDXY->setAxisTitle("Hardware DXY", 1); - muColl2hwPt2 = - ibooker.book1D("muhwPt2Coll2", (muonColl2Title + "HW p_{T}2" + trkAddrIgnoreText).c_str(), 512, -0.5, 511.5); - muColl2hwPt2->setAxisTitle("Hardware P_{T}2", 1); + muColl2hwPtUnconstrained = ibooker.book1D("muhwPtUnconstrainedColl2", + (muonColl2Title + "HW p_{T} unconstrained" + trkAddrIgnoreText).c_str(), + 512, + -0.5, + 511.5); + muColl2hwPtUnconstrained->setAxisTitle("Hardware P_{T} unconstrained", 1); } } @@ -333,7 +339,7 @@ void L1TStage2RegionalMuonCandComp::analyze(const edm::Event& e, const edm::Even muColl1TrkAddrSize->Fill(muon1TrackAddr.size()); if (isBmtf) { muColl1hwDXY->Fill(muonIt1->hwDXY()); - muColl1hwPt2->Fill(muonIt1->hwPt2()); + muColl1hwPtUnconstrained->Fill(muonIt1->hwPtUnconstrained()); } for (std::map::const_iterator trIt1 = muon1TrackAddr.begin(); trIt1 != muon1TrackAddr.end(); ++trIt1) { @@ -357,7 +363,7 @@ void L1TStage2RegionalMuonCandComp::analyze(const edm::Event& e, const edm::Even muColl2TrkAddrSize->Fill(muon2TrackAddr.size()); if (isBmtf) { muColl2hwDXY->Fill(muonIt2->hwDXY()); - muColl2hwPt2->Fill(muonIt2->hwPt2()); + muColl2hwPtUnconstrained->Fill(muonIt2->hwPtUnconstrained()); } for (std::map::const_iterator trIt2 = muon2TrackAddr.begin(); trIt2 != muon2TrackAddr.end(); ++trIt2) { @@ -506,7 +512,7 @@ void L1TStage2RegionalMuonCandComp::analyze(const edm::Event& e, const edm::Even errorSummaryNum->Fill(RDXY); } } - if (muonIt1->hwPt2() != muonIt2->hwPt2()) { + if (muonIt1->hwPtUnconstrained() != muonIt2->hwPtUnconstrained()) { muonMismatch = true; summary->Fill(PT2BAD); if (incBin[RPT2]) { @@ -534,7 +540,7 @@ void L1TStage2RegionalMuonCandComp::analyze(const edm::Event& e, const edm::Even muColl1TrkAddrSize->Fill(muon1TrackAddr.size()); if (isBmtf) { muColl1hwDXY->Fill(muonIt1->hwDXY()); - muColl1hwPt2->Fill(muonIt1->hwPt2()); + muColl1hwPtUnconstrained->Fill(muonIt1->hwPtUnconstrained()); } for (std::map::const_iterator trIt1 = muon1TrackAddr.begin(); trIt1 != muon1TrackAddr.end(); ++trIt1) { @@ -554,7 +560,7 @@ void L1TStage2RegionalMuonCandComp::analyze(const edm::Event& e, const edm::Even muColl2TrkAddrSize->Fill(muon2TrackAddr.size()); if (isBmtf) { muColl2hwDXY->Fill(muonIt2->hwDXY()); - muColl2hwPt2->Fill(muonIt2->hwPt2()); + muColl2hwPtUnconstrained->Fill(muonIt2->hwPtUnconstrained()); } for (std::map::const_iterator trIt2 = muon2TrackAddr.begin(); trIt2 != muon2TrackAddr.end(); ++trIt2) { diff --git a/DataFormats/L1TMuon/interface/RegionalMuonCand.h b/DataFormats/L1TMuon/interface/RegionalMuonCand.h index b9e9831de3693..92c0290dabb40 100644 --- a/DataFormats/L1TMuon/interface/RegionalMuonCand.h +++ b/DataFormats/L1TMuon/interface/RegionalMuonCand.h @@ -45,7 +45,7 @@ namespace l1t { RegionalMuonCand() : m_hwPt(0), - m_hwPt2(0), + m_hwPtUnconstrained(0), m_hwDXY(0), m_hwPhi(0), m_hwEta(0), @@ -59,7 +59,7 @@ namespace l1t { RegionalMuonCand(int pt, int phi, int eta, int sign, int signvalid, int quality, int processor, tftype trackFinder) : m_hwPt(pt), - m_hwPt2(0), + m_hwPtUnconstrained(0), m_hwDXY(0), m_hwPhi(phi), m_hwEta(eta), @@ -107,7 +107,7 @@ namespace l1t { tftype trackFinder, std::map trackAddress) : m_hwPt(pt), - m_hwPt2(0), + m_hwPtUnconstrained(0), m_hwDXY(0), m_hwPhi(phi), m_hwEta(eta), @@ -125,7 +125,7 @@ namespace l1t { /// Set compressed pT as transmitted by hardware LSB = 0.5 (9 bits) void setHwPt(int bits) { m_hwPt = bits; }; /// Set compressed second displaced pT as transmitted by hardware LSB = 1.0 (8 bits) - void setHwPt2(int bits) { m_hwPt2 = bits; }; + void setHwPtUnconstrained(int bits) { m_hwPtUnconstrained = bits; }; /// Set compressed impact parameter with respect to beamspot (4 bits) void setHwDXY(int bits) { m_hwDXY = bits; }; /// Set compressed relative phi as transmitted by hardware LSB = 2*pi/576 (8 bits) @@ -160,7 +160,7 @@ namespace l1t { /// Get compressed pT (returned int * 0.5 = pT (GeV)) const int hwPt() const { return m_hwPt; }; /// Get second compressed pT (returned int * 1.0 = pT (GeV)) - const int hwPt2() const { return m_hwPt2; }; + const int hwPtUnconstrained() const { return m_hwPtUnconstrained; }; /// Get compressed impact parameter (4 bits) const int hwDXY() const { return m_hwDXY; }; /// Get compressed local phi (returned int * 2*pi/576 = local phi in rad) @@ -201,7 +201,7 @@ namespace l1t { private: int m_hwPt; - int m_hwPt2; + int m_hwPtUnconstrained; int m_hwDXY; int m_hwPhi; int m_hwEta; diff --git a/DataFormats/L1TMuon/src/RegionalMuonCand.cc b/DataFormats/L1TMuon/src/RegionalMuonCand.cc index 856fadc8d18fb..861dee51c8725 100644 --- a/DataFormats/L1TMuon/src/RegionalMuonCand.cc +++ b/DataFormats/L1TMuon/src/RegionalMuonCand.cc @@ -25,8 +25,8 @@ namespace l1t { } bool RegionalMuonCand::operator==(const RegionalMuonCand& rhs) const { - return m_hwPt == rhs.hwPt() && m_hwPt2 == rhs.hwPt2() && m_hwDXY == rhs.hwDXY() && m_hwPhi == rhs.hwPhi() && - m_hwEta == rhs.hwEta() && m_hwHF == (bool)rhs.hwHF() && m_hwSign == rhs.hwSign() && + return m_hwPt == rhs.hwPt() && m_hwPtUnconstrained == rhs.hwPtUnconstrained() && m_hwDXY == rhs.hwDXY() && + m_hwPhi == rhs.hwPhi() && m_hwEta == rhs.hwEta() && m_hwHF == (bool)rhs.hwHF() && m_hwSign == rhs.hwSign() && m_hwSignValid == rhs.hwSignValid() && m_hwQuality == rhs.hwQual() && m_link == rhs.link() && m_processor == rhs.processor() && m_trackFinder == rhs.trackFinderType() && m_trackAddress == rhs.trackAddress(); diff --git a/DataFormats/L1TMuon/src/classes_def.xml b/DataFormats/L1TMuon/src/classes_def.xml index 84258a067d589..c411aeb8cd82b 100644 --- a/DataFormats/L1TMuon/src/classes_def.xml +++ b/DataFormats/L1TMuon/src/classes_def.xml @@ -63,7 +63,8 @@ - + + diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc index 62c45fa15ea3d..22a4b8116584d 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFUnpackerOutput.cc @@ -74,7 +74,7 @@ namespace l1t { if (isKalman) { LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi() - << " diplacedPt = " << muCand.hwPt2(); + << " diplacedPt = " << muCand.hwPtUnconstrained(); } else { LogDebug("L1T") << "Pt = " << muCand.hwPt() << " eta: " << muCand.hwEta() << " phi: " << muCand.hwPhi(); } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc index c513ad52fb3c5..2a8d556dc0eba 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.cc @@ -106,7 +106,7 @@ namespace l1t { LogDebug("L1T") << "Mu" << nWord / 2 << ": eta " << mu.hwEta() << " phi " << mu.hwPhi() << " pT " << mu.hwPt() << " qual " << mu.hwQual() << " sign " << mu.hwSign() << " sign valid " - << mu.hwSignValid() << " unconstrained pT " << mu.hwPt2(); + << mu.hwSignValid() << " unconstrained pT " << mu.hwPtUnconstrained(); res->push_back(bx, mu); } diff --git a/L1Trigger/L1TMuon/interface/GMTInternalMuon.h b/L1Trigger/L1TMuon/interface/GMTInternalMuon.h index f56139232570f..0b8b142a9f196 100644 --- a/L1Trigger/L1TMuon/interface/GMTInternalMuon.h +++ b/L1Trigger/L1TMuon/interface/GMTInternalMuon.h @@ -43,7 +43,7 @@ namespace l1t { const RegionalMuonCand& origin() const { return m_regional; }; inline const int hwPt() const { return m_regional.hwPt(); }; - inline const int hwPtUnconstrained() const { return m_regional.hwPt2(); }; + inline const int hwPtUnconstrained() const { return m_regional.hwPtUnconstrained(); }; inline const int hwDXY() const { return m_regional.hwDXY(); }; inline const int hwLocalPhi() const { return m_regional.hwPhi(); }; inline const int hwEta() const { return m_regional.hwEta(); }; diff --git a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc index 40a17e3aca2f3..81e8ba965b678 100644 --- a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc @@ -55,7 +55,7 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( mu.setTrackSubAddress(RegionalMuonCand::kStat3, statAddr2); mu.setTrackSubAddress(RegionalMuonCand::kStat4, statAddr1); // Additionally we now have displacement information from the BMTF - mu.setHwPt2((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_); + mu.setHwPtUnconstrained((raw_data_32_63 >> ptUnconstrainedShift_) & ptUnconstrainedMask_); mu.setHwDXY((raw_data_32_63 >> dxyShift_) & dxyMask_); } mu.setTrackSubAddress(RegionalMuonCand::kSegSelStat1, 0); diff --git a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc index 7380382040bd8..c8b1adacf4aef 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc @@ -105,7 +105,7 @@ l1t::RegionalMuonCand L1TMuonBarrelKalmanAlgo::convertToBMTF(const L1MuKBMTrack& l1t::RegionalMuonCand muon(pt, phi, eta, sign, signValid, quality, processor, l1t::bmtf, addr); muon.setHwHF(HF); - muon.setHwPt2(pt2); + muon.setHwPtUnconstrained(pt2); muon.setHwDXY(dxy); //nw the words! diff --git a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanSectorProcessor.cc b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanSectorProcessor.cc index bdb84df864f3d..9c28428153de5 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanSectorProcessor.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanSectorProcessor.cc @@ -114,7 +114,7 @@ L1TMuonBarrelKalmanSectorProcessor::bmtf_out L1TMuonBarrelKalmanSectorProcessor: out.addr4_1 = mu.trackSubAddress(l1t::RegionalMuonCand::kStat4); out.wheel_1 = mu.trackSubAddress(l1t::RegionalMuonCand::kWheelSide) * (1 << 2) + mu.trackSubAddress(l1t::RegionalMuonCand::kWheelNum); - out.ptSTA_1 = mu.hwPt2(); + out.ptSTA_1 = mu.hwPtUnconstrained(); } if (tracks.size() > 1) { @@ -135,7 +135,7 @@ L1TMuonBarrelKalmanSectorProcessor::bmtf_out L1TMuonBarrelKalmanSectorProcessor: out.wheel_2 = mu.trackSubAddress(l1t::RegionalMuonCand::kWheelSide) * (1 << 2) + mu.trackSubAddress(l1t::RegionalMuonCand::kWheelNum); - out.ptSTA_2 = mu.hwPt2(); + out.ptSTA_2 = mu.hwPtUnconstrained(); } if (tracks.size() > 2) { @@ -155,7 +155,7 @@ L1TMuonBarrelKalmanSectorProcessor::bmtf_out L1TMuonBarrelKalmanSectorProcessor: out.addr4_3 = mu.trackSubAddress(l1t::RegionalMuonCand::kStat4); out.wheel_3 = mu.trackSubAddress(l1t::RegionalMuonCand::kWheelSide) * (1 << 2) + mu.trackSubAddress(l1t::RegionalMuonCand::kWheelNum); - out.ptSTA_3 = mu.hwPt2(); + out.ptSTA_3 = mu.hwPtUnconstrained(); } return out; } diff --git a/L1Trigger/L1TMuonBarrel/test/kalmanTools/kmtfAnalysis.py b/L1Trigger/L1TMuonBarrel/test/kalmanTools/kmtfAnalysis.py index f489bd1defca0..a29b918519d17 100644 --- a/L1Trigger/L1TMuonBarrel/test/kalmanTools/kmtfAnalysis.py +++ b/L1Trigger/L1TMuonBarrel/test/kalmanTools/kmtfAnalysis.py @@ -1,9 +1,9 @@ from __future__ import print_function import ROOT,itertools,math # -from array import array # +from array import array # from DataFormats.FWLite import Events, Handle ROOT.FWLiteEnabler.enable() -# +# @@ -24,7 +24,7 @@ class BMTFMuon: def __init__(self,mu,pt,eta,phi): self.muon=mu self.p4 = ROOT.reco.Candidate.PolarLorentzVector(pt,eta,phi,0.105) - + def quality(self): return self.muon.hwQual() @@ -38,7 +38,7 @@ def hasFineEta(self): return self.muon.hwHF() def ptUnconstrained(self): - return self.muon.hwPt2() + return self.muon.hwPtUnconstrained() def dxy(self): return self.muon.hwDXY() @@ -47,7 +47,7 @@ def charge(self): if self.muon.hwSign()>0: return -1 else: - return +1 + return +1 def __getattr__(self, name): return getattr(self.p4,name) @@ -59,7 +59,7 @@ def getQual(track): q=0 for stub in track.stubs(): q+=stub.quality() - return q; + return q; def fetchTP(event,etaMax=0.83): @@ -76,7 +76,7 @@ def fetchTP(event,etaMax=0.83): trigger=tH.product() # for f in range(0,trigger.sizeFilters()): # print(f,trigger.filterLabel(f)) -# import pdb;pdb.set_trace() +# import pdb;pdb.set_trace() obj = trigger.getObjects() index = trigger.filterIndex(ROOT.edm.InputTag("hltL3fL1sMu22Or25L1f0L2f10QL3Filtered27Q::HLT")) if index==trigger.sizeFilters(): @@ -108,7 +108,7 @@ def fetchTP(event,etaMax=0.83): break if isProbe: probes.append(mu) - + return probes @@ -204,10 +204,10 @@ def fetchBMTF(event,isData,etaMax=1.2): K=1.0/pt K=1.181*K/(1+0.4867*K) pt=1.0/K - #### + #### phi=globalBMTFPhi(mu,'BMTF') rawP = rawPhi(mu) - eta = mu.hwEta()*0.010875 + eta = mu.hwEta()*0.010875 if abs(eta)<=etaMax: b = BMTFMuon(mu,pt,eta,phi) b.rawPhi=rawP @@ -231,7 +231,7 @@ def fetchKMTFNew(event,etaMax=1.2,saturate=True): pt=140.0 phi=globalBMTFPhi(mu,'KMTF') rawP = rawPhi(mu) - eta = mu.hwEta()*0.010875 + eta = mu.hwEta()*0.010875 if abs(eta)<=etaMax: b = BMTFMuon(mu,pt,eta,phi) b.rawPhi=rawP @@ -265,7 +265,7 @@ def fetchKMTF(event,etaMax=0.83,patterns=[],comps=[],chis=[],pts=[]): if mu.hitPattern()==p and mu.pt()>pt and (mu.trackCompatibility()>comp or mu.approxChi2()>chi): veto=True break; - if not veto: + if not veto: out.append(mu) return sorted(out,key=lambda x: x.pt(),reverse=True) @@ -299,7 +299,7 @@ def deltaR2( e1, p1, e2, p2): return de*de + dp*dp -def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): +def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): print("--------EVENT"+str(counter)+"------------") print("-----------------------------") print("-----------------------------") @@ -506,7 +506,7 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): # log(counter,stubs,gen,kmtfFull,kmtf,bmtf) - + for track in kmtfFull: chiAll[track.hitPattern()].Fill(abs(track.curvatureAtVertex()),track.approxChi2()) trackCompAll[track.hitPattern()].Fill(abs(track.curvatureAtVertex()),min(track.trackCompatibility(),99.5)); @@ -519,19 +519,19 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): etaKMTF.Fill(track.eta()) fineEtaKMTF.Fill(track.hasFineEta()) - if len(kmtf)>0: - PT=kmtf[0].pt() + if len(kmtf)>0: + PT=kmtf[0].pt() if kmtf[0].pt()>49.99: PT=49.99 - + if abs(kmtf[0].eta())<0.7: rateKMTFp7.Fill(PT) rateKMTF.Fill(PT) - - if len(kmtfFull)>0: - - PT=kmtfFull[0].pt() + + if len(kmtfFull)>0: + + PT=kmtfFull[0].pt() if kmtfFull[0].pt()>49.99: PT=49.99 ratePerTrack[kmtfFull[0].hitPattern()].Fill(PT) @@ -542,17 +542,17 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): etaBMTF.Fill(track.eta()) fineEtaBMTF.Fill(track.hasFineEta()) - if (len(bmtf)>0): - PT=bmtf[0].pt() + if (len(bmtf)>0): + PT=bmtf[0].pt() if bmtf[0].pt()>49.99: - PT=49.99 + PT=49.99 if abs(bmtf[0].eta())<0.7: rateBMTFp7.Fill(PT) rateBMTF.Fill(PT) # if ( len(kmtfFull)>0) and (kmtfFull[0].pt()>50): # log(counter,stubs,gen,kmtfFull,kmtf,bmtf) - + # if (len(kmtf)>0 and kmtf[0].pt()>20) and (len(bmtf)==0 or (len(bmtf)>0 and bmtf[0].pt()<10)): # log(counter,stubs,gen,kmtfFull,kmtf,bmtf) @@ -574,18 +574,18 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): genPhi.Fill(g.phi()) #match *(loosely because we still use coarse eta) - matchedBMTF = filter(lambda x: deltaR(g.eta(),g.phi(),x.eta(),x.phi())<0.3,bmtf) - matchedKMTF = filter(lambda x: deltaR(g.eta(),g.phi(),x.eta(),x.phi())<0.3,kmtf) - matchedKMTFFull = filter(lambda x: deltaR(g.eta(),g.phi(),x.eta(),x.phi())<0.3,kmtfFull) + matchedBMTF = filter(lambda x: deltaR(g.eta(),g.phi(),x.eta(),x.phi())<0.3,bmtf) + matchedKMTF = filter(lambda x: deltaR(g.eta(),g.phi(),x.eta(),x.phi())<0.3,kmtf) + matchedKMTFFull = filter(lambda x: deltaR(g.eta(),g.phi(),x.eta(),x.phi())<0.3,kmtfFull) -# matchedBMTF = filter(lambda x: abs(deltaPhi(g.phi(),x.phi()))<2.5,bmtf) -# matchedKMTF = filter(lambda x: abs(deltaPhi(g.phi(),x.phi()))<2.5,kmtf) -# matchedKMTFFull = filter(lambda x: abs(deltaPhi(g.phi(),x.phi()))<2.5,kmtfFull) +# matchedBMTF = filter(lambda x: abs(deltaPhi(g.phi(),x.phi()))<2.5,bmtf) +# matchedKMTF = filter(lambda x: abs(deltaPhi(g.phi(),x.phi()))<2.5,kmtf) +# matchedKMTFFull = filter(lambda x: abs(deltaPhi(g.phi(),x.phi()))<2.5,kmtfFull) - bestBMTF=None + bestBMTF=None if len(matchedBMTF)>0: bestBMTF = max(matchedBMTF,key = lambda x: x.quality()*1000+x.pt()) resBMTF.Fill(g.pt(),curvResidual(bestBMTF,g)) @@ -598,17 +598,17 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): phiCalibBMTF.Fill(g.charge()/g.pt(),bestBMTF.rawPhi-g.phi()) resRBMTF.Fill(deltaR(g.eta(),g.phi(),bestBMTF.eta(),bestBMTF.phi())) bmtfCalib.Fill(bestBMTF.pt(),bestBMTF.pt()/g.pt()) - - # for the turn on , first cut on pt and then match + + # for the turn on , first cut on pt and then match for threshold in PTThresholds: filteredBMTF = filter(lambda x: x.pt()>=float(threshold),matchedBMTF) if len(filteredBMTF)>0: genPtBMTF[threshold].Fill(g.pt()) if g.pt()>40: genEtaBMTF[threshold].Fill(g.eta()) - - bestKMTF=None + + bestKMTF=None if len(matchedKMTF)>0: bestKMTF = max(matchedKMTF,key = lambda x: 1000*x.quality()+x.pt()) @@ -619,7 +619,7 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): resPTKMTF.Fill(g.pt(),ptResidual(bestKMTF,g)) - + resEtaKMTF.Fill(g.eta(),bestKMTF.eta()-g.eta()) resPhiKMTF.Fill(g.pt(),bestKMTF.rawPhi-genPhiAt2) if g.pt()<140: @@ -629,7 +629,7 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): K = bestKMTF.charge()/bestKMTF.pt() if K==0: K=1; - + # if len(matchedKMTF)>0 and len(matchedBMTF)>0: # if bestBMTF.hasFineEta() and (not bestKMTF.hasFineEta()): @@ -640,18 +640,18 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): # print(s.bxNum(),s.scNum(), s.whNum(), s.stNum(),d ) - + # if abs(curvResidual(bestKMTF,g))>2.: - + for threshold in PTThresholds: filteredKMTF = filter(lambda x: x.pt()>=float(threshold),matchedKMTF) if len(filteredKMTF)>0: genPtKMTF[threshold].Fill(g.pt()) if len(filteredKMTF)>0 and g.pt()>40: genEtaKMTF[threshold].Fill(g.eta()) - + # if (bestKMTF==None or (bestKMTF!=None and bestKMTF.pt()<15)) and bestBMTF!=None and g.pt()>30 and abs(g.eta())>0.15 and abs(g.eta())<0.32: # log(counter,stubs,gen,kmtfFull,kmtf,bmtf) @@ -680,11 +680,11 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): # import pdb;pdb.set_trace() if len(matchedKMTFFull)>0: - bestKMTFFull = max(matchedKMTFFull,key = lambda x: x.rank()*1000+x.pt()) + bestKMTFFull = max(matchedKMTFFull,key = lambda x: x.rank()*1000+x.pt()) chiMatched[bestKMTFFull.hitPattern()].Fill(abs(bestKMTFFull.curvatureAtVertex()),bestKMTFFull.approxChi2()); trackComp[bestKMTFFull.hitPattern()].Fill(abs(bestKMTFFull.curvatureAtVertex()),min(bestKMTFFull.trackCompatibility(),99.5)); - + resKMTFTrack[bestKMTFFull.hitPattern()].Fill(g.pt(),curvResidual(bestKMTFFull,g)) resKMTFTrack[0].Fill(g.pt(),curvResidual(bestKMTFFull,g)) if bestKMTFFull.charge()>0: @@ -697,15 +697,15 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): - - - - + + + + f=ROOT.TFile("results_"+tag+".root","RECREATE") @@ -715,27 +715,27 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): quality.Write() -resKMTF.Write() +resKMTF.Write() for n,t in resKMTFTrack.iteritems(): t.Write() - -resKMTFEta.Write() -resSTAKMTF.Write() -resPTKMTF.Write() + +resKMTFEta.Write() +resSTAKMTF.Write() +resPTKMTF.Write() resBMTF.Write() resBMTFEta.Write() resPTBMTF.Write() -resEtaKMTF.Write() -resEtaBMTF.Write() -resPhiKMTF.Write() -resRKMTF.Write() -resPhiBMTF.Write() +resEtaKMTF.Write() +resEtaBMTF.Write() +resPhiKMTF.Write() +resRKMTF.Write() +resPhiBMTF.Write() phiCalibBMTF.Write() phiCalibKMTF.Write() -resRBMTF.Write() +resRBMTF.Write() #bmtfCalib.Write() #kfCalib.Write() genPt.Write() @@ -761,7 +761,7 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): genPtKMTF[p].Add(genPtBMTF[p],-1) genPtKMTF[p].Divide(genPt) genPtKMTF[p].Write("efficiencyDiffVsPt"+str(p)) - + genEtaKMTF[p].Add(genEtaBMTF[p],-1) genEtaKMTF[p].Divide(genEta) genEtaKMTF[p].Write("efficiencyDiffVsEta"+str(p)) @@ -780,11 +780,11 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): -rateBMTF.Write() +rateBMTF.Write() c = rateBMTF.GetCumulative(False) c.SetLineWidth(3) c.SetLineColor(ROOT.kBlack) -c.Write("normRateBMTF") +c.Write("normRateBMTF") for track in kfCalibPlus.keys(): kfCalibPlus[track].Write() @@ -799,9 +799,9 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): bmtfCalib.Write() -rateKMTF.Write() +rateKMTF.Write() c = rateKMTF.GetCumulative(False) -c.Write("normRateKMTF") +c.Write("normRateKMTF") d = rateBMTF.GetCumulative(False) @@ -809,13 +809,13 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): d.Write("rateRatioBMTFoverKMTF") -rateBMTFp7.Write() +rateBMTFp7.Write() c = rateBMTFp7.GetCumulative(False) -c.Write("normRateBMTFEtaP7") +c.Write("normRateBMTFEtaP7") -rateKMTFp7.Write() +rateKMTFp7.Write() c = rateKMTFp7.GetCumulative(False) -c.Write("normRateKMTFEtaP7") +c.Write("normRateKMTFEtaP7") @@ -823,9 +823,3 @@ def log(counter,mystubs,gen,kmtfFull,kmtf,bmtf): fineEtaBMTF.Write() f.Close() - - - - - - diff --git a/L1Trigger/L1TMuonBarrel/test/kalmanTools/validation.py b/L1Trigger/L1TMuonBarrel/test/kalmanTools/validation.py index 1a58552cd2fb0..a7a515194f274 100644 --- a/L1Trigger/L1TMuonBarrel/test/kalmanTools/validation.py +++ b/L1Trigger/L1TMuonBarrel/test/kalmanTools/validation.py @@ -1,9 +1,9 @@ from __future__ import print_function import ROOT,itertools,math # -from array import array # +from array import array # from DataFormats.FWLite import Events, Handle ROOT.FWLiteEnabler.enable() -# +# @@ -64,7 +64,7 @@ def fetchKMTF(event,etaMax,collection): mu = kbmtf.at(bx,j) kbmtfMuons[bx].append(mu) # kbmtfMuons[bx]=sorted(kbmtfMuons[bx],key=lambda x: x.hwPt(),reverse=True) - return kbmtfMuons + return kbmtfMuons def curvResidual(a,b): return (a.charge()/a.pt()-b.charge()/b.pt())*b.pt()/b.charge() @@ -96,7 +96,7 @@ def deltaR2( e1, p1, e2, p2): return de*de + dp*dp -def log(event,counter,mystubs,kmtf,bmtf): +def log(event,counter,mystubs,kmtf,bmtf): print("--------EVENT"+str(counter)+"------------") print('RUN={run} LUMI={lumi} EVENT={event}'.format(run=event.eventAuxiliary().id().run(),lumi=event.eventAuxiliary().id().luminosityBlock(),event=event.eventAuxiliary().id().event())) print("-----------------------------") @@ -106,10 +106,10 @@ def log(event,counter,mystubs,kmtf,bmtf): print('wheel={w} sector={sc} station={st} high/low={ts} phi={phi} phiB={phiB} qual={qual} BX={BX}'.format(w=stub.whNum(),sc=stub.scNum(),st=stub.stNum(),ts=stub.Ts2Tag(),phi=stub.phi(),phiB=stub.phiB(),qual=stub.code(),BX=stub.bxNum())) print('EMU:') for g in bmtf : - print("EMU sector={sector} pt={pt} eta={eta} phi={phi} qual={qual} dxy={dxy} pt2={pt2} hasFineEta={HF}".format(sector=g.processor(), pt=g.hwPt(),eta=g.hwEta(),phi=g.hwPhi(),qual=g.hwQual(),dxy=g.hwDXY(),pt2=g.hwPt2(),HF=g.hwHF())) + print("EMU sector={sector} pt={pt} eta={eta} phi={phi} qual={qual} dxy={dxy} pt2={pt2} hasFineEta={HF}".format(sector=g.processor(), pt=g.hwPt(),eta=g.hwEta(),phi=g.hwPhi(),qual=g.hwQual(),dxy=g.hwDXY(),pt2=g.hwPtUnconstrained(),HF=g.hwHF())) print('DATA:') for g in kmtf : - print("DATA sector={sector} pt={pt} eta={eta} phi={phi} qual={qual} dxy={dxy} pt2={pt2} hasFineEta={HF}".format(sector=g.processor(),pt=g.hwPt(),eta=g.hwEta(),phi=g.hwPhi(),qual=g.hwQual(),dxy=g.hwDXY(),pt2=g.hwPt2(),HF=g.hwHF())) + print("DATA sector={sector} pt={pt} eta={eta} phi={phi} qual={qual} dxy={dxy} pt2={pt2} hasFineEta={HF}".format(sector=g.processor(),pt=g.hwPt(),eta=g.hwEta(),phi=g.hwPhi(),qual=g.hwQual(),dxy=g.hwDXY(),pt2=g.hwPtUnconstrained(),HF=g.hwHF())) print("-----------------------------") print("-----------------------------") print("c + enter to continue") @@ -185,7 +185,7 @@ def fill(info,mu): info['HF1'].Fill(mu[0].hwHF()) info['qual1'].Fill(mu[0].hwQual()) info['dxy1'].Fill(mu[0].hwDXY()) - info['ptSTA1'].Fill(mu[0].hwPt2()) + info['ptSTA1'].Fill(mu[0].hwPtUnconstrained()) else: info['pt1'].Fill(0) info['eta1'].Fill(0) @@ -202,7 +202,7 @@ def fill(info,mu): info['HF2'].Fill(mu[1].hwHF()) info['qual2'].Fill(mu[1].hwQual()) info['dxy2'].Fill(mu[1].hwDXY()) - info['ptSTA2'].Fill(mu[1].hwPt2()) + info['ptSTA2'].Fill(mu[1].hwPtUnconstrained()) else: info['pt2'].Fill(0) info['eta2'].Fill(0) @@ -219,7 +219,7 @@ def fill(info,mu): info['HF3'].Fill(mu[2].hwHF()) info['qual3'].Fill(mu[2].hwQual()) info['dxy3'].Fill(mu[2].hwDXY()) - info['ptSTA3'].Fill(mu[2].hwPt2()) + info['ptSTA3'].Fill(mu[2].hwPtUnconstrained()) else: info['pt3'].Fill(0) info['eta3'].Fill(0) @@ -248,14 +248,14 @@ def fill(info,mu): stubs=fetchStubsOLD(event,True) unpacker=fetchKMTF(event,100.0,'bmtfDigis:kBMTF') emulator=fetchKMTF(event,100.0,'simKBmtfDigis:BMTF') - - + + for processor in range(0,12): for bx in BUNCHES: emu=filter(lambda x: x.processor()==processor,emulator[bx]) data=filter(lambda x: x.processor()==processor,unpacker[bx]) if (len(emu)+len(data))>0: - + fill(histos['emu'],emu) fill(histos['fw'],data) # if len(emu)!=0 and len(data)==0: @@ -287,16 +287,10 @@ def fill(info,mu): l.AddEntry(histos['fw'][h],"data","p") l.Draw() c.Write("plot_"+h) - - - - - - -f.Close() +f.Close() From 55c9a8b9b54cc7de4cdd33dffddb177699c998ef Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 23 Apr 2020 19:01:54 +0200 Subject: [PATCH 20/37] Configuring GMT inputs by era --- .../L1TMuon/python/simGmtStage2Digis_cfi.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py index 26e5562aa1397..25385e675f480 100644 --- a/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py +++ b/L1Trigger/L1TMuon/python/simGmtStage2Digis_cfi.py @@ -7,7 +7,7 @@ ) simGmtStage2Digis = cms.EDProducer('L1TMuonProducer', - barrelTFInput = cms.InputTag("simBmtfDigis", "BMTF"), + barrelTFInput = cms.InputTag("simKBmtfDigis", "BMTF"), overlapTFInput = cms.InputTag("simOmtfDigis", "OMTF"), forwardTFInput = cms.InputTag("simEmtfDigis", "EMTF"), #triggerTowerInput = cms.InputTag("simGmtCaloSumDigis", "TriggerTower2x2s"), @@ -31,3 +31,19 @@ ) ) ) + +## Era: Run2_2016 +from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger +stage2L1Trigger.toModify(simGmtStage2Digis, barrelTFInput = cms.InputTag("simBmtfDigis", "BMTF")) + +## Era: Run2_2017 +from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017 +stage2L1Trigger_2017.toModify(simGmtStage2Digis, barrelTFInput = cms.InputTag("simBmtfDigis", "BMTF")) + +### Era: Run2_2018 +from Configuration.Eras.Modifier_stage2L1Trigger_2018_cff import stage2L1Trigger_2018 +stage2L1Trigger_2018.toModify(simGmtStage2Digis, barrelTFInput = cms.InputTag("simBmtfDigis", "BMTF")) + +### Era: Run3_2021 +from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 +stage2L1Trigger_2021.toModify(simGmtStage2Digis, barrelTFInput = cms.InputTag("simKBmtfDigis", "BMTF")) From fad4fd5215338f181150b1b0e3213261a2d7417f Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 23 Apr 2020 19:02:15 +0200 Subject: [PATCH 21/37] Running KBMTF in parallel to BMTF --- .../Configuration/python/customiseReEmul.py | 22 +++++++++++++++---- L1Trigger/L1TMuon/python/simDigis_cff.py | 4 +++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/L1Trigger/Configuration/python/customiseReEmul.py b/L1Trigger/Configuration/python/customiseReEmul.py index eb3eca67a4970..082ee58efd537 100644 --- a/L1Trigger/Configuration/python/customiseReEmul.py +++ b/L1Trigger/Configuration/python/customiseReEmul.py @@ -75,8 +75,12 @@ def L1TReEmulFromRAW2015(process): srcCSC = "csctfDigis" ) stage2L1Trigger.toModify(process.simBmtfDigis, - DTDigi_Source = "simTwinMuxDigis", - DTDigi_Theta_Source = "dttfDigis" + DTDigi_Source = "simTwinMuxDigis", + DTDigi_Theta_Source = "dttfDigis" + ) + stage2L1Trigger.toModify(process.simKBmtfStubs, + srcPhi = "simTwinMuxDigis", + srcTheta = "dttfDigis" ) stage2L1Trigger.toModify(process.simEmtfDigis, CSCInput = "csctfDigis", @@ -141,8 +145,13 @@ def L1TReEmulFromRAW2016(process): ) # BMTF stage2L1Trigger.toModify(process.simBmtfDigis, - DTDigi_Source = 'simTwinMuxDigis', - DTDigi_Theta_Source = 'bmtfDigis' + DTDigi_Source = "simTwinMuxDigis", + DTDigi_Theta_Source = "bmtfDigis" + ) + # KBMTF + stage2L1Trigger.toModify(process.simKBmtfStubs, + srcPhi = 'simTwinMuxDigis', + srcTheta = 'bmtfDigis' ) # OMTF stage2L1Trigger.toModify(process.simOmtfDigis, @@ -291,6 +300,11 @@ def L1TReEmulFromRAWsimTP(process): DTDigi_Source = 'simTwinMuxDigis', DTDigi_Theta_Source = 'simDtTriggerPrimitiveDigis' ) + # KBMTF + stage2L1Trigger.toModify(process.simKBmtfStubs, + srcPhi = "simTwinMuxDigis", + srcTheta = "simDtTriggerPrimitiveDigis" + ) # OMTF stage2L1Trigger.toModify(process.simOmtfDigis, srcRPC = 'muonRPCDigis', diff --git a/L1Trigger/L1TMuon/python/simDigis_cff.py b/L1Trigger/L1TMuon/python/simDigis_cff.py index 2aaae7634b403..4263ff9b6ea92 100644 --- a/L1Trigger/L1TMuon/python/simDigis_cff.py +++ b/L1Trigger/L1TMuon/python/simDigis_cff.py @@ -75,6 +75,8 @@ # from L1Trigger.L1TTwinMux.simTwinMuxDigis_cfi import * from L1Trigger.L1TMuonBarrel.simBmtfDigis_cfi import * +from L1Trigger.L1TMuonBarrel.simKBmtfStubs_cfi import * +from L1Trigger.L1TMuonBarrel.simKBmtfDigis_cfi import * from L1Trigger.L1TMuonEndCap.simEmtfDigis_cfi import * from L1Trigger.L1TMuonOverlap.simOmtfDigis_cfi import * from L1Trigger.L1TMuon.simGmtCaloSumDigis_cfi import * @@ -82,7 +84,7 @@ from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger # # -stage2L1Trigger.toReplaceWith(SimL1TMuonTask, cms.Task(SimL1TMuonCommonTask, simTwinMuxDigis, simBmtfDigis, simEmtfDigis, simOmtfDigis, simGmtCaloSumDigis, simGmtStage2Digis)) +stage2L1Trigger.toReplaceWith(SimL1TMuonTask, cms.Task(SimL1TMuonCommonTask, simTwinMuxDigis, simBmtfDigis, simKBmtfStubs, simKBmtfDigis, simEmtfDigis, simOmtfDigis, simGmtCaloSumDigis, simGmtStage2Digis)) # # Phase-2 Trigger From 6baf7e87ece39b962822fd1281e6e22fde9bf7bd Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Wed, 29 Apr 2020 16:19:38 +0200 Subject: [PATCH 22/37] Refactor muon packer in preparation for Run-3 data format --- .../implementations_stage2/MuonPacker.cc | 82 ++++++++++++------- .../implementations_stage2/MuonPacker.h | 9 +- .../L1TRawToDigi/python/gmtStage2Raw_cfi.py | 17 ++++ .../L1TRawToDigi/python/gtStage2Raw_cfi.py | 20 ++++- .../L1TMuon/interface/MuonRawDigiTranslator.h | 18 ++-- .../L1TMuon/src/MuonRawDigiTranslator.cc | 18 +++- 6 files changed, 115 insertions(+), 49 deletions(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc index 6118fdf7c332d..36139bcaca905 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc @@ -13,36 +13,8 @@ namespace l1t { PayloadMap payloadMap; - for (int i = muons->getFirstBX(); i <= muons->getLastBX(); ++i) { - // the first muon in every BX and every block id is 0 - for (unsigned int blkId = b1_; blkId < b1_ + 7; blkId += 2) { - payloadMap[blkId].push_back(0); - payloadMap[blkId].push_back(0); - } - - unsigned int blkId = b1_; - int muCtr = 1; - for (auto mu = muons->begin(i); mu != muons->end(i) && muCtr <= 8; ++mu, ++muCtr) { - uint32_t msw = 0; - uint32_t lsw = 0; - - MuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw); - - payloadMap[blkId].push_back(lsw); - payloadMap[blkId].push_back(msw); - - // go to next block id after two muons - if (muCtr % 2 == 0) { - blkId += 2; - } - } - - // padding empty muons to reach 3 muons per block id per BX - for (auto& kv : payloadMap) { - while (kv.second.size() % 6 != 0) { - kv.second.push_back(0); - } - } + for (int bx = muons->getFirstBX(); bx <= muons->getLastBX(); ++bx) { + packBx(payloadMap, muons, bx); } Blocks blocks; @@ -53,8 +25,58 @@ namespace l1t { } return blocks; } + + void MuonPacker::packBx(PayloadMap& payloadMap, const edm::Handle& muons, int bx) { + // the first word in every BX and every block id is 0 + for (unsigned int blkId = b1_; blkId < b1_ + 7; blkId += 2) { + payloadMap[blkId].push_back(0); + } + + unsigned int blkId = b1_; + auto mu { muons->begin(bx) }; + uint32_t shared_word { 0 }; + uint32_t mu1_msw { 0 }; + uint32_t mu2_msw { 0 }; + uint32_t mu1_lsw { 0 }; + uint32_t mu2_lsw { 0 }; + // Slightly convoluted logic to account for the Run-3 muon readout record: + // To make space for displacement information we moved the raw (i.e. non-extrapolated) eta value to the second "spare" word + // in the block which we call "shared word". So the logic below needs to be aware if it is operating on the first or second + // muon in the block in order tp place the eta value in the right place in the shared word. Additionally the logic needs to + // wait for the second muon in the block before filling the payload map because the shared word goes in first. + for (int muCtr = 1; muCtr <= 8; ++muCtr) { + + if (mu != muons->end(bx)) { + MuonRawDigiTranslator::generatePackedDataWords(*mu, shared_word, mu2_lsw, mu2_msw, fedId_, fwId_, 2-(muCtr%2)); + ++mu; + } + + // If we're remaining in the current block the muon we just packed is the first one in the block. + // If not we add both muons to the payload map and go to the next block. + // TODO: Handle case when there's only one muon in the block. + if (muCtr % 2 == 1) { + mu1_lsw = mu2_lsw; + mu1_msw = mu2_msw; + } else { + payloadMap[blkId].push_back(shared_word); + payloadMap[blkId].push_back(mu1_lsw); + payloadMap[blkId].push_back(mu1_msw); + payloadMap[blkId].push_back(mu2_lsw); + payloadMap[blkId].push_back(mu2_msw); + + blkId += 2; + + shared_word = 0; + mu1_lsw = 0; + mu1_msw = 0; + } + mu2_lsw = 0; + mu2_msw = 0; + } + } } // namespace stage2 } // namespace l1t DEFINE_L1T_PACKER(l1t::stage2::GTMuonPacker); DEFINE_L1T_PACKER(l1t::stage2::GMTMuonPacker); + diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h index 11bd4b96c7457..e0a3c710ffb6a 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h @@ -8,12 +8,19 @@ namespace l1t { namespace stage2 { class MuonPacker : public Packer { public: - MuonPacker(unsigned b1) : b1_(b1) {} + MuonPacker(unsigned b1) : b1_(b1), fwId_(0) {} Blocks pack(const edm::Event&, const PackerTokens*) override; unsigned b1_; + inline void setFwVersion(unsigned fwId) { fwId_ = fwId; }; + inline void setFed(unsigned fedId) { fedId_ = fedId; }; private: typedef std::map> PayloadMap; + + void packBx(PayloadMap& payloadMap, const edm::Handle& muons, int bx); // TODO: Muons probably can't be const because I'm using an iterator on them. + + unsigned fwId_; + unsigned fedId_; }; class GTMuonPacker : public MuonPacker { diff --git a/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py b/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py index a949a2394519e..9d322767feb09 100644 --- a/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py +++ b/EventFilter/L1TRawToDigi/python/gmtStage2Raw_cfi.py @@ -17,3 +17,20 @@ lenSlinkHeader = cms.untracked.int32(8), lenSlinkTrailer = cms.untracked.int32(8) ) + +## Era: Run2_2016 +from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger +stage2L1Trigger.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(0x3000000)) + +## Era: Run2_2017 +from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017 +stage2L1Trigger_2017.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(0x4010000)) + +### Era: Run2_2018 +from Configuration.Eras.Modifier_stage2L1Trigger_2018_cff import stage2L1Trigger_2018 +stage2L1Trigger_2018.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(0x4010000)) + +### Era: Run3_2021 +from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 +stage2L1Trigger_2021.toModify(gmtStage2Raw, BMTFInputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(0x6000000)) + diff --git a/EventFilter/L1TRawToDigi/python/gtStage2Raw_cfi.py b/EventFilter/L1TRawToDigi/python/gtStage2Raw_cfi.py index 7941872c0c3d8..8bfb66b9f7629 100644 --- a/EventFilter/L1TRawToDigi/python/gtStage2Raw_cfi.py +++ b/EventFilter/L1TRawToDigi/python/gtStage2Raw_cfi.py @@ -12,8 +12,24 @@ JetInputTag = cms.InputTag("simCaloStage2Digis"), EtSumInputTag = cms.InputTag("simCaloStage2Digis"), FedId = cms.int32(1404), - ## FWId = cms.uint32(0x10A6), # FW version in GMT with vtx-etrapolation - FWId = cms.uint32(0x10F2), # FW version for packing new HI centrality variables + FWId = cms.uint32(0x1120), # FW w/ displaced muon info. lenSlinkHeader = cms.untracked.int32(8), lenSlinkTrailer = cms.untracked.int32(8) ) + +## Era: Run2_2016 +from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger +stage2L1Trigger.toModify(gtStage2Raw, FWId = cms.uint32(0x1000)) # FW w/o coordinates at vtx. + +## Era: Run2_2017 +from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017 +stage2L1Trigger_2017.toModify(gtStage2Raw, FWId = cms.uint32(0x10A6)) # FW w/ vtx extrapolation. + +### Era: Run2_2018 +from Configuration.Eras.Modifier_stage2L1Trigger_2018_cff import stage2L1Trigger_2018 +stage2L1Trigger_2018.toModify(gtStage2Raw, FWId = cms.uint32(0x10F2)) # FW w/ new HI centrality variables & vtx extrapolation. + +### Era: Run3_2021 +from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 +stage2L1Trigger_2021.toModify(gtStage2Raw, FWId = cms.uint32(0x1120)) # FW w/ displaced muon info. + diff --git a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h index 55f91d8508961..31341fc03ae29 100644 --- a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h @@ -6,18 +6,11 @@ namespace l1t { class MuonRawDigiTranslator { public: - static void fillMuon(Muon& mu, - uint32_t raw_data_spare, - uint32_t raw_data_00_31, - uint32_t raw_data_32_63, - int fed, - unsigned int fw, - int muInBx); - static void fillMuon(Muon& mu, uint32_t raw_data_spare, uint64_t dataword, int fed, unsigned int fw, int muInBx); - static void fillIntermediateMuon(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, unsigned int fw); - static void generatePackedDataWords(const Muon&, uint32_t&, uint32_t&); - static uint64_t generate64bitDataWord(const Muon&); - static int calcHwEta(const uint32_t& raw, const unsigned absEtaShift, const unsigned etaSignShift); + static void fillMuon(Muon&, uint32_t, uint32_t, int, unsigned int); + static void fillMuon(Muon&, uint64_t, int, unsigned int); + static void generatePackedDataWords(const Muon& mu, uint32_t& raw_data_spare, uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, int fedId, int fwId, int muInBx); + static void generate64bitDataWord(const Muon& mu, uint32_t& raw_data_spare, uint64_t& dataword, int fedId, int fwId, int muInBx); + static int calcHwEta(const uint32_t&, const unsigned, const unsigned); static constexpr unsigned ptMask_ = 0x1FF; static constexpr unsigned ptShift_ = 10; @@ -58,3 +51,4 @@ namespace l1t { } // namespace l1t #endif + diff --git a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc index 44ca904a2a615..ddaa20a08c231 100644 --- a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc @@ -157,8 +157,12 @@ void l1t::MuonRawDigiTranslator::fillIntermediateMuonQuantitiesRun3(Muon& mu, } void l1t::MuonRawDigiTranslator::generatePackedDataWords(const Muon& mu, + uint32_t& raw_data_spare, uint32_t& raw_data_00_31, - uint32_t& raw_data_32_63) { + uint32_t& raw_data_32_63, + int fedID, + int fwID, + int muInBx) { int abs_eta = mu.hwEta(); if (abs_eta < 0) { abs_eta += (1 << (etaSignShift_ - absEtaShift_)); @@ -177,12 +181,17 @@ void l1t::MuonRawDigiTranslator::generatePackedDataWords(const Muon& mu, (mu.hwPhi() & phiMask_) << phiShift_; } -uint64_t l1t::MuonRawDigiTranslator::generate64bitDataWord(const Muon& mu) { +void l1t::MuonRawDigiTranslator::generate64bitDataWord(const Muon& mu, + uint32_t& raw_data_spare, + uint64_t& dataword, + int fedId, + int fwId, + int muInBx) { uint32_t lsw; uint32_t msw; - generatePackedDataWords(mu, lsw, msw); - return (((uint64_t)msw) << 32) + lsw; + generatePackedDataWords(mu, raw_data_spare, lsw, msw, fedId, fwId, muInBx); + dataword = (((uint64_t)msw) << 32) + lsw; } int l1t::MuonRawDigiTranslator::calcHwEta(const uint32_t& raw, @@ -196,3 +205,4 @@ int l1t::MuonRawDigiTranslator::calcHwEta(const uint32_t& raw, return abs_eta; } } + From 69874554a75cbb556247d13ad0f4c9ae17a519c7 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Sun, 3 May 2020 19:10:16 +0200 Subject: [PATCH 23/37] MuonPacker packs according to era Packs correctly for Run-2 2016, Run-2 from 2017 (w/ extrapolated coordiantes), and Run-3 --- .../implementations_stage2/GMTSetup.cc | 7 ++- .../plugins/implementations_stage2/GTSetup.cc | 21 ++++---- .../implementations_stage2/MuonPacker.cc | 42 ++++++++------- .../implementations_stage2/MuonPacker.h | 11 ++-- .../L1TMuon/interface/MuonRawDigiTranslator.h | 20 ++++--- .../L1TMuon/src/MuonRawDigiTranslator.cc | 54 +++++++++++++------ 6 files changed, 95 insertions(+), 60 deletions(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc index 56ef3d0cdcab7..dc45a6e5f2438 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc @@ -6,6 +6,7 @@ #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h" +#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.h" @@ -40,9 +41,13 @@ namespace l1t { PackerMap res; if (fed == 1402) { // Use amc_no and board id 1 for packing + auto gmt_out_packer = + static_pointer_cast(PackerFactory::get()->make("stage2::GMTMuonPacker")); + gmt_out_packer->setFed(fed); + gmt_out_packer->setFwVersion(fw); res[{1, 1}] = { PackerFactory::get()->make("stage2::RegionalMuonGMTPacker"), - PackerFactory::get()->make("stage2::GMTMuonPacker"), + gmt_out_packer, PackerFactory::get()->make("stage2::IntermediateMuonPacker"), }; } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.cc index 7ef5bdadc5d93..11b6aec6befd5 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GTSetup.cc @@ -2,6 +2,7 @@ #include "EventFilter/L1TRawToDigi/plugins/PackingSetupFactory.h" #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h" +#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/EGammaUnpacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/EtSumUnpacker.h" @@ -31,15 +32,17 @@ namespace l1t { if (fed == 1404) { // Use board id 1 for packing - res[{1, 1}] = { - - PackerFactory::get()->make("stage2::GTMuonPacker"), - PackerFactory::get()->make("stage2::GTEGammaPacker"), - PackerFactory::get()->make("stage2::GTEtSumPacker"), - PackerFactory::get()->make("stage2::GTJetPacker"), - PackerFactory::get()->make("stage2::GTTauPacker"), - PackerFactory::get()->make("stage2::GlobalAlgBlkPacker"), - PackerFactory::get()->make("stage2::GlobalExtBlkPacker")}; + auto gt_muon_packer = + static_pointer_cast(PackerFactory::get()->make("stage2::GTMuonPacker")); + gt_muon_packer->setFed(fed); + gt_muon_packer->setFwVersion(fw); + res[{1, 1}] = {gt_muon_packer, + PackerFactory::get()->make("stage2::GTEGammaPacker"), + PackerFactory::get()->make("stage2::GTEtSumPacker"), + PackerFactory::get()->make("stage2::GTJetPacker"), + PackerFactory::get()->make("stage2::GTTauPacker"), + PackerFactory::get()->make("stage2::GlobalAlgBlkPacker"), + PackerFactory::get()->make("stage2::GlobalExtBlkPacker")}; } return res; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc index 36139bcaca905..f2d62ae8f8470 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.cc @@ -1,7 +1,5 @@ -#include "FWCore/Framework/interface/Event.h" #include "EventFilter/L1TRawToDigi/plugins/PackerFactory.h" -#include "L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h" #include "GMTTokens.h" #include "MuonPacker.h" @@ -14,13 +12,12 @@ namespace l1t { PayloadMap payloadMap; for (int bx = muons->getFirstBX(); bx <= muons->getLastBX(); ++bx) { - packBx(payloadMap, muons, bx); + packBx(payloadMap, muons, bx); } Blocks blocks; // push everything in the blocks vector for (auto& kv : payloadMap) { - //cout << kv.first << ": " << kv.second.size() << kv.second[0] << "\n"; blocks.push_back(Block(kv.first, kv.second)); } return blocks; @@ -33,32 +30,37 @@ namespace l1t { } unsigned int blkId = b1_; - auto mu { muons->begin(bx) }; - uint32_t shared_word { 0 }; - uint32_t mu1_msw { 0 }; - uint32_t mu2_msw { 0 }; - uint32_t mu1_lsw { 0 }; - uint32_t mu2_lsw { 0 }; + auto mu{muons->begin(bx)}; + uint32_t mu1_shared_word{0}; + uint32_t mu2_shared_word{0}; + uint32_t mu1_msw{0}; + uint32_t mu2_msw{0}; + uint32_t mu1_lsw{0}; + uint32_t mu2_lsw{0}; // Slightly convoluted logic to account for the Run-3 muon readout record: - // To make space for displacement information we moved the raw (i.e. non-extrapolated) eta value to the second "spare" word - // in the block which we call "shared word". So the logic below needs to be aware if it is operating on the first or second - // muon in the block in order tp place the eta value in the right place in the shared word. Additionally the logic needs to - // wait for the second muon in the block before filling the payload map because the shared word goes in first. + // To make space for displacement information we moved the raw + // (i.e. non-extrapolated) eta value to the second "spare" word + // in the block which we call "shared word". So the logic below + // needs to be aware if it is operating on the first or second + // muon in the block in order to place the eta value in the right + // place in the shared word. Additionally the logic needs to + // wait for the second muon in the block before filling the + // payload map because the shared word goes in first. for (int muCtr = 1; muCtr <= 8; ++muCtr) { - if (mu != muons->end(bx)) { - MuonRawDigiTranslator::generatePackedDataWords(*mu, shared_word, mu2_lsw, mu2_msw, fedId_, fwId_, 2-(muCtr%2)); + MuonRawDigiTranslator::generatePackedDataWords( + *mu, mu2_shared_word, mu2_lsw, mu2_msw, fedId_, fwId_, 2 - (muCtr % 2)); ++mu; } // If we're remaining in the current block the muon we just packed is the first one in the block. // If not we add both muons to the payload map and go to the next block. - // TODO: Handle case when there's only one muon in the block. if (muCtr % 2 == 1) { + mu1_shared_word = mu2_shared_word; mu1_lsw = mu2_lsw; mu1_msw = mu2_msw; } else { - payloadMap[blkId].push_back(shared_word); + payloadMap[blkId].push_back(mu1_shared_word | mu2_shared_word); payloadMap[blkId].push_back(mu1_lsw); payloadMap[blkId].push_back(mu1_msw); payloadMap[blkId].push_back(mu2_lsw); @@ -66,10 +68,11 @@ namespace l1t { blkId += 2; - shared_word = 0; + mu1_shared_word = 0; mu1_lsw = 0; mu1_msw = 0; } + mu2_shared_word = 0; mu2_lsw = 0; mu2_msw = 0; } @@ -79,4 +82,3 @@ namespace l1t { DEFINE_L1T_PACKER(l1t::stage2::GTMuonPacker); DEFINE_L1T_PACKER(l1t::stage2::GMTMuonPacker); - diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h index e0a3c710ffb6a..7cb46c12845bb 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h @@ -2,13 +2,16 @@ #define L1T_PACKER_STAGE2_MUONPACKER_H #include +#include "FWCore/Framework/interface/Event.h" #include "EventFilter/L1TRawToDigi/interface/Packer.h" +#include "L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h" + namespace l1t { namespace stage2 { class MuonPacker : public Packer { public: - MuonPacker(unsigned b1) : b1_(b1), fwId_(0) {} + MuonPacker(unsigned b1) : b1_(b1) {} Blocks pack(const edm::Event&, const PackerTokens*) override; unsigned b1_; inline void setFwVersion(unsigned fwId) { fwId_ = fwId; }; @@ -17,10 +20,10 @@ namespace l1t { private: typedef std::map> PayloadMap; - void packBx(PayloadMap& payloadMap, const edm::Handle& muons, int bx); // TODO: Muons probably can't be const because I'm using an iterator on them. + void packBx(PayloadMap& payloadMap, const edm::Handle& muons, int bx); - unsigned fwId_; - unsigned fedId_; + unsigned fwId_{0}; + unsigned fedId_{0}; }; class GTMuonPacker : public MuonPacker { diff --git a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h index 31341fc03ae29..6708a6b512463 100644 --- a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h @@ -8,8 +8,15 @@ namespace l1t { public: static void fillMuon(Muon&, uint32_t, uint32_t, int, unsigned int); static void fillMuon(Muon&, uint64_t, int, unsigned int); - static void generatePackedDataWords(const Muon& mu, uint32_t& raw_data_spare, uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, int fedId, int fwId, int muInBx); - static void generate64bitDataWord(const Muon& mu, uint32_t& raw_data_spare, uint64_t& dataword, int fedId, int fwId, int muInBx); + static void generatePackedDataWords(const Muon& mu, + uint32_t& raw_data_spare, + uint32_t& raw_data_00_31, + uint32_t& raw_data_32_63, + int fedId, + int fwId, + int muInBx); + static void generate64bitDataWord( + const Muon& mu, uint32_t& raw_data_spare, uint64_t& dataword, int fedId, int fwId, int muInBx); static int calcHwEta(const uint32_t&, const unsigned, const unsigned); static constexpr unsigned ptMask_ = 0x1FF; @@ -39,16 +46,7 @@ namespace l1t { static constexpr unsigned etaMu1SignShift_ = 20; // For Run-3 static constexpr unsigned absEtaMu2Shift_ = 21; // For Run-3 static constexpr unsigned etaMu2SignShift_ = 29; // For Run-3 - - private: - static void fillMuonStableQuantities(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); - static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); - static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); - static void fillMuonQuantitiesRun3( - Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx); - static void fillIntermediateMuonQuantitiesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); }; } // namespace l1t #endif - diff --git a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc index ddaa20a08c231..cbe5ab0ace5e9 100644 --- a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc @@ -171,22 +171,47 @@ void l1t::MuonRawDigiTranslator::generatePackedDataWords(const Muon& mu, if (abs_eta_at_vtx < 0) { abs_eta_at_vtx += (1 << (etaAtVtxSignShift_ - absEtaAtVtxShift_)); } - raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ | - (abs_eta_at_vtx & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEtaAtVtx() < 0) << etaAtVtxSignShift_ | - (mu.hwPhiAtVtx() & phiMask_) << phiAtVtxShift_; - - raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ | - (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_ | - (abs_eta & absEtaMask_) << absEtaShift_ | (mu.hwEta() < 0) << etaSignShift_ | - (mu.hwPhi() & phiMask_) << phiShift_; + if ((fedID == 1402 && fwID < 0x4010000) || (fedID == 1404 && fwID < 0x10A6)) { + // For 2016 the non-extrapolated coordiantes were in the place that are now occupied by the extrapolated quantities. + raw_data_spare = 0; + raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ | + (abs_eta & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEta() < 0) << etaAtVtxSignShift_ | + (mu.hwPhi() & phiMask_) << phiAtVtxShift_; + raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ | + (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_; + } else if ((fedID == 1402 && fwID < 0x6000000) || (fedID == 1404 && fwID < 0x1120)) { + raw_data_spare = 0; + raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ | + (abs_eta_at_vtx & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEtaAtVtx() < 0) << etaAtVtxSignShift_ | + (mu.hwPhiAtVtx() & phiMask_) << phiAtVtxShift_; + + raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ | + (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_ | + (abs_eta & absEtaMask_) << absEtaShift_ | (mu.hwEta() < 0) << etaSignShift_ | + (mu.hwPhi() & phiMask_) << phiShift_; + } else { + int absEtaShiftRun3{0}, etaSignShiftRun3{0}; + if (muInBx == 1) { + absEtaShiftRun3 = absEtaMu1Shift_; + etaSignShiftRun3 = etaMu1SignShift_; + } else if (muInBx == 2) { + absEtaShiftRun3 = absEtaMu2Shift_; + etaSignShiftRun3 = etaMu2SignShift_; + } + raw_data_spare = (abs_eta & absEtaMask_) << absEtaShiftRun3 | (mu.hwEta() < 0) << etaSignShiftRun3; + raw_data_00_31 = (mu.hwPt() & ptMask_) << ptShift_ | (mu.hwQual() & qualMask_) << qualShift_ | + (abs_eta_at_vtx & absEtaMask_) << absEtaAtVtxShift_ | (mu.hwEtaAtVtx() < 0) << etaAtVtxSignShift_ | + (mu.hwPhiAtVtx() & phiMask_) << phiAtVtxShift_; + raw_data_32_63 = mu.hwCharge() << chargeShift_ | mu.hwChargeValid() << chargeValidShift_ | + (mu.tfMuonIndex() & tfMuonIndexMask_) << tfMuonIndexShift_ | (mu.hwIso() & isoMask_) << isoShift_ | + (mu.hwPhi() & phiMask_) << phiShift_ | + (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << ptUnconstrainedShift_ | + (mu.hwDXY() & dxyMask_) << dxyShift_; + } } -void l1t::MuonRawDigiTranslator::generate64bitDataWord(const Muon& mu, - uint32_t& raw_data_spare, - uint64_t& dataword, - int fedId, - int fwId, - int muInBx) { +void l1t::MuonRawDigiTranslator::generate64bitDataWord( + const Muon& mu, uint32_t& raw_data_spare, uint64_t& dataword, int fedId, int fwId, int muInBx) { uint32_t lsw; uint32_t msw; @@ -205,4 +230,3 @@ int l1t::MuonRawDigiTranslator::calcHwEta(const uint32_t& raw, return abs_eta; } } - From 681f7864ed8a58490054e3ba14628423e916390d Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 16 May 2019 15:53:36 +0200 Subject: [PATCH 24/37] Added raw track addresses to L1UpgradeTfMuon branch of L1TNtuples The original field with track addresses was filled with incorrect or incomplete values for most TFs. Using static function from RegionalMuonRawDigiTranslator that I factored out in order to generate the raw track address. --- .../L1AnalysisL1UpgradeTfMuonDataFormat.h | 3 +-- .../src/L1AnalysisL1UpgradeTfMuon.cc | 24 +------------------ 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h index eb1105d2ff8b3..a6bb8995ec5e6 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h @@ -45,8 +45,7 @@ namespace L1Analysis { std::vector tfMuonBx; std::vector tfMuonWh; std::vector tfMuonTrAdd; - std::vector> tfMuonDecodedTrAdd; - std::vector tfMuonHwTrAdd; + std::vector tfMuonRawTrAdd; }; } // namespace L1Analysis #endif diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index 4bb09bebb66d1..3e088991ffc35 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -24,7 +24,6 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrackFinderType.push_back(it->trackFinderType()); l1upgradetfmuon_.tfMuonHwHF.push_back(it->hwHF()); l1upgradetfmuon_.tfMuonBx.push_back(ibx); - std::map decoded_track_address; if (it->trackFinderType() == l1t::tftype::bmtf) { int detSide = it->trackSubAddress(l1t::RegionalMuonCand::kWheelSide); int wheelNum = it->trackSubAddress(l1t::RegionalMuonCand::kWheelNum); @@ -39,29 +38,8 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrAdd.push_back(stat2); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat3); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat4); - - decoded_track_address["wheel"] = wheel; - decoded_track_address["station1"] = stat1; - decoded_track_address["station2"] = stat2; - decoded_track_address["station3"] = stat3; - decoded_track_address["station4"] = stat4; - } else if (it->trackFinderType() == l1t::omtf_neg || it->trackFinderType() == l1t::omtf_pos) { - decoded_track_address["kLayers"] = it->trackSubAddress(l1t::RegionalMuonCand::kLayers); - decoded_track_address["kWeight"] = it->trackSubAddress(l1t::RegionalMuonCand::kWeight); - } else if (it->trackFinderType() == l1t::emtf_neg || it->trackFinderType() == l1t::emtf_pos) { - decoded_track_address["kME1Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Seg); - decoded_track_address["kME1Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Ch); - decoded_track_address["kME2Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Seg); - decoded_track_address["kME2Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Ch); - decoded_track_address["kME3Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Seg); - decoded_track_address["kME3Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Ch); - decoded_track_address["kME4Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Seg); - decoded_track_address["kME4Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Ch); - decoded_track_address["kTrkNum"] = it->trackSubAddress(l1t::RegionalMuonCand::kTrkNum); - decoded_track_address["kBX"] = it->trackSubAddress(l1t::RegionalMuonCand::kBX); } - l1upgradetfmuon_.tfMuonDecodedTrAdd.push_back(decoded_track_address); - l1upgradetfmuon_.tfMuonHwTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it)); + l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it)); l1upgradetfmuon_.nTfMuons++; } From a4bec95c6187793812053d62bcb35a66534ef9d5 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Mon, 18 May 2020 12:16:57 +0200 Subject: [PATCH 25/37] Regional muon packer adapted for Kalman muons from BMTF Includes configuration of packer by Era. Modifications still needed for the BMTF setup to make use of this. --- .../BMTFPackerOutput.cc | 18 +++++------ .../implementations_stage2/BMTFPackerOutput.h | 3 ++ .../implementations_stage2/GMTSetup.cc | 12 +++++-- .../RegionalMuonGMTPacker.cc | 2 +- .../RegionalMuonGMTPacker.h | 3 ++ .../L1TRawToDigi/python/bmtfStage2Raw_cfi.py | 16 ++++++++++ .../interface/RegionalMuonRawDigiTranslator.h | 16 +++++----- .../src/RegionalMuonRawDigiTranslator.cc | 32 +++++++++++-------- 8 files changed, 67 insertions(+), 35 deletions(-) diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc index 4379ce88bcbbf..57a180018b244 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.cc @@ -21,7 +21,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); + RegionalMuonRawDigiTranslator::generatePackedDataWords(*imu, firstWord, lastWord, isKalman_); payloadMap_[bmtfBlockID].push_back(firstWord); //imu->link()*2+1 payloadMap_[bmtfBlockID].push_back(lastWord); //imu->link()*2+1 } @@ -51,14 +51,14 @@ namespace l1t { blocks.push_back(block); /* - //debug from here - std::cout << "block id : " << block.header().getID() << std::endl; - - std::cout << "payload created : " << std::endl; - for (auto &word : block.payload()) - std::cout << std::bitset<32>(word).to_string() << std::endl; - //debug up to here - */ + //debug from here + std::cout << "block id : " << block.header().getID() << std::endl; + + std::cout << "payload created : " << std::endl; + for (auto &word : block.payload()) + std::cout << std::bitset<32>(word).to_string() << std::endl; + //debug up to here + */ return blocks; } diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.h index b80c6a944ba18..12396a2616595 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/BMTFPackerOutput.h @@ -11,9 +11,12 @@ namespace l1t { class BMTFPackerOutput : public Packer { public: Blocks pack(const edm::Event&, const PackerTokens*) override; + void setKalmanAlgoTrue() { isKalman_ = true; }; private: std::map > payloadMap_; + + bool isKalman_{false}; }; } // namespace stage2 } // namespace l1t diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc index dc45a6e5f2438..86430eee00ec3 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/GMTSetup.cc @@ -6,9 +6,10 @@ #include "EventFilter/L1TRawToDigi/plugins/UnpackerFactory.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTUnpacker.h" +#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonPacker.h" -#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.h" #include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/IntermediateMuonUnpacker.h" +#include "EventFilter/L1TRawToDigi/plugins/implementations_stage2/MuonUnpacker.h" #include "GMTSetup.h" @@ -40,13 +41,18 @@ namespace l1t { PackerMap GMTSetup::getPackers(int fed, unsigned int fw) { PackerMap res; if (fed == 1402) { - // Use amc_no and board id 1 for packing + auto gmt_in_packer = static_pointer_cast( + PackerFactory::get()->make("stage2::RegionalMuonGMTPacker")); + if (fw >= 0x6000000) { + gmt_in_packer->setKalmanAlgoTrue(); + } auto gmt_out_packer = static_pointer_cast(PackerFactory::get()->make("stage2::GMTMuonPacker")); gmt_out_packer->setFed(fed); gmt_out_packer->setFwVersion(fw); + // Use amc_no and board id 1 for packing res[{1, 1}] = { - PackerFactory::get()->make("stage2::RegionalMuonGMTPacker"), + gmt_in_packer, gmt_out_packer, PackerFactory::get()->make("stage2::IntermediateMuonPacker"), }; diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc index cc6136ed0bd4c..4ba50c5c03ee7 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.cc @@ -54,7 +54,7 @@ namespace l1t { uint32_t msw = 0; uint32_t lsw = 0; - RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw); + RegionalMuonRawDigiTranslator::generatePackedDataWords(*mu, lsw, msw, isKalman_); payloadMap[linkTimes2].push_back(lsw); payloadMap[linkTimes2].push_back(msw); diff --git a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h index 06a7b7f177367..879a1dd1f5bab 100644 --- a/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h +++ b/EventFilter/L1TRawToDigi/plugins/implementations_stage2/RegionalMuonGMTPacker.h @@ -13,10 +13,13 @@ namespace l1t { class RegionalMuonGMTPacker : public Packer { public: Blocks pack(const edm::Event&, const PackerTokens*) override; + void setKalmanAlgoTrue() { isKalman_ = true; }; private: typedef std::map> PayloadMap; void packTF(const edm::Event&, const edm::EDGetTokenT&, Blocks&); + + bool isKalman_{false}; }; } // namespace stage2 } // namespace l1t diff --git a/EventFilter/L1TRawToDigi/python/bmtfStage2Raw_cfi.py b/EventFilter/L1TRawToDigi/python/bmtfStage2Raw_cfi.py index 56ccb6cce87df..57cf90df06908 100644 --- a/EventFilter/L1TRawToDigi/python/bmtfStage2Raw_cfi.py +++ b/EventFilter/L1TRawToDigi/python/bmtfStage2Raw_cfi.py @@ -10,3 +10,19 @@ FedId = cms.int32(1376), FWId = cms.uint32(1), ) + +## Era: Run2_2016 +from Configuration.Eras.Modifier_stage2L1Trigger_cff import stage2L1Trigger +stage2L1Trigger.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(1)) + +## Era: Run2_2017 +from Configuration.Eras.Modifier_stage2L1Trigger_2017_cff import stage2L1Trigger_2017 +stage2L1Trigger_2017.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(1)) + +### Era: Run2_2018 +from Configuration.Eras.Modifier_stage2L1Trigger_2018_cff import stage2L1Trigger_2018 +stage2L1Trigger_2018.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simBmtfDigis", "BMTF"), FWId = cms.uint32(1)) + +### Era: Run3_2021 +from Configuration.Eras.Modifier_stage2L1Trigger_2021_cff import stage2L1Trigger_2021 +stage2L1Trigger_2021.toModify(bmtfStage2Raw, InputLabel = cms.InputTag("simKBmtfDigis", "BMTF"), FWId = cms.uint32(2499805536)) diff --git a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h index f09c2905411d0..20f5f755740b3 100644 --- a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h @@ -6,12 +6,14 @@ namespace l1t { class RegionalMuonRawDigiTranslator { public: - static void fillRegionalMuonCand( - RegionalMuonCand& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isKalman); - static void fillRegionalMuonCand(RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isKalman); - static void generatePackedDataWords(const RegionalMuonCand&, uint32_t&, uint32_t&); - static uint64_t generate64bitDataWord(const RegionalMuonCand&); - static int generateRawTrkAddress(const RegionalMuonCand&); + static void fillRegionalMuonCand(RegionalMuonCand&, uint32_t, uint32_t, int, tftype); + static void fillRegionalMuonCand(RegionalMuonCand&, uint64_t, int, tftype); + static void generatePackedDataWords(const RegionalMuonCand& mu, + uint32_t& raw_data_00_31, + uint32_t& raw_data_32_63, + bool isKalman); + static uint64_t generate64bitDataWord(const RegionalMuonCand& mu, bool isKalman); + static int generateRawTrkAddress(const RegionalMuonCand&, bool isKalman); static constexpr unsigned ptMask_ = 0x1FF; static constexpr unsigned ptShift_ = 0; @@ -34,8 +36,6 @@ namespace l1t { static constexpr unsigned trackAddressMask_ = 0x1FFFFFFF; static constexpr unsigned trackAddressShift_ = 2; // relative shifts within track address - static constexpr unsigned bmtfTrAddrSegSelMask_ = 0xF; - static constexpr unsigned bmtfTrAddrSegSelShift_ = 21; static constexpr unsigned bmtfTrAddrDetSideShift_ = 20; static constexpr unsigned bmtfTrAddrWheelMask_ = 0x3; static constexpr unsigned bmtfTrAddrWheelShift_ = 18; diff --git a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc index 81e8ba965b678..dae2fd06445f4 100644 --- a/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/RegionalMuonRawDigiTranslator.cc @@ -31,7 +31,6 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( // set track address with subaddresses int rawTrackAddress = (raw_data_32_63 >> trackAddressShift_) & trackAddressMask_; if (tf == bmtf) { - //int segSel = (rawTrackAddress >> bmtfTrAddrSegSelShift_) & bmtfTrAddrSegSelMask_; int detSide = (rawTrackAddress >> bmtfTrAddrDetSideShift_) & 0x1; int wheelNum = (rawTrackAddress >> bmtfTrAddrWheelShift_) & bmtfTrAddrWheelMask_; int statAddr1 = ((rawTrackAddress >> bmtfTrAddrStat1Shift_) & bmtfTrAddrStat1Mask_); @@ -99,7 +98,8 @@ void l1t::RegionalMuonRawDigiTranslator::fillRegionalMuonCand( void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalMuonCand& mu, uint32_t& raw_data_00_31, - uint32_t& raw_data_32_63) { + uint32_t& raw_data_32_63, + const bool isKalman) { int abs_eta = mu.hwEta(); if (abs_eta < 0) { abs_eta += (1 << (etaSignShift_ - absEtaShift_)); @@ -114,21 +114,25 @@ void l1t::RegionalMuonRawDigiTranslator::generatePackedDataWords(const RegionalM (mu.hwPhi() < 0) << phiSignShift_; // generate the raw track address from the subaddresses - int rawTrkAddr = generateRawTrkAddress(mu); + int rawTrkAddr = generateRawTrkAddress(mu, isKalman); raw_data_32_63 = mu.hwSign() << signShift_ | mu.hwSignValid() << signValidShift_ | (rawTrkAddr & trackAddressMask_) << trackAddressShift_; + if (isKalman) { + raw_data_32_63 |= (mu.hwPtUnconstrained() & ptUnconstrainedMask_) << ptUnconstrainedShift_ | (mu.hwDXY() & dxyMask_) + << dxyShift_; + } } -uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu) { +uint64_t l1t::RegionalMuonRawDigiTranslator::generate64bitDataWord(const RegionalMuonCand& mu, const bool isKalman) { uint32_t lsw; uint32_t msw; - generatePackedDataWords(mu, lsw, msw); + generatePackedDataWords(mu, lsw, msw, isKalman); return (((uint64_t)msw) << 32) + lsw; } -int l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(const RegionalMuonCand& mu) { +int l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(const RegionalMuonCand& mu, const bool isKalman) { int tf = mu.trackFinderType(); int rawTrkAddr = 0; if (tf == bmtf) { @@ -140,14 +144,14 @@ int l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(const RegionalMuon int stat2 = mu.trackSubAddress(RegionalMuonCand::kStat2); int stat3 = mu.trackSubAddress(RegionalMuonCand::kStat3); int stat4 = mu.trackSubAddress(RegionalMuonCand::kStat4); - - int segSel = mu.trackSubAddress(RegionalMuonCand::kSegSelStat1) | - (mu.trackSubAddress(RegionalMuonCand::kSegSelStat2)) >> 1 | - (mu.trackSubAddress(RegionalMuonCand::kSegSelStat3)) >> 2 | - (mu.trackSubAddress(RegionalMuonCand::kSegSelStat4)) >> 3; - - rawTrkAddr = (segSel & bmtfTrAddrSegSelMask_) << bmtfTrAddrSegSelShift_ | - (detSide & 0x1) << bmtfTrAddrDetSideShift_ | + if (isKalman) { + stat1 = mu.trackSubAddress(RegionalMuonCand::kStat4); + stat2 = mu.trackSubAddress(RegionalMuonCand::kStat3); + stat3 = mu.trackSubAddress(RegionalMuonCand::kStat2); + stat4 = mu.trackSubAddress(RegionalMuonCand::kStat1); + } + + rawTrkAddr = (detSide & 0x1) << bmtfTrAddrDetSideShift_ | (wheelNum & bmtfTrAddrWheelMask_) << bmtfTrAddrWheelShift_ | (stat1 & bmtfTrAddrStat1Mask_) << bmtfTrAddrStat1Shift_ | (stat2 & bmtfTrAddrStat2Mask_) << bmtfTrAddrStat2Shift_ | From c32d0a4801628e8d5b26f6b6f3ca96726b99f62b Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Mon, 18 May 2020 13:34:25 +0200 Subject: [PATCH 26/37] Made L1TNtuples work with changed raw2digi translator Not done nicely, should be cleaned up. --- L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index 3e088991ffc35..189109fdba94b 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -39,7 +39,7 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrAdd.push_back(stat3); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat4); } - l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it)); + l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it, true)); // TODO: We're assuming that we're dealing with Kalman muons here. l1upgradetfmuon_.nTfMuons++; } From 13fb02aa16b5897c212cd49df017266faad04a74 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Mon, 29 Jun 2020 17:11:35 +0200 Subject: [PATCH 27/37] Fixed a rare bug in the ghost busting for KBMTF --- .../L1TMuon/src/MicroGMTCancelOutUnit.cc | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc b/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc index 58bf1f6d194e9..1fc7e442e25d0 100644 --- a/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc +++ b/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc @@ -359,6 +359,7 @@ namespace l1t { stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat3]); stations_w1.push_back(trkAddr_w1[l1t::RegionalMuonCand::bmtfAddress::kStat4]); //std::cout << "Track address 1: wheelSide (1 == negative side): " << wheelSide_w1 << ", wheelNum: " << wheelNum_w1 << ", stations1234: 0x" << hex << stations_w1[0] << stations_w1[1] << stations_w1[2] << stations_w1[3] << dec << std::endl; + //std::cout << "Muon1 eta: " << (*mu_w1)->hwEta() << " phi: " << (*mu_w1)->hwGlobalPhi() << " pT: " << (*mu_w1)->hwPt() << " qual: " << (*mu_w1)->origin().hwQual() << std::endl; for (auto mu_w2 = coll2.begin(); mu_w2 != coll2.end(); ++mu_w2) { std::map trkAddr_w2 = (*mu_w2)->origin().trackAddress(); @@ -369,7 +370,8 @@ namespace l1t { stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat2]); stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat3]); stations_w2.push_back(trkAddr_w2[l1t::RegionalMuonCand::bmtfAddress::kStat4]); - //std::cout << "Track address 2: wheelSide (1 == negative side): " << wheelSide_w2 << ", wheelNum: " << wheelNum_w2 << ", stations1234: 0x" << hex << stations_w2[0] << stations_w2[1] << stations_w2[2] << stations_w2[3] << dec << std::endl; + // std::cout << "Track address 2: wheelSide (1 == negative side): " << wheelSide_w2 << ", wheelNum: " << wheelNum_w2 << ", stations1234: 0x" << hex << stations_w2[0] << stations_w2[1] << stations_w2[2] << stations_w2[3] << dec << std::endl; + // std::cout << "Muon2 eta: " << (*mu_w2)->hwEta() << " phi: " << (*mu_w2)->hwGlobalPhi() << " pT: " << (*mu_w2)->hwPt() << " qual: " << (*mu_w2)->origin().hwQual() << std::endl; int nMatchedStations = 0; // search for duplicates in stations 2-4 @@ -403,17 +405,17 @@ namespace l1t { } } else { // If one muon in 0+ and one muon in 0- (0+ and 0- are physically the same wheel), however wheel 0 is not split in kalman algorithm if (wheelNum_w1 == 0 && wheelNum_w2 == 1) { - if ((stations_w1[i] == 0xA && stations_w2[1] == 0x0) || - (stations_w1[i] == 0xB && stations_w2[1] == 0x1) || - (stations_w1[i] == 0x8 && stations_w2[1] == 0x4) || - (stations_w1[i] == 0x9 && stations_w2[1] == 0x5)) { + if ((stations_w1[i] == 0xA && stations_w2[i] == 0x0) || + (stations_w1[i] == 0xB && stations_w2[i] == 0x1) || + (stations_w1[i] == 0x8 && stations_w2[i] == 0x4) || + (stations_w1[i] == 0x9 && stations_w2[i] == 0x5)) { ++nMatchedStations; } } else if (wheelNum_w1 == 1 && wheelNum_w2 == 0) { - if ((stations_w1[i] == 0x2 && stations_w2[1] == 0x8) || - (stations_w1[i] == 0x3 && stations_w2[1] == 0x9) || - (stations_w1[i] == 0x0 && stations_w2[1] == 0xC) || - (stations_w1[i] == 0x1 && stations_w2[1] == 0xD)) { + if ((stations_w1[i] == 0x2 && stations_w2[i] == 0x8) || + (stations_w1[i] == 0x3 && stations_w2[i] == 0x9) || + (stations_w1[i] == 0x0 && stations_w2[i] == 0xC) || + (stations_w1[i] == 0x1 && stations_w2[i] == 0xD)) { ++nMatchedStations; } } From bdd62828feb86f10d88c65904d0c8a5d182798bd Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Mon, 29 Jun 2020 17:12:57 +0200 Subject: [PATCH 28/37] Added simKBmtfDigis to FEVTDEBUG event content --- L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py index 71fe0bdb8c54c..436822e8ab8e9 100644 --- a/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py +++ b/L1Trigger/Configuration/python/L1Trigger_EventContent_cff.py @@ -73,6 +73,7 @@ 'keep *_simCaloStage2Digis_*_*', 'keep *_simGmtDigis_*_*', "keep *_simBmtfDigis_*_*", + "keep *_simKBmtfDigis_*_*", "keep *_simOmtfDigis_*_*", "keep *_simEmtfDigis_*_*", "keep *_simGmtStage2Digis_*_*", From 8182c0c48e399ef81f6d58d4ba6542d33c46f11d Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Wed, 1 Jul 2020 16:06:15 +0200 Subject: [PATCH 29/37] Correct flipped BMTF track addresses --- .../L1TMuon/src/MicroGMTCancelOutUnit.cc | 4 ++-- .../src/L1TMuonBarrelKalmanAlgo.cc | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc b/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc index 1fc7e442e25d0..4d97ce7dc32b4 100644 --- a/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc +++ b/L1Trigger/L1TMuon/src/MicroGMTCancelOutUnit.cc @@ -374,8 +374,8 @@ namespace l1t { // std::cout << "Muon2 eta: " << (*mu_w2)->hwEta() << " phi: " << (*mu_w2)->hwGlobalPhi() << " pT: " << (*mu_w2)->hwPt() << " qual: " << (*mu_w2)->origin().hwQual() << std::endl; int nMatchedStations = 0; - // search for duplicates in stations 2-4 - for (int i = 1; i < 4; ++i) { + // search for duplicates in stations 1-3 + for (int i = 0; i < 3; ++i) { if (wheelSide_w1 == wheelSide_w2) { // both tracks are on the same detector side if (wheelNum_w1 == wheelNum_w2) { // both tracks have the same reference wheel if ((stations_w1[i] == 0x2 && stations_w2[i] == 0x0) || diff --git a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc index c8b1adacf4aef..0909710653d4d 100644 --- a/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc +++ b/L1Trigger/L1TMuonBarrel/src/L1TMuonBarrelKalmanAlgo.cc @@ -1068,10 +1068,10 @@ std::map L1TMuonBarrelKalmanAlgo::trackAddress(const L1MuKBMTrack& tra out[l1t::RegionalMuonCand::kWheelNum] = 2; else out[l1t::RegionalMuonCand::kWheelNum] = 0; - out[l1t::RegionalMuonCand::kStat1] = 3; + out[l1t::RegionalMuonCand::kStat1] = 15; out[l1t::RegionalMuonCand::kStat2] = 15; out[l1t::RegionalMuonCand::kStat3] = 15; - out[l1t::RegionalMuonCand::kStat4] = 15; + out[l1t::RegionalMuonCand::kStat4] = 3; out[l1t::RegionalMuonCand::kSegSelStat1] = 0; out[l1t::RegionalMuonCand::kSegSelStat2] = 0; out[l1t::RegionalMuonCand::kSegSelStat3] = 0; @@ -1092,24 +1092,24 @@ std::map L1TMuonBarrelKalmanAlgo::trackAddress(const L1MuKBMTrack& tra addr = 1; else addr = 2; - out[l1t::RegionalMuonCand::kStat1] = addr; + out[l1t::RegionalMuonCand::kStat4] = addr; } if (stub->stNum() == 3) { - out[l1t::RegionalMuonCand::kStat2] = addr; + out[l1t::RegionalMuonCand::kStat3] = addr; } if (stub->stNum() == 2) { - out[l1t::RegionalMuonCand::kStat3] = addr; + out[l1t::RegionalMuonCand::kStat2] = addr; } if (stub->stNum() == 1) { - out[l1t::RegionalMuonCand::kStat4] = addr; + out[l1t::RegionalMuonCand::kStat1] = addr; } } word = 0; - word = word | out[l1t::RegionalMuonCand::kStat1] << 12; - word = word | out[l1t::RegionalMuonCand::kStat2] << 8; - word = word | out[l1t::RegionalMuonCand::kStat3] << 4; - word = word | out[l1t::RegionalMuonCand::kStat4]; + word = word | out[l1t::RegionalMuonCand::kStat4] << 12; + word = word | out[l1t::RegionalMuonCand::kStat3] << 8; + word = word | out[l1t::RegionalMuonCand::kStat2] << 4; + word = word | out[l1t::RegionalMuonCand::kStat1]; return out; } From e3fbdc61fb804745f52d4e2391ab1303ee88df12 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Mon, 28 Sep 2020 23:49:27 +0200 Subject: [PATCH 30/37] Post rebase-fix. --- L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h | 4 ++-- L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h index 6708a6b512463..212a5e1282acc 100644 --- a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h @@ -6,8 +6,8 @@ namespace l1t { class MuonRawDigiTranslator { public: - static void fillMuon(Muon&, uint32_t, uint32_t, int, unsigned int); - static void fillMuon(Muon&, uint64_t, int, unsigned int); + static void fillMuon(Muon&, uint32_t, uint32_t, uint32_t, int, unsigned int, int); + static void fillMuon(Muon&, uint32_t, uint64_t, int, unsigned int, int); static void generatePackedDataWords(const Muon& mu, uint32_t& raw_data_spare, uint32_t& raw_data_00_31, diff --git a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h index 20f5f755740b3..5bbbf9dfa5a43 100644 --- a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h @@ -6,8 +6,8 @@ namespace l1t { class RegionalMuonRawDigiTranslator { public: - static void fillRegionalMuonCand(RegionalMuonCand&, uint32_t, uint32_t, int, tftype); - static void fillRegionalMuonCand(RegionalMuonCand&, uint64_t, int, tftype); + static void fillRegionalMuonCand(RegionalMuonCand&, uint32_t, uint32_t, int, tftype, bool); + static void fillRegionalMuonCand(RegionalMuonCand&, uint64_t, int, tftype, bool); static void generatePackedDataWords(const RegionalMuonCand& mu, uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, From 392c8ac3e9e3e097315625a37575ff5de4d5e214 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 29 Sep 2020 00:06:05 +0200 Subject: [PATCH 31/37] code-format --- L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index 189109fdba94b..7bf21b6c6c0c7 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -39,7 +39,8 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrAdd.push_back(stat3); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat4); } - l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress(*it, true)); // TODO: We're assuming that we're dealing with Kalman muons here. + l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress( + *it, true)); // TODO: We're assuming that we're dealing with Kalman muons here. l1upgradetfmuon_.nTfMuons++; } From f26ca244ddb965a74ec162de76f24809ae422a88 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Wed, 30 Sep 2020 11:31:48 +0200 Subject: [PATCH 32/37] Further post-rebase cleanup --- .../L1TMuon/interface/MuonRawDigiTranslator.h | 21 +++++- .../interface/RegionalMuonRawDigiTranslator.h | 7 +- L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc | 64 ++++++++++--------- .../L1AnalysisL1UpgradeTfMuonDataFormat.h | 3 +- .../src/L1AnalysisL1UpgradeTfMuon.cc | 24 ++++++- 5 files changed, 82 insertions(+), 37 deletions(-) diff --git a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h index 212a5e1282acc..c980dcd65fed1 100644 --- a/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h @@ -6,8 +6,15 @@ namespace l1t { class MuonRawDigiTranslator { public: - static void fillMuon(Muon&, uint32_t, uint32_t, uint32_t, int, unsigned int, int); - static void fillMuon(Muon&, uint32_t, uint64_t, int, unsigned int, int); + static void fillMuon(Muon& mu, + uint32_t raw_data_spare, + uint32_t raw_data_00_31, + uint32_t raw_data_32_63, + int fed, + unsigned int fw, + int muInBx); + static void fillMuon(Muon& mu, uint32_t raw_data_spare, uint64_t dataword, int fed, unsigned int fw, int muInBx); + static void fillIntermediateMuon(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, unsigned int fw); static void generatePackedDataWords(const Muon& mu, uint32_t& raw_data_spare, uint32_t& raw_data_00_31, @@ -17,7 +24,7 @@ namespace l1t { int muInBx); static void generate64bitDataWord( const Muon& mu, uint32_t& raw_data_spare, uint64_t& dataword, int fedId, int fwId, int muInBx); - static int calcHwEta(const uint32_t&, const unsigned, const unsigned); + static int calcHwEta(const uint32_t& raw, const unsigned absEtaShift, const unsigned etaSignShift); static constexpr unsigned ptMask_ = 0x1FF; static constexpr unsigned ptShift_ = 10; @@ -46,6 +53,14 @@ namespace l1t { static constexpr unsigned etaMu1SignShift_ = 20; // For Run-3 static constexpr unsigned absEtaMu2Shift_ = 21; // For Run-3 static constexpr unsigned etaMu2SignShift_ = 29; // For Run-3 + + private: + static void fillMuonStableQuantities(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonCoordinates2016(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonCoordinatesFrom2017(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); + static void fillMuonQuantitiesRun3( + Muon& mu, uint32_t raw_data_spare, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int muInBx); + static void fillIntermediateMuonQuantitiesRun3(Muon& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63); }; } // namespace l1t diff --git a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h index 5bbbf9dfa5a43..0ee774b831864 100644 --- a/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h +++ b/L1Trigger/L1TMuon/interface/RegionalMuonRawDigiTranslator.h @@ -6,8 +6,9 @@ namespace l1t { class RegionalMuonRawDigiTranslator { public: - static void fillRegionalMuonCand(RegionalMuonCand&, uint32_t, uint32_t, int, tftype, bool); - static void fillRegionalMuonCand(RegionalMuonCand&, uint64_t, int, tftype, bool); + static void fillRegionalMuonCand( + RegionalMuonCand& mu, uint32_t raw_data_00_31, uint32_t raw_data_32_63, int proc, tftype tf, bool isKalman); + static void fillRegionalMuonCand(RegionalMuonCand& mu, uint64_t dataword, int proc, tftype tf, bool isKalman); static void generatePackedDataWords(const RegionalMuonCand& mu, uint32_t& raw_data_00_31, uint32_t& raw_data_32_63, @@ -36,6 +37,8 @@ namespace l1t { static constexpr unsigned trackAddressMask_ = 0x1FFFFFFF; static constexpr unsigned trackAddressShift_ = 2; // relative shifts within track address + static constexpr unsigned bmtfTrAddrSegSelMask_ = 0xF; + static constexpr unsigned bmtfTrAddrSegSelShift_ = 21; static constexpr unsigned bmtfTrAddrDetSideShift_ = 20; static constexpr unsigned bmtfTrAddrWheelMask_ = 0x3; static constexpr unsigned bmtfTrAddrWheelShift_ = 18; diff --git a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc index 07b75d8ede758..a505990757bb0 100644 --- a/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc +++ b/L1Trigger/L1TMuon/plugins/L1TMuonProducer.cc @@ -481,23 +481,26 @@ void L1TMuonProducer::splitAndConvertMuons(const edm::Handlesize(bx); ++i, ++muIdx) { - int link = in->at(bx, i).link(); - if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) - continue; // only process if input link is enabled and not masked - if (currentLink != link) { - muIdx = 0; - currentLink = link; - } - int gPhi = MicroGMTConfiguration::calcGlobalPhi( - in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor()); - int tfMuonIdx = 3 * (currentLink - 36) + muIdx; - std::shared_ptr out = std::make_shared(in->at(bx, i), gPhi, tfMuonIdx); - if (in->at(bx, i).hwEta() > 0) { - out_pos.push_back(out); - wedges_pos[in->at(bx, i).processor()].push_back(out); - } else { - out_neg.emplace_back(out); - wedges_neg[in->at(bx, i).processor()].push_back(out); + if (in->at(bx, i).hwPt() > 0) { + int link = in->at(bx, i).link(); + if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) { + continue; // only process if input link is enabled and not masked + } + if (currentLink != link) { + muIdx = 0; + currentLink = link; + } + int gPhi = MicroGMTConfiguration::calcGlobalPhi( + in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor()); + int tfMuonIdx = 3 * (currentLink - 36) + muIdx; + std::shared_ptr out = std::make_shared(in->at(bx, i), gPhi, tfMuonIdx); + if (in->at(bx, i).hwEta() > 0) { + out_pos.push_back(out); + wedges_pos[in->at(bx, i).processor()].push_back(out); + } else { + out_neg.emplace_back(out); + wedges_neg[in->at(bx, i).processor()].push_back(out); + } } } for (int i = 0; i < 6; ++i) { @@ -524,19 +527,22 @@ void L1TMuonProducer::convertMuons(const edm::Handlesize(bx); ++i, ++muIdx) { - int link = in->at(bx, i).link(); - if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) - continue; // only process if input link is enabled and not masked - if (currentLink != link) { - muIdx = 0; - currentLink = link; + if (in->at(bx, i).hwPt() > 0) { + int link = in->at(bx, i).link(); + if (m_inputsToDisable.test(link) || m_maskedInputs.test(link)) { + continue; // only process if input link is enabled and not masked + } + if (currentLink != link) { + muIdx = 0; + currentLink = link; + } + int gPhi = MicroGMTConfiguration::calcGlobalPhi( + in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor()); + int tfMuonIdx = 3 * (currentLink - 36) + muIdx; + std::shared_ptr outMu = std::make_shared(in->at(bx, i), gPhi, tfMuonIdx); + out.emplace_back(outMu); + wedges[in->at(bx, i).processor()].push_back(outMu); } - int gPhi = MicroGMTConfiguration::calcGlobalPhi( - in->at(bx, i).hwPhi(), in->at(bx, i).trackFinderType(), in->at(bx, i).processor()); - int tfMuonIdx = 3 * (currentLink - 36) + muIdx; - std::shared_ptr outMu = std::make_shared(in->at(bx, i), gPhi, tfMuonIdx); - out.emplace_back(outMu); - wedges[in->at(bx, i).processor()].push_back(outMu); } for (int i = 0; i < 12; ++i) { if (wedges[i].size() > 3) diff --git a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h index a6bb8995ec5e6..eb1105d2ff8b3 100644 --- a/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h +++ b/L1Trigger/L1TNtuples/interface/L1AnalysisL1UpgradeTfMuonDataFormat.h @@ -45,7 +45,8 @@ namespace L1Analysis { std::vector tfMuonBx; std::vector tfMuonWh; std::vector tfMuonTrAdd; - std::vector tfMuonRawTrAdd; + std::vector> tfMuonDecodedTrAdd; + std::vector tfMuonHwTrAdd; }; } // namespace L1Analysis #endif diff --git a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc index 7bf21b6c6c0c7..622b4ad3e42f0 100644 --- a/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc +++ b/L1Trigger/L1TNtuples/src/L1AnalysisL1UpgradeTfMuon.cc @@ -24,6 +24,7 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrackFinderType.push_back(it->trackFinderType()); l1upgradetfmuon_.tfMuonHwHF.push_back(it->hwHF()); l1upgradetfmuon_.tfMuonBx.push_back(ibx); + std::map decoded_track_address; if (it->trackFinderType() == l1t::tftype::bmtf) { int detSide = it->trackSubAddress(l1t::RegionalMuonCand::kWheelSide); int wheelNum = it->trackSubAddress(l1t::RegionalMuonCand::kWheelNum); @@ -38,10 +39,29 @@ void L1Analysis::L1AnalysisL1UpgradeTfMuon::SetTfMuon(const l1t::RegionalMuonCan l1upgradetfmuon_.tfMuonTrAdd.push_back(stat2); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat3); l1upgradetfmuon_.tfMuonTrAdd.push_back(stat4); + decoded_track_address["wheel"] = wheel; + decoded_track_address["station1"] = stat1; + decoded_track_address["station2"] = stat2; + decoded_track_address["station3"] = stat3; + decoded_track_address["station4"] = stat4; + } else if (it->trackFinderType() == l1t::omtf_neg || it->trackFinderType() == l1t::omtf_pos) { + decoded_track_address["kLayers"] = it->trackSubAddress(l1t::RegionalMuonCand::kLayers); + decoded_track_address["kWeight"] = it->trackSubAddress(l1t::RegionalMuonCand::kWeight); + } else if (it->trackFinderType() == l1t::emtf_neg || it->trackFinderType() == l1t::emtf_pos) { + decoded_track_address["kME1Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Seg); + decoded_track_address["kME1Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME1Ch); + decoded_track_address["kME2Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Seg); + decoded_track_address["kME2Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME2Ch); + decoded_track_address["kME3Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Seg); + decoded_track_address["kME3Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME3Ch); + decoded_track_address["kME4Seg"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Seg); + decoded_track_address["kME4Ch"] = it->trackSubAddress(l1t::RegionalMuonCand::kME4Ch); + decoded_track_address["kTrkNum"] = it->trackSubAddress(l1t::RegionalMuonCand::kTrkNum); + decoded_track_address["kBX"] = it->trackSubAddress(l1t::RegionalMuonCand::kBX); } - l1upgradetfmuon_.tfMuonRawTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress( + l1upgradetfmuon_.tfMuonDecodedTrAdd.push_back(decoded_track_address); + l1upgradetfmuon_.tfMuonHwTrAdd.push_back(l1t::RegionalMuonRawDigiTranslator::generateRawTrkAddress( *it, true)); // TODO: We're assuming that we're dealing with Kalman muons here. - l1upgradetfmuon_.nTfMuons++; } } From cb57909266620fb031a0617968062d2b6b5fec7b Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Wed, 30 Sep 2020 16:18:58 +0200 Subject: [PATCH 33/37] Applied changes from code-checks --- DataFormats/L1Trigger/interface/Muon.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataFormats/L1Trigger/interface/Muon.h b/DataFormats/L1Trigger/interface/Muon.h index 2b5e421046261..3b30133cf8c0e 100644 --- a/DataFormats/L1Trigger/interface/Muon.h +++ b/DataFormats/L1Trigger/interface/Muon.h @@ -68,7 +68,7 @@ namespace l1t { double ptUnconstrained = 0., int dXY = 0); - ~Muon(); + ~Muon() override; // set values inline void setHwCharge(int charge) { hwCharge_ = charge; }; From bbcc394abca85d1df35305f141521ddd729e7cfe Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 1 Oct 2020 16:24:02 +0200 Subject: [PATCH 34/37] Log when we can't fill raw eta of uGMT output muons --- L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc index cbe5ab0ace5e9..02fbe67eb6bc5 100644 --- a/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc +++ b/L1Trigger/L1TMuon/src/MuonRawDigiTranslator.cc @@ -1,3 +1,4 @@ +#include "FWCore/MessageLogger/interface/MessageLogger.h" #include "TMath.h" #include "L1Trigger/L1TMuon/interface/MuonRawDigiTranslator.h" @@ -124,7 +125,7 @@ void l1t::MuonRawDigiTranslator::fillMuonQuantitiesRun3( } else if (muInBx == 2) { mu.setHwEta(calcHwEta(raw_data_spare, absEtaMu2Shift_, etaMu2SignShift_)); } else { - // TODO: Log an error? + edm::LogWarning("L1T") << "Received invalid muon id " << muInBx << ". Cannot fill eta value in the muon system."; } mu.setHwPhi((raw_data_32_63 >> phiShift_) & phiMask_); From fd78ab8c393ace61480041a9383d083e0a17ce35 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Thu, 1 Oct 2020 16:29:05 +0200 Subject: [PATCH 35/37] Reverted regression in BMTF DQM that was introduced during merge --- DQM/L1TMonitor/interface/L1TStage2BMTF.h | 2 +- DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DQM/L1TMonitor/interface/L1TStage2BMTF.h b/DQM/L1TMonitor/interface/L1TStage2BMTF.h index a77c03b05cb55..038d38f11deab 100644 --- a/DQM/L1TMonitor/interface/L1TStage2BMTF.h +++ b/DQM/L1TMonitor/interface/L1TStage2BMTF.h @@ -33,7 +33,7 @@ #include "DataFormats/L1GlobalTrigger/interface/L1GlobalTriggerReadoutRecord.h" // dqm requirements -#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMStore.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" #include "FWCore/Framework/interface/Frameworkfwd.h" diff --git a/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h b/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h index d312f8b640ecf..f679c4d30a852 100644 --- a/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h +++ b/DQM/L1TMonitor/interface/L1TStage2RegionalMuonCandComp.h @@ -4,7 +4,7 @@ #include "DataFormats/L1TMuon/interface/RegionalMuonCand.h" #include "DQMServices/Core/interface/DQMEDAnalyzer.h" -#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMStore.h" #include "FWCore/Framework/interface/Event.h" #include "FWCore/MessageLogger/interface/MessageLogger.h" From 4e8cd8b4f5452036a9889382c9c7a69c53c25984 Mon Sep 17 00:00:00 2001 From: Dinyar Rabady Date: Mon, 12 Oct 2020 13:20:51 +0200 Subject: [PATCH 36/37] Versioning RegionalMuonCand data format --- DataFormats/L1TMuon/src/classes_def.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/DataFormats/L1TMuon/src/classes_def.xml b/DataFormats/L1TMuon/src/classes_def.xml index c411aeb8cd82b..2e25eb36a2176 100644 --- a/DataFormats/L1TMuon/src/classes_def.xml +++ b/DataFormats/L1TMuon/src/classes_def.xml @@ -1,7 +1,14 @@ - + + + + + + + + From c3734a8d729369719a64077b5e6f4571ec6d77b3 Mon Sep 17 00:00:00 2001 From: Vladimir Date: Tue, 27 Oct 2020 09:29:25 +0100 Subject: [PATCH 37/37] Fix versionining in iorules, synced with #31848 --- DataFormats/L1TMuon/src/classes_def.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataFormats/L1TMuon/src/classes_def.xml b/DataFormats/L1TMuon/src/classes_def.xml index 2e25eb36a2176..8acf940fba8a4 100644 --- a/DataFormats/L1TMuon/src/classes_def.xml +++ b/DataFormats/L1TMuon/src/classes_def.xml @@ -5,7 +5,7 @@ - +