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

Constructor & Destructor Documentation

◆ L1MuGMTMerger()

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

constructor

Definition at line 70 of file L1MuGMTMerger.cc.

References dtcsc_mu, and rpc_mu.

70  : m_gmt(gmt), m_id(id), dtcsc_mu(4), rpc_mu(4) {
71  dtcsc_mu.reserve(4);
72  rpc_mu.reserve(4);
73 }
std::vector< const L1MuRegionalCand * > dtcsc_mu
const L1MuGlobalMuonTrigger & m_gmt
std::vector< const L1MuRegionalCand * > rpc_mu

◆ ~L1MuGMTMerger()

L1MuGMTMerger::~L1MuGMTMerger ( )
virtual

destructor

Definition at line 78 of file L1MuGMTMerger.cc.

References reset().

78 { reset(); }
void reset()
clear Merger

Member Function Documentation

◆ Cands()

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

return std::vector with all muon candidates

Definition at line 79 of file L1MuGMTMerger.h.

References m_MuonCands.

Referenced by L1MuGMTSorter::run().

79 { return m_MuonCands; }
std::vector< L1MuGMTExtendedCand * > m_MuonCands

◆ convertedEta()

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

Definition at line 306 of file L1MuGMTMerger.cc.

References L1MuGMTConfig::getLFEtaConvLUT(), amptDefaultParameters_cff::mu, and L1MuGMTLFEtaConvLUT::SpecificLookup_eta_gmt().

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

306  {
308  return etaconv_lut->SpecificLookup_eta_gmt(mu->type_idx(), mu->eta_packed());
309 }
unsigned SpecificLookup_eta_gmt(int idx, unsigned eta_regional) const
specific lookup function for eta_gmt
static L1MuGMTLFEtaConvLUT * getLFEtaConvLUT()

◆ createDTCSCCand()

void L1MuGMTMerger::createDTCSCCand ( int  idx_dtcsc)
private

Definition at line 220 of file L1MuGMTMerger.cc.

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

220  {
221  L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
222 
223  tmpmuon->setBx(dtcsc_mu[idx_dtcsc]->bx());
224  tmpmuon->setPhiPacked(projectedPhi(dtcsc_mu[idx_dtcsc]));
225  tmpmuon->setEtaPacked(convertedEta(dtcsc_mu[idx_dtcsc]));
226  tmpmuon->setPtPacked(dtcsc_mu[idx_dtcsc]->pt_packed());
227  tmpmuon->setChargePacked(sysign(dtcsc_mu[idx_dtcsc]));
228  tmpmuon->setMIP(m_gmt.MipIsoAU(m_id)->MIP(idx_dtcsc));
229  tmpmuon->setIsolation(m_gmt.MipIsoAU(m_id)->ISO(idx_dtcsc));
230  tmpmuon->setRank(L1MuGMTSortRankUnit::sort_rank(dtcsc_mu[idx_dtcsc]));
231 
232  unsigned quality = 0;
234  case 0:
235  quality = 6;
236  break; //DT/CSC
237  case 1:
238  quality = 2;
239  break; //VERY LOW QUALITY LEVEL 1
240  case 2:
241  quality = 3;
242  break; //VERY LOW QUALITY LEVEL 2
243  case 3:
244  quality = 4;
245  break; //VERY LOW QUALITY LEVEL 3
246  }
247 
248  if ((m_id == 1) && (dtcsc_mu[idx_dtcsc]->finehalo_packed() == 1))
249  quality = 1; // HALO quality
250 
251  tmpmuon->setQuality(quality); // RPC
252  tmpmuon->setDTCSCIndex(idx_dtcsc);
253  tmpmuon->setRPCIndex(0);
254  tmpmuon->setFwdBit(m_id);
255  tmpmuon->setRPCBit(0);
256 
257  m_MuonCands.push_back(tmpmuon);
258 }
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:151
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:163
std::vector< L1MuGMTExtendedCand * > m_MuonCands
unsigned sysign(const L1MuRegionalCand *mu) const
const L1MuGMTMipIsoAU * MipIsoAU(int id) const
return pointer to MIP & ISO bit assignment unit
bool MIP(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
void setDTCSCIndex(unsigned int idxdtcsc)
set index of contributing DT/CSC muon
unsigned projectedPhi(const L1MuRegionalCand *mu) const
static unsigned getVeryLowQualityLevel(const L1MuRegionalCand *)
Very low quality bits.
string quality
std::vector< const L1MuRegionalCand * > dtcsc_mu
unsigned convertedEta(const L1MuRegionalCand *mu) const
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:169
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
Definition: L1MuGMTCand.h:166
bool ISO(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:154
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:157
void setRPCBit(unsigned int rpcbit)
set RPC bit (1=RPC, 0=DT/CSC or matched)
void setRank(unsigned int rank)
set rank
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:148
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:160

◆ createMergedCand()

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

Definition at line 343 of file L1MuGMTMerger.cc.

References funct::abs(), l1GtPatternGenerator_cfi::bx, 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(), DiDispStaMuonMonitor_cfi::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().

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

◆ createRPCCand()

void L1MuGMTMerger::createRPCCand ( int  idx_rpc)
private

Definition at line 260 of file L1MuGMTMerger.cc.

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

260  {
261  L1MuGMTExtendedCand* tmpmuon = new L1MuGMTExtendedCand();
262 
263  tmpmuon->setBx(rpc_mu[idx_rpc]->bx());
264  tmpmuon->setPhiPacked(projectedPhi(rpc_mu[idx_rpc]));
265  tmpmuon->setEtaPacked(convertedEta(rpc_mu[idx_rpc]));
266  tmpmuon->setPtPacked(rpc_mu[idx_rpc]->pt_packed());
267  tmpmuon->setChargePacked(sysign(rpc_mu[idx_rpc]));
268  tmpmuon->setMIP(m_gmt.MipIsoAU(m_id)->MIP(idx_rpc + 4));
269  tmpmuon->setIsolation(m_gmt.MipIsoAU(m_id)->ISO(idx_rpc + 4));
270  tmpmuon->setRank(L1MuGMTSortRankUnit::sort_rank(rpc_mu[idx_rpc]));
271 
272  unsigned quality = 0;
274  case 0:
275  quality = 5;
276  break; //RPC
277  case 1:
278  quality = 2;
279  break; //VERY LOW QUALITY LEVEL1
280  case 2:
281  quality = 3;
282  break; //VERY LOW QUALITY LEVEL2
283  case 3:
284  quality = 4;
285  break; //VERY LOW QUALITY LEVEL3
286  }
287 
288  tmpmuon->setQuality(quality); // RPC
289  tmpmuon->setDTCSCIndex(0);
290  tmpmuon->setRPCIndex(idx_rpc);
291  tmpmuon->setFwdBit(m_id);
292  tmpmuon->setRPCBit(1);
293 
294  m_MuonCands.push_back(tmpmuon);
295 }
void setPtPacked(unsigned pt)
set packed pt-code of muon candidate
Definition: L1MuGMTCand.h:151
void setMIP(bool mip)
set min ionizing bit for muon candidate
Definition: L1MuGMTCand.h:163
std::vector< L1MuGMTExtendedCand * > m_MuonCands
unsigned sysign(const L1MuRegionalCand *mu) const
const L1MuGMTMipIsoAU * MipIsoAU(int id) const
return pointer to MIP & ISO bit assignment unit
bool MIP(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
void setDTCSCIndex(unsigned int idxdtcsc)
set index of contributing DT/CSC muon
unsigned projectedPhi(const L1MuRegionalCand *mu) const
static unsigned getVeryLowQualityLevel(const L1MuRegionalCand *)
Very low quality bits.
string quality
unsigned convertedEta(const L1MuRegionalCand *mu) const
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:169
void setChargePacked(unsigned ch)
set packed charge/synchronization word of muon candidate (0=POS, 1=NEG, 2=UNDEF, 3=SYNC) ...
Definition: L1MuGMTCand.h:166
std::vector< const L1MuRegionalCand * > rpc_mu
bool ISO(int idx) const
return select matrix (idx 0..3: DT/CSC, idx 4..7: RPC)
void setQuality(unsigned quality)
set quality of muon candidate
Definition: L1MuGMTCand.h:154
void setEtaPacked(unsigned eta)
set packed eta-code of muon candidate
Definition: L1MuGMTCand.h:157
void setRPCBit(unsigned int rpcbit)
set RPC bit (1=RPC, 0=DT/CSC or matched)
void setRank(unsigned int rank)
set rank
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:148
void setIsolation(bool isol)
set isolation of muon candidate
Definition: L1MuGMTCand.h:160

◆ doANDMerge()

int L1MuGMTMerger::doANDMerge ( unsigned  MMconfig) const
private

Definition at line 304 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

304 { return (MMconfig & 64) == 64; }

◆ doSpecialMerge()

int L1MuGMTMerger::doSpecialMerge ( unsigned  MMconfig) const
private

Definition at line 302 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

302 { return (MMconfig & 1) == 1; }

◆ id()

int L1MuGMTMerger::id ( void  ) const
inline

return identifier

Definition at line 76 of file L1MuGMTMerger.h.

References m_id.

76 { return m_id; }

◆ load()

void L1MuGMTMerger::load ( )
private

Definition at line 129 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().

129  {
130  // barrel Merger gets DTBX and barrel RPC muons
131  if (m_id == 0) {
132  for (unsigned idt = 0; idt < L1MuGMTConfig::MAXDTBX; idt++) {
133  dtcsc_mu[idt] = m_gmt.Data()->DTBXMuon(idt);
134  }
135  for (unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCbarrel; irpc++) {
136  rpc_mu[irpc] = m_gmt.Data()->RPCMuon(irpc);
137  }
138  }
139 
140  // endcap Merger gets CSC and endcap RPC muons
141  if (m_id == 1) {
142  for (unsigned icsc = 0; icsc < L1MuGMTConfig::MAXCSC; icsc++) {
143  dtcsc_mu[icsc] = m_gmt.Data()->CSCMuon(icsc);
144  }
145  for (unsigned irpc = 0; irpc < L1MuGMTConfig::MAXRPCendcap; irpc++) {
146  rpc_mu[irpc] = m_gmt.Data()->RPCMuon(irpc + 4);
147  }
148  }
149 }
const L1MuRegionalCand * RPCMuon(int index) const
get RPC muon
Definition: L1MuGMTPSB.cc:224
const L1MuRegionalCand * DTBXMuon(int index) const
get DTBX muon
Definition: L1MuGMTPSB.cc:231
const L1MuRegionalCand * CSCMuon(int index) const
get CSC muon
Definition: L1MuGMTPSB.cc:238
std::vector< const L1MuRegionalCand * > dtcsc_mu
const L1MuGlobalMuonTrigger & m_gmt
static const unsigned int MAXCSC
Definition: L1MuGMTConfig.h:85
static const unsigned int MAXDTBX
Definition: L1MuGMTConfig.h:85
static const unsigned int MAXRPCendcap
Definition: L1MuGMTConfig.h:85
std::vector< const L1MuRegionalCand * > rpc_mu
static const unsigned int MAXRPCbarrel
Definition: L1MuGMTConfig.h:85
const L1MuGMTPSB * Data() const
return pointer to PSB

◆ merge()

void L1MuGMTMerger::merge ( )
private

Definition at line 151 of file L1MuGMTMerger.cc.

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

Referenced by run().

151  {
152  const L1MuGMTMatrix<bool>& pairM = m_gmt.Matcher(m_id)->pairM();
153 
154  // Handling of cancel-out and empty muons is different in software and hardware
155  //
156  // - in hardware, a candidate may be empty (pt_code == 0) and an empty bit
157  // is passed to the sorter in order to suppress the candidate. In the
158  // software no candidate is created in this case.
159  //
160  // - in hardware, RPC candidates are passed to the sorter even if they are
161  // also used in a matched pair. They are then suppressed in the sorter. In
162  // software no RPC candidate is created if the muon is used in a pair.
163  //
164  // - in hardware, cancel-out signals from the cancel-out units in the own and
165  // other Logic FPGA are passed to the sorter in order to cancel out muons.
166  // In software the cancel-out signals are alrady checked here in the merger
167  // and no candidates are created for cancelled muons.
168  //
169  // There may therefore be less muons passed to the sorter in software than
170  // in Hardware. At the output of the first sorter stage the results should
171  // be comparable, again.
172 
173  unsigned HaloOverwritesMatched = 1;
174 
175  // loop over DT/CSC muons
176  for (int i = 0; i < 4; i++) {
177  if (dtcsc_mu[i] != nullptr) {
178  int match_idx = pairM.rowAny(i);
179 
180  int csc_is_halo = (m_id == 1) && (dtcsc_mu[i]->finehalo_packed() == 1);
181 
182  if ((match_idx != -1) && // is it matched?
183  (!(csc_is_halo && HaloOverwritesMatched)))
184  createMergedCand(i, match_idx);
185  else {
186  // check my first and the other chip's second cancel-out units
190  }
191  }
192  }
193 
194  // additionally loop over RPC muons
195  for (int j = 0; j < 4; j++) {
196  if (rpc_mu[j] != nullptr) {
197  int match_idx = pairM.colAny(j);
198 
199  if (match_idx == -1) { // is it unmatched?
201  createRPCCand(j);
202  }
203  }
204  }
205 
206  // set physical values in the GMT candidates for use in the analysis
207  const L1MuTriggerScales* theTriggerScales = L1MuGMTConfig::getTriggerScales();
208  const L1MuTriggerPtScale* theTriggerPtScale = L1MuGMTConfig::getTriggerPtScale();
209 
210  std::vector<L1MuGMTExtendedCand*>::const_iterator icand;
211  for (icand = m_MuonCands.begin(); icand != m_MuonCands.end(); icand++) {
212  L1MuGMTExtendedCand* cand = (*icand);
213  cand->setPhiValue(theTriggerScales->getPhiScale()->getLowEdge(cand->phiIndex()));
214  cand->setEtaValue(theTriggerScales->getGMTEtaScale()->getCenter(cand->etaIndex()));
215  cand->setPtValue(theTriggerPtScale->getPtScale()->getLowEdge(cand->ptIndex()));
216  // cand->setPtValue( theTriggerScales->getPtScale()->getLowEdge( cand->ptIndex() ));
217  }
218 }
const L1MuScale * getGMTEtaScale() const
get the GMT eta scale
const L1MuGMTMatcher * Matcher(int id) const
return pointer to Matcher
std::vector< L1MuGMTExtendedCand * > m_MuonCands
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)
const L1MuScale * getPhiScale() const
get the phi scale
virtual float getCenter(unsigned packed) const =0
get the center of bin represented by packed
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 * getPtScale() const
get the Pt scale
void createDTCSCCand(int idx_dtcsc)
const bool cancelOtherChipMuon(int idx) const
return cancel bit for barrel RPC (m_id==2) or forward RPC (m_id==3) muon
std::vector< const L1MuRegionalCand * > dtcsc_mu
const L1MuGlobalMuonTrigger & m_gmt
const L1MuGMTMatrix< bool > & pairM() const
return pair matrix
static const L1MuTriggerPtScale * getTriggerPtScale()
std::vector< const L1MuRegionalCand * > rpc_mu
static const L1MuTriggerScales * getTriggerScales()
int rowAny(int r) const
is any element in row r > 0 ? return index or -1
int colAny(int c) const
is any element in column c > 0 ? return index or -1
const L1MuGMTCancelOutUnit * CancelOutUnit(int id) const
return pointer to Cancel Out Unit
void createRPCCand(int idx_rpc)

◆ merge_rank()

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

Merge Rank Table.

Definition at line 506 of file L1MuGMTMerger.cc.

References PVValHelper::eta, RemoveAddSevLevel::flag, L1MuGMTConfig::getLFMergeRankCombineLUT(), L1MuGMTConfig::getLFMergeRankEtaPhiLUT(), L1MuGMTConfig::getLFMergeRankEtaQLUT(), L1MuGMTConfig::getLFMergeRankPtQLUT(), phi, DiDispStaMuonMonitor_cfi::pt, submitPVResolutionJobs::q, L1MuGMTLFMergeRankEtaQLUT::SpecificLookup_flag(), L1MuGMTLFMergeRankCombineLUT::SpecificLookup_merge_rank(), L1MuGMTLFMergeRankEtaPhiLUT::SpecificLookup_rank_etaphi(), L1MuGMTLFMergeRankEtaQLUT::SpecificLookup_rank_etaq(), and L1MuGMTLFMergeRankPtQLUT::SpecificLookup_rank_ptq().

Referenced by createMergedCand().

506  {
507  if (muon == nullptr || muon->empty())
508  return 0;
509 
510  unsigned lut_idx = muon->type_idx();
511 
512  // obtain inputs as coded in HW
513  unsigned eta = muon->eta_packed();
514  unsigned q = muon->quality_packed();
515  unsigned pt = muon->pt_packed();
516  unsigned phi = muon->phi_packed();
517 
518  // lookup eta-q
520  unsigned rank_etaq = etaq_lut->SpecificLookup_rank_etaq(lut_idx, eta, q);
521  unsigned flag = etaq_lut->SpecificLookup_flag(lut_idx, eta, q);
522 
523  // lookup pt-q
525  unsigned rank_ptq = ptq_lut->SpecificLookup_rank_ptq(lut_idx, q, pt);
526 
527  // lookup etaphi
529  unsigned rank_etaphi = etaphi_lut->SpecificLookup_rank_etaphi(lut_idx, eta, phi);
530 
531  // combine
533  unsigned rank = combine_lut->SpecificLookup_merge_rank(lut_idx, rank_etaq, rank_ptq, rank_etaphi);
534 
535  int rank_signed = rank;
536 
537  if (flag == 1)
538  rank_signed *= -1;
539 
540  return rank_signed;
541 }
static L1MuGMTLFMergeRankPtQLUT * getLFMergeRankPtQLUT()
unsigned SpecificLookup_rank_ptq(int idx, unsigned q, unsigned pt) const
specific lookup function for rank_ptq
unsigned SpecificLookup_merge_rank(int idx, unsigned rank_etaq, unsigned rank_ptq, unsigned rank_etaphi) const
specific lookup function for merge_rank
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 SpecificLookup_rank_etaphi(int idx, unsigned eta, unsigned phi) const
specific lookup function for rank_etaphi
static L1MuGMTLFMergeRankEtaQLUT * getLFMergeRankEtaQLUT()

◆ print()

void L1MuGMTMerger::print ( void  ) const

print results after selection

Definition at line 114 of file L1MuGMTMerger.cc.

References m_MuonCands.

Referenced by L1MuGlobalMuonTrigger::produce().

114  {
115  edm::LogVerbatim("GMT_Merger_info") << " ";
116 
117  std::vector<L1MuGMTExtendedCand*>::const_iterator iter;
118  for (iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++) {
119  if (*iter && !(*iter)->empty())
120  (*iter)->print();
121  }
122 
123  edm::LogVerbatim("GMT_Merger_info") << " ";
124 }
Log< level::Info, true > LogVerbatim
std::vector< L1MuGMTExtendedCand * > m_MuonCands

◆ projectedPhi()

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

Definition at line 311 of file L1MuGMTMerger.cc.

References HLT_2022v15_cff::eta4, L1MuGMTConfig::getLFPhiProEtaConvLUT(), L1MuGMTConfig::getLFPhiProLUT(), L1MuSignedPacking< Bits >::idxFromPacked(), amptDefaultParameters_cff::mu, L1MuGMTLFPhiProLUT::SpecificLookup_dphi(), and L1MuGMTLFPhiProEtaConvLUT::SpecificLookup_eta_out().

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

311  {
312  // convert eta
314  unsigned eta4 = phiproetaconv_lut->SpecificLookup_eta_out(mu->type_idx(), mu->eta_packed());
315 
316  // look up delta-phi 9 bit signed
318  unsigned dphi9 = phipro_lut->SpecificLookup_dphi(mu->type_idx(), eta4, mu->pt_packed(), mu->charge_packed());
319 
320  // sign extend
321  L1MuSignedPacking<9> DPhiPacking;
322  int dphi = DPhiPacking.idxFromPacked(dphi9);
323 
324  // add modulo 144
325  int newphi = mu->phi_packed() + dphi;
326  if (newphi < 0)
327  newphi += 144;
328  if (newphi >= 144)
329  newphi -= 144;
330 
331  return (unsigned)newphi;
332 }
static L1MuGMTLFPhiProLUT * getLFPhiProLUT()
unsigned SpecificLookup_dphi(int idx, unsigned eta, unsigned pt, unsigned charge) const
specific lookup function for dphi
int idxFromPacked(unsigned packed) const override
get the value from the packed notation (+/-)
Definition: L1MuPacking.h:100
unsigned SpecificLookup_eta_out(int idx, unsigned eta_in) const
specific lookup function for eta_out
static L1MuGMTLFPhiProEtaConvLUT * getLFPhiProEtaConvLUT()

◆ reset()

void L1MuGMTMerger::reset ( void  )

clear Merger

Definition at line 95 of file L1MuGMTMerger.cc.

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

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

95  {
96  for (int i = 0; i < 4; i++) {
97  dtcsc_mu[i] = nullptr;
98  rpc_mu[i] = nullptr;
99  }
100 
101  std::vector<L1MuGMTExtendedCand*>::iterator iter;
102  for (iter = m_MuonCands.begin(); iter != m_MuonCands.end(); iter++) {
103  if (*iter)
104  delete (*iter);
105  *iter = nullptr;
106  }
107 
108  m_MuonCands.clear();
109 }
std::vector< L1MuGMTExtendedCand * > m_MuonCands
std::vector< const L1MuRegionalCand * > dtcsc_mu
std::vector< const L1MuRegionalCand * > rpc_mu

◆ run()

void L1MuGMTMerger::run ( )

run GMT Merger

Definition at line 87 of file L1MuGMTMerger.cc.

References load(), and merge().

Referenced by L1MuGlobalMuonTrigger::produce().

87  {
88  load();
89  merge();
90 }

◆ selectDTCSC()

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

Definition at line 297 of file L1MuGMTMerger.cc.

Referenced by createMergedCand().

297  {
298  return ((MMconfig & 32) == 32) || (((MMconfig & 8) == 8) && by_rank) || (((MMconfig & 4) == 4) && by_pt) ||
299  (((MMconfig & 2) == 2) && by_combi);
300 }

◆ sysign()

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

Definition at line 334 of file L1MuGMTMerger.cc.

References amptDefaultParameters_cff::mu.

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

334  {
335  unsigned sysign = mu->charge_packed();
336 
337  if (mu->charge_valid_packed() == 0)
338  sysign = 2; // undefined charge
339 
340  return sysign;
341 }
unsigned sysign(const L1MuRegionalCand *mu) const

Member Data Documentation

◆ dtcsc_mu

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

Definition at line 104 of file L1MuGMTMerger.h.

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

◆ m_gmt

const L1MuGlobalMuonTrigger& L1MuGMTMerger::m_gmt
private

Definition at line 101 of file L1MuGMTMerger.h.

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

◆ m_id

int L1MuGMTMerger::m_id
private

Definition at line 102 of file L1MuGMTMerger.h.

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

◆ m_MuonCands

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

◆ rpc_mu

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

Definition at line 105 of file L1MuGMTMerger.h.

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

◆ singleRank

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

Definition at line 109 of file L1MuGMTMerger.h.