CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuGMTPhiProjectionUnit.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTPhiProjectionUnit
4 //
5 // Description: GMT Phi Projection Unit
6 //
7 //
8 // $Date: 2007/04/10 09:59:19 $
9 // $Revision: 1.3 $
10 //
11 // Author :
12 // H. Sakulin CERN EP
13 //
14 // Migrated to CMSSW:
15 // I. Mikulec
16 //
17 //--------------------------------------------------
18 
19 //-----------------------
20 // This Class's Header --
21 //-----------------------
22 
24 
25 //---------------
26 // C++ Headers --
27 //---------------
28 
29 #include <iostream>
30 #include <vector>
31 #include <cmath>
32 
33 //-------------------------------
34 // Collaborating Class Headers --
35 //-------------------------------
36 
39 
41 
46 
48 
49 // --------------------------------
50 // class L1MuGMTPhiProjectionUnit
51 //---------------------------------
52 
53 //----------------
54 // Constructors --
55 //----------------
57  m_MIAU(miau), m_id(id), m_mu(0) {
58 }
59 
60 //--------------
61 // Destructor --
62 //--------------
64 
65  reset();
66 
67 }
68 
69 //--------------
70 // Operations --
71 //--------------
72 
73 //
74 // run phi projection unit
75 //
77 
78  load();
79  if (m_mu && ( !m_mu->empty() ) ) {
80  int lut_id = m_id / 4;
81 
82  // obtain inputs as coded in HW
83  unsigned pt = m_mu->pt_packed();
84  unsigned charge = m_mu->charge_packed();
85  unsigned eta = m_mu->eta_packed();
86  unsigned phi = m_mu->phi_packed();
87 
88  // split phi in fine and coarse
89  unsigned phi_fine = phi & ( (1<<3) - 1 ); // lower 3 bits
90  unsigned phi_coarse = phi >> 3; // upper 5 bits
91 
92  // eta conversion lookup
94  unsigned eta4bit = etaconv_lut->SpecificLookup_eta_out (lut_id, eta);
95 
96  // phi projection 1 lookups
98  unsigned cphi_fine = phipro1_lut->SpecificLookup_cphi_fine (lut_id, phi_fine, eta4bit, pt, charge);
99  unsigned cphi_ofs = phipro1_lut->SpecificLookup_cphi_ofs (lut_id, phi_fine, eta4bit, pt, charge);
100 
101  // phi projection 2 lookup
103  unsigned phi_sel_bits = phipro2_lut->SpecificLookup_phi_sel (lut_id, phi_coarse, cphi_fine, cphi_ofs, charge);
104 
105  // convert to bit array
106  //
107  // see comments in L1MuGMTMIAUEtaProLUT.cc
108  //
109  m_phi_select = (unsigned) 0;
110 
111  // shift by 9 bits //FIXME: fix when calo delivers the MIP bits correctly!
112  for (unsigned int i=0; i<9; i++)
113  if ( (phi_sel_bits & (1 << i)) == (unsigned) (1<<i))
114  m_phi_select[i+9] = 1;
115 
116  for (unsigned int i=9; i<18; i++)
117  if ( (phi_sel_bits & (1 << i)) == (unsigned) (1<<i))
118  m_phi_select[i-9] = 1;
119 
121  }
122 }
123 
124 
125 //
126 // reset phi projection unit
127 //
129 
130  m_mu = 0;
131  m_iphi = 0;
132  m_fphi = 0.;
133  m_phi_select = (unsigned int) 0;
134 }
135 
136 
137 //
138 // print results of phi projection
139 //
141 
142  edm::LogVerbatim("GMT_PhiProjection_info") << "Phi select bits: ";
143  for ( int i=0; i<18; i++ ) {
144  edm::LogVerbatim("GMT_PhiProjection_info") << m_phi_select[i] << " ";
145  }
146  edm::LogVerbatim("GMT_PhiProjection_info") << " ";
147 }
148 
149 
150 //
151 // load 1 muon into phi projection unit
152 //
154 
155  // retrieve muon from MIP & ISO bit assignment unit
156  m_mu = m_MIAU.muon( m_id % 8 );
157 }
158 
159 
int i
Definition: DBlmapReader.cc:9
void print() const
print results after phi projection
static L1MuGMTMIAUPhiPro2LUT * getMIAUPhiPro2LUT()
virtual bool empty() const
return empty flag
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
virtual ~L1MuGMTPhiProjectionUnit()
destructor
T eta() const
double charge(const std::vector< uint8_t > &Ampls)
L1MuGMTPhiProjectionUnit(const L1MuGMTMipIsoAU &miau, int id)
constructor
static L1MuGMTMIAUEtaConvLUT * getMIAUEtaConvLUT()
const L1MuGlobalMuonTrigger & GMT() const
unsigned SpecificLookup_cphi_fine(int idx, unsigned phi_fine, unsigned eta, unsigned pt, unsigned charge) const
specific lookup function for cphi_fine
void run()
run phi projection unit
unsigned eta_packed() const
return eta packed as in hardware
unsigned SpecificLookup_phi_sel(int idx, unsigned cphi_start, unsigned cphi_fine, unsigned cphi_ofs, unsigned charge) const
specific lookup function for phi_sel
unsigned SpecificLookup_cphi_ofs(int idx, unsigned phi_fine, unsigned eta, unsigned pt, unsigned charge) const
specific lookup function for cphi_ofs
const L1MuGMTMipIsoAU & m_MIAU
unsigned SpecificLookup_eta_out(int idx, unsigned eta_in) const
specific lookup function for eta_out
void SetPhiSelBits(int idx, unsigned phisel)
Set phi select bits for current bx.
static L1MuGMTMIAUPhiPro1LUT * getMIAUPhiPro1LUT()
void reset()
clear phi projection unit
unsigned pt_packed() const
return pt packed as in hardware
const L1MuRegionalCand * m_mu
L1MuGMTDebugBlock * DebugBlockForFill() const
for debug: return the debug block (in order to fill it)
const L1MuRegionalCand * muon(int idx) const
return input muon (idx: 0..3: DT/CSC, 4..7: RPC)
unsigned phi_packed() const
return phi packed as in hardware
Definition: DDAxes.h:10