CMS 3D CMS Logo

L1MuGMTMatcher Class Reference

Matching Unit in the L1 Global Muon Trigger. More...

#include <L1Trigger/GlobalMuonTrigger/src/L1MuGMTMatcher.h>

List of all members.

Public Member Functions

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

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< intmatchQuality
L1MuGMTMatrix< boolpairMatrix
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.

00062                                                                        : 
00063                m_gmt(gmt), m_id(id), first(MaxMatch), second(MaxMatch), 
00064                matchQuality(MaxMatch,MaxMatch), pairMatrix(MaxMatch,MaxMatch) {
00065 
00066   first.reserve(MaxMatch);
00067   second.reserve(MaxMatch);
00068 
00069 }

L1MuGMTMatcher::~L1MuGMTMatcher (  )  [virtual]

destructor

Definition at line 74 of file L1MuGMTMatcher.cc.

References reset().

00074                                 { 
00075 
00076   reset();
00077   
00078 }


Member Function Documentation

int L1MuGMTMatcher::id ( void   )  const [inline]

return identifier

Definition at line 65 of file L1MuGMTMatcher.h.

References m_id.

00065 { return m_id; } 

void L1MuGMTMatcher::load ( void   )  [private]

Definition at line 132 of file L1MuGMTMatcher.cc.

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

Referenced by run().

00132                           {
00133 
00134   // barrel matcher gets DTBX and barrel RPC muons
00135   if ( m_id == 0 ) {
00136     for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
00137       first[idt] = m_gmt.Data()->DTBXMuon(idt);
00138     }
00139     for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++ ) {
00140       second[irpc] = m_gmt.Data()->RPCMuon(irpc);
00141     }
00142   }
00143   
00144   // endcap matcher gets CSC and endcap RPC muons
00145   if ( m_id == 1 ) {  
00146     for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
00147       first[icsc] = m_gmt.Data()->CSCMuon(icsc);
00148     }
00149     for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++ ) {
00150       second[irpc] = m_gmt.Data()->RPCMuon(irpc+4);
00151     }
00152   }
00153 
00154   // matcher in DT/CSC cancel-out unit gets DTBX and CSC muons
00155   if ( m_id == 2 ) {
00156     for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
00157       first[idt] = m_gmt.Data()->DTBXMuon(idt);
00158     }
00159     for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
00160       second[icsc] = m_gmt.Data()->CSCMuon(icsc);
00161     }
00162   }
00163 
00164   // matcher in CSC/DT cancel-out unit gets CSC and DTBX muons
00165   if ( m_id==3 ) {
00166     for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
00167       first[icsc] = m_gmt.Data()->CSCMuon(icsc);
00168     }
00169     for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
00170       second[idt] = m_gmt.Data()->DTBXMuon(idt);
00171     }
00172   }
00173 
00174   // bRPC/CSC gets barrel RPC and CSC muons
00175   if ( m_id == 4 ) {  
00176     for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++ ) {
00177       first[irpc] = m_gmt.Data()->RPCMuon(irpc);
00178     }
00179     for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
00180       second[icsc] = m_gmt.Data()->CSCMuon(icsc);
00181     }
00182   }
00183 
00184   // bRPC/DT matcher gets forward RPC and DTBX muons
00185   if ( m_id == 5 ) {
00186     for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++ ) {
00187       first[irpc] = m_gmt.Data()->RPCMuon(irpc+4);
00188     }
00189     for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
00190       second[idt] = m_gmt.Data()->DTBXMuon(idt);
00191     }
00192   }
00193 }

int L1MuGMTMatcher::lookup_mq ( int  i,
int  j 
) [private]

Definition at line 273 of file L1MuGMTMatcher.cc.

References kinem::delta_phi(), empty, first, L1MuGMTConfig::getLFCOUDeltaEtaLUT(), L1MuGMTConfig::getLFDeltaEtaLUT(), L1MuGMTConfig::getLFDisableHotLUT(), L1MuGMTConfig::getLFMatchQualLUT(), L1MuGMTConfig::getLFOvlEtaConvLUT(), L1MuGMTSortRankUnit::isDisabled(), 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().

00273                                           {
00274 
00275   bool empty1 = ( first[i] != 0 ) ? first[i]->empty() : true;
00276   bool empty2 = ( second[j] != 0 ) ? second[j]->empty() : true;
00277   if ( empty1 || empty2) return 0; 
00278 
00279   //
00280   // (1) calculate delta-phi (integer version)
00281   //
00282   unsigned phi1 = first[i]->phi_packed();
00283   unsigned phi2 = second[j]->phi_packed();
00284   
00285   int delta_phi = ( ( phi1 - phi2 + 3*72  ) % 144  ) - 72;
00286   
00287   if (delta_phi < -3 || delta_phi >3) 
00288     delta_phi = -4;
00289   
00290   L1MuSignedPacking<3> DPhiPacking;
00291   unsigned delta_phi_packed = DPhiPacking.packedFromIdx (delta_phi);
00292   
00293   //
00294   // (2) look-up delta-eta
00295   //
00296   unsigned eta1 = first[i]->eta_packed();
00297   unsigned eta2 = second[j]->eta_packed();
00298 
00299   unsigned delta_eta_packed = 0;
00300   
00301   if (m_id == 0 || m_id == 1) { // main matching units
00302     // first is dt/csc, second is rpc
00303 
00304     bool disable1 = L1MuGMTSortRankUnit::isDisabled(first[i]);
00305     bool disable2 = L1MuGMTSortRankUnit::isDisabled(second[j]);;
00306 
00307     if (disable1 || disable2) return 0;
00308  
00309     L1MuGMTLFDeltaEtaLUT* de_lut = L1MuGMTConfig::getLFDeltaEtaLUT(); 
00310     delta_eta_packed = de_lut->SpecificLookup_delta_eta (m_id, eta1, eta2);
00311   }
00312   else { // overlap cancel-out matching units
00313     // first is own chip, second is other chip
00314     int idx1 = first[i]->type_idx(); 
00315     int idx1_dcrr = (idx1==1)?2:(idx1==2)?1:idx1;
00316 
00317     int idx2 = second[j]->type_idx(); 
00318     int idx2_dcrr = (idx2==1)?2:(idx2==2)?1:idx2;
00319 
00320     bool disable1 = L1MuGMTSortRankUnit::isDisabled(first[i]);
00321     
00322     L1MuGMTLFDisableHotLUT* dishot_lut = L1MuGMTConfig::getLFDisableHotLUT(); 
00323     bool disable2 = dishot_lut->SpecificLookup_disable_hot (idx2_dcrr, 
00324                                                             second[j]->eta_packed(), 
00325                                                             second[j]->phi_packed()) == 1;
00326 
00327     if (disable1 || disable2) return 0;
00328     
00329     // convert eta to 4-bit, first
00330     L1MuGMTLFOvlEtaConvLUT* econv_lut = L1MuGMTConfig::getLFOvlEtaConvLUT(); 
00331 
00332 
00333     unsigned eta1_4bit = econv_lut->SpecificLookup_eta_ovl (idx1_dcrr, eta1);
00334     unsigned eta2_4bit = econv_lut->SpecificLookup_eta_ovl (idx2_dcrr, eta2);
00335 
00336     // look up delta eta
00337     L1MuGMTLFCOUDeltaEtaLUT* cou_de_lut = L1MuGMTConfig::getLFCOUDeltaEtaLUT(); 
00338     delta_eta_packed = cou_de_lut->SpecificLookup_delta_eta (m_id-2, eta1_4bit, eta2_4bit);
00339   }
00340 
00341   //
00342   // (3) look up match quality
00343   //
00344   L1MuGMTLFMatchQualLUT* mq_lut = L1MuGMTConfig::getLFMatchQualLUT(); 
00345     
00346   unsigned mq = mq_lut->SpecificLookup_mq(m_id, delta_eta_packed, delta_phi_packed);
00347 
00348   return mq;
00349 }

void L1MuGMTMatcher::match (  )  [private]

Definition at line 199 of file L1MuGMTMatcher.cc.

References L1MuGlobalMuonTrigger::DebugBlockForFill(), i, i1, 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().

00199                            {
00200 
00201   L1MuGMTMatrix<bool> maxMatrix(MaxMatch,MaxMatch);
00202   L1MuGMTMatrix<bool> disableMatrix(MaxMatch,MaxMatch);
00203   maxMatrix.init(false);
00204   disableMatrix.init(false);
00205 
00206   // loop over all combinations
00207 
00208   unsigned i,j;
00209   for ( i = 0; i < MaxMatch; i++ ) 
00210     for ( j = 0; j < MaxMatch; j++ ) 
00211       matchQuality(i,j) = lookup_mq(i,j);
00212 
00213   // store in debug block
00214   m_gmt.DebugBlockForFill()->SetMQMatrix( m_id, matchQuality) ;
00215 
00216   // fill MAX matrix
00217 
00218   for ( i = 0; i < MaxMatch; i++ )
00219     for ( j = 0; j < MaxMatch; j++ ) 
00220       maxMatrix(i,j) = matchQuality.isMax(i,j) && (matchQuality(i,j) != 0);
00221   
00222   // fill disable matrix
00223  
00224   for ( i = 0; i < MaxMatch; i++ )  
00225     for ( j = 0; j < MaxMatch; j++ ) {
00226 
00227       for ( unsigned i1 = 0; i1 < MaxMatch; i1++ ) 
00228         if ( i1 != i ) disableMatrix(i,j) = disableMatrix(i,j) || maxMatrix(i1,j);
00229       
00230       for ( unsigned j1 = 0; j1 < MaxMatch; j1++ ) 
00231         if ( j1 != j ) disableMatrix(i,j) = disableMatrix(i,j) || maxMatrix(i,j1);
00232   }
00233 
00234   // fill pair matrix
00235 
00236   for ( i = 0; i < MaxMatch; i++ ) {  
00237     for ( j = 0; j < MaxMatch; j++ ) {
00238 
00239       bool max = true;
00240 
00241       for ( unsigned i1 = 0; i1 < i; i1++ ) {
00242           max = max && ((matchQuality(i,j) > matchQuality(i1,j)) ||
00243                          disableMatrix(i1,j));
00244       }
00245 
00246       for ( unsigned i1 = i+1; i1 < MaxMatch; i1++ ) {
00247           max = max && ((matchQuality(i,j) >= matchQuality(i1,j)) ||
00248                          disableMatrix(i1,j));
00249       }
00250 
00251       for ( unsigned j1 = 0; j1 < j; j1++ ) {
00252           max = max && ((matchQuality(i,j) > matchQuality(i,j1)) ||
00253                          disableMatrix(i,j1));
00254       }
00255 
00256       for ( unsigned j1 = j+1; j1 < MaxMatch; j1++ ) {
00257           max = max && ((matchQuality(i,j) >= matchQuality(i,j1)) ||
00258                          disableMatrix(i,j1));
00259       }
00260  
00261       pairMatrix(i,j) = max && (matchQuality(i,j) != 0);
00262 
00263     }
00264   }  
00265 
00266   // store in debug block
00267   m_gmt.DebugBlockForFill()->SetPairMatrix( m_id, pairMatrix) ;
00268 }

bool L1MuGMTMatcher::pairM ( int  i,
int  j 
) const [inline]

return pair matrix

Definition at line 71 of file L1MuGMTMatcher.h.

References pairMatrix.

00071 { return pairMatrix(i,j); }

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().

00068 { return 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().

00113                            {
00114 
00115   edm::LogVerbatim("GMT_Matcher_info");
00116   if ( L1MuGMTConfig::Debug(4) ) {
00117     edm::LogVerbatim("GMT_Matcher_info") << "MATCH Quality : ";
00118     matchQuality.print();
00119   }
00120 
00121   edm::LogVerbatim("GMT_Matcher_info") << "PAIR Matrix : ";
00122   pairMatrix.print();
00123 
00124   edm::LogVerbatim("GMT_Matcher_info");
00125 
00126 }

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().

00097                            {
00098 
00099   matchQuality.init(0);
00100   pairMatrix.init(false);
00101   
00102   for ( unsigned i = 0; i < MaxMatch; i++ ) {
00103     first[i] = 0;
00104     second[i] = 0;
00105   }  
00106 
00107 }

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().

00087                          {
00088 
00089   load();
00090   match();
00091   
00092 }


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().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:55 2009 for CMSSW by  doxygen 1.5.4