CMS 3D CMS Logo

L1MuGMTCancelOutUnit.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTCancelOutUnit
4 //
5 // Description: DT/CSC cancel-out unit
6 //
7 //
8 //
9 // Author :
10 // H. Sakulin CERN EP
11 //
12 // Migrated to CMSSW:
13 // I. Mikulec
14 //
15 //--------------------------------------------------
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
20 
22 
23 //---------------
24 // C++ Headers --
25 //---------------
26 
27 #include <iostream>
28 #include <iomanip>
29 #include <cmath>
30 #include <string>
31 #include <sstream>
32 
33 //-------------------------------
34 // Collaborating Class Headers --
35 //-------------------------------
36 
43 
44 // --------------------------------
45 // class L1MuGMTCancelOutUnit
46 //---------------------------------
47 
48 //----------------
49 // Constructors --
50 //----------------
52  : m_gmt(gmt), m_id(id), m_matcher(gmt, id + 2), m_MyChipCancelbits(4), m_OtherChipCancelbits(4) {}
53 
54 //--------------
55 // Destructor --
56 //--------------
58 
59 //--------------
60 // Operations --
61 //--------------
62 
63 //
64 // run cancel-out unit
65 //
67  m_matcher.run();
68  if (L1MuGMTConfig::Debug(3)) {
69  edm::LogVerbatim("GMT_CancelOut_info") << "result of cancel-out matcher: ";
70  m_matcher.print();
71  }
72  decide();
73 }
74 
75 //
76 // clear cancel-out unit
77 //
79  m_matcher.reset();
80 
81  for (int i = 0; i < 4; i++) {
82  m_MyChipCancelbits[i] = false;
83  m_OtherChipCancelbits[i] = false;
84  }
85 }
86 
87 //
88 // print cancel-out results
89 //
91  std::stringstream outmy;
92  switch (m_id) {
93  case 0:
94  outmy << "DT ";
95  break;
96  case 1:
97  outmy << "CSC ";
98  break;
99  case 2:
100  outmy << "bRPC";
101  break;
102  case 3:
103  outmy << "fRPC";
104  break;
105  }
106  outmy << "(my chip) cancel-bits : ";
107  for (int i = 0; i < 4; i++)
108  outmy << m_MyChipCancelbits[i] << " ";
109  edm::LogVerbatim("GMT_CancelOut_info") << outmy.str();
110 
111  std::stringstream outother;
112  if (m_id == 2 || m_id == 3) {
113  outother << (m_id == 2 ? "CSC" : "DT") << "(other chip) cancel-bits : ";
114  for (int i = 0; i < 4; i++)
115  outother << m_OtherChipCancelbits[i] << " ";
116  outother << std::endl;
117  }
118  edm::LogVerbatim("GMT_CancelOut_info") << outother.str();
119 }
120 
121 //
122 // compute cancel decision
123 //
125  // CancelDecisionLogic configuration register
126  //
127  unsigned CDL_config = L1MuGMTConfig::getRegCDLConfig()->getValue(m_id);
128 
129  // compute cancel decsion for my chip muons (mine)
130 
131  for (int imine = 0; imine < 4; imine++) {
132  int idxother = m_matcher.pairM().rowAny(imine);
133  if (idxother != -1) {
134  int mine_is_matched = 0;
135  switch (m_id) {
136  case 0:
137  mine_is_matched = m_gmt.Matcher(0)->pairM().rowAny(imine) != -1;
138  break; //DT
139  case 1:
140  mine_is_matched = m_gmt.Matcher(1)->pairM().rowAny(imine) != -1;
141  break; //CSC
142  case 2:
143  mine_is_matched = m_gmt.Matcher(0)->pairM().colAny(imine) != -1;
144  break; //bRPC
145  case 3:
146  mine_is_matched = m_gmt.Matcher(1)->pairM().colAny(imine) != -1;
147  break; //fRPC
148  }
149  int other_is_matched = m_gmt.Matcher(1 - (m_id % 2))->pairM().rowAny(idxother) != -1;
150 
151  // calculate address of bit in CDL_config register
152  unsigned addr = (unsigned)(2 * mine_is_matched + other_is_matched);
153  unsigned mask = (unsigned)1 << addr;
154 
155  m_MyChipCancelbits[imine] = (CDL_config & mask) == mask;
156  }
157  }
158 
159  // compute cancel decsison for other chip muons (other)
160 
161  for (int iother = 0; iother < 4; iother++) {
162  int idxmine = m_matcher.pairM().colAny(iother);
163  if (idxmine != -1) {
164  int mine_is_matched = 0;
165  switch (m_id) {
166  case 0:
167  mine_is_matched = m_gmt.Matcher(0)->pairM().rowAny(idxmine) != -1;
168  break; //DT
169  case 1:
170  mine_is_matched = m_gmt.Matcher(1)->pairM().rowAny(idxmine) != -1;
171  break; //CSC
172  case 2:
173  mine_is_matched = m_gmt.Matcher(0)->pairM().colAny(idxmine) != -1;
174  break; //bRPC
175  case 3:
176  mine_is_matched = m_gmt.Matcher(1)->pairM().colAny(idxmine) != -1;
177  break; //fRPC
178  }
179  int other_is_matched = m_gmt.Matcher(1 - (m_id % 2))->pairM().rowAny(iother) != -1;
180 
181  // calculate address of bit in CDL_config register
182  unsigned addr = (unsigned)(2 * other_is_matched + mine_is_matched);
183  unsigned mask = (unsigned)1 << (addr + 4);
184 
185  m_OtherChipCancelbits[iother] = (CDL_config & mask) == mask;
186  }
187  }
188 
190 }
L1MuGMTMatrix::colAny
int colAny(int c) const
is any element in column c > 0 ? return index or -1
Definition: L1MuGMTMatrix.h:262
mps_fire.i
i
Definition: mps_fire.py:428
L1MuGMTMatcher.h
L1MuGMTCancelOutUnit::m_MyChipCancelbits
std::vector< bool > m_MyChipCancelbits
Definition: L1MuGMTCancelOutUnit.h:100
L1MuGMTCancelOutUnit::decide
void decide()
Definition: L1MuGMTCancelOutUnit.cc:124
L1MuGlobalMuonTrigger::DebugBlockForFill
L1MuGMTDebugBlock * DebugBlockForFill() const
for debug: return the debug block (in order to fill it)
Definition: L1MuGlobalMuonTrigger.h:101
L1MuGMTCancelOutUnit::run
void run()
run cancel-out unit
Definition: L1MuGMTCancelOutUnit.cc:66
L1MuGMTConfig::getRegCDLConfig
static L1MuGMTRegCDLConfig * getRegCDLConfig()
Definition: L1MuGMTConfig.h:136
L1MuGMTMatcher::pairM
const L1MuGMTMatrix< bool > & pairM() const
return pair matrix
Definition: L1MuGMTMatcher.h:64
L1MuGMTCancelOutUnit::~L1MuGMTCancelOutUnit
virtual ~L1MuGMTCancelOutUnit()
destructor
Definition: L1MuGMTCancelOutUnit.cc:57
L1MuGMTMatrix.h
L1MuGMTDebugBlock::SetCancelBits
void SetCancelBits(int idx, const std::vector< bool > &mine, const std::vector< bool > &others)
Set cancel bits.
Definition: L1MuGMTDebugBlock.cc:81
generateTowerEtThresholdLUT.addr
addr
Definition: generateTowerEtThresholdLUT.py:57
L1MuGlobalMuonTrigger
Definition: L1MuGlobalMuonTrigger.h:64
L1MuGMTMatrix::rowAny
int rowAny(int r) const
is any element in row r > 0 ? return index or -1
Definition: L1MuGMTMatrix.h:276
L1MuGMTConfig.h
L1MuGlobalMuonTrigger::Matcher
const L1MuGMTMatcher * Matcher(int id) const
return pointer to Matcher
Definition: L1MuGlobalMuonTrigger.h:78
L1MuGMTCancelOutUnit::m_gmt
const L1MuGlobalMuonTrigger & m_gmt
Definition: L1MuGMTCancelOutUnit.h:96
L1MuGMTDebugBlock.h
L1MuGMTReg::getValue
unsigned getValue(int idx)
get Value
Definition: L1MuGMTReg.h:53
L1MuGMTCancelOutUnit.h
L1MuGMTMatcher::run
void run()
run Matcher
Definition: L1MuGMTMatcher.cc:83
L1MuGMTMatcher::print
void print()
print matching results
Definition: L1MuGMTMatcher.cc:104
L1MuGMTCancelOutUnit::m_matcher
L1MuGMTMatcher m_matcher
Definition: L1MuGMTCancelOutUnit.h:99
L1MuGMTReg.h
L1MuGMTCancelOutUnit::m_id
int m_id
Definition: L1MuGMTCancelOutUnit.h:97
L1MuGMTMatcher::reset
void reset()
clear Matcher
Definition: L1MuGMTMatcher.cc:91
edm::LogVerbatim
Log< level::Info, true > LogVerbatim
Definition: MessageLogger.h:128
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
L1MuGMTCancelOutUnit::m_OtherChipCancelbits
std::vector< bool > m_OtherChipCancelbits
Definition: L1MuGMTCancelOutUnit.h:101
L1MuGlobalMuonTrigger.h
L1MuGMTCancelOutUnit::reset
void reset()
clear cancel-out unit
Definition: L1MuGMTCancelOutUnit.cc:78
L1MuGMTConfig::Debug
static bool Debug()
Definition: L1MuGMTConfig.h:101
L1MuGMTCancelOutUnit::print
void print()
print cancel-out bits
Definition: L1MuGMTCancelOutUnit.cc:90
L1MuGMTCancelOutUnit::L1MuGMTCancelOutUnit
L1MuGMTCancelOutUnit(const L1MuGlobalMuonTrigger &gmt, int id)
constructor
Definition: L1MuGMTCancelOutUnit.cc:51