CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_5_3_13_patch3/src/L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUPhiPro2LUT.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuGMTMIAUPhiPro2LUT
00004 //
00005 // 
00006 //   $Date: 2007/04/02 15:45:39 $
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/L1MuGMTMIAUPhiPro2LUT.h"
00021 
00022 //---------------
00023 // C++ Headers --
00024 //---------------
00025 
00026 //-------------------------------
00027 // Collaborating Class Headers --
00028 //-------------------------------
00029 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
00030 
00031 //-------------------
00032 // InitParameters  --
00033 //-------------------
00034 
00035 void L1MuGMTMIAUPhiPro2LUT::InitParameters() {
00036   m_IsolationCellSizePhi = L1MuGMTConfig::getIsolationCellSizePhi();
00037 }
00038 
00039 //--------------------------------------------------------------------------------
00040 // Phi Projection LUT 2:  Set phi-select-bits based on start calo region(5bit), offset(3bit),
00041 // =====================  fine-grain offset(1bit) and charge(1 bit)
00042 //
00043 // The 18 phi-select bits select which calo regions have to be checked for MIP
00044 // and Quiet information. For MIP by default only one region is checked while for
00045 // the Quiet bits multiple regions can be ckecked based on IsolationCellSizePhi.
00046 // If IsolationCellSizePhi is even, then the fine-grain offset decides in which 
00047 // direction from the central region to check additional regions.
00048 // 
00049 //--------------------------------------------------------------------------------
00050 
00051 unsigned L1MuGMTMIAUPhiPro2LUT::TheLookupFunction (int idx, unsigned cphi_start, unsigned cphi_fine, unsigned cphi_ofs, unsigned charge) const {
00052   // idx is MIP_DT, MIP_BRPC, ISO_DT, ISO_BRPC, MIP_CSC, MIP_FRPC, ISO_CSC, ISO_FRPC
00053   // INPUTS:  cphi_start(5) cphi_fine(1) cphi_ofs(3) charge(1)
00054   // OUTPUTS: phi_sel(18) 
00055 
00056   // this LUT generates the 18 phi-select bits for the 18 Calo regions
00057   if (cphi_start > 17) return 0;
00058 
00059   int isISO = (idx / 2) % 2;
00060     
00061   int offset = ( int(cphi_ofs) - 1 ) * ( (charge==0) ? 1 : -1 );
00062   
00063   int center_region = ( 18 + int(cphi_start) + offset ) % 18;
00064     
00065   // for MIP bit assignment, only one region is selected
00066   unsigned phi_select_word = 1 << center_region;
00067 
00068   // for ISOlation bit assignment, multiple regions can be selected according to the IsolationCellSize
00069   if (isISO) {
00070     int imin = center_region - ( m_IsolationCellSizePhi-1 ) / 2;
00071     int imax = center_region + ( m_IsolationCellSizePhi-1 ) / 2;
00072 
00073     // for even number of isolation cells check the fine grain info
00074     if (m_IsolationCellSizePhi%2 == 0) {
00075       if ( cphi_fine==1 ) imax++;
00076       else imin--;
00077     }
00078 
00079     for (int i=imin; i<=imax; i++ )
00080       phi_select_word |= 1 << ( (i+18) % 18 );
00081   }
00082 
00083   return phi_select_word;
00084 }
00085 
00086 
00087 
00088 
00089 
00090 
00091 
00092 
00093 
00094 
00095 
00096 
00097 
00098 
00099 
00100 
00101 
00102