CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
L1MuGMTMatcher Class Reference

#include <L1MuGMTMatcher.h>

Public Member Functions

int id () const
 return identifier More...
 
 L1MuGMTMatcher (const L1MuGlobalMuonTrigger &gmt, int id)
 constructor More...
 
const L1MuGMTMatrix< bool > & pairM () const
 return pair matrix More...
 
bool pairM (int i, int j) const
 return pair matrix More...
 
void print ()
 print matching results More...
 
void reset ()
 clear Matcher More...
 
void run ()
 run Matcher More...
 
virtual ~L1MuGMTMatcher ()
 destructor More...
 

Static Public Attributes

static const unsigned int MaxMatch = 4
 

Private Member Functions

void load ()
 
int lookup_mq (int i, int j)
 
void match ()
 

Private Attributes

std::vector< const
L1MuRegionalCand * > 
first
 
const L1MuGlobalMuonTriggerm_gmt
 
int m_id
 
L1MuGMTMatrix< int > matchQuality
 
L1MuGMTMatrix< bool > pairMatrix
 
std::vector< const
L1MuRegionalCand * > 
second
 

Detailed Description

Matching Unit in the L1 Global Muon Trigger.

Definition at line 43 of file L1MuGMTMatcher.h.

Constructor & Destructor Documentation

L1MuGMTMatcher::L1MuGMTMatcher ( const L1MuGlobalMuonTrigger gmt,
int  id 
)

constructor

Definition at line 62 of file L1MuGMTMatcher.cc.

References first, MaxMatch, and second.

62  :
63  m_gmt(gmt), m_id(id), first(MaxMatch), second(MaxMatch),
65 
66  first.reserve(MaxMatch);
67  second.reserve(MaxMatch);
68 
69 }
const L1MuGlobalMuonTrigger & m_gmt
std::vector< const L1MuRegionalCand * > second
std::vector< const L1MuRegionalCand * > first
L1MuGMTMatrix< bool > pairMatrix
static const unsigned int MaxMatch
L1MuGMTMatrix< int > matchQuality
L1MuGMTMatcher::~L1MuGMTMatcher ( )
virtual

destructor

Definition at line 74 of file L1MuGMTMatcher.cc.

References reset().

74  {
75 
76  reset();
77 
78 }
void reset()
clear Matcher

Member Function Documentation

int L1MuGMTMatcher::id ( void  ) const
inline

return identifier

Definition at line 65 of file L1MuGMTMatcher.h.

References m_id.

65 { return m_id; }
void L1MuGMTMatcher::load ( )
private

Definition at line 132 of file L1MuGMTMatcher.cc.

References L1MuGMTPSB::CSCMuon(), L1MuGlobalMuonTrigger::Data(), L1MuGMTPSB::DTBXMuon(), first, irpc, m_gmt, m_id, L1MuGMTConfig::MAXCSC, L1MuGMTConfig::MAXDTBX, L1MuGMTConfig::MAXRPCbarrel, L1MuGMTConfig::MAXRPCendcap, L1MuGMTPSB::RPCMuon(), and second.

Referenced by run().

