Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:56

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTLFSortRankEtaQLUT
0004 //
0005 //
0006 //
0007 //   Author :
0008 //   H. Sakulin            HEPHY Vienna
0009 //
0010 //   Migrated to CMSSW:
0011 //   I. Mikulec
0012 //
0013 //--------------------------------------------------
0014 
0015 //-----------------------
0016 // This Class's Header --
0017 //-----------------------
0018 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFSortRankEtaQLUT.h"
0019 
0020 //---------------
0021 // C++ Headers --
0022 //---------------
0023 
0024 //-------------------------------
0025 // Collaborating Class Headers --
0026 //-------------------------------
0027 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0028 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
0029 #include "CondFormats/L1TObjects/interface/L1MuPacking.h"
0030 
0031 //-------------------
0032 // InitParameters  --
0033 //-------------------
0034 
0035 void L1MuGMTLFSortRankEtaQLUT::InitParameters() { m_version = L1MuGMTConfig::getVersionSortRankEtaQLUT(); }
0036 
0037 //------------------------------------------------------------------------------------
0038 // Sort Rank LUT, Eta-Quality part
0039 //
0040 // This LUT determines the dependency of the sort rank on Eta and Quality.
0041 // Inputs:  Eta(6 bit) and Quality(3 bit)
0042 // Outputs: Very-low-quality bits (2 bit)
0043 //          Rank contribution 2-bit
0044 //
0045 // The very-low quality bits are used to suppress unmatched muons in certain
0046 // trigger-algorithms. By default vlq(1)(MSB) means: not to be used in di-muon trigger
0047 // and vlq(0)(LSB) means not to be used in single-muon trigger.
0048 //
0049 // The Rank-contribution from Eta-Quality is currently not used. Its influence on the
0050 // sort-rank can be determined in the Sort-Rank Combine LUT.
0051 //
0052 // Explanation of the meaning of m_version:
0053 //
0054 // m_version split to 4bit fields:
0055 // bits 0-3: qCSC=2 code
0056 //           - 0 - do nothing
0057 //           - 1 - all to qGMT=3
0058 //           - 2 - |eta|<1.5 || |eta|>1.8 to qGMT=3
0059 //           - 3 - 1.2<|eta|<1.5 || |eta|>1.8 to qGMT=3
0060 //           - >3 - do nothing
0061 // bits 4-7: qCSC=1 code
0062 //           - 0 - |eta|>1.2 to qGMT=3
0063 //           - 1 - |eta|>1.3 to qGMT=3
0064 //           - >1 - nothing done
0065 // bits 8-11: qRPC<3 code
0066 //           - 0 - qRPC=0 1.04<|eta|<1.24 || |eta|>1.48 to qGMT=2
0067 //                 qRPC=1 0.83<|eta|<1.04 || 1.14<|eta|<1.24 || |eta|>1.36 to qGMT=2
0068 //                 qRPC=2 0.83<|eta|<0.93 to qGMT=2
0069 //           - 1 - do nothing
0070 //           - 2 - remove qRPC=0 in endcap from single muon
0071 //           - 3 - remove qRPC=0 from single muon
0072 //           - 4 - remove qRPC=0 in endcap from all
0073 //           - 5 - remove qRPC=0 from all
0074 //           - >0 - do nothing
0075 //
0076 // m_version=1: TDR
0077 // m_version=2: 2010 data
0078 // m_version>2: 2011
0079 //
0080 //------------------------------------------------------------------------------------
0081 
0082 unsigned L1MuGMTLFSortRankEtaQLUT::TheLookupFunction(int idx, unsigned eta, unsigned q) const {
0083   // idx is DT, BRPC, CSC, FRPC
0084   // INPUTS:  eta(6) q(3)
0085   // OUTPUTS: vlq(2) rank_etaq(2)
0086 
0087   const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
0088 
0089   int isRPC = idx % 2;
0090   //  int isFWD = idx / 2;
0091 
0092   float etaValue = fabs(theTriggerScales->getRegionalEtaScale(idx)->getCenter(eta));
0093 
0094   //
0095   // very-low-quality flags
0096   //
0097   // 0 .. no VLQ set
0098   // 1 .. output muon will be quality 2 (disable in single and di-muon trigger)
0099   // 2 .. output muon will be quality 3 (disable in single-muon trigger only)
0100   // 3 .. output muon will be quality 4 (disable in di-muon trigger only)
0101 
0102   unsigned vlq = 0;
0103 
0104   int vCSC2 = (m_version)&0xf;
0105   int vCSC1 = (m_version >> 4) & 0xf;
0106   int vRPC = (m_version >> 8) & 0xf;
0107 
0108   // RPC selection
0109   if (isRPC) {
0110     if (vRPC == 0) {
0111       if ((q == 0 && ((etaValue > 1.04 && etaValue < 1.24) ||  // Q0, high rate, high noise
0112                       (etaValue > 1.48))) ||                   // Q0, high rate, high noise
0113           (q == 1 && ((etaValue > 0.83 && etaValue < 1.04) ||  // Q1, high rate
0114                       (etaValue > 1.14 && etaValue < 1.24) ||  // Q1, high noise
0115                       (etaValue > 1.36))) ||                   // Q1, high rate
0116           (q == 2 && (etaValue > 0.83 && etaValue < 0.93)))    // Q2, high rate
0117         vlq = 1;
0118     }
0119     // reserve vRPC == 1 for doing nothing for bwd compatibility
0120     if (vRPC == 2) {
0121       if (q == 0 && etaValue > 1.04)
0122         vlq = 2;
0123     }
0124     if (vRPC == 3) {
0125       if (q == 0)
0126         vlq = 2;
0127     }
0128     if (vRPC == 4) {
0129       if (q == 0 && etaValue > 1.04)
0130         vlq = 1;
0131     }
0132     if (vRPC == 5) {
0133       if (q == 0)
0134         vlq = 1;
0135     }
0136   }
0137 
0138   // CSC selection
0139   if (idx == 2) {  // CSC
0140     if (q == 2) {
0141       if (vCSC2 == 1)
0142         vlq = 2;
0143       if (vCSC2 == 2) {
0144         if (etaValue < 1.5 || etaValue > 1.8)
0145           vlq = 2;  // disable in single-muon trigger only
0146       }
0147       if (vCSC2 == 3) {
0148         if ((etaValue > 1.2 && etaValue < 1.5) || etaValue > 1.8)
0149           vlq = 2;  // disable in single-muon trigger only
0150       }
0151     }
0152 
0153     if (q == 1) {
0154       if (vCSC1 == 0) {
0155         if (etaValue > 1.2)
0156           vlq = 2;  // disable in single-muon trigger only
0157       }
0158       if (vCSC1 == 1) {
0159         if (etaValue > 1.3)
0160           vlq = 2;  // disable in single-muon trigger only
0161       }
0162     }
0163   }
0164 
0165   if (L1MuGMTConfig::getDoOvlRpcAnd()) {
0166     if (idx == 0) {  // DT
0167       if (etaValue > 0.91)
0168         vlq = 1;
0169     }
0170     if (idx == 2) {  // CSC
0171       if (etaValue < 1.06)
0172         vlq = 1;
0173     }
0174   }
0175 
0176   //
0177   // Rank contribution from eta and quality
0178   //
0179 
0180   // by default return maximum
0181   // LUT can later be used to reduce the sort rank of certain regions
0182   unsigned rank_etaq = 3;
0183 
0184   return (vlq << 2) | rank_etaq;
0185 }