CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_1/src/L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFCOUDeltaEtaLUT.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuGMTLFCOUDeltaEtaLUT
00004 //
00005 // 
00006 //   $Date: 2007/04/02 15:45:38 $
00007 //   $Revision: 1.3 $
00008 //
00009 //   Author :
00010 //   H. Sakulin            HEPHY Vienna
00011 //
00012 //   Migrated to CMSSW:
00013 //   I. Mikulec
00014 //
00015 //--------------------------------------------------
00016 
00017 //-----------------------
00018 // This Class's Header --
00019 //-----------------------
00020 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFCOUDeltaEtaLUT.h"
00021 
00022 //---------------
00023 // C++ Headers --
00024 //---------------
00025 
00026 //#include <iostream>
00027 
00028 //-------------------------------
00029 // Collaborating Class Headers --
00030 //-------------------------------
00031 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
00032 #include "CondFormats/L1TObjects/interface/L1MuGMTScales.h"
00033 #include "CondFormats/L1TObjects/interface/L1MuPacking.h"
00034 
00035 //-------------------
00036 // InitParameters  --
00037 //-------------------
00038 
00039 void L1MuGMTLFCOUDeltaEtaLUT::InitParameters() {
00040 }
00041 
00042 //---------------------------------------------------------------------------
00043 // Cancel-Out-Unit Delta-Eta LUT
00044 // =============================
00045 // 
00046 // Calculate delta-eta between two eta values coded in a special 4-bit scale 
00047 // used in the overlap region
00048 //
00049 // This scale is used to save I/O pins and in order to be able to do the delta-eta 
00050 // calculateion in a distributed RAM LUT
00051 //
00052 //---------------------------------------------------------------------------
00053 
00054 unsigned L1MuGMTLFCOUDeltaEtaLUT::TheLookupFunction (int idx, unsigned eta1, unsigned eta2) const {
00055   // idx is DTCSC, CSCDT, bRPCCSC, fRPCDT
00056   // INPUTS:  eta1(4) eta2(4)
00057   // OUTPUTS: delta_eta(4) 
00058 
00059   const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
00060 
00061   // check out of range in inputs
00062   L1MuSignedPacking<4> pack;
00063   unsigned delta_eta_OOR = pack.packedFromIdx (-8);
00064 
00065   if (eta1==7 || eta2 ==7) return delta_eta_OOR;
00066 
00067   int type1=0, type2=0;
00068   switch (idx) {
00069     case 0: type1 = 0; type2 = 2; break; // DT, CSC
00070     case 1: type1 = 2; type2 = 0; break; // CSC, DT
00071     case 2: type1 = 1; type2 = 2; break; // bRPC, CSC
00072     case 3: type1 = 3; type2 = 0; break; // fRPC, DT
00073   }
00074 
00075   float etaValue1 = theGMTScales->getOvlEtaScale(type1)->getCenter(eta1);
00076   float etaValue2 = theGMTScales->getOvlEtaScale(type2)->getCenter(eta2); 
00077 
00078   float delta_eta = etaValue1 - etaValue2;
00079 
00080   unsigned delta_eta_4bit = 0;
00081 
00082   // check out of range
00083   if (delta_eta < theGMTScales->getDeltaEtaScale(idx+2)->getScaleMin() ||
00084       delta_eta > theGMTScales->getDeltaEtaScale(idx+2)->getScaleMax()) {
00085     delta_eta_4bit = delta_eta_OOR;
00086   }
00087   else {
00088     delta_eta_4bit = theGMTScales->getDeltaEtaScale(idx+2)->getPacked( delta_eta );
00089   }
00090     
00091   return delta_eta_4bit;
00092 }
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102 
00103 
00104 
00105 
00106 
00107 
00108 
00109 
00110 
00111