132  {
133 
134  // barrel matcher gets DTBX and barrel RPC muons
135  if ( m_id == 0 ) {
136  for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
137  first[idt] = m_gmt.Data()->DTBXMuon(idt);
138  }
139  for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++ ) {
140  second[irpc] = m_gmt.Data()->RPCMuon(irpc);
141  }
142  }
143 
144  // endcap matcher gets CSC and endcap RPC muons
145  if ( m_id == 1 ) {
146  for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
147  first[icsc] = m_gmt.Data()->CSCMuon(icsc);
148  }
149  for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++ ) {
150  second[irpc] = m_gmt.Data()->RPCMuon(irpc+4);
151  }
152  }
153 
154  // matcher in DT/CSC cancel-out unit gets DTBX and CSC muons
155  if ( m_id == 2 ) {
156  for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
157  first[idt] = m_gmt.Data()->DTBXMuon(idt);
158  }
159  for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
160  second[icsc] = m_gmt.Data()->CSCMuon(icsc);
161  }
162  }
163 
164  // matcher in CSC/DT cancel-out unit gets CSC and DTBX muons
165  if ( m_id==3 ) {
166  for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
167  first[icsc] = m_gmt.Data()->CSCMuon(icsc);
168  }
169  for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
170  second[idt] = m_gmt.Data()->DTBXMuon(idt);
171  }
172  }
173 
174  // bRPC/CSC gets barrel RPC and CSC muons
175  if ( m_id == 4 ) {
176  for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++ ) {
177  first[irpc] = m_gmt.Data()->RPCMuon(irpc);
178  }
179  for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
180  second[icsc] = m_gmt.Data()->CSCMuon(icsc);
181  }
182  }
183 
184  // bRPC/DT matcher gets forward RPC and DTBX muons
185  if ( m_id == 5 ) {
186  for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++ ) {
187  first[irpc] = m_gmt.Data()->RPCMuon(irpc+4);
188  }
189  for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
190  second[idt] = m_gmt.Data()->DTBXMuon(idt);
191  }
192  }
193 }
const L1MuGlobalMuonTrigger & m_gmt
const L1MuRegionalCand * CSCMuon(int index) const
get CSC muon
Definition: L1MuGMTPSB.cc:252
std::vector< const L1MuRegionalCand * > second
const L1MuGMTPSB * Data() const
return pointer to PSB
const L1MuRegionalCand * RPCMuon(int index) const
get RPC muon
Definition: L1MuGMTPSB.cc:232
int irpc
static const unsigned int MAXCSC
Definition: L1MuGMTConfig.h:91
static const unsigned int MAXDTBX
Definition: L1MuGMTConfig.h:91
static const unsigned int MAXRPCendcap
Definition: L1MuGMTConfig.h:90
std::vector< const L1MuRegionalCand * > first
const L1MuRegionalCand * DTBXMuon(int index) const
get DTBX muon
Definition: L1MuGMTPSB.cc:242
static const unsigned int MAXRPCbarrel
Definition: L1MuGMTConfig.h:90
int L1MuGMTMatcher::lookup_mq ( int  i,
int  j 
)
private

Definition at line 273 of file L1MuGMTMatcher.cc.

References kinem::delta_phi(), relativeConstraints::empty, first, L1MuGMTConfig::getLFCOUDeltaEtaLUT(), L1MuGMTConfig::getLFDeltaEtaLUT(), L1MuGMTConfig::getLFDisableHotLUT(), L1MuGMTConfig::getLFMatchQualLUT(), L1MuGMTConfig::getLFOvlEtaConvLUT(), i, L1MuGMTSortRankUnit::isDisabled(), j, m_id, L1MuSignedPacking< Bits >::packedFromIdx(), second, L1MuGMTLFCOUDeltaEtaLUT::SpecificLookup_delta_eta(), L1MuGMTLFDeltaEtaLUT::SpecificLookup_delta_eta(), L1MuGMTLFDisableHotLUT::SpecificLookup_disable_hot(), L1MuGMTLFOvlEtaConvLUT::SpecificLookup_eta_ovl(), and L1MuGMTLFMatchQualLUT::SpecificLookup_mq().

Referenced by match().

