CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC2_patch1/src/L1Trigger/GlobalMuonTrigger/src/L1MuGMTLFMatchQualLUT.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuGMTLFMatchQualLUT
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/L1MuGMTLFMatchQualLUT.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 L1MuGMTLFMatchQualLUT::InitParameters() {
00040 
00041   m_EtaWeights[0]=L1MuGMTConfig::getEtaWeightBarrel();
00042   m_PhiWeights[0]=L1MuGMTConfig::getPhiWeightBarrel();
00043   m_EtaPhiThresholds[0]=L1MuGMTConfig::getEtaPhiThresholdBarrel();
00044   
00045   m_EtaWeights[1]=L1MuGMTConfig::getEtaWeightEndcap();
00046   m_PhiWeights[1]=L1MuGMTConfig::getPhiWeightEndcap();
00047   m_EtaPhiThresholds[1]=L1MuGMTConfig::getEtaPhiThresholdEndcap();
00048   
00049   for (int i=2; i<6; i++) {
00050     m_EtaWeights[i]=L1MuGMTConfig::getEtaWeightCOU();
00051     m_PhiWeights[i]=L1MuGMTConfig::getPhiWeightCOU();
00052     m_EtaPhiThresholds[i]=L1MuGMTConfig::getEtaPhiThresholdCOU();
00053   }
00054 }
00055 
00056 //------------------------
00057 // The Lookup Function  --
00058 //------------------------
00059 
00060 unsigned L1MuGMTLFMatchQualLUT::TheLookupFunction (int idx, unsigned delta_eta, unsigned delta_phi) const {
00061   // idx is DTRPC, CSCRPC, DTCSC, CSCDT, CSCbRPC, DTfRPC
00062   // INPUTS:  delta_eta(4) delta_phi(3)
00063   // OUTPUTS: mq(6) 
00064 
00065   const L1MuGMTScales* theGMTScales = L1MuGMTConfig::getGMTScales();
00066 
00067   float deta = theGMTScales->getDeltaEtaScale(idx)->getCenter( delta_eta );
00068   float dphi = theGMTScales->getDeltaPhiScale()->getCenter( delta_phi );
00069       
00070   // check out-of range code
00071   L1MuSignedPacking<4> EtaPacking;
00072   int delta_eta_signed = EtaPacking.idxFromPacked(delta_eta);
00073   L1MuSignedPacking<3> PhiPacking;
00074   int delta_phi_signed = PhiPacking.idxFromPacked(delta_phi);
00075 
00076   bool dphi_outofrange = (delta_phi_signed == -4);
00077 
00078   // limit delta-phi even further    **FIXME: make this configurable
00079   if (delta_phi_signed >=3 || delta_phi_signed <=-3) 
00080     dphi_outofrange = true;
00081 
00082   // check out-of range code
00083   bool deta_outofrange = (delta_eta_signed == -8);
00084 
00085   // limit delta-eta even further    **FIXME: make this configurable
00086   if (delta_eta_signed >=7 || delta_eta_signed <=-7) 
00087     deta_outofrange = true;
00088 
00089   double delta_etaphi = sqrt(m_EtaWeights[idx]*deta*deta + m_PhiWeights[idx]*dphi*dphi);
00090 
00091 //    cout << "MQ LUT       : delta_phi = " << dphi
00092 //         << ", delta_eta = " << deta
00093 //         << ", delta_etaphi = " << delta_etaphi
00094 //         << endl;
00095 
00096       
00097   int matchqual = 0;
00098   if ( dphi_outofrange || deta_outofrange ||
00099        delta_etaphi > m_EtaPhiThresholds[idx] ) {
00100     matchqual = 0;
00101   }
00102   else {
00103     double mq = 64. * (m_EtaPhiThresholds[idx] - delta_etaphi) / m_EtaPhiThresholds[idx];
00104     matchqual = static_cast<int>(mq);
00105   }
00106 
00107   if (matchqual > 63) matchqual = 63;
00108   return matchqual;  
00109 }
00110 
00111 
00112 
00113 
00114 
00115 
00116 
00117 
00118 
00119 
00120 
00121 
00122 
00123 
00124 
00125 
00126 
00127 
00128