CMS 3D CMS Logo

CMSSW_4_4_3_patch1/src/L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUEtaProLUT.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuGMTMIAUEtaProLUT
00004 //
00005 // 
00006 //   $Date: 2008/04/17 23:18:30 $
00007 //   $Revision: 1.7 $
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/L1MuGMTMIAUEtaProLUT.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/L1MuTriggerScales.h"
00034 #include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
00035 #include "CondFormats/L1TObjects/interface/L1MuPacking.h"
00036 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTEtaLUT.h"
00037 #include "CondFormats/L1TObjects/interface/L1CaloGeometry.h"
00038 
00039 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00040 
00041 //-------------------
00042 // InitParameters  --
00043 //-------------------
00044 
00045 void L1MuGMTMIAUEtaProLUT::InitParameters() {
00046   m_IsolationCellSizeEta = L1MuGMTConfig::getIsolationCellSizeEta();
00047 }
00048 
00049 //--------------------------------------------------------------------------------
00050 // Eta Projection LUT: Based on eta(6), pt(5) and charge(1), project in eta and directly 
00051 // =================== output the eta select-bits for the regions in eta.
00052 //  
00053 // In the barrel there are 8 slect bits while in the forward chip there are 10.
00054 //
00055 // output: eta select bits
00056 //                    eta= -3.                                     3. 
00057 // total: 14 rings in eta   0  1  2  3  4  5  6  7  8  9 10 11 12 13
00058 // 
00059 // barrel:8                          0  1  2  3  4  5  6  7
00060 // fwd:10                   0  1  2  3  4              5  6  7  8  9
00061 //
00062 // As for the phi projection, in case of MIP bits by defualt only one region is checked
00063 // while for the ISO bit assignment multiple regions can be checked as given by 
00064 // IsolationCellSizeEta. Adjacent regions to be ckecked are determined in analogy to
00065 // the phi projection.
00066 //
00067 //--------------------------------------------------------------------------------
00068 
00069 unsigned L1MuGMTMIAUEtaProLUT::TheLookupFunction (int idx, unsigned eta, unsigned pt, unsigned charge) const {
00070   // idx is MIP_DT, MIP_BRPC, ISO_DT, ISO_BRPC, MIP_CSC, MIP_FRPC, ISO_CSC, ISO_FRPC
00071   // INPUTS:  eta(6) pt(5) charge(1)
00072   // OUTPUTS: eta_sel(10) 
00073 
00074   // const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
00075   const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
00076   const L1MuTriggerPtScale* theTriggerPtScale = L1MuGMTConfig::getTriggerPtScale();
00077   const L1CaloGeometry* theCaloGeom = L1MuGMTConfig::getCaloGeom() ;
00078 
00079   int isRPC = idx % 2;
00080   int isFWD = idx / 4;
00081       
00082   int isISO = (idx / 2) % 2;
00083 
00084   int idx_drcr = isFWD * 2 + isRPC;
00085 
00086   if (pt==0) return 0; // empty candidate
00087 
00088   int ch_idx = (charge == 0) ? 1 : 0; // positive charge is 0 (but idx 1)
00089 
00090   float oldeta = theTriggerScales->getRegionalEtaScale(idx_drcr)->getCenter(eta);
00091 
00092   if (idx_drcr==2) oldeta = theTriggerScales->getRegionalEtaScale(idx_drcr)->getLowEdge(eta); //FIXME use center when changed in ORCA
00093 
00094   if ( (isRPC && isFWD && fabs(oldeta) < 1.04  ) ||
00095        (isRPC && !isFWD && fabs(oldeta) > 1.04 ) ) {
00096     if(!m_saveFlag) edm::LogWarning("LUTRangeViolation") 
00097                          << "L1MuGMTMIAUEtaProLUT::TheLookupFunction: RPC " << (isFWD?"fwd":"brl") 
00098                          << " eta value out of range: " << oldeta;
00099   }
00100 
00101   // eta conversion depends only on isys by default
00102   int isys = isFWD + 2 * isRPC; // DT, CSC, BRPC, FRPC
00103   float neweta  =  L1MuGMTEtaLUT::eta (isys, isISO, ch_idx, oldeta, 
00104      theTriggerPtScale->getPtScale()->getLowEdge(pt) );  // use old LUT, here
00105   // theTriggerScales->getPtScale()->getLowEdge(pt) );  // use old LUT, here
00106 
00107 
00108   //  unsigned icenter = theGMTScales->getCaloEtaScale()->getPacked( neweta );
00109   // globalEtaIndex is 0-21 for forward+central; need to shift to 0-13 for central only
00110   unsigned icenter = theCaloGeom->globalEtaIndex( neweta ) - theCaloGeom->numberGctForwardEtaBinsPerHalf() ;
00111 
00112   unsigned eta_select_word_14 = 1 << icenter; // for the whole detector
00113     
00114   // for ISOlation bit assignment, multiple regions can be selected according to the IsolationCellSize
00115   if (isISO) {
00116     int imin = icenter - ( m_IsolationCellSizeEta-1 ) / 2;
00117     int imax = icenter + ( m_IsolationCellSizeEta-1 ) / 2;
00118 
00119     // for even number of isolation cells check the fine grain info
00120     if (m_IsolationCellSizeEta%2 == 0) {
00121       // float bincenter = theGMTScales->getCaloEtaScale()->getCenter( icenter );
00122       // globalEtaIndex is 0-21 for forward+central; need to shift to 0-13 for central only
00123       float bincenter = theCaloGeom->globalEtaBinCenter( icenter + theCaloGeom->numberGctForwardEtaBinsPerHalf() );
00124       if ( neweta > bincenter ) imax++;
00125       else imin--;
00126     }
00127     if (imin<0) imin=0; 
00128     if (imax>13) imax=13;
00129 
00130     for (int i=imin; i<=imax; i++ )
00131       eta_select_word_14 |= 1 << i ;
00132   }
00133     
00134   // generate select words for barrel (10 central bits)
00135   // and for forward (5+5 fwd bits) case
00136   unsigned eta_select_word;
00137   if (isFWD) {
00138     unsigned mask5 = (1<<5)-1;
00139     eta_select_word = eta_select_word_14 & mask5;
00140     eta_select_word |= ( eta_select_word_14 & (mask5 << 9) ) >> 4;
00141   }
00142   else {
00143     unsigned mask10 = (1<<10)-1;
00144     eta_select_word = ( eta_select_word_14 & (mask10 << 2) ) >> 2;
00145   }
00146 
00147   return eta_select_word;
00148 }
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166