Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:19:57

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTPhiProjectionUnit
0004 //
0005 //   Description: GMT Phi Projection Unit
0006 //
0007 //
0008 //
0009 //   Author :
0010 //   H. Sakulin                CERN EP
0011 //
0012 //   Migrated to CMSSW:
0013 //   I. Mikulec
0014 //
0015 //--------------------------------------------------
0016 
0017 //-----------------------
0018 // This Class's Header --
0019 //-----------------------
0020 
0021 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTPhiProjectionUnit.h"
0022 
0023 //---------------
0024 // C++ Headers --
0025 //---------------
0026 
0027 #include <iostream>
0028 #include <vector>
0029 #include <cmath>
0030 
0031 //-------------------------------
0032 // Collaborating Class Headers --
0033 //-------------------------------
0034 
0035 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0036 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMipIsoAU.h"
0037 
0038 #include "L1Trigger/GlobalMuonTrigger/interface/L1MuGlobalMuonTrigger.h"
0039 
0040 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTDebugBlock.h"
0041 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUEtaConvLUT.h"
0042 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUPhiPro1LUT.h"
0043 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUPhiPro2LUT.h"
0044 
0045 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0046 
0047 // --------------------------------
0048 //       class L1MuGMTPhiProjectionUnit
0049 //---------------------------------
0050 
0051 //----------------
0052 // Constructors --
0053 //----------------
0054 L1MuGMTPhiProjectionUnit::L1MuGMTPhiProjectionUnit(const L1MuGMTMipIsoAU& miau, int id)
0055     : m_MIAU(miau), m_id(id), m_mu(nullptr) {}
0056 
0057 //--------------
0058 // Destructor --
0059 //--------------
0060 L1MuGMTPhiProjectionUnit::~L1MuGMTPhiProjectionUnit() { reset(); }
0061 
0062 //--------------
0063 // Operations --
0064 //--------------
0065 
0066 //
0067 // run phi projection unit
0068 //
0069 void L1MuGMTPhiProjectionUnit::run() {
0070   load();
0071   if (m_mu && (!m_mu->empty())) {
0072     int lut_id = m_id / 4;
0073 
0074     // obtain inputs as coded in HW
0075     unsigned pt = m_mu->pt_packed();
0076     unsigned charge = m_mu->charge_packed();
0077     unsigned eta = m_mu->eta_packed();
0078     unsigned phi = m_mu->phi_packed();
0079 
0080     // split phi in fine and coarse
0081     unsigned phi_fine = phi & ((1 << 3) - 1);  // lower 3 bits
0082     unsigned phi_coarse = phi >> 3;            // upper 5 bits
0083 
0084     // eta conversion lookup
0085     L1MuGMTMIAUEtaConvLUT* etaconv_lut = L1MuGMTConfig::getMIAUEtaConvLUT();
0086     unsigned eta4bit = etaconv_lut->SpecificLookup_eta_out(lut_id, eta);
0087 
0088     // phi projection 1 lookups
0089     L1MuGMTMIAUPhiPro1LUT* phipro1_lut = L1MuGMTConfig::getMIAUPhiPro1LUT();
0090     unsigned cphi_fine = phipro1_lut->SpecificLookup_cphi_fine(lut_id, phi_fine, eta4bit, pt, charge);
0091     unsigned cphi_ofs = phipro1_lut->SpecificLookup_cphi_ofs(lut_id, phi_fine, eta4bit, pt, charge);
0092 
0093     // phi projection 2 lookup
0094     L1MuGMTMIAUPhiPro2LUT* phipro2_lut = L1MuGMTConfig::getMIAUPhiPro2LUT();
0095     unsigned phi_sel_bits = phipro2_lut->SpecificLookup_phi_sel(lut_id, phi_coarse, cphi_fine, cphi_ofs, charge);
0096 
0097     // convert to bit array
0098     //
0099     // see comments in L1MuGMTMIAUEtaProLUT.cc
0100     //
0101     m_phi_select = (unsigned)0;
0102 
0103     //  shift by 9 bits  //FIXME: fix when calo delivers the MIP bits correctly!
0104     for (unsigned int i = 0; i < 9; i++)
0105       if ((phi_sel_bits & (1 << i)) == (unsigned)(1 << i))
0106         m_phi_select[i + 9] = true;
0107 
0108     for (unsigned int i = 9; i < 18; i++)
0109       if ((phi_sel_bits & (1 << i)) == (unsigned)(1 << i))
0110         m_phi_select[i - 9] = true;
0111 
0112     m_MIAU.GMT().DebugBlockForFill()->SetPhiSelBits(m_id, m_phi_select.to_ulong());
0113   }
0114 }
0115 
0116 //
0117 // reset phi projection unit
0118 //
0119 void L1MuGMTPhiProjectionUnit::reset() {
0120   m_mu = nullptr;
0121   m_iphi = 0;
0122   m_fphi = 0.;
0123   m_phi_select = (unsigned int)0;
0124 }
0125 
0126 //
0127 // print results of phi projection
0128 //
0129 void L1MuGMTPhiProjectionUnit::print() const {
0130   edm::LogVerbatim("GMT_PhiProjection_info") << "Phi select bits: ";
0131   for (int i = 0; i < 18; i++) {
0132     edm::LogVerbatim("GMT_PhiProjection_info") << m_phi_select[i] << "  ";
0133   }
0134   edm::LogVerbatim("GMT_PhiProjection_info") << " ";
0135 }
0136 
0137 //
0138 // load 1 muon into phi projection unit
0139 //
0140 void L1MuGMTPhiProjectionUnit::load() {
0141   // retrieve muon from MIP & ISO bit assignment unit
0142   m_mu = m_MIAU.muon(m_id % 8);
0143 }