Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-10-25 09:54:31

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTSortRankUnit
0004 //
0005 //   Description: GMT Sort Rank Unit
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   H. Sakulin                   HEPHY Vienna
0011 //
0012 //   Migrated to CMSSW:
0013 //   I. Mikulec
0014 //
0015 //--------------------------------------------------
0016 
0017 //-----------------------
0018 // This Class's Header --
0019 //-----------------------
0020 
0021 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTSortRankUnit.h"
0022 
0023 //---------------
0024 // C++ Headers --
0025 //---------------
0026 
0027 //-------------------------------
0028 // Collaborating Class Headers --
0029 //-------------------------------
0030 #include "DataFormats/L1GlobalMuonTrigger/interface/L1MuRegionalCand.h"
0031 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0032 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankEtaQLUT.h"
0033 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankPtQLUT.h"
0034 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankEtaPhiLUT.h"
0035 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankCombineLUT.h"
0036 
0037 //---------------------------------
0038 //       class L1MuGMTSortRankUnit
0039 //---------------------------------
0040 
0041 unsigned L1MuGMTSortRankUnit::sort_rank(const L1MuRegionalCand* muon) {
0042   if (muon == nullptr || muon->empty())
0043     return 0;
0044 
0045   unsigned lut_idx = muon->type_idx();
0046 
0047   // obtain inputs as coded in HW
0048   unsigned eta = muon->eta_packed();
0049   unsigned q = muon->quality_packed();
0050   unsigned pt = muon->pt_packed();
0051   unsigned phi = muon->phi_packed();
0052 
0053   // lookup eta-q
0054   L1MuGMTLFSortRankEtaQLUT* etaq_lut = L1MuGMTConfig::getLFSortRankEtaQLUT();
0055   unsigned rank_etaq = etaq_lut->SpecificLookup_rank_etaq(lut_idx, eta, q);
0056 
0057   // lookup pt-q
0058   L1MuGMTLFSortRankPtQLUT* ptq_lut = L1MuGMTConfig::getLFSortRankPtQLUT();
0059   unsigned rank_ptq = ptq_lut->SpecificLookup_rank_ptq(lut_idx, q, pt);
0060 
0061   // lookup etaphi
0062   L1MuGMTLFSortRankEtaPhiLUT* etaphi_lut = L1MuGMTConfig::getLFSortRankEtaPhiLUT();
0063   unsigned rank_etaphi = etaphi_lut->SpecificLookup_rank_etaphi(lut_idx, eta, phi);
0064 
0065   // combine
0066   L1MuGMTLFSortRankCombineLUT* combine_lut = L1MuGMTConfig::getLFSortRankCombineLUT();
0067   unsigned rank = combine_lut->SpecificLookup_sort_rank(lut_idx, rank_etaq, rank_ptq, rank_etaphi);
0068 
0069   return rank;
0070 }
0071 
0072 unsigned L1MuGMTSortRankUnit::getVeryLowQualityLevel(const L1MuRegionalCand* muon) {
0073   if (muon == nullptr || muon->empty())
0074     return 0;
0075 
0076   unsigned lut_idx = muon->type_idx();
0077 
0078   // obtain inputs as coded in HW
0079   unsigned eta = muon->eta_packed();
0080   unsigned q = muon->quality_packed();
0081 
0082   // lookup eta-q
0083   L1MuGMTLFSortRankEtaQLUT* etaq_lut = L1MuGMTConfig::getLFSortRankEtaQLUT();
0084   return etaq_lut->SpecificLookup_vlq(lut_idx, eta, q);
0085 }
0086 
0087 bool L1MuGMTSortRankUnit::isDisabled(const L1MuRegionalCand* muon) {
0088   if (muon == nullptr || muon->empty())
0089     return true;
0090 
0091   unsigned lut_idx = muon->type_idx();
0092 
0093   // obtain inputs as coded in HW
0094   unsigned eta = muon->eta_packed();
0095   unsigned phi = muon->phi_packed();
0096 
0097   // lookup eta-q
0098   L1MuGMTLFSortRankEtaPhiLUT* etaphi_lut = L1MuGMTConfig::getLFSortRankEtaPhiLUT();
0099 
0100   return etaphi_lut->SpecificLookup_rank_etaphi(lut_idx, eta, phi) == 3;
0101 }