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(), ExpressReco_HICollisions_FallBack::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 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  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: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)
int selectDTCSC(unsigned MMconfig, int by_rank, int by_pt, int by_combi) const
unsigned projectedPhi(const L1MuRegionalCand *mu) const
T eta() 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, 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
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 530 of file L1MuGMTMerger.cc.

References L1MuRegionalCand::empty(), eta(), L1MuRegionalCand::eta_packed(), L1MuGMTConfig::getLFMergeRankCombineLUT(), L1MuGMTConfig::getLFMergeRankEtaPhiLUT(), L1MuGMTConfig::getLFMergeRankEtaQLUT(), L1MuGMTConfig::getLFMergeRankPtQLUT(), phi, L1MuRegionalCand::phi_packed(), ExpressReco_HICollisions_FallBack::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 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
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.