Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTMIAUEtaProLUT
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/L1MuGMTMIAUEtaProLUT.h"
0019 
0020 //---------------
0021 // C++ Headers --
0022 //---------------
0023 
0024 //#include <iostream>
0025 
0026 //-------------------------------
0027 // Collaborating Class Headers --
0028 //-------------------------------
0029 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0030 #include "CondFormats/L1TObjects/interface/L1MuGMTScales.h"
0031 #include "CondFormats/L1TObjects/interface/L1MuTriggerScales.h"
0032 #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
0033 #include "CondFormats/L1TObjects/interface/L1MuPacking.h"
0034 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTEtaLUT.h"
0035 #include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
0036 
0037 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0038 
0039 //-------------------
0040 // InitParameters  --
0041 //-------------------
0042 
0043 void L1MuGMTMIAUEtaProLUT::InitParameters() { m_IsolationCellSizeEta = L1MuGMTConfig::getIsolationCellSizeEta(); }
0044 
0045 //--------------------------------------------------------------------------------
0046 // Eta Projection LUT: Based on eta(6), pt(5) and charge(1), project in eta and directly
0047 // =================== output the eta select-bits for the regions in eta.
0048 //
0049 // In the barrel there are 8 slect bits while in the forward chip there are 10.
0050 //
0051 // output: eta select bits
0052 //                    eta= -3.                                     3.
0053 // total: 14 rings in eta   0  1  2  3  4  5  6  7  8  9 10 11 12 13
0054 //
0055 // barrel:8                          0  1  2  3  4  5  6  7
0056 // fwd:10                   0  1  2  3  4              5  6  7  8  9
0057 //
0058 // As for the phi projection, in case of MIP bits by defualt only one region is checked
0059 // while for the ISO bit assignment multiple regions can be checked as given by
0060 // IsolationCellSizeEta. Adjacent regions to be ckecked are determined in analogy to
0061 // the phi projection.
0062 //
0063 //--------------------------------------------------------------------------------
0064 
0065 unsigned L1MuGMTMIAUEtaProLUT::TheLookupFunction(int idx, unsigned eta, unsigned pt, unsigned charge) const {
0066   // idx is MIP_DT, MIP_BRPC, ISO_DT, ISO_BRPC, MIP_CSC, MIP_FRPC, ISO_CSC, ISO_FRPC
0067   // INPUTS:  eta(6) pt(5) charge(1)
0068   // OUTPUTS: eta_sel(10)
0069 
0070   // const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
0071   const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
0072   const L1MuTriggerPtScale* theTriggerPtScale = L1MuGMTConfig::getTriggerPtScale();
0073   const L1CaloGeometry* theCaloGeom = L1MuGMTConfig::getCaloGeom();
0074 
0075   int isRPC = idx % 2;
0076   int isFWD = idx / 4;
0077 
0078   int isISO = (idx / 2) % 2;
0079 
0080   int idx_drcr = isFWD * 2 + isRPC;
0081 
0082   if (pt == 0)
0083     return 0;  // empty candidate
0084 
0085   int ch_idx = (charge == 0) ? 1 : 0;  // positive charge is 0 (but idx 1)
0086 
0087   float oldeta = theTriggerScales->getRegionalEtaScale(idx_drcr)->getCenter(eta);
0088 
0089   if (idx_drcr == 2)
0090     oldeta = theTriggerScales->getRegionalEtaScale(idx_drcr)->getLowEdge(eta);  //FIXME use center when changed in ORCA
0091 
0092   if ((isRPC && isFWD && fabs(oldeta) < 1.04) || (isRPC && !isFWD && fabs(oldeta) > 1.04)) {
0093     if (!m_saveFlag)
0094       edm::LogWarning("LUTRangeViolation") << "L1MuGMTMIAUEtaProLUT::TheLookupFunction: RPC " << (isFWD ? "fwd" : "brl")
0095                                            << " eta value out of range: " << oldeta;
0096   }
0097 
0098   // eta conversion depends only on isys by default
0099   int isys = isFWD + 2 * isRPC;  // DT, CSC, BRPC, FRPC
0100   float neweta = L1MuGMTEtaLUT::eta(isys,
0101                                     isISO,
0102                                     ch_idx,
0103                                     oldeta,
0104                                     theTriggerPtScale->getPtScale()->getLowEdge(pt));  // use old LUT, here
0105   // theTriggerScales->getPtScale()->getLowEdge(pt) );  // use old LUT, here
0106 
0107   //  unsigned icenter = theGMTScales->getCaloEtaScale()->getPacked( neweta );
0108   // globalEtaIndex is 0-21 for forward+central; need to shift to 0-13 for central only
0109   unsigned icenter = theCaloGeom->globalEtaIndex(neweta) - theCaloGeom->numberGctForwardEtaBinsPerHalf();
0110 
0111   unsigned eta_select_word_14 = 1 << icenter;  // for the whole detector
0112 
0113   // for ISOlation bit assignment, multiple regions can be selected according to the IsolationCellSize
0114   if (isISO) {
0115     int imin = icenter - (m_IsolationCellSizeEta - 1) / 2;
0116     int imax = icenter + (m_IsolationCellSizeEta - 1) / 2;
0117 
0118     // for even number of isolation cells check the fine grain info
0119     if (m_IsolationCellSizeEta % 2 == 0) {
0120       // float bincenter = theGMTScales->getCaloEtaScale()->getCenter( icenter );
0121       // globalEtaIndex is 0-21 for forward+central; need to shift to 0-13 for central only
0122       float bincenter = theCaloGeom->globalEtaBinCenter(icenter + theCaloGeom->numberGctForwardEtaBinsPerHalf());
0123       if (neweta > bincenter)
0124         imax++;
0125       else
0126         imin--;
0127     }
0128     if (imin < 0)
0129       imin = 0;
0130     if (imax > 13)
0131       imax = 13;
0132 
0133     for (int i = imin; i <= imax; i++)
0134       eta_select_word_14 |= 1 << i;
0135   }
0136 
0137   // generate select words for barrel (10 central bits)
0138   // and for forward (5+5 fwd bits) case
0139   unsigned eta_select_word;
0140   if (isFWD) {
0141     unsigned mask5 = (1 << 5) - 1;
0142     eta_select_word = eta_select_word_14 & mask5;
0143     eta_select_word |= (eta_select_word_14 & (mask5 << 9)) >> 4;
0144   } else {
0145     unsigned mask10 = (1 << 10) - 1;
0146     eta_select_word = (eta_select_word_14 & (mask10 << 2)) >> 2;
0147   }
0148 
0149   return eta_select_word;
0150 }