273  {
274 
275  bool empty1 = ( first[i] != 0 ) ? first[i]->empty() : true;
276  bool empty2 = ( second[j] != 0 ) ? second[j]->empty() : true;
277  if ( empty1 || empty2) return 0;
278 
279  //
280  // (1) calculate delta-phi (integer version)
281  //
282  unsigned phi1 = first[i]->phi_packed();
283  unsigned phi2 = second[j]->phi_packed();
284 
285  int delta_phi = ( ( phi1 - phi2 + 3*72 ) % 144 ) - 72;
286 
287  if (delta_phi < -3 || delta_phi >3)
288  delta_phi = -4;
289 
290  L1MuSignedPacking<3> DPhiPacking;
291  unsigned delta_phi_packed = DPhiPacking.packedFromIdx (delta_phi);
292 
293  //
294  // (2) look-up delta-eta
295  //
296  unsigned eta1 = first[i]->eta_packed();
297  unsigned eta2 = second[j]->eta_packed();
298 
299  unsigned delta_eta_packed = 0;
300 
301  if (m_id == 0 || m_id == 1) { // main matching units
302  // first is dt/csc, second is rpc
303 
304  bool disable1 = L1MuGMTSortRankUnit::isDisabled(first[i]);
305  bool disable2 = L1MuGMTSortRankUnit::isDisabled(second[j]);;
306 
307  if (disable1 || disable2) return 0;
308 
310  delta_eta_packed = de_lut->SpecificLookup_delta_eta (m_id, eta1, eta2);
311  }
312  else { // overlap cancel-out matching units
313  // first is own chip, second is other chip
314  int idx1 = first[i]->type_idx();
315  int idx1_dcrr = (idx1==1)?2:(idx1==2)?1:idx1;
316 
317  int idx2 = second[j]->type_idx();
318  int idx2_dcrr = (idx2==1)?2:(idx2==2)?1:idx2;
319 
320  bool disable1 = L1MuGMTSortRankUnit::isDisabled(first[i]);
321 
323  bool disable2 = dishot_lut->SpecificLookup_disable_hot (idx2_dcrr,
324  second[j]->eta_packed(),
325  second[j]->phi_packed()) == 1;
326 
327  if (disable1 || disable2) return 0;
328 
329  // convert eta to 4-bit, first
331 
332 
333  unsigned eta1_4bit = econv_lut->SpecificLookup_eta_ovl (idx1_dcrr, eta1);
334  unsigned eta2_4bit = econv_lut->SpecificLookup_eta_ovl (idx2_dcrr, eta2);
335 
336  // look up delta eta
338  delta_eta_packed = cou_de_lut->SpecificLookup_delta_eta (m_id-2, eta1_4bit, eta2_4bit);
339  }
340 
341  //
342  // (3) look up match quality
343  //
345 
346  unsigned mq = mq_lut->SpecificLookup_mq(m_id, delta_eta_packed, delta_phi_packed);
347 
348  return mq;
349 }
int i
Definition: DBlmapReader.cc:9
virtual unsigned packedFromIdx(int idx) const
get the packed notation of a value, check range
Definition: L1MuPacking.h:94
static bool isDisabled(const L1MuRegionalCand *)
Diable bit.
unsigned SpecificLookup_eta_ovl(int idx, unsigned eta6) const
specific lookup function for eta_ovl
static L1MuGMTLFMatchQualLUT * getLFMatchQualLUT()
static L1MuGMTLFOvlEtaConvLUT * getLFOvlEtaConvLUT()
unsigned SpecificLookup_mq(int idx, unsigned delta_eta, unsigned delta_phi) const
specific lookup function for mq
std::vector< const L1MuRegionalCand * > second
static L1MuGMTLFDeltaEtaLUT * getLFDeltaEtaLUT()
unsigned SpecificLookup_delta_eta(int idx, unsigned eta_dtcsc, unsigned eta_rpc) const
specific lookup function for delta_eta
int j
Definition: DBlmapReader.cc:9
static L1MuGMTLFDisableHotLUT * getLFDisableHotLUT()
std::vector< const L1MuRegionalCand * > first
double delta_phi(double ph11, double phi2)
Definition: AnglesUtil.h:91
static L1MuGMTLFCOUDeltaEtaLUT * getLFCOUDeltaEtaLUT()
unsigned SpecificLookup_disable_hot(int idx, unsigned eta, unsigned phi) const
specific lookup function for disable_hot
unsigned SpecificLookup_delta_eta(int idx, unsigned eta1, unsigned eta2) const
specific lookup function for delta_eta
void L1MuGMTMatcher::match ( )
private

Definition at line 199 of file L1MuGMTMatcher.cc.

References L1MuGlobalMuonTrigger::DebugBlockForFill(), i, L1MuGMTMatrix< T >::init(), L1MuGMTMatrix< T >::isMax(), j, lookup_mq(), m_gmt, m_id, matchQuality, max(), MaxMatch, pairMatrix, L1MuGMTDebugBlock::SetMQMatrix(), and L1MuGMTDebugBlock::SetPairMatrix().

