CMS 3D CMS Logo

L1MuGMTMerger Class Reference

L1 Global Muon Trigger Merger. More...

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

List of all members.

Public Member Functions

const std::vector
< L1MuGMTExtendedCand * > & 
Cands () const
 return std::vector with all muon candidates
int id () const
 return identifier
 L1MuGMTMerger (const L1MuGlobalMuonTrigger &gmt, int id)
 constructor
void print () const
 print results after selection
void reset ()
 clear Merger
void run ()
 run GMT Merger
virtual ~L1MuGMTMerger ()
 destructor

Private Member Functions

unsigned convertedEta (const L1MuRegionalCand *mu) const
void createDTCSCCand (int idx_dtcsc)
void createMergedCand (int idx_dtcsc, int idx_rpc)
void createRPCCand (int idx_rpc)
int doANDMerge (unsigned MMconfig) const
int doSpecialMerge (unsigned MMconfig) const
void load ()
void merge ()
int merge_rank (const L1MuRegionalCand *) const
 Merge Rank Table.
unsigned projectedPhi (const L1MuRegionalCand *mu) const
int selectDTCSC (unsigned MMconfig, int by_rank, int by_pt, int by_combi) const
unsigned sysign (const L1MuRegionalCand *mu) const

Private Attributes

std::vector< const
L1MuRegionalCand * > 
dtcsc_mu
const L1MuGlobalMuonTriggerm_gmt
int m_id
std::vector
< L1MuGMTExtendedCand * > 
m_MuonCands
std::vector< const
L1MuRegionalCand * > 
rpc_mu
std::vector< intsingleRank


Detailed Description

L1 Global Muon Trigger Merger.

There are two GMT Mergers. One for the barrel (id=0) and one for the forward (id=1) part.

The merger receives four DT(CSC) muons and four RPC muons. Each DT(CSC) muon is either merged with an RPC one or passed through.

To simplify the C++ model, the merger conatians also the conversion units and sort rank units as well as the MergeMethodSelection unit which are separate units in the hardware.

Definition at line 63 of file L1MuGMTMerger.h.


Constructor & Destructor Documentation

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

constructor

Definition at line 73 of file L1MuGMTMerger.cc.

References dtcsc_mu, and rpc_mu.

00073                                                                      : 
00074   m_gmt(gmt), m_id(id), dtcsc_mu(4), rpc_mu(4) {
00075 
00076   dtcsc_mu.reserve(4);
00077   rpc_mu.reserve(4);
00078    
00079 }

L1MuGMTMerger::~L1MuGMTMerger (  )  [virtual]

destructor

Definition at line 84 of file L1MuGMTMerger.cc.

References reset().

00084                               { 
00085   reset();  
00086 }


Member Function Documentation

const std::vector<L1MuGMTExtendedCand*>& L1MuGMTMerger::Cands (  )  const [inline]

return std::vector with all muon candidates

Definition at line 86 of file L1MuGMTMerger.h.

References m_MuonCands.

Referenced by L1MuGMTSorter::run().

00086 { return m_MuonCands; }

unsigned L1MuGMTMerger::convertedEta ( const L1MuRegionalCand mu  )  const [private]

Definition at line 321 of file L1MuGMTMerger.cc.

References L1MuRegionalCand::eta_packed(), L1MuGMTConfig::getLFEtaConvLUT(), L1MuGMTLFEtaConvLUT::SpecificLookup_eta_gmt(), and L1MuRegionalCand::type_idx().

Referenced by createDTCSCCand(), createMergedCand(), and createRPCCand().

00321                                                                      {
00322   L1MuGMTLFEtaConvLUT* etaconv_lut = L1MuGMTConfig::getLFEtaConvLUT();
00323   return etaconv_lut->SpecificLookup_eta_gmt (mu->type_idx(), mu->eta_packed() );
00324 }

void L1MuGMTMerger::createDTCSCCand ( int  idx_dtcsc  )  [private]

Definition at line 242 of file L1MuGMTMerger.cc.

References convertedEta(), dtcsc_mu, L1MuGMTSortRankUnit::getVeryLowQualityLevel(), L1MuGMTMipIsoAU::ISO(), m_gmt, m_id, m_MuonCands, L1MuGMTMipIsoAU::MIP(), L1MuGlobalMuonTrigger::MipIsoAU(), projectedPhi(), L1MuGMTCand::setBx(), L1MuGMTCand::setChargePacked(), L1MuGMTExtendedCand::setDTCSCIndex(), L1MuGMTCand::setEtaPacked(), L1MuGMTExtendedCand::setFwdBit(), L1MuGMTCand::setIsolation(), L1MuGMTCand::setMIP(), L1MuGMTCand::setPhiPacked(), L1MuGMTCand::setPtPacked(), L1MuGMTCand::setQuality(), L1MuGMTExtendedCand::setRank(), L1MuGMTExtendedCand::setRPCBit(), L1MuGMTExtendedCand::setRPCIndex(), L1MuGMTSortRankUnit::sort_rank(), and sysign().

