Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:22:14

0001 //-------------------------------------------------
0002 //
0003 //   Class: L1MuGMTEtaProjectionUnit
0004 //
0005 //   Description: GMT Eta 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/L1MuGMTEtaProjectionUnit.h"
0022 //---------------
0023 // C++ Headers --
0024 //---------------
0025 
0026 #include <iostream>
0027 #include <vector>
0028 #include <cmath>
0029 
0030 //-------------------------------
0031 // Collaborating Class Headers --
0032 //-------------------------------
0033 
0034 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTConfig.h"
0035 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMipIsoAU.h"
0036 #include "L1Trigger/GlobalMuonTrigger/interface/L1MuGlobalMuonTrigger.h"
0037 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTDebugBlock.h"
0038 #include "L1Trigger/GlobalMuonTrigger/src/L1MuGMTMIAUEtaProLUT.h"
0039 
0040 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0041 
0042 // --------------------------------
0043 //       class L1MuGMTEtaProjectionUnit
0044 //---------------------------------
0045 
0046 //----------------
0047 // Constructors --
0048 //----------------
0049 L1MuGMTEtaProjectionUnit::L1MuGMTEtaProjectionUnit(const L1MuGMTMipIsoAU& miau, int id)
0050     : m_MIAU(miau), m_id(id), m_mu(nullptr) {}
0051 
0052 //--------------
0053 // Destructor --
0054 //--------------
0055 L1MuGMTEtaProjectionUnit::~L1MuGMTEtaProjectionUnit() { reset(); }
0056 
0057 //--------------
0058 // Operations --
0059 //--------------
0060 
0061 //
0062 // run eta projection unit
0063 //
0064 void L1MuGMTEtaProjectionUnit::run() {
0065   load();
0066   if (m_mu && (!m_mu->empty())) {
0067     int isFwd = m_id / 16;
0068     int lut_id = m_id / 4;
0069 
0070     // obtain inputs as coded in HW
0071     unsigned pt = m_mu->pt_packed();
0072     unsigned charge = m_mu->charge_packed();
0073     unsigned eta = m_mu->eta_packed();
0074 
0075     // lookup
0076     L1MuGMTMIAUEtaProLUT* ep_lut = L1MuGMTConfig::getMIAUEtaProLUT();
0077     unsigned eta_sel_bits = ep_lut->SpecificLookup_eta_sel(lut_id, eta, pt, charge);
0078 
0079     // convert to bit array
0080     //
0081     // see comments in L1MuGMTMIAUEtaProLUT.cc
0082     //
0083     m_eta_select = (unsigned)0;
0084 
0085     if (isFwd) {  // forward
0086       for (int i = 0; i < 5; i++)
0087         if ((eta_sel_bits & (1 << i)) == (unsigned)(1 << i))
0088           m_eta_select[i] = true;
0089 
0090       for (int i = 5; i < 10; i++)
0091         if ((eta_sel_bits & (1 << i)) == (unsigned)(1 << i))
0092           m_eta_select[i + 4] = true;
0093     } else {  // barrel
0094       for (int i = 0; i < 10; i++)
0095         if ((eta_sel_bits & (1 << i)) == (unsigned)(1 << i))
0096           m_eta_select[i + 2] = true;
0097     }
0098 
0099     //    m_MIAU.GMT().DebugBlockForFill()->SetEtaSelBits( m_id, m_eta_select.read(0,14)) ;
0100     m_MIAU.GMT().DebugBlockForFill()->SetEtaSelBits(m_id, m_eta_select.to_ulong());
0101   }
0102 }
0103 
0104 //
0105 // reset eta projection unit
0106 //
0107 void L1MuGMTEtaProjectionUnit::reset() {
0108   m_mu = nullptr;
0109   m_ieta = 0;
0110   m_feta = 0.;
0111   m_eta_select = (unsigned int)0;
0112 }
0113 
0114 //
0115 // print results of eta projection
0116 //
0117 void L1MuGMTEtaProjectionUnit::print() const {
0118   edm::LogVerbatim("GMT_EtaProjection_info") << "Eta select bits: ";
0119   for (int i = 0; i < 14; i++) {
0120     edm::LogVerbatim("GMT_EtaProjection_info") << m_eta_select[i] << "  ";
0121   }
0122   edm::LogVerbatim("GMT_EtaProjection_info");
0123 }
0124 
0125 //
0126 // load 1 muon into eta projection unit
0127 //
0128 void L1MuGMTEtaProjectionUnit::load() {
0129   // retrieve muon from MIP & ISO bit assignment unit
0130   m_mu = m_MIAU.muon(m_id % 8);
0131 }