Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTLFPhiProEtaConvLUT
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/L1MuGMTLFPhiProEtaConvLUT.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/L1MuPacking.h"
0033 
0034 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0035 
0036 //-------------------
0037 // InitParameters  --
0038 //-------------------
0039 
0040 void L1MuGMTLFPhiProEtaConvLUT::InitParameters() {}
0041 
0042 //------------------------
0043 // The Lookup Function  --
0044 //------------------------
0045 //
0046 // The LUT converts eta from 6 to 4 bits in order to use it as an Input to the Phi Projection
0047 // LUT in the Logic FPGA. It uses the same Scales as in the MIP/ISO AU Chip.
0048 //
0049 
0050 unsigned L1MuGMTLFPhiProEtaConvLUT::TheLookupFunction(int idx, unsigned eta_in) const {
0051   // idx is DT, BRPC, CSC, FRPC
0052   // INPUTS:  eta_in(6)
0053   // OUTPUTS: eta_out(4)
0054 
0055   const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
0056   const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
0057 
0058   int isRPC = idx % 2;
0059   int isFWD = idx / 2;
0060 
0061   float etaValue = theTriggerScales->getRegionalEtaScale(idx)->getCenter(eta_in);
0062 
0063   unsigned eta4bit = 0;
0064   if ((isRPC && isFWD && fabs(etaValue) < theGMTScales->getReducedEtaScale(3)->getScaleMin()) ||
0065       (isRPC && !isFWD && fabs(etaValue) > theGMTScales->getReducedEtaScale(1)->getScaleMax())) {
0066     if (!m_saveFlag)
0067       edm::LogWarning("LUTRangeViolation") << "L1MuGMTMIAUEtaConvLUT::TheLookupFunction: RPC "
0068                                            << (isFWD ? "fwd" : "brl") << " eta value out of range: " << etaValue;
0069   } else
0070     eta4bit = theGMTScales->getReducedEtaScale(idx)->getPacked(etaValue);
0071 
0072   return eta4bit;
0073 }