Referenced by merge().

00242                                                  {
00243   L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
00244    
00245   tmpmuon->setBx(dtcsc_mu[idx_dtcsc]->bx());
00246   tmpmuon->setPhiPacked( projectedPhi(dtcsc_mu[idx_dtcsc]) ); 
00247   tmpmuon->setEtaPacked( convertedEta(dtcsc_mu[idx_dtcsc]) ); 
00248   tmpmuon->setPtPacked( dtcsc_mu[idx_dtcsc]->pt_packed() ); 
00249   tmpmuon->setChargePacked( sysign(dtcsc_mu[idx_dtcsc]) ); 
00250   tmpmuon->setMIP( m_gmt.MipIsoAU(m_id)->MIP(idx_dtcsc) );    
00251   tmpmuon->setIsolation ( m_gmt.MipIsoAU(m_id)->ISO(idx_dtcsc) );    
00252   tmpmuon->setRank( L1MuGMTSortRankUnit::sort_rank(dtcsc_mu[idx_dtcsc]) );
00253 
00254   unsigned quality = 0;
00255   switch ( L1MuGMTSortRankUnit::getVeryLowQualityLevel(dtcsc_mu[idx_dtcsc]) ) {
00256   case 0: quality = 6; break; //DT/CSC
00257   case 1: quality = 2; break; //VERY LOW QUALITY LEVEL 1
00258   case 2: quality = 3; break; //VERY LOW QUALITY LEVEL 2
00259   case 3: quality = 4; break; //VERY LOW QUALITY LEVEL 3
00260   }
00261 
00262   if ( (m_id==1) && (dtcsc_mu[idx_dtcsc]->finehalo_packed() == 1) ) 
00263     quality = 1; // HALO quality
00264 
00265   tmpmuon->setQuality( quality ); // RPC
00266   tmpmuon->setDTCSCIndex(idx_dtcsc);
00267   tmpmuon->setRPCIndex(0);
00268   tmpmuon->setFwdBit( m_id );
00269   tmpmuon->setRPCBit( 0 );
00270 
00271   m_MuonCands.push_back(tmpmuon);
00272 }

void L1MuGMTMerger::createMergedCand ( int  idx_dtcsc,
int  idx_rpc 
) [private]

Definition at line 359 of file L1MuGMTMerger.cc.

References funct::abs(), convertedEta(), doANDMerge(), doSpecialMerge(), dtcsc_mu, eta, L1MuGMTConfig::getLFPtMixLUT(), L1MuGMTConfig::getRegMMConfigCharge(), L1MuGMTConfig::getRegMMConfigEta(), L1MuGMTConfig::getRegMMConfigISO(), L1MuGMTConfig::getRegMMConfigMIP(), L1MuGMTConfig::getRegMMConfigPhi(), L1MuGMTConfig::getRegMMConfigPt(), L1MuGMTConfig::getRegMMConfigSRK(), L1MuGMTConfig::getRegSortRankOffset(), L1MuGMTReg::getValue(), L1MuGMTMipIsoAU::ISO(), m_gmt, m_id, m_MuonCands, merge_rank(), L1MuGMTMipIsoAU::MIP(), L1MuGlobalMuonTrigger::MipIsoAU(), phi, projectedPhi(), rpc_mu, selectDTCSC(), L1MuGMTCand::setBx(), L1MuGMTCand::setChargePacked(), L1MuGMTExtendedCand::setDTCSCIndex(), L1MuGMTCand::setEtaPacked(), L1MuGMTExtendedCand::setFwdBit(), L1MuGMTCand::setIsolation(), L1MuGMTCand::setMIP(), L1MuGMTCand::setPhiPacked(), L1MuGMTCand::setPtPacked(), L1MuGMTCand::setQuality(), L1MuGMTExtendedCand::setRank(), L1MuGMTExtendedCand::setRPCBit(), L1MuGMTExtendedCand::setRPCIndex(), L1MuGMTSortRankUnit::sort_rank(), L1MuGMTLFPtMixLUT::SpecificLookup_pt_mixed(), and sysign().

Referenced by merge().

