CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/L1Trigger/GlobalMuonTrigger/src/L1MuGMTPhiProjectionUnit.cc

Go to the documentation of this file.
00001 //-------------------------------------------------
00002 //
00003 //   Class: L1MuGMTPhiProjectionUnit
00004 //
00005 //   Description: GMT Phi Projection Unit
00006 //
00007 //
00008 //   $Date: 2007/04/10 09:59:19 $
00009 //   $Revision: 1.3 $
00010 //
00011 //   Author :
00012 //   H. Sakulin                CERN EP 
00013 //
00014 //   Migrated to CMSSW:
00015 //   I. Mikulec
00016 //
00017 //--------------------------------------------------
00018 
00019 //-----------------------
00020 // This Class's Header --
00021 //-----------------------
00022 
00023 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTPhiProjectionUnit.h"
00024 
00025 //---------------
00026 // C++ Headers --
00027 //---------------
00028 
00029 #include <iostream>
00030 #include <vector>
00031 #include <cmath>
00032 
00033 //-------------------------------
00034 // Collaborating Class Headers --
00035 //-------------------------------
00036 
00037 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
00038 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMipIsoAU.h"
00039 
00040 #include "L1Trigger/GlobalMuonTrigger/interface/L1MuGlobalMuonTrigger.h"
00041 
00042 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTDebugBlock.h"
00043 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUEtaConvLUT.h"
00044 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUPhiPro1LUT.h"
00045 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUPhiPro2LUT.h"
00046 
00047 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00048 
00049 // --------------------------------
00050 //       class L1MuGMTPhiProjectionUnit
00051 //---------------------------------
00052 
00053 //----------------
00054 // Constructors --
00055 //----------------
00056 L1MuGMTPhiProjectionUnit::L1MuGMTPhiProjectionUnit(const L1MuGMTMipIsoAU& miau, int id) : 
00057   m_MIAU(miau), m_id(id), m_mu(0) {
00058 }
00059 
00060 //--------------
00061 // Destructor --
00062 //--------------
00063 L1MuGMTPhiProjectionUnit::~L1MuGMTPhiProjectionUnit() { 
00064 
00065   reset();
00066   
00067 }
00068 
00069 //--------------
00070 // Operations --
00071 //--------------
00072  
00073 //
00074 // run phi projection unit
00075 //
00076 void L1MuGMTPhiProjectionUnit::run() {
00077 
00078   load();
00079   if (m_mu && ( !m_mu->empty() ) ) {
00080     int lut_id = m_id / 4;
00081 
00082     // obtain inputs as coded in HW
00083     unsigned pt  = m_mu->pt_packed();
00084     unsigned charge  = m_mu->charge_packed();
00085     unsigned eta = m_mu->eta_packed();
00086     unsigned phi = m_mu->phi_packed();
00087 
00088     // split phi in fine and coarse
00089     unsigned phi_fine = phi & ( (1<<3) - 1 ); // lower 3 bits
00090     unsigned phi_coarse = phi >> 3; // upper 5 bits
00091 
00092     // eta conversion lookup
00093     L1MuGMTMIAUEtaConvLUT* etaconv_lut = L1MuGMTConfig::getMIAUEtaConvLUT();
00094     unsigned eta4bit = etaconv_lut->SpecificLookup_eta_out (lut_id, eta);
00095     
00096     // phi projection 1 lookups
00097     L1MuGMTMIAUPhiPro1LUT* phipro1_lut = L1MuGMTConfig::getMIAUPhiPro1LUT();
00098     unsigned cphi_fine = phipro1_lut->SpecificLookup_cphi_fine (lut_id, phi_fine, eta4bit, pt, charge);
00099     unsigned cphi_ofs  = phipro1_lut->SpecificLookup_cphi_ofs  (lut_id, phi_fine, eta4bit, pt, charge);
00100 
00101     // phi projection 2 lookup
00102     L1MuGMTMIAUPhiPro2LUT* phipro2_lut = L1MuGMTConfig::getMIAUPhiPro2LUT();
00103     unsigned phi_sel_bits = phipro2_lut->SpecificLookup_phi_sel (lut_id, phi_coarse, cphi_fine, cphi_ofs, charge);
00104 
00105     // convert to bit array
00106     //
00107     // see comments in L1MuGMTMIAUEtaProLUT.cc
00108     //
00109     m_phi_select = (unsigned) 0;
00110     
00111     //  shift by 9 bits  //FIXME: fix when calo delivers the MIP bits correctly!
00112     for (unsigned int i=0; i<9; i++)
00113       if ( (phi_sel_bits & (1 << i))  == (unsigned) (1<<i))
00114         m_phi_select[i+9] = 1;
00115     
00116     for (unsigned int i=9; i<18; i++)
00117       if ( (phi_sel_bits & (1 << i))  == (unsigned) (1<<i))
00118         m_phi_select[i-9] = 1;
00119     
00120     m_MIAU.GMT().DebugBlockForFill()->SetPhiSelBits( m_id, m_phi_select.to_ulong()) ;
00121   }
00122 }
00123 
00124 
00125 //
00126 // reset phi projection unit
00127 //
00128 void L1MuGMTPhiProjectionUnit::reset() {
00129 
00130   m_mu = 0;
00131   m_iphi = 0;
00132   m_fphi = 0.;
00133   m_phi_select = (unsigned int) 0;
00134 }
00135 
00136 
00137 //
00138 // print results of phi projection
00139 //
00140 void L1MuGMTPhiProjectionUnit::print() const {
00141 
00142   edm::LogVerbatim("GMT_PhiProjection_info") << "Phi select bits: ";
00143   for ( int i=0; i<18; i++ ) {
00144     edm::LogVerbatim("GMT_PhiProjection_info") << m_phi_select[i] << "  ";
00145   }
00146   edm::LogVerbatim("GMT_PhiProjection_info") << " ";
00147 }
00148 
00149 
00150 //
00151 // load 1 muon into phi projection unit
00152 //
00153 void L1MuGMTPhiProjectionUnit::load() {
00154 
00155   // retrieve muon from MIP & ISO bit assignment unit   
00156   m_mu = m_MIAU.muon( m_id % 8 );
00157 }
00158 
00159