Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTLFCOUDeltaEtaLUT
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/L1MuGMTLFCOUDeltaEtaLUT.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/L1MuPacking.h"
0032 
0033 //-------------------
0034 // InitParameters  --
0035 //-------------------
0036 
0037 void L1MuGMTLFCOUDeltaEtaLUT::InitParameters() {}
0038 
0039 //---------------------------------------------------------------------------
0040 // Cancel-Out-Unit Delta-Eta LUT
0041 // =============================
0042 //
0043 // Calculate delta-eta between two eta values coded in a special 4-bit scale
0044 // used in the overlap region
0045 //
0046 // This scale is used to save I/O pins and in order to be able to do the delta-eta
0047 // calculateion in a distributed RAM LUT
0048 //
0049 //---------------------------------------------------------------------------
0050 
0051 unsigned L1MuGMTLFCOUDeltaEtaLUT::TheLookupFunction(int idx, unsigned eta1, unsigned eta2) const {
0052   // idx is DTCSC, CSCDT, bRPCCSC, fRPCDT
0053   // INPUTS:  eta1(4) eta2(4)
0054   // OUTPUTS: delta_eta(4)
0055 
0056   const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
0057 
0058   // check out of range in inputs
0059   L1MuSignedPacking<4> pack;
0060   unsigned delta_eta_OOR = pack.packedFromIdx(-8);
0061 
0062   if (eta1 == 7 || eta2 == 7)
0063     return delta_eta_OOR;
0064 
0065   int type1 = 0, type2 = 0;
0066   switch (idx) {
0067     case 0:
0068       type1 = 0;
0069       type2 = 2;
0070       break;  // DT, CSC
0071     case 1:
0072       type1 = 2;
0073       type2 = 0;
0074       break;  // CSC, DT
0075     case 2:
0076       type1 = 1;
0077       type2 = 2;
0078       break;  // bRPC, CSC
0079     case 3:
0080       type1 = 3;
0081       type2 = 0;
0082       break;  // fRPC, DT
0083   }
0084 
0085   float etaValue1 = theGMTScales->getOvlEtaScale(type1)->getCenter(eta1);
0086   float etaValue2 = theGMTScales->getOvlEtaScale(type2)->getCenter(eta2);
0087 
0088   float delta_eta = etaValue1 - etaValue2;
0089 
0090   unsigned delta_eta_4bit = 0;
0091 
0092   // check out of range
0093   if (delta_eta < theGMTScales->getDeltaEtaScale(idx + 2)->getScaleMin() ||
0094       delta_eta > theGMTScales->getDeltaEtaScale(idx + 2)->getScaleMax()) {
0095     delta_eta_4bit = delta_eta_OOR;
0096   } else {
0097     delta_eta_4bit = theGMTScales->getDeltaEtaScale(idx + 2)->getPacked(delta_eta);
0098   }
0099 
0100   return delta_eta_4bit;
0101 }