00359                                                                {
00360 
00361   // In the hardware matrices of select_bits are calculated for all
00362   // possible pairings. 
00363   // In ORCA we only calculate selec-bits for the actual 
00364   // pairs to save time.
00365 
00366   // look up merge ranks
00367   int merge_rank_dtcsc = merge_rank(dtcsc_mu[idx_dtcsc]);
00368   int merge_rank_rpc   = merge_rank(rpc_mu[idx_rpc]);
00369 
00370   // calculate select-bits (1: take DT/CSC, 0: take RPC)
00371   int selected_by_rank = abs(merge_rank_dtcsc) > abs(merge_rank_rpc);
00372   int selected_by_pt   = dtcsc_mu[idx_dtcsc]->pt_packed() <= rpc_mu[idx_rpc]->pt_packed();
00373 
00374   // Selection by combination of min pt and higher rank
00375   // select by rank if both flags are set, otherwise by min pt
00376   // in other words: select by minpt if one flag is not set
00377   int selected_by_combi = (merge_rank_dtcsc<0 && merge_rank_rpc<0) ? selected_by_rank : selected_by_pt;
00378 
00379   
00380   L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
00381    
00382   tmpmuon->setBx(dtcsc_mu[idx_dtcsc]->bx());
00383 
00384 
00385   // merge phi
00386   //  unsigned MMConfig_phi = 32; // take DT
00387   unsigned MMConfig_phi = L1MuGMTConfig::getRegMMConfigPhi()->getValue(m_id);
00388 
00389   unsigned phi = 0;
00390   
00391   if (selectDTCSC(MMConfig_phi, selected_by_rank, selected_by_pt, selected_by_combi) )
00392     phi = projectedPhi( dtcsc_mu[idx_dtcsc] );
00393   else
00394     phi = projectedPhi( rpc_mu[idx_rpc] );
00395 
00396   tmpmuon->setPhiPacked( phi );
00397    
00398   // merge eta
00399   unsigned MMConfig_eta = L1MuGMTConfig::getRegMMConfigEta()->getValue(m_id);
00400 
00401   unsigned eta = 0;
00402   
00403   if (doSpecialMerge( MMConfig_eta ) ) {
00404     if ( (m_id == 1) || dtcsc_mu[idx_dtcsc]->finehalo_packed() ) 
00405       eta = convertedEta( dtcsc_mu[idx_dtcsc] );
00406     else
00407       eta = convertedEta( rpc_mu[idx_rpc] );
00408   } 
00409   else {
00410     if ( selectDTCSC(MMConfig_eta, selected_by_rank, selected_by_pt, selected_by_combi) )
00411       eta = convertedEta( dtcsc_mu[idx_dtcsc] );
00412     else
00413       eta = convertedEta( rpc_mu[idx_rpc] );    
00414   }
00415   tmpmuon->setEtaPacked( eta );
00416 
00417   // merge pt
00418   unsigned MMConfig_pt = L1MuGMTConfig::getRegMMConfigPt()->getValue(m_id);
00419 
00420   unsigned pt = 0;
00421 
00422   if (doSpecialMerge( MMConfig_pt ) ) { // mix pt
00423     L1MuGMTLFPtMixLUT* ptmix_lut = L1MuGMTConfig::getLFPtMixLUT();
00424     pt = ptmix_lut->SpecificLookup_pt_mixed (m_id, dtcsc_mu[idx_dtcsc]->pt_packed(), 
00425                                              rpc_mu[idx_rpc]->pt_packed());    
00426   } 
00427   else {
00428     if ( selectDTCSC(MMConfig_pt, selected_by_rank, selected_by_pt, selected_by_combi) )
00429       pt = dtcsc_mu[idx_dtcsc]->pt_packed();
00430     else
00431       pt = rpc_mu[idx_rpc]->pt_packed();
00432   }
00433   tmpmuon->setPtPacked( pt );
00434 
00435   // merge charge
00436   unsigned MMConfig_charge = L1MuGMTConfig::getRegMMConfigCharge()->getValue(m_id);
00437 
00438   unsigned sy_sign = 0;
00439 
00440   if (doSpecialMerge( MMConfig_charge ) ) {
00441     // based on charge valid bits
00442     if ( rpc_mu[idx_rpc]->charge_valid_packed()==1 && dtcsc_mu[idx_dtcsc]->charge_valid_packed()==0 )
00443       sy_sign = sysign(rpc_mu[idx_rpc]);
00444     else 
00445       sy_sign = sysign(dtcsc_mu[idx_dtcsc]);
00446   } 
00447   else {
00448     if ( selectDTCSC(MMConfig_charge, selected_by_rank, selected_by_pt, selected_by_combi) )
00449       sy_sign = sysign(dtcsc_mu[idx_dtcsc]);
00450     else
00451       sy_sign = sysign(rpc_mu[idx_rpc]);
00452   }
00453   tmpmuon->setChargePacked( sy_sign );
00454    
00455   // merge quality  
00456 
00457   
00458   // merge MIP
00459   unsigned MMConfig_MIP = L1MuGMTConfig::getRegMMConfigMIP()->getValue(m_id);
00460 
00461   bool mip_bit = false;
00462 
00463   bool mip_bit_dtcsc = m_gmt.MipIsoAU(m_id)->MIP(idx_dtcsc);
00464   bool mip_bit_rpc   = m_gmt.MipIsoAU(m_id)->MIP(idx_rpc+4);
00465  
00466   if ( doSpecialMerge(MMConfig_MIP) ) {
00467     if ( doANDMerge(MMConfig_MIP) )
00468       mip_bit =  mip_bit_dtcsc && mip_bit_rpc;
00469     else
00470       mip_bit =  mip_bit_dtcsc || mip_bit_rpc;
00471   }
00472   else {
00473     if ( selectDTCSC(MMConfig_MIP, selected_by_rank, selected_by_pt, selected_by_combi) )
00474       mip_bit = mip_bit_dtcsc;
00475     else
00476       mip_bit = mip_bit_rpc;
00477   }
00478 
00479   tmpmuon->setMIP(mip_bit);
00480  
00481   // merge ISO
00482   unsigned MMConfig_ISO = L1MuGMTConfig::getRegMMConfigISO()->getValue(m_id);
00483 
00484   bool iso_bit = false;
00485 
00486   bool iso_bit_dtcsc = m_gmt.MipIsoAU(m_id)->ISO(idx_dtcsc);
00487   bool iso_bit_rpc   = m_gmt.MipIsoAU(m_id)->ISO(idx_rpc+4);
00488  
00489   if ( doSpecialMerge(MMConfig_ISO) ) {
00490     if ( doANDMerge(MMConfig_ISO) )
00491       iso_bit =  iso_bit_dtcsc && iso_bit_rpc;
00492     else
00493       iso_bit =  iso_bit_dtcsc || iso_bit_rpc;
00494   }
00495   else {
00496     if ( selectDTCSC(MMConfig_ISO, selected_by_rank, selected_by_pt, selected_by_combi) )
00497       iso_bit = iso_bit_dtcsc;
00498     else
00499       iso_bit = iso_bit_rpc;
00500   }
00501 
00502   tmpmuon->setIsolation(iso_bit);
00503 
00504   // merge sort rank
00505   unsigned MMConfig_SRK = L1MuGMTConfig::getRegMMConfigSRK()->getValue(m_id);
00506 
00507   unsigned rank_offset = L1MuGMTConfig::getRegSortRankOffset()->getValue(m_id);
00508 
00509   unsigned rank = 0;
00510   if ( selectDTCSC(MMConfig_SRK, selected_by_rank, selected_by_pt, selected_by_combi) )
00511     rank = L1MuGMTSortRankUnit::sort_rank(dtcsc_mu[idx_dtcsc]) + rank_offset; 
00512   else
00513     rank = L1MuGMTSortRankUnit::sort_rank(rpc_mu[idx_rpc])     + rank_offset;
00514 
00515   tmpmuon->setRank(rank); 
00516 
00517   // quality of merged candidate
00518   tmpmuon->setQuality( 7 ); // code for matched muons
00519 
00520   tmpmuon->setDTCSCIndex(idx_dtcsc);
00521   tmpmuon->setRPCIndex(idx_rpc);
00522   tmpmuon->setFwdBit( m_id );
00523   tmpmuon->setRPCBit( 0 );
00524    
00525   m_MuonCands.push_back(tmpmuon);
00526 }

void L1MuGMTMerger::createRPCCand ( int  idx_rpc  )  [private]

Definition at line 275 of file L1MuGMTMerger.cc.

References convertedEta(), L1MuGMTSortRankUnit::getVeryLowQualityLevel(), L1MuGMTMipIsoAU::ISO(), m_gmt, m_id, m_MuonCands, L1MuGMTMipIsoAU::MIP(), L1MuGlobalMuonTrigger::MipIsoAU(), projectedPhi(), rpc_mu, L1MuGMTCand::setBx(), L1MuGMTCand::setChargePacked(), L1MuGMTExtendedCand::setDTCSCIndex(), L1MuGMTCand::setEtaPacked(), L1MuGMTExtendedCand::setFwdBit(), L1MuGMTCand::setIsolation(), L1MuGMTCand::setMIP(), L1MuGMTCand::setPhiPacked(), L1MuGMTCand::setPtPacked(), L1MuGMTCand::setQuality(), L1MuGMTExtendedCand::setRank(), L1MuGMTExtendedCand::setRPCBit(), L1MuGMTExtendedCand::setRPCIndex(), L1MuGMTSortRankUnit::sort_rank(), and sysign().

Referenced by merge().

00275                                              {
00276   L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
00277    
00278   tmpmuon->setBx(rpc_mu[idx_rpc]->bx()); 
00279   tmpmuon->setPhiPacked( projectedPhi(rpc_mu[idx_rpc]) ); 
00280   tmpmuon->setEtaPacked( convertedEta(rpc_mu[idx_rpc]) ); 
00281   tmpmuon->setPtPacked( rpc_mu[idx_rpc]->pt_packed() ); 
00282   tmpmuon->setChargePacked( sysign( rpc_mu[idx_rpc] ) ); 
00283   tmpmuon->setMIP( m_gmt.MipIsoAU(m_id)->MIP(idx_rpc+4) );    
00284   tmpmuon->setIsolation ( m_gmt.MipIsoAU(m_id)->ISO(idx_rpc+4) );    
00285   tmpmuon->setRank( L1MuGMTSortRankUnit::sort_rank(rpc_mu[idx_rpc]) );
00286 
00287   unsigned quality = 0;
00288   switch ( L1MuGMTSortRankUnit::getVeryLowQualityLevel(rpc_mu[idx_rpc]) ) {
00289   case 0: quality = 5; break; //RPC
00290   case 1: quality = 2; break; //VERY LOW QUALITY LEVEL1
00291   case 2: quality = 3; break; //VERY LOW QUALITY LEVEL2
00292   case 3: quality = 4; break; //VERY LOW QUALITY LEVEL3
00293   }
00294 
00295   tmpmuon->setQuality( quality ); // RPC
00296   tmpmuon->setDTCSCIndex(0);
00297   tmpmuon->setRPCIndex(idx_rpc);
00298   tmpmuon->setFwdBit( m_id );
00299   tmpmuon->setRPCBit( 1 );
00300     
00301   m_MuonCands.push_back(tmpmuon);
00302 }

int L1MuGMTMerger::doANDMerge ( unsigned  MMconfig  )  const [private]

Definition at line 317 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

00317                                                      {
00318   return (MMconfig & 64) == 64;
00319 }

int L1MuGMTMerger::doSpecialMerge ( unsigned  MMconfig  )  const [private]

Definition at line 313 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

00313                                                          {
00314   return (MMconfig & 1) == 1;
00315 }

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

return identifier

Definition at line 83 of file L1MuGMTMerger.h.

References m_id.

00083 { return m_id; }

void L1MuGMTMerger::load ( void   )  [private]

Definition at line 142 of file L1MuGMTMerger.cc.

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

Referenced by run().

00142                          {
00143 
00144   // barrel Merger gets DTBX and barrel RPC muons
00145   if ( m_id == 0 ) {
00146     for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
00147       dtcsc_mu[idt] = m_gmt.Data()->DTBXMuon(idt);
00148     }
00149     for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++ ) {
00150       rpc_mu[irpc] = m_gmt.Data()->RPCMuon(irpc);
00151     }
00152   }
00153   
00154   // endcap Merger gets CSC and endcap RPC muons
00155   if ( m_id == 1 ) {  
00156     for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
00157       dtcsc_mu[icsc] = m_gmt.Data()->CSCMuon(icsc);
00158     }
00159     for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++ ) {
00160       rpc_mu[irpc] = m_gmt.Data()->RPCMuon(irpc+4);
00161     }
00162   }
00163  
00164 }

void L1MuGMTMerger::merge (  )  [private]

Definition at line 167 of file L1MuGMTMerger.cc.

References L1MuGMTCancelOutUnit::cancelMyChipMuon(), L1MuGMTCancelOutUnit::cancelOtherChipMuon(), L1MuGlobalMuonTrigger::CancelOutUnit(), L1MuGMTMatrix< T >::colAny(), createDTCSCCand(), createMergedCand(), createRPCCand(), dtcsc_mu, L1MuGMTCand::etaIndex(), L1MuScale::getCenter(), L1MuTriggerScales::getGMTEtaScale(), L1MuScale::getLowEdge(), L1MuTriggerScales::getPhiScale(), L1MuTriggerPtScale::getPtScale(), L1MuGMTConfig::getTriggerPtScale(), L1MuGMTConfig::getTriggerScales(), i, L1MuGMTSortRankUnit::isDisabled(), j, m_gmt, m_id, m_MuonCands, L1MuGlobalMuonTrigger::Matcher(), L1MuGMTMatcher::pairM(), L1MuGMTCand::phiIndex(), L1MuGMTCand::ptIndex(), L1MuGMTMatrix< T >::rowAny(), rpc_mu, L1MuGMTCand::setEtaValue(), L1MuGMTCand::setPhiValue(), and L1MuGMTCand::setPtValue().

Referenced by run().

00167                           {
00168 
00169   const L1MuGMTMatrix<bool>& pairM = m_gmt.Matcher(m_id)->pairM();
00170 
00171   // Handling of cancel-out and empty muons is different in software and hardware
00172   //
00173   // - in hardware, a candidate may be empty (pt_code == 0) and an empty bit
00174   //   is passed to the sorter in order to suppress the candidate. In the
00175   //   software no candidate is created in this case.
00176   //
00177   // - in hardware, RPC candidates are passed to the sorter even if they are 
00178   //   also used in a matched pair. They are then suppressed in the sorter. In
00179   //   software no RPC candidate is created if the muon is used in a pair.
00180   //
00181   // - in hardware, cancel-out signals from the cancel-out units in the own and   
00182   //   other Logic FPGA are passed to the sorter in order to cancel out muons.
00183   //   In software the cancel-out signals are alrady checked here in the merger 
00184   //   and no candidates are created for cancelled muons.
00185   //
00186   // There may therefore be less muons passed to the sorter in software than 
00187   // in Hardware. At the output of the first sorter stage the results should 
00188   // be comparable, again.
00189   
00190   unsigned HaloOverwritesMatched = 1;
00191   
00192   // loop over DT/CSC muons
00193   for (int i=0; i<4; i++) {
00194     if (dtcsc_mu[i] != 0) {
00195 
00196       int match_idx = pairM.rowAny(i);
00197 
00198       int csc_is_halo = (m_id==1) && (dtcsc_mu[i]->finehalo_packed() == 1);
00199 
00200       if ( (match_idx != -1) && // is it matched?
00201            (! (csc_is_halo && HaloOverwritesMatched) ) )
00202         createMergedCand(i, match_idx);         
00203       else {
00204         // check my first and the other chip's second cancel-out units
00205         if ((! m_gmt.CancelOutUnit(m_id)->cancelMyChipMuon(i) ) &&
00206             (! m_gmt.CancelOutUnit(3-m_id)->cancelOtherChipMuon(i) ) &&
00207             (! L1MuGMTSortRankUnit::isDisabled(dtcsc_mu[i]) ) )
00208           createDTCSCCand(i);
00209       }
00210     }
00211   }
00212 
00213   // additionally loop over RPC muons
00214   for (int j=0; j<4; j++) {
00215     if (rpc_mu[j] != 0) {      
00216       
00217       int match_idx = pairM.colAny(j);
00218       
00219       if (match_idx == -1) { // is it unmatched?
00220         if ((! m_gmt.CancelOutUnit(m_id+2)->cancelMyChipMuon(j) ) &&
00221             (! L1MuGMTSortRankUnit::isDisabled(rpc_mu[j]) ) )
00222           createRPCCand(j);
00223       }
00224     }
00225   }
00226 
00227   // set physical values in the GMT candidates for use in the analysis
00228   const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
00229   const L1MuTriggerPtScale* theTriggerPtScale = L1MuGMTConfig::getTriggerPtScale();
00230   
00231   std::vector<L1MuGMTExtendedCand*>::const_iterator icand;
00232   for(icand=m_MuonCands.begin();icand!=m_MuonCands.end();icand++) {
00233     L1MuGMTExtendedCand* cand = (*icand);
00234     cand->setPhiValue( theTriggerScales->getPhiScale()->getLowEdge( cand->phiIndex() ));
00235     cand->setEtaValue( theTriggerScales->getGMTEtaScale()->getCenter( cand->etaIndex() ));
00236     cand->setPtValue( theTriggerPtScale->getPtScale()->getLowEdge( cand->ptIndex() ));
00237     // cand->setPtValue( theTriggerScales->getPtScale()->getLowEdge( cand->ptIndex() ));
00238   }
00239 
00240 }

int L1MuGMTMerger::merge_rank ( const L1MuRegionalCand muon  )  const [private]

Merge Rank Table.

Definition at line 530 of file L1MuGMTMerger.cc.

References L1MuRegionalCand::empty(), eta, L1MuRegionalCand::eta_packed(), L1MuGMTConfig::getLFMergeRankCombineLUT(), L1MuGMTConfig::getLFMergeRankEtaPhiLUT(), L1MuGMTConfig::getLFMergeRankEtaQLUT(), L1MuGMTConfig::getLFMergeRankPtQLUT(), phi, L1MuRegionalCand::phi_packed(), L1MuRegionalCand::pt_packed(), L1MuRegionalCand::quality_packed(), L1MuGMTLFMergeRankEtaQLUT::SpecificLookup_flag(), L1MuGMTLFMergeRankCombineLUT::SpecificLookup_merge_rank(), L1MuGMTLFMergeRankEtaPhiLUT::SpecificLookup_rank_etaphi(), L1MuGMTLFMergeRankEtaQLUT::SpecificLookup_rank_etaq(), L1MuGMTLFMergeRankPtQLUT::SpecificLookup_rank_ptq(), and L1MuRegionalCand::type_idx().

Referenced by createMergedCand().

00530                                                                 {
00531 
00532   if ( muon == 0 || muon->empty() ) return 0;
00533 
00534   unsigned lut_idx= muon->type_idx();
00535   
00536   // obtain inputs as coded in HW
00537   unsigned eta = muon->eta_packed();
00538   unsigned q = muon->quality_packed();
00539   unsigned pt  = muon->pt_packed();
00540   unsigned phi = muon->phi_packed();
00541 
00542   // lookup eta-q
00543   L1MuGMTLFMergeRankEtaQLUT* etaq_lut = L1MuGMTConfig::getLFMergeRankEtaQLUT();
00544   unsigned rank_etaq = etaq_lut->SpecificLookup_rank_etaq (lut_idx, eta, q);
00545   unsigned flag = etaq_lut->SpecificLookup_flag (lut_idx, eta, q);
00546    
00547   // lookup pt-q
00548   L1MuGMTLFMergeRankPtQLUT* ptq_lut = L1MuGMTConfig::getLFMergeRankPtQLUT();
00549   unsigned rank_ptq = ptq_lut->SpecificLookup_rank_ptq (lut_idx, q, pt);
00550   
00551   // lookup etaphi
00552   L1MuGMTLFMergeRankEtaPhiLUT* etaphi_lut = L1MuGMTConfig::getLFMergeRankEtaPhiLUT();
00553   unsigned rank_etaphi = etaphi_lut->SpecificLookup_rank_etaphi (lut_idx, eta, phi);
00554   
00555   // combine
00556   L1MuGMTLFMergeRankCombineLUT* combine_lut = L1MuGMTConfig::getLFMergeRankCombineLUT();
00557   unsigned rank = combine_lut->SpecificLookup_merge_rank (lut_idx, rank_etaq, rank_ptq, rank_etaphi);
00558 
00559   int rank_signed = rank;
00560 
00561   if (flag == 1) rank_signed *= -1;
00562    
00563   return rank_signed;
00564 }

void L1MuGMTMerger::print ( void   )  const

print results after selection

Definition at line 125 of file L1MuGMTMerger.cc.

References iter, and m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

00125                                 {
00126 
00127   edm::LogVerbatim("GMT_Merger_info") << " ";
00128 
00129   std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
00130   for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
00131     if ( *iter && !(*iter)->empty() ) (*iter)->print();
00132   }
00133   
00134   edm::LogVerbatim("GMT_Merger_info") << " ";
00135 
00136 }

unsigned L1MuGMTMerger::projectedPhi ( const L1MuRegionalCand mu  )  const [private]

Definition at line 326 of file L1MuGMTMerger.cc.

References L1MuRegionalCand::charge_packed(), L1MuRegionalCand::eta_packed(), L1MuGMTConfig::getLFPhiProEtaConvLUT(), L1MuGMTConfig::getLFPhiProLUT(), L1MuSignedPacking< Bits >::idxFromPacked(), L1MuRegionalCand::phi_packed(), L1MuRegionalCand::pt_packed(), L1MuGMTLFPhiProLUT::SpecificLookup_dphi(), L1MuGMTLFPhiProEtaConvLUT::SpecificLookup_eta_out(), and L1MuRegionalCand::type_idx().

Referenced by createDTCSCCand(), createMergedCand(), and createRPCCand().

00326                                                                      {
00327 
00328   // convert eta
00329   L1MuGMTLFPhiProEtaConvLUT* phiproetaconv_lut = L1MuGMTConfig::getLFPhiProEtaConvLUT();
00330   unsigned eta4 = phiproetaconv_lut->SpecificLookup_eta_out (mu->type_idx(), mu->eta_packed() );
00331   
00332   // look up delta-phi 9 bit signed
00333   L1MuGMTLFPhiProLUT* phipro_lut = L1MuGMTConfig::getLFPhiProLUT();
00334   unsigned dphi9 = phipro_lut->SpecificLookup_dphi (mu->type_idx(), eta4, mu->pt_packed(), mu->charge_packed());
00335   
00336   // sign extend
00337   L1MuSignedPacking<9> DPhiPacking;
00338   int dphi = DPhiPacking.idxFromPacked( dphi9 );
00339   
00340   // add modulo 144
00341   int newphi = mu->phi_packed() + dphi; 
00342   if (newphi < 0) newphi += 144;
00343   if (newphi >= 144) newphi -= 144;
00344 
00345   return (unsigned) newphi;  
00346 }

void L1MuGMTMerger::reset ( void   ) 

clear Merger

Definition at line 104 of file L1MuGMTMerger.cc.

References dtcsc_mu, i, iter, m_MuonCands, and rpc_mu.

Referenced by L1MuGlobalMuonTrigger::reset(), and ~L1MuGMTMerger().

00104                           {
00105 
00106   for ( int i = 0; i < 4; i++ ) {  
00107     dtcsc_mu[i] = 0;
00108     rpc_mu[i] = 0;
00109   }
00110   
00111   std::vector<L1MuGMTExtendedCand*>::iterator iter;
00112   for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
00113     if ( *iter ) delete (*iter); 
00114     *iter = 0;
00115   }
00116 
00117   m_MuonCands.clear();
00118 
00119 }

void L1MuGMTMerger::run ( void   ) 

run GMT Merger

Definition at line 95 of file L1MuGMTMerger.cc.

References load(), and merge().

Referenced by L1MuGlobalMuonTrigger::produce().

00095                         {
00096   load();
00097   merge();  
00098 }

int L1MuGMTMerger::selectDTCSC ( unsigned  MMconfig,
int  by_rank,
int  by_pt,
int  by_combi 
) const [private]

Definition at line 304 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

00304                                                                                             {
00305   return 
00306     (   (MMconfig & 32) == 32 ) ||
00307     ( ( (MMconfig &  8) ==  8 ) && by_rank ) ||
00308     ( ( (MMconfig &  4) ==  4 ) && by_pt   ) ||
00309     ( ( (MMconfig &  2) ==  2 ) && by_combi);
00310 
00311 } 

unsigned L1MuGMTMerger::sysign ( const L1MuRegionalCand mu  )  const [private]

Definition at line 349 of file L1MuGMTMerger.cc.

References L1MuRegionalCand::charge_packed(), and L1MuRegionalCand::charge_valid_packed().

Referenced by createDTCSCCand(), createMergedCand(), and createRPCCand().

00349                                                                {
00350 
00351   unsigned sysign = mu->charge_packed();
00352 
00353   if ( mu->charge_valid_packed() == 0 )
00354     sysign = 2; // undefined charge
00355 
00356   return sysign;
00357 }


Member Data Documentation

std::vector<const L1MuRegionalCand*> L1MuGMTMerger::dtcsc_mu [private]

Definition at line 113 of file L1MuGMTMerger.h.

Referenced by createDTCSCCand(), createMergedCand(), L1MuGMTMerger(), load(), merge(), and reset().

const L1MuGlobalMuonTrigger& L1MuGMTMerger::m_gmt [private]

Definition at line 110 of file L1MuGMTMerger.h.

Referenced by createDTCSCCand(), createMergedCand(), createRPCCand(), load(), and merge().

int L1MuGMTMerger::m_id [private]

Definition at line 111 of file L1MuGMTMerger.h.

Referenced by createDTCSCCand(), createMergedCand(), createRPCCand(), id(), load(), and merge().

std::vector<L1MuGMTExtendedCand*> L1MuGMTMerger::m_MuonCands [private]

Definition at line 116 of file L1MuGMTMerger.h.

Referenced by Cands(), createDTCSCCand(), createMergedCand(), createRPCCand(), merge(), print(), and reset().

std::vector<const L1MuRegionalCand*> L1MuGMTMerger::rpc_mu [private]

Definition at line 114 of file L1MuGMTMerger.h.

Referenced by createMergedCand(), createRPCCand(), L1MuGMTMerger(), load(), merge(), and reset().

std::vector<int> L1MuGMTMerger::singleRank [private]

Definition at line 118 of file L1MuGMTMerger.h.


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