CMS 3D CMS Logo

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

#include <L1MuGMTMerger.h>

Public Member Functions

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

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. More...
 
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< int > singleRank
 

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.

73  :
74  m_gmt(gmt), m_id(id), dtcsc_mu(4), rpc_mu(4) {
75 
76  dtcsc_mu.reserve(4);
77  rpc_mu.reserve(4);
78 
79 }
std::vector< const L1MuRegionalCand * > dtcsc_mu
const L1MuGlobalMuonTrigger & m_gmt
std::vector< const L1MuRegionalCand * > rpc_mu
L1MuGMTMerger::~L1MuGMTMerger ( )
virtual

destructor

Definition at line 84 of file L1MuGMTMerger.cc.

References reset().

84  {
85  reset();
86 }
void reset()
clear Merger

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

86 { return m_MuonCands; }
std::vector< L1MuGMTExtendedCand * > 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().

321  {
323  return etaconv_lut->SpecificLookup_eta_gmt (mu->type_idx(), mu->eta_packed() );
324 }
unsigned SpecificLookup_eta_gmt(int idx, unsigned eta_regional) const
specific lookup function for eta_gmt
unsigned eta_packed() const
return eta packed as in hardware
static L1MuGMTLFEtaConvLUT * getLFEtaConvLUT()
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
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().

242  {
243  L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
244 
245  tmpmuon->setBx(dtcsc_mu[idx_dtcsc]->bx());
246  tmpmuon->setPhiPacked( projectedPhi(dtcsc_mu[idx_dtcsc]) );
247  tmpmuon->setEtaPacked( convertedEta(dtcsc_mu[idx_dtcsc]) );
248  tmpmuon->setPtPacked( dtcsc_mu[idx_dtcsc]->pt_packed() );
249  tmpmuon->setChargePacked( sysign(dtcsc_mu[idx_dtcsc]) );
250  tmpmuon->setMIP( m_gmt.MipIsoAU(m_id)->MIP(idx_dtcsc) );
251  tmpmuon->setIsolation ( m_gmt.MipIsoAU(m_id)->ISO(idx_dtcsc) );
252  tmpmuon->setRank( L1MuGMTSortRankUnit::sort_rank(dtcsc_mu[idx_dtcsc]) );
253 
254  unsigned quality = 0;
256  case 0: quality = 6; break; //DT/CSC
257  case 1: quality = 2; break; //VERY LOW QUALITY LEVEL 1
258  case 2: quality = 3; break; //VERY LOW QUALITY LEVEL 2
259  case 3: quality = 4; break; //VERY LOW QUALITY LEVEL 3
260  }
261 
262  if ( (m_id==1) && (dtcsc_mu[idx_dtcsc]->finehalo_packed() == 1) )
263  quality = 1; // HALO quality
264 
265  tmpmuon->setQuality( quality ); // RPC
266  tmpmuon->setDTCSCIndex(idx_dtcsc);
267  tmpmuon->setRPCIndex(0);
268  tmpmuon->setFwdBit( m_id );
269  tmpmuon->setRPCBit( 0 );
270 
271  m_MuonCands.push_back(tmpmuon);
272 }
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:156
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:168
std::vector< L1MuGMTExtendedCand * > m_MuonCands
void setDTCSCIndex(unsigned int idxdtcsc)
set index of contributing DT/CSC muon
bool MIP(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
unsigned projectedPhi(const L1MuRegionalCand *mu) const
static unsigned getVeryLowQualityLevel(const L1MuRegionalCand *)
Very low quality bits.
std::vector< const L1MuRegionalCand * > dtcsc_mu
const L1MuGlobalMuonTrigger & m_gmt
void setFwdBit(unsigned int fwdbit)
set forward bit (1=forward, 0=barrel)
static unsigned sort_rank(const L1MuRegionalCand *)
Sort Rank Table.
void setBx(int bx)
set bunch crossing identifier
Definition: L1MuGMTCand.h:174
unsigned sysign(const L1MuRegionalCand *mu) const
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
Definition: L1MuGMTCand.h:171
unsigned convertedEta(const L1MuRegionalCand *mu) const
const L1MuGMTMipIsoAU * MipIsoAU(int id) const
return pointer to MIP &amp; ISO bit assignment unit
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:159
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:162
void setRPCBit(unsigned int rpcbit)
set RPC bit (1=RPC, 0=DT/CSC or matched)
void setRank(unsigned int rank)
set rank
bool ISO(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
void setRPCIndex(unsigned int idxrpc)
set index of contributing RPC muon
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
Definition: L1MuGMTCand.h:153
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:165
void L1MuGMTMerger::createMergedCand ( int  idx_dtcsc,
int  idx_rpc 
)
private

Definition at line 359 of file L1MuGMTMerger.cc.

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

359  {
360 
361  // In the hardware matrices of select_bits are calculated for all
362  // possible pairings.
363  // In ORCA we only calculate selec-bits for the actual
364  // pairs to save time.
365 
366  // look up merge ranks
367  int merge_rank_dtcsc = merge_rank(dtcsc_mu[idx_dtcsc]);
368  int merge_rank_rpc = merge_rank(rpc_mu[idx_rpc]);
369 
370  // calculate select-bits (1: take DT/CSC, 0: take RPC)
371  // fix: if equal prefer DT/CSC as in HW!
372 // int selected_by_rank = abs(merge_rank_dtcsc) > abs(merge_rank_rpc);
373  int selected_by_rank = abs(merge_rank_dtcsc) >= abs(merge_rank_rpc);
374  int selected_by_pt = dtcsc_mu[idx_dtcsc]->pt_packed() <= rpc_mu[idx_rpc]->pt_packed();
375 
376  // Selection by combination of min pt and higher rank
377  // select by rank if both flags are set, otherwise by min pt
378  // in other words: select by minpt if one flag is not set
379  int selected_by_combi = (merge_rank_dtcsc<0 && merge_rank_rpc<0) ? selected_by_rank : selected_by_pt;
380 
381 
382  L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
383 
384  tmpmuon->setBx(dtcsc_mu[idx_dtcsc]->bx());
385 
386 
387  // merge phi
388  // unsigned MMConfig_phi = 32; // take DT
389  unsigned MMConfig_phi = L1MuGMTConfig::getRegMMConfigPhi()->getValue(m_id);
390 
391  unsigned phi = 0;
392 
393  if (selectDTCSC(MMConfig_phi, selected_by_rank, selected_by_pt, selected_by_combi) )
394  phi = projectedPhi( dtcsc_mu[idx_dtcsc] );
395  else
396  phi = projectedPhi( rpc_mu[idx_rpc] );
397 
398  tmpmuon->setPhiPacked( phi );
399 
400  // merge eta
401  unsigned MMConfig_eta = L1MuGMTConfig::getRegMMConfigEta()->getValue(m_id);
402 
403  unsigned eta = 0;
404 
405  if (doSpecialMerge( MMConfig_eta ) ) {
406  if ( (m_id == 1) || dtcsc_mu[idx_dtcsc]->finehalo_packed() )
407  eta = convertedEta( dtcsc_mu[idx_dtcsc] );
408  else
409  eta = convertedEta( rpc_mu[idx_rpc] );
410  }
411  else {
412  if ( selectDTCSC(MMConfig_eta, selected_by_rank, selected_by_pt, selected_by_combi) )
413  eta = convertedEta( dtcsc_mu[idx_dtcsc] );
414  else
415  eta = convertedEta( rpc_mu[idx_rpc] );
416  }
417  tmpmuon->setEtaPacked( eta );
418 
419  // merge pt
420  unsigned MMConfig_pt = L1MuGMTConfig::getRegMMConfigPt()->getValue(m_id);
421 
422  unsigned pt = 0;
423 
424  if (doSpecialMerge( MMConfig_pt ) ) { // mix pt
426  pt = ptmix_lut->SpecificLookup_pt_mixed (m_id, dtcsc_mu[idx_dtcsc]->pt_packed(),
427  rpc_mu[idx_rpc]->pt_packed());
428  }
429  else {
430  if ( selectDTCSC(MMConfig_pt, selected_by_rank, selected_by_pt, selected_by_combi) )
431  pt = dtcsc_mu[idx_dtcsc]->pt_packed();
432  else
433  pt = rpc_mu[idx_rpc]->pt_packed();
434  }
435  tmpmuon->setPtPacked( pt );
436 
437  // merge charge
438  unsigned MMConfig_charge = L1MuGMTConfig::getRegMMConfigCharge()->getValue(m_id);
439 
440  unsigned sy_sign = 0;
441 
442  if (doSpecialMerge( MMConfig_charge ) ) {
443  // based on charge valid bits
444  if ( rpc_mu[idx_rpc]->charge_valid_packed()==1 && dtcsc_mu[idx_dtcsc]->charge_valid_packed()==0 )
445  sy_sign = sysign(rpc_mu[idx_rpc]);
446  else
447  sy_sign = sysign(dtcsc_mu[idx_dtcsc]);
448  }
449  else {
450  if ( selectDTCSC(MMConfig_charge, selected_by_rank, selected_by_pt, selected_by_combi) )
451  sy_sign = sysign(dtcsc_mu[idx_dtcsc]);
452  else
453  sy_sign = sysign(rpc_mu[idx_rpc]);
454  }
455  tmpmuon->setChargePacked( sy_sign );
456 
457  // merge quality
458 
459 
460  // merge MIP
461  unsigned MMConfig_MIP = L1MuGMTConfig::getRegMMConfigMIP()->getValue(m_id);
462 
463  bool mip_bit = false;
464 
465  bool mip_bit_dtcsc = m_gmt.MipIsoAU(m_id)->MIP(idx_dtcsc);
466  bool mip_bit_rpc = m_gmt.MipIsoAU(m_id)->MIP(idx_rpc+4);
467 
468  if ( doSpecialMerge(MMConfig_MIP) ) {
469  if ( doANDMerge(MMConfig_MIP) )
470  mip_bit = mip_bit_dtcsc && mip_bit_rpc;
471  else
472  mip_bit = mip_bit_dtcsc || mip_bit_rpc;
473  }
474  else {
475  if ( selectDTCSC(MMConfig_MIP, selected_by_rank, selected_by_pt, selected_by_combi) )
476  mip_bit = mip_bit_dtcsc;
477  else
478  mip_bit = mip_bit_rpc;
479  }
480 
481  tmpmuon->setMIP(mip_bit);
482 
483  // merge ISO
484  unsigned MMConfig_ISO = L1MuGMTConfig::getRegMMConfigISO()->getValue(m_id);
485 
486  bool iso_bit = false;
487 
488  bool iso_bit_dtcsc = m_gmt.MipIsoAU(m_id)->ISO(idx_dtcsc);
489  bool iso_bit_rpc = m_gmt.MipIsoAU(m_id)->ISO(idx_rpc+4);
490 
491  if ( doSpecialMerge(MMConfig_ISO) ) {
492  if ( doANDMerge(MMConfig_ISO) )
493  iso_bit = iso_bit_dtcsc && iso_bit_rpc;
494  else
495  iso_bit = iso_bit_dtcsc || iso_bit_rpc;
496  }
497  else {
498  if ( selectDTCSC(MMConfig_ISO, selected_by_rank, selected_by_pt, selected_by_combi) )
499  iso_bit = iso_bit_dtcsc;
500  else
501  iso_bit = iso_bit_rpc;
502  }
503 
504  tmpmuon->setIsolation(iso_bit);
505 
506  // merge sort rank
507  unsigned MMConfig_SRK = L1MuGMTConfig::getRegMMConfigSRK()->getValue(m_id);
508 
509  unsigned rank_offset = L1MuGMTConfig::getRegSortRankOffset()->getValue(m_id);
510 
511  unsigned rank = 0;
512  if ( selectDTCSC(MMConfig_SRK, selected_by_rank, selected_by_pt, selected_by_combi) )
513  rank = L1MuGMTSortRankUnit::sort_rank(dtcsc_mu[idx_dtcsc]) + rank_offset;
514  else
515  rank = L1MuGMTSortRankUnit::sort_rank(rpc_mu[idx_rpc]) + rank_offset;
516 
517  tmpmuon->setRank(rank);
518 
519  // quality of merged candidate
520  tmpmuon->setQuality( 7 ); // code for matched muons
521 
522  tmpmuon->setDTCSCIndex(idx_dtcsc);
523  tmpmuon->setRPCIndex(idx_rpc);
524  tmpmuon->setFwdBit( m_id );
525  tmpmuon->setRPCBit( 0 );
526 
527  m_MuonCands.push_back(tmpmuon);
528 }
static L1MuGMTRegMMConfigISO * getRegMMConfigISO()
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:156
static L1MuGMTRegMMConfigCharge * getRegMMConfigCharge()
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:168
std::vector< L1MuGMTExtendedCand * > m_MuonCands
static L1MuGMTRegMMConfigEta * getRegMMConfigEta()
unsigned getValue(int idx)
get Value
Definition: L1MuGMTReg.h:57
void setDTCSCIndex(unsigned int idxdtcsc)
set index of contributing DT/CSC muon
#define abs(x)
Definition: mlp_lapack.h:159
bool MIP(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
T eta() const
int selectDTCSC(unsigned MMconfig, int by_rank, int by_pt, int by_combi) const
unsigned projectedPhi(const L1MuRegionalCand *mu) const
std::vector< const L1MuRegionalCand * > dtcsc_mu
static L1MuGMTRegMMConfigSRK * getRegMMConfigSRK()
const L1MuGlobalMuonTrigger & m_gmt
void setFwdBit(unsigned int fwdbit)
set forward bit (1=forward, 0=barrel)
static L1MuGMTRegMMConfigPhi * getRegMMConfigPhi()
static L1MuGMTRegMMConfigPt * getRegMMConfigPt()
static unsigned sort_rank(const L1MuRegionalCand *)
Sort Rank Table.
void setBx(int bx)
set bunch crossing identifier
Definition: L1MuGMTCand.h:174
static L1MuGMTLFPtMixLUT * getLFPtMixLUT()
unsigned sysign(const L1MuRegionalCand *mu) const
int doANDMerge(unsigned MMconfig) const
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
Definition: L1MuGMTCand.h:171
unsigned SpecificLookup_pt_mixed(int idx, unsigned pt_dtcsc, unsigned pt_rpc) const
specific lookup function for pt_mixed
unsigned convertedEta(const L1MuRegionalCand *mu) const
int merge_rank(const L1MuRegionalCand *) const
Merge Rank Table.
std::vector< const L1MuRegionalCand * > rpc_mu
const L1MuGMTMipIsoAU * MipIsoAU(int id) const
return pointer to MIP &amp; ISO bit assignment unit
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:159
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:162
void setRPCBit(unsigned int rpcbit)
set RPC bit (1=RPC, 0=DT/CSC or matched)
void setRank(unsigned int rank)
set rank
bool ISO(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
static L1MuGMTRegSortRankOffset * getRegSortRankOffset()
static L1MuGMTRegMMConfigMIP * getRegMMConfigMIP()
void setRPCIndex(unsigned int idxrpc)
set index of contributing RPC muon
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
Definition: L1MuGMTCand.h:153
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:165
int doSpecialMerge(unsigned MMconfig) const
Definition: DDAxes.h:10
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().

275  {
276  L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
277 
278  tmpmuon->setBx(rpc_mu[idx_rpc]->bx());
279  tmpmuon->setPhiPacked( projectedPhi(rpc_mu[idx_rpc]) );
280  tmpmuon->setEtaPacked( convertedEta(rpc_mu[idx_rpc]) );
281  tmpmuon->setPtPacked( rpc_mu[idx_rpc]->pt_packed() );
282  tmpmuon->setChargePacked( sysign( rpc_mu[idx_rpc] ) );
283  tmpmuon->setMIP( m_gmt.MipIsoAU(m_id)->MIP(idx_rpc+4) );
284  tmpmuon->setIsolation ( m_gmt.MipIsoAU(m_id)->ISO(idx_rpc+4) );
285  tmpmuon->setRank( L1MuGMTSortRankUnit::sort_rank(rpc_mu[idx_rpc]) );
286 
287  unsigned quality = 0;
289  case 0: quality = 5; break; //RPC
290  case 1: quality = 2; break; //VERY LOW QUALITY LEVEL1
291  case 2: quality = 3; break; //VERY LOW QUALITY LEVEL2
292  case 3: quality = 4; break; //VERY LOW QUALITY LEVEL3
293  }
294 
295  tmpmuon->setQuality( quality ); // RPC
296  tmpmuon->setDTCSCIndex(0);
297  tmpmuon->setRPCIndex(idx_rpc);
298  tmpmuon->setFwdBit( m_id );
299  tmpmuon->setRPCBit( 1 );
300 
301  m_MuonCands.push_back(tmpmuon);
302 }
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:156
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:168
std::vector< L1MuGMTExtendedCand * > m_MuonCands
void setDTCSCIndex(unsigned int idxdtcsc)
set index of contributing DT/CSC muon
bool MIP(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
unsigned projectedPhi(const L1MuRegionalCand *mu) const
static unsigned getVeryLowQualityLevel(const L1MuRegionalCand *)
Very low quality bits.
const L1MuGlobalMuonTrigger & m_gmt
void setFwdBit(unsigned int fwdbit)
set forward bit (1=forward, 0=barrel)
static unsigned sort_rank(const L1MuRegionalCand *)
Sort Rank Table.
void setBx(int bx)
set bunch crossing identifier
Definition: L1MuGMTCand.h:174
unsigned sysign(const L1MuRegionalCand *mu) const
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
Definition: L1MuGMTCand.h:171
unsigned convertedEta(const L1MuRegionalCand *mu) const
std::vector< const L1MuRegionalCand * > rpc_mu
const L1MuGMTMipIsoAU * MipIsoAU(int id) const
return pointer to MIP &amp; ISO bit assignment unit
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:159
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:162
void setRPCBit(unsigned int rpcbit)
set RPC bit (1=RPC, 0=DT/CSC or matched)
void setRank(unsigned int rank)
set rank
bool ISO(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
void setRPCIndex(unsigned int idxrpc)
set index of contributing RPC muon
void setPhiPacked(unsigned phi)
set packed phi-code of muon candidate
Definition: L1MuGMTCand.h:153
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:165
int L1MuGMTMerger::doANDMerge ( unsigned  MMconfig) const
private

Definition at line 317 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

317  {
318  return (MMconfig & 64) == 64;
319 }
int L1MuGMTMerger::doSpecialMerge ( unsigned  MMconfig) const
private

Definition at line 313 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

313  {
314  return (MMconfig & 1) == 1;
315 }
int L1MuGMTMerger::id ( void  ) const
inline

return identifier

Definition at line 83 of file L1MuGMTMerger.h.

References m_id.

83 { return m_id; }
void L1MuGMTMerger::load ( )
private

Definition at line 142 of file L1MuGMTMerger.cc.

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

Referenced by run().

142  {
143 
144  // barrel Merger gets DTBX and barrel RPC muons
145  if ( m_id == 0 ) {
146  for ( unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++ ) {
147  dtcsc_mu[idt] = m_gmt.Data()->DTBXMuon(idt);
148  }
149  for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++ ) {
150  rpc_mu[irpc] = m_gmt.Data()->RPCMuon(irpc);
151  }
152  }
153 
154  // endcap Merger gets CSC and endcap RPC muons
155  if ( m_id == 1 ) {
156  for ( unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++ ) {
157  dtcsc_mu[icsc] = m_gmt.Data()->CSCMuon(icsc);
158  }
159  for ( unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++ ) {
160  rpc_mu[irpc] = m_gmt.Data()->RPCMuon(irpc+4);
161  }
162  }
163 
164 }
const L1MuRegionalCand * CSCMuon(int index) const
get CSC muon
Definition: L1MuGMTPSB.cc:252
std::vector< const L1MuRegionalCand * > dtcsc_mu
const L1MuGlobalMuonTrigger & m_gmt
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 * > rpc_mu
const L1MuRegionalCand * DTBXMuon(int index) const
get DTBX muon
Definition: L1MuGMTPSB.cc:242
static const unsigned int MAXRPCbarrel
Definition: L1MuGMTConfig.h:90
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().

167  {
168 
169  const L1MuGMTMatrix<bool>& pairM = m_gmt.Matcher(m_id)->pairM();
170 
171  // Handling of cancel-out and empty muons is different in software and hardware
172  //
173  // - in hardware, a candidate may be empty (pt_code == 0) and an empty bit
174  // is passed to the sorter in order to suppress the candidate. In the
175  // software no candidate is created in this case.
176  //
177  // - in hardware, RPC candidates are passed to the sorter even if they are
178  // also used in a matched pair. They are then suppressed in the sorter. In
179  // software no RPC candidate is created if the muon is used in a pair.
180  //
181  // - in hardware, cancel-out signals from the cancel-out units in the own and
182  // other Logic FPGA are passed to the sorter in order to cancel out muons.
183  // In software the cancel-out signals are alrady checked here in the merger
184  // and no candidates are created for cancelled muons.
185  //
186  // There may therefore be less muons passed to the sorter in software than
187  // in Hardware. At the output of the first sorter stage the results should
188  // be comparable, again.
189 
190  unsigned HaloOverwritesMatched = 1;
191 
192  // loop over DT/CSC muons
193  for (int i=0; i<4; i++) {
194  if (dtcsc_mu[i] != 0) {
195 
196  int match_idx = pairM.rowAny(i);
197 
198  int csc_is_halo = (m_id==1) && (dtcsc_mu[i]->finehalo_packed() == 1);
199 
200  if ( (match_idx != -1) && // is it matched?
201  (! (csc_is_halo && HaloOverwritesMatched) ) )
202  createMergedCand(i, match_idx);
203  else {
204  // check my first and the other chip's second cancel-out units
205  if ((! m_gmt.CancelOutUnit(m_id)->cancelMyChipMuon(i) ) &&
208  createDTCSCCand(i);
209  }
210  }
211  }
212 
213  // additionally loop over RPC muons
214  for (int j=0; j<4; j++) {
215  if (rpc_mu[j] != 0) {
216 
217  int match_idx = pairM.colAny(j);
218 
219  if (match_idx == -1) { // is it unmatched?
220  if ((! m_gmt.CancelOutUnit(m_id+2)->cancelMyChipMuon(j) ) &&
222  createRPCCand(j);
223  }
224  }
225  }
226 
227  // set physical values in the GMT candidates for use in the analysis
228  const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
229  const L1MuTriggerPtScale* theTriggerPtScale = L1MuGMTConfig::getTriggerPtScale();
230 
231  std::vector<L1MuGMTExtendedCand*>::const_iterator icand;
232  for(icand=m_MuonCands.begin();icand!=m_MuonCands.end();icand++) {
233  L1MuGMTExtendedCand* cand = (*icand);
234  cand->setPhiValue( theTriggerScales->getPhiScale()->getLowEdge( cand->phiIndex() ));
235  cand->setEtaValue( theTriggerScales->getGMTEtaScale()->getCenter( cand->etaIndex() ));
236  cand->setPtValue( theTriggerPtScale->getPtScale()->getLowEdge( cand->ptIndex() ));
237  // cand->setPtValue( theTriggerScales->getPtScale()->getLowEdge( cand->ptIndex() ));
238  }
239 
240 }
int i
Definition: DBlmapReader.cc:9
const L1MuGMTMatcher * Matcher(int id) const
return pointer to Matcher
std::vector< L1MuGMTExtendedCand * > m_MuonCands
const L1MuScale * getPtScale() const
get the Pt scale
unsigned int phiIndex() const
get phi-code
Definition: L1MuGMTCand.h:75
static bool isDisabled(const L1MuRegionalCand *)
Diable bit.
virtual float getLowEdge(unsigned packed) const =0
get the low edge of bin represented by packed
void createMergedCand(int idx_dtcsc, int idx_rpc)
unsigned int etaIndex() const
get eta-code
Definition: L1MuGMTCand.h:110
int rowAny(int r) const
is any element in row r &gt; 0 ? return index or -1
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
void createDTCSCCand(int idx_dtcsc)
std::vector< const L1MuRegionalCand * > dtcsc_mu
const L1MuGlobalMuonTrigger & m_gmt
void setPhiValue(float phiVal)
Setters for physical values.
Definition: L1MuGMTCand.h:179
const bool cancelMyChipMuon(int idx) const
return cancel bit for DT (m_id==0 || m_id==3) or CSC (m_id==1 || m_id==2) muon
const L1MuScale * getPhiScale() const
get the phi scale
int j
Definition: DBlmapReader.cc:9
const L1MuGMTCancelOutUnit * CancelOutUnit(int id) const
return pointer to Cancel Out Unit
static const L1MuTriggerPtScale * getTriggerPtScale()
std::vector< const L1MuRegionalCand * > rpc_mu
static const L1MuTriggerScales * getTriggerScales()
void setEtaValue(float etaVal)
Set Eta Value (need to set type, first)
Definition: L1MuGMTCand.h:185
const bool cancelOtherChipMuon(int idx) const
return cancel bit for barrel RPC (m_id==2) or forward RPC (m_id==3) muon
const L1MuGMTMatrix< bool > & pairM() const
return pair matrix
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
void setPtValue(float ptVal)
Set Pt Value.
Definition: L1MuGMTCand.h:182
unsigned int ptIndex() const
get pt-code
Definition: L1MuGMTCand.h:78
int colAny(int c) const
is any element in column c &gt; 0 ? return index or -1
void createRPCCand(int idx_rpc)
int L1MuGMTMerger::merge_rank ( const L1MuRegionalCand muon) const
private

Merge Rank Table.

Definition at line 532 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(), lumiQueryAPI::q, 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().

532  {
533 
534  if ( muon == 0 || muon->empty() ) return 0;
535 
536  unsigned lut_idx= muon->type_idx();
537 
538  // obtain inputs as coded in HW
539  unsigned eta = muon->eta_packed();
540  unsigned q = muon->quality_packed();
541  unsigned pt = muon->pt_packed();
542  unsigned phi = muon->phi_packed();
543 
544  // lookup eta-q
546  unsigned rank_etaq = etaq_lut->SpecificLookup_rank_etaq (lut_idx, eta, q);
547  unsigned flag = etaq_lut->SpecificLookup_flag (lut_idx, eta, q);
548 
549  // lookup pt-q
551  unsigned rank_ptq = ptq_lut->SpecificLookup_rank_ptq (lut_idx, q, pt);
552 
553  // lookup etaphi
555  unsigned rank_etaphi = etaphi_lut->SpecificLookup_rank_etaphi (lut_idx, eta, phi);
556 
557  // combine
559  unsigned rank = combine_lut->SpecificLookup_merge_rank (lut_idx, rank_etaq, rank_ptq, rank_etaphi);
560 
561  int rank_signed = rank;
562 
563  if (flag == 1) rank_signed *= -1;
564 
565  return rank_signed;
566 }
unsigned SpecificLookup_rank_ptq(int idx, unsigned q, unsigned pt) const
specific lookup function for rank_ptq
unsigned SpecificLookup_rank_etaphi(int idx, unsigned eta, unsigned phi) const
specific lookup function for rank_etaphi
long int flag
Definition: mlp_lapack.h:47
static L1MuGMTLFMergeRankPtQLUT * getLFMergeRankPtQLUT()
virtual bool empty() const
return empty flag
T eta() const
unsigned SpecificLookup_merge_rank(int idx, unsigned rank_etaq, unsigned rank_ptq, unsigned rank_etaphi) const
specific lookup function for merge_rank
unsigned eta_packed() const
return eta packed as in hardware
unsigned SpecificLookup_rank_etaq(int idx, unsigned eta, unsigned q) const
specific lookup function for rank_etaq
static L1MuGMTLFMergeRankEtaPhiLUT * getLFMergeRankEtaPhiLUT()
unsigned SpecificLookup_flag(int idx, unsigned eta, unsigned q) const
specific lookup function for flag
static L1MuGMTLFMergeRankCombineLUT * getLFMergeRankCombineLUT()
unsigned int quality_packed() const
return quality packed as in hardware
unsigned pt_packed() const
return pt packed as in hardware
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
static L1MuGMTLFMergeRankEtaQLUT * getLFMergeRankEtaQLUT()
unsigned phi_packed() const
return phi packed as in hardware
Definition: DDAxes.h:10
void L1MuGMTMerger::print ( void  ) const

print results after selection

Definition at line 125 of file L1MuGMTMerger.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

125  {
126 
127  edm::LogVerbatim("GMT_Merger_info") << " ";
128 
129  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
130  for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
131  if ( *iter && !(*iter)->empty() ) (*iter)->print();
132  }
133 
134  edm::LogVerbatim("GMT_Merger_info") << " ";
135 
136 }
std::vector< L1MuGMTExtendedCand * > m_MuonCands
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().

326  {
327 
328  // convert eta
330  unsigned eta4 = phiproetaconv_lut->SpecificLookup_eta_out (mu->type_idx(), mu->eta_packed() );
331 
332  // look up delta-phi 9 bit signed
334  unsigned dphi9 = phipro_lut->SpecificLookup_dphi (mu->type_idx(), eta4, mu->pt_packed(), mu->charge_packed());
335 
336  // sign extend
337  L1MuSignedPacking<9> DPhiPacking;
338  int dphi = DPhiPacking.idxFromPacked( dphi9 );
339 
340  // add modulo 144
341  int newphi = mu->phi_packed() + dphi;
342  if (newphi < 0) newphi += 144;
343  if (newphi >= 144) newphi -= 144;
344 
345  return (unsigned) newphi;
346 }
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
virtual int idxFromPacked(unsigned packed) const
get the value from the packed notation (+/-)
Definition: L1MuPacking.h:92
unsigned SpecificLookup_dphi(int idx, unsigned eta, unsigned pt, unsigned charge) const
specific lookup function for dphi
unsigned SpecificLookup_eta_out(int idx, unsigned eta_in) const
specific lookup function for eta_out
static L1MuGMTLFPhiProLUT * getLFPhiProLUT()
unsigned eta_packed() const
return eta packed as in hardware
unsigned pt_packed() const
return pt packed as in hardware
static L1MuGMTLFPhiProEtaConvLUT * getLFPhiProEtaConvLUT()
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
unsigned phi_packed() const
return phi packed as in hardware
void L1MuGMTMerger::reset ( void  )

clear Merger

Definition at line 104 of file L1MuGMTMerger.cc.

References dtcsc_mu, i, m_MuonCands, and rpc_mu.

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

104  {
105 
106  for ( int i = 0; i < 4; i++ ) {
107  dtcsc_mu[i] = 0;
108  rpc_mu[i] = 0;
109  }
110 
111  std::vector<L1MuGMTExtendedCand*>::iterator iter;
112  for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
113  if ( *iter ) delete (*iter);
114  *iter = 0;
115  }
116 
117  m_MuonCands.clear();
118 
119 }
int i
Definition: DBlmapReader.cc:9
std::vector< L1MuGMTExtendedCand * > m_MuonCands
std::vector< const L1MuRegionalCand * > dtcsc_mu
std::vector< const L1MuRegionalCand * > rpc_mu
void L1MuGMTMerger::run ( void  )

run GMT Merger

Definition at line 95 of file L1MuGMTMerger.cc.

References load(), and merge().

Referenced by L1MuGlobalMuonTrigger::produce().

95  {
96  load();
97  merge();
98 }
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().

304  {
305  return
306  ( (MMconfig & 32) == 32 ) ||
307  ( ( (MMconfig & 8) == 8 ) && by_rank ) ||
308  ( ( (MMconfig & 4) == 4 ) && by_pt ) ||
309  ( ( (MMconfig & 2) == 2 ) && by_combi);
310 
311 }
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().

349  {
350 
351  unsigned sysign = mu->charge_packed();
352 
353  if ( mu->charge_valid_packed() == 0 )
354  sysign = 2; // undefined charge
355 
356  return sysign;
357 }
unsigned charge_valid_packed() const
return charge valid packed as in hardware (1=valid, 0=not valid)
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
unsigned sysign(const L1MuRegionalCand *mu) const

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