CMS 3D CMS Logo

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 61 of file L1MuGMTMerger.h.

Constructor & Destructor Documentation

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

constructor

Definition at line 71 of file L1MuGMTMerger.cc.

References dtcsc_mu, and rpc_mu.

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

destructor

Definition at line 82 of file L1MuGMTMerger.cc.

References reset().

82  {
83  reset();
84 }
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 84 of file L1MuGMTMerger.h.

References convertedEta(), createDTCSCCand(), createMergedCand(), createRPCCand(), doANDMerge(), doSpecialMerge(), load(), m_MuonCands, merge(), merge_rank(), RPCpg::mu, projectedPhi(), selectDTCSC(), and sysign().

Referenced by L1MuGMTSorter::run().

84 { return m_MuonCands; }
std::vector< L1MuGMTExtendedCand * > m_MuonCands
unsigned L1MuGMTMerger::convertedEta ( const L1MuRegionalCand mu) const
private

Definition at line 319 of file L1MuGMTMerger.cc.

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

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

319  {
321  return etaconv_lut->SpecificLookup_eta_gmt (mu->type_idx(), mu->eta_packed() );
322 }
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 240 of file L1MuGMTMerger.cc.

References convertedEta(), dtcsc_mu, L1MuGMTSortRankUnit::getVeryLowQualityLevel(), L1MuGMTMipIsoAU::ISO(), m_gmt, m_id, m_MuonCands, L1MuGMTMipIsoAU::MIP(), L1MuGlobalMuonTrigger::MipIsoAU(), projectedPhi(), btvTracks_cfi::quality, 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 Cands(), and merge().

240  {
241  L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
242 
243  tmpmuon->setBx(dtcsc_mu[idx_dtcsc]->bx());
244  tmpmuon->setPhiPacked( projectedPhi(dtcsc_mu[idx_dtcsc]) );
245  tmpmuon->setEtaPacked( convertedEta(dtcsc_mu[idx_dtcsc]) );
246  tmpmuon->setPtPacked( dtcsc_mu[idx_dtcsc]->pt_packed() );
247  tmpmuon->setChargePacked( sysign(dtcsc_mu[idx_dtcsc]) );
248  tmpmuon->setMIP( m_gmt.MipIsoAU(m_id)->MIP(idx_dtcsc) );
249  tmpmuon->setIsolation ( m_gmt.MipIsoAU(m_id)->ISO(idx_dtcsc) );
250  tmpmuon->setRank( L1MuGMTSortRankUnit::sort_rank(dtcsc_mu[idx_dtcsc]) );
251 
252  unsigned quality = 0;
254  case 0: quality = 6; break; //DT/CSC
255  case 1: quality = 2; break; //VERY LOW QUALITY LEVEL 1
256  case 2: quality = 3; break; //VERY LOW QUALITY LEVEL 2
257  case 3: quality = 4; break; //VERY LOW QUALITY LEVEL 3
258  }
259 
260  if ( (m_id==1) && (dtcsc_mu[idx_dtcsc]->finehalo_packed() == 1) )
261  quality = 1; // HALO quality
262 
263  tmpmuon->setQuality( quality ); // RPC
264  tmpmuon->setDTCSCIndex(idx_dtcsc);
265  tmpmuon->setRPCIndex(0);
266  tmpmuon->setFwdBit( m_id );
267  tmpmuon->setRPCBit( 0 );
268 
269  m_MuonCands.push_back(tmpmuon);
270 }
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:154
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:166
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:172
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:169
unsigned convertedEta(const L1MuRegionalCand *mu) const
const L1MuGMTMipIsoAU * MipIsoAU(int id) const
return pointer to MIP & ISO bit assignment unit
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:157
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:160
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:151
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:163
void L1MuGMTMerger::createMergedCand ( int  idx_dtcsc,
int  idx_rpc 
)
private

Definition at line 357 of file L1MuGMTMerger.cc.

References funct::abs(), convertedEta(), doANDMerge(), doSpecialMerge(), dtcsc_mu, PVValHelper::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(), EnergyCorrector::pt, 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 Cands(), and merge().

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

Definition at line 273 of file L1MuGMTMerger.cc.

References convertedEta(), L1MuGMTSortRankUnit::getVeryLowQualityLevel(), L1MuGMTMipIsoAU::ISO(), m_gmt, m_id, m_MuonCands, L1MuGMTMipIsoAU::MIP(), L1MuGlobalMuonTrigger::MipIsoAU(), projectedPhi(), btvTracks_cfi::quality, 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 Cands(), and merge().

273  {
274  L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
275 
276  tmpmuon->setBx(rpc_mu[idx_rpc]->bx());
277  tmpmuon->setPhiPacked( projectedPhi(rpc_mu[idx_rpc]) );
278  tmpmuon->setEtaPacked( convertedEta(rpc_mu[idx_rpc]) );
279  tmpmuon->setPtPacked( rpc_mu[idx_rpc]->pt_packed() );
280  tmpmuon->setChargePacked( sysign( rpc_mu[idx_rpc] ) );
281  tmpmuon->setMIP( m_gmt.MipIsoAU(m_id)->MIP(idx_rpc+4) );
282  tmpmuon->setIsolation ( m_gmt.MipIsoAU(m_id)->ISO(idx_rpc+4) );
283  tmpmuon->setRank( L1MuGMTSortRankUnit::sort_rank(rpc_mu[idx_rpc]) );
284 
285  unsigned quality = 0;
287  case 0: quality = 5; break; //RPC
288  case 1: quality = 2; break; //VERY LOW QUALITY LEVEL1
289  case 2: quality = 3; break; //VERY LOW QUALITY LEVEL2
290  case 3: quality = 4; break; //VERY LOW QUALITY LEVEL3
291  }
292 
293  tmpmuon->setQuality( quality ); // RPC
294  tmpmuon->setDTCSCIndex(0);
295  tmpmuon->setRPCIndex(idx_rpc);
296  tmpmuon->setFwdBit( m_id );
297  tmpmuon->setRPCBit( 1 );
298 
299  m_MuonCands.push_back(tmpmuon);
300 }
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:154
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:166
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:172
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:169
unsigned convertedEta(const L1MuRegionalCand *mu) const
std::vector< const L1MuRegionalCand * > rpc_mu
const L1MuGMTMipIsoAU * MipIsoAU(int id) const
return pointer to MIP & ISO bit assignment unit
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:157
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:160
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:151
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:163
int L1MuGMTMerger::doANDMerge ( unsigned  MMconfig) const
private

Definition at line 315 of file L1MuGMTMerger.cc.

Referenced by Cands(), and createMergedCand().

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

Definition at line 311 of file L1MuGMTMerger.cc.

Referenced by Cands(), and createMergedCand().

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

return identifier

Definition at line 81 of file L1MuGMTMerger.h.

References m_id.

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

Definition at line 140 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 Cands(), and run().

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

Definition at line 165 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(), mps_fire::i, L1MuGMTSortRankUnit::isDisabled(), 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 Cands(), and run().

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

References L1MuRegionalCand::empty(), PVValHelper::eta, L1MuRegionalCand::eta_packed(), RemoveAddSevLevel::flag, L1MuGMTConfig::getLFMergeRankCombineLUT(), L1MuGMTConfig::getLFMergeRankEtaPhiLUT(), L1MuGMTConfig::getLFMergeRankEtaQLUT(), L1MuGMTConfig::getLFMergeRankPtQLUT(), phi, L1MuRegionalCand::phi_packed(), EnergyCorrector::pt, 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 Cands(), and createMergedCand().

530  {
531 
532  if ( muon == 0 || muon->empty() ) return 0;
533 
534  unsigned lut_idx= muon->type_idx();
535 
536  // obtain inputs as coded in HW
537  unsigned eta = muon->eta_packed();
538  unsigned q = muon->quality_packed();
539  unsigned pt = muon->pt_packed();
540  unsigned phi = muon->phi_packed();
541 
542  // lookup eta-q
544  unsigned rank_etaq = etaq_lut->SpecificLookup_rank_etaq (lut_idx, eta, q);
545  unsigned flag = etaq_lut->SpecificLookup_flag (lut_idx, eta, q);
546 
547  // lookup pt-q
549  unsigned rank_ptq = ptq_lut->SpecificLookup_rank_ptq (lut_idx, q, pt);
550 
551  // lookup etaphi
553  unsigned rank_etaphi = etaphi_lut->SpecificLookup_rank_etaphi (lut_idx, eta, phi);
554 
555  // combine
557  unsigned rank = combine_lut->SpecificLookup_merge_rank (lut_idx, rank_etaq, rank_ptq, rank_etaphi);
558 
559  int rank_signed = rank;
560 
561  if (flag == 1) rank_signed *= -1;
562 
563  return rank_signed;
564 }
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
static L1MuGMTLFMergeRankPtQLUT * getLFMergeRankPtQLUT()
virtual bool empty() const
return empty flag
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
void L1MuGMTMerger::print ( void  ) const

print results after selection

Definition at line 123 of file L1MuGMTMerger.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

123  {
124 
125  edm::LogVerbatim("GMT_Merger_info") << " ";
126 
127  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
128  for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
129  if ( *iter && !(*iter)->empty() ) (*iter)->print();
130  }
131 
132  edm::LogVerbatim("GMT_Merger_info") << " ";
133 
134 }
std::vector< L1MuGMTExtendedCand * > m_MuonCands
unsigned L1MuGMTMerger::projectedPhi ( const L1MuRegionalCand mu) const
private

Definition at line 324 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 Cands(), createDTCSCCand(), createMergedCand(), and createRPCCand().

324  {
325 
326  // convert eta
328  unsigned eta4 = phiproetaconv_lut->SpecificLookup_eta_out (mu->type_idx(), mu->eta_packed() );
329 
330  // look up delta-phi 9 bit signed
332  unsigned dphi9 = phipro_lut->SpecificLookup_dphi (mu->type_idx(), eta4, mu->pt_packed(), mu->charge_packed());
333 
334  // sign extend
335  L1MuSignedPacking<9> DPhiPacking;
336  int dphi = DPhiPacking.idxFromPacked( dphi9 );
337 
338  // add modulo 144
339  int newphi = mu->phi_packed() + dphi;
340  if (newphi < 0) newphi += 144;
341  if (newphi >= 144) newphi -= 144;
342 
343  return (unsigned) newphi;
344 }
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:100
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 102 of file L1MuGMTMerger.cc.

References dtcsc_mu, mps_fire::i, m_MuonCands, and rpc_mu.

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

102  {
103 
104  for ( int i = 0; i < 4; i++ ) {
105  dtcsc_mu[i] = 0;
106  rpc_mu[i] = 0;
107  }
108 
109  std::vector<L1MuGMTExtendedCand*>::iterator iter;
110  for ( iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++ ) {
111  if ( *iter ) delete (*iter);
112  *iter = 0;
113  }
114 
115  m_MuonCands.clear();
116 
117 }
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 93 of file L1MuGMTMerger.cc.

References load(), and merge().

Referenced by L1MuGlobalMuonTrigger::produce().

93  {
94  load();
95  merge();
96 }
int L1MuGMTMerger::selectDTCSC ( unsigned  MMconfig,
int  by_rank,
int  by_pt,
int  by_combi 
) const
private

Definition at line 302 of file L1MuGMTMerger.cc.

Referenced by Cands(), and createMergedCand().

302  {
303  return
304  ( (MMconfig & 32) == 32 ) ||
305  ( ( (MMconfig & 8) == 8 ) && by_rank ) ||
306  ( ( (MMconfig & 4) == 4 ) && by_pt ) ||
307  ( ( (MMconfig & 2) == 2 ) && by_combi);
308 
309 }
unsigned L1MuGMTMerger::sysign ( const L1MuRegionalCand mu) const
private

Definition at line 347 of file L1MuGMTMerger.cc.

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

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

347  {
348 
349  unsigned sysign = mu->charge_packed();
350 
351  if ( mu->charge_valid_packed() == 0 )
352  sysign = 2; // undefined charge
353 
354  return sysign;
355 }
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 111 of file L1MuGMTMerger.h.

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

const L1MuGlobalMuonTrigger& L1MuGMTMerger::m_gmt
private

Definition at line 108 of file L1MuGMTMerger.h.

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

int L1MuGMTMerger::m_id
private

Definition at line 109 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 112 of file L1MuGMTMerger.h.

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

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

Definition at line 116 of file L1MuGMTMerger.h.