CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
RPCTCGhostBusterSorter Class Reference

#include <RPCTCGhostBusterSorter.h>

Public Member Functions

 RPCTCGhostBusterSorter (RPCTriggerConfiguration *triggerConfig)
 
L1RpcTBMuonsVec run (L1RpcTBMuonsVec2 &tbMuonsVec)
 

Private Attributes

RPCTriggerConfigurationm_TriggerConfig
 

Detailed Description

Peformes the Trigger Crate Ghost Buster and sorter algorithm. Because the class does not keep any data and GB is the same for every TC, there might be one and the same object of this class for all TCs.

Author
Karol Bunkowski (Warsaw)

Definition at line 14 of file RPCTCGhostBusterSorter.h.

Constructor & Destructor Documentation

◆ RPCTCGhostBusterSorter()

RPCTCGhostBusterSorter::RPCTCGhostBusterSorter ( RPCTriggerConfiguration triggerConfig)

Definition at line 8 of file RPCTCGhostBusterSorter.cc.

8  {
9  m_TriggerConfig = triggerConfig;
10 }
RPCTriggerConfiguration * m_TriggerConfig

Member Function Documentation

◆ run()

L1RpcTBMuonsVec RPCTCGhostBusterSorter::run ( L1RpcTBMuonsVec2 tbMuonsVec)

Peformes the Trigger Crate Ghost Buster and sorter algorithm - in eta between TB of one TC. Coverts muons etaAddr from 2bit tow num on TB (0-2 or 0-3) to continous m_tower number (etaAddr) (0 - 32, tower0 = 16)

Returns
always 4 muons

Definition at line 12 of file RPCTCGhostBusterSorter.cc.

References funct::abs(), RPCConst::m_TCGB_OUT_MUONS_CNT, and jetsAK4_CHS_cff::sort.

Referenced by RPCTriggerCrate::runTCGBSorter().

12  {
13  for (unsigned int iTB = 0; iTB < tbMuonsVec2.size() - 1; iTB++) {
14  for (unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++) {
15  if (tbMuonsVec2[iTB][iMu].getPtCode() == 0)
16  break; //becouse muons are sorted
17 
18  //muon from this TB is on positive edge of TB (last m_tower of this tb):
19  if (tbMuonsVec2[iTB][iMu].getEtaAddr() == (m_TriggerConfig->getTowsCntOnTB(iTB) - 1)) {
20  for (unsigned int iMuN = 0; iMuN < tbMuonsVec2[iTB + 1].size(); iMuN++) {
21  if (tbMuonsVec2[iTB + 1][iMuN].getPtCode() == 0)
22  break; //becouse muons are sorted
23 
24  //muon from next TB is on negative edge (first m_tower of this TB):
25  if (tbMuonsVec2[iTB + 1][iMuN].getEtaAddr() == 0) {
26  if (abs(tbMuonsVec2[iTB][iMu].getPhiAddr() - tbMuonsVec2[iTB + 1][iMuN].getPhiAddr()) <= 1) {
27  if (tbMuonsVec2[iTB][iMu].getCode() < tbMuonsVec2[iTB + 1][iMuN].getCode()) {
28  tbMuonsVec2[iTB][iMu].kill();
29  } else {
30  tbMuonsVec2[iTB + 1][iMuN].kill();
31  }
32  }
33  }
34  }
35  }
36  }
37  }
38 
39  //---------sorting-----------------------------------------
40  /* multiset<RPCTBMuon, RPCTBMuon::TMuonMore> liveMuonsSet;
41  for(unsigned int iTB = 0; iTB < tbMuonsVec2.size(); iTB++)
42  for(unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++)
43  if(tbMuonsVec2[iTB][iMu].isLive()) {
44 
45  int etaAddr = tbMuonsVec2[iTB][iMu].getEtaAddr() | (iTB<<2); //m_tower number natural
46  etaAddr = m_TriggerConfig->towAddr2TowNum(etaAddr); //m_tower number: -16 : 16
47  etaAddr = etaAddr + 16; // m_tower number continous 0 : 32
48  tbMuonsVec2[iTB][iMu].setEtaAddr(etaAddr);
49 
50  liveMuonsSet.insert(tbMuonsVec2[iTB][iMu]);
51  }
52  L1RpcTBMuonsVec outputMuons(liveMuonsSet.begin(), liveMuonsSet.end()); */
53 
54  L1RpcTBMuonsVec outputMuons;
55  for (unsigned int iTB = 0; iTB < tbMuonsVec2.size(); iTB++)
56  for (unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++)
57  if (tbMuonsVec2[iTB][iMu].isLive()) {
58  int etaAddr = tbMuonsVec2[iTB][iMu].getEtaAddr() | (iTB << 2); //m_tower number natural <0...35>
59  etaAddr = m_TriggerConfig->towAddr2TowNum(etaAddr); //m_tower number: -16 : 16
60  //etaAddr = etaAddr + 16; // m_tower number continous 0 : 32
61  etaAddr = m_TriggerConfig->towNum2TowNum2Comp(etaAddr); // 10 oct 2006 - moved from FS
62  tbMuonsVec2[iTB][iMu].setEtaAddr(etaAddr);
63 
64  outputMuons.push_back(tbMuonsVec2[iTB][iMu]);
65  }
66 
67  sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
68 
69  //-------setting size to m_GBETA_OUT_MUONS_CNT----------------
70  while (outputMuons.size() < RPCConst::m_TCGB_OUT_MUONS_CNT)
71  outputMuons.push_back(RPCTBMuon());
72  while (outputMuons.size() > RPCConst::m_TCGB_OUT_MUONS_CNT)
73  outputMuons.pop_back();
74 
75  return outputMuons;
76 }
RPCTriggerConfiguration * m_TriggerConfig
static const unsigned int m_TCGB_OUT_MUONS_CNT
m_Number of muon candidates return by Trigger Crate&#39;s Ghost Buster
Definition: RPCConst.h:160
virtual int towAddr2TowNum(int towAddr)=0
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:218
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual int getTowsCntOnTB(int tbNum)=0
Returns the count of Towers, that are covered by given TB .
virtual int towNum2TowNum2Comp(int towNum)=0
Used in sorting.
Definition: RPCTBMuon.h:89

Member Data Documentation

◆ m_TriggerConfig

RPCTriggerConfiguration* RPCTCGhostBusterSorter::m_TriggerConfig
private

Definition at line 26 of file RPCTCGhostBusterSorter.h.