Referenced by run().

199  {
200 
202  L1MuGMTMatrix<bool> disableMatrix(MaxMatch,MaxMatch);
203  maxMatrix.init(false);
204  disableMatrix.init(false);
205 
206  // loop over all combinations
207 
208  unsigned i,j;
209  for ( i = 0; i < MaxMatch; i++ )
210  for ( j = 0; j < MaxMatch; j++ )
211  matchQuality(i,j) = lookup_mq(i,j);
212 
213  // store in debug block
215 
216  // fill MAX matrix
217 
218  for ( i = 0; i < MaxMatch; i++ )
219  for ( j = 0; j < MaxMatch; j++ )
220  maxMatrix(i,j) = matchQuality.isMax(i,j) && (matchQuality(i,j) != 0);
221 
222  // fill disable matrix
223 
224  for ( i = 0; i < MaxMatch; i++ )
225  for ( j = 0; j < MaxMatch; j++ ) {
226 
227  for ( unsigned i1 = 0; i1 < MaxMatch; i1++ )
228  if ( i1 != i ) disableMatrix(i,j) = disableMatrix(i,j) || maxMatrix(i1,j);
229 
230  for ( unsigned j1 = 0; j1 < MaxMatch; j1++ )
231  if ( j1 != j ) disableMatrix(i,j) = disableMatrix(i,j) || maxMatrix(i,j1);
232  }
233 
234  // fill pair matrix
235 
236  for ( i = 0; i < MaxMatch; i++ ) {
237  for ( j = 0; j < MaxMatch; j++ ) {
238 
239  bool max = true;
240 
241  for ( unsigned i1 = 0; i1 < i; i1++ ) {
242  max = max && ((matchQuality(i,j) > matchQuality(i1,j)) ||
243  disableMatrix(i1,j));
244  }
245 
246  for ( unsigned i1 = i+1; i1 < MaxMatch; i1++ ) {
247  max = max && ((matchQuality(i,j) >= matchQuality(i1,j)) ||
248  disableMatrix(i1,j));
249  }
250 
251  for ( unsigned j1 = 0; j1 < j; j1++ ) {
252  max = max && ((matchQuality(i,j) > matchQuality(i,j1)) ||
253  disableMatrix(i,j1));
254  }
255 
256  for ( unsigned j1 = j+1; j1 < MaxMatch; j1++ ) {
257  max = max && ((matchQuality(i,j) >= matchQuality(i,j1)) ||
258  disableMatrix(i,j1));
259  }
260 
261  pairMatrix(i,j) = max && (matchQuality(i,j) != 0);
262 
263  }
264  }
265 
266  // store in debug block
268 }
int i
Definition: DBlmapReader.cc:9
const L1MuGlobalMuonTrigger & m_gmt
bool isMax(int r, int c) const
is the element (r,c) the max. entry in its row and column?
int lookup_mq(int i, int j)
const T & max(const T &a, const T &b)
void SetPairMatrix(int idx, L1MuGMTMatrix< bool > pm)
Set pair matrices.
int j
Definition: DBlmapReader.cc:9
void SetMQMatrix(int idx, L1MuGMTMatrix< int > mqm)
Set match quality matrices.
L1MuGMTMatrix< bool > pairMatrix
static const unsigned int MaxMatch
L1MuGMTMatrix< int > matchQuality
L1MuGMTDebugBlock * DebugBlockForFill() const
for debug: return the debug block (in order to fill it)
const L1MuGMTMatrix<bool>& L1MuGMTMatcher::pairM ( ) const
inline

return pair matrix

Definition at line 68 of file L1MuGMTMatcher.h.

References pairMatrix.

Referenced by L1MuGMTCancelOutUnit::decide(), and L1MuGMTMerger::merge().

68 { return pairMatrix; }
L1MuGMTMatrix< bool > pairMatrix
bool L1MuGMTMatcher::pairM ( int  i,
int  j 
) const
inline

return pair matrix

Definition at line 71 of file L1MuGMTMatcher.h.

References pairMatrix.

71 { return pairMatrix(i,j); }
int i
Definition: DBlmapReader.cc:9
int j
Definition: DBlmapReader.cc:9
L1MuGMTMatrix< bool > pairMatrix
void L1MuGMTMatcher::print ( void  )

print matching results

Definition at line 113 of file L1MuGMTMatcher.cc.

References L1MuGMTConfig::Debug(), matchQuality, pairMatrix, and L1MuGMTMatrix< T >::print().

Referenced by L1MuGlobalMuonTrigger::produce(), and L1MuGMTCancelOutUnit::run().

113  {
114 
115  edm::LogVerbatim("GMT_Matcher_info");
116  if ( L1MuGMTConfig::Debug(4) ) {
117  edm::LogVerbatim("GMT_Matcher_info") << "MATCH Quality : ";
119  }
120 
121  edm::LogVerbatim("GMT_Matcher_info") << "PAIR Matrix : ";
122  pairMatrix.print();
123 
124  edm::LogVerbatim("GMT_Matcher_info");
125 
126 }
static bool Debug()
void print() const
print matrix
L1MuGMTMatrix< bool > pairMatrix
L1MuGMTMatrix< int > matchQuality
void L1MuGMTMatcher::reset ( void  )

clear Matcher

Definition at line 97 of file L1MuGMTMatcher.cc.

References first, i, L1MuGMTMatrix< T >::init(), matchQuality, MaxMatch, pairMatrix, and second.

Referenced by L1MuGlobalMuonTrigger::reset(), L1MuGMTCancelOutUnit::reset(), and ~L1MuGMTMatcher().

97  {
98 
99  matchQuality.init(0);
100  pairMatrix.init(false);
101 
102  for ( unsigned i = 0; i < MaxMatch; i++ ) {
103  first[i] = 0;
104  second[i] = 0;
105  }
106 
107 }
int i
Definition: DBlmapReader.cc:9
void init(T v=0)
initialize matrix
std::vector< const L1MuRegionalCand * > second
std::vector< const L1MuRegionalCand * > first
L1MuGMTMatrix< bool > pairMatrix
static const unsigned int MaxMatch
L1MuGMTMatrix< int > matchQuality
void L1MuGMTMatcher::run ( void  )

run Matcher

Definition at line 87 of file L1MuGMTMatcher.cc.

References load(), and match().

Referenced by L1MuGlobalMuonTrigger::produce(), and L1MuGMTCancelOutUnit::run().

87  {
88 
89  load();
90  match();
91 
92 }

Member Data Documentation

std::vector<const L1MuRegionalCand*> L1MuGMTMatcher::first
private

Definition at line 87 of file L1MuGMTMatcher.h.

Referenced by L1MuGMTMatcher(), load(), lookup_mq(), and reset().

const L1MuGlobalMuonTrigger& L1MuGMTMatcher::m_gmt
private

Definition at line 84 of file L1MuGMTMatcher.h.

Referenced by load(), and match().

int L1MuGMTMatcher::m_id
private

Definition at line 85 of file L1MuGMTMatcher.h.

Referenced by id(), load(), lookup_mq(), and match().

L1MuGMTMatrix<int> L1MuGMTMatcher::matchQuality
private

Definition at line 90 of file L1MuGMTMatcher.h.

Referenced by match(), print(), and reset().

const unsigned int L1MuGMTMatcher::MaxMatch = 4
static

Definition at line 47 of file L1MuGMTMatcher.h.

Referenced by L1MuGMTMatcher(), match(), and reset().

L1MuGMTMatrix<bool> L1MuGMTMatcher::pairMatrix
private

Definition at line 91 of file L1MuGMTMatcher.h.

Referenced by match(), pairM(), print(), and reset().

std::vector<const L1MuRegionalCand*> L1MuGMTMatcher::second
private

Definition at line 88 of file L1MuGMTMatcher.h.

Referenced by L1MuGMTMatcher(), load(), lookup_mq(), and reset().