CMS 3D CMS Logo

List of all members | Public Member Functions
RPCTBGhostBuster Class Reference

#include <RPCTBGhostBuster.h>

Public Member Functions

L1RpcTBMuonsVec gBEta (L1RpcTBMuonsVec2 &gbPhiMuonsVec2) const
 
L1RpcTBMuonsVec gBPhi (L1RpcTBMuonsVec &pacMuonsVec) const
 
L1RpcTBMuonsVec run (L1RpcTBMuonsVec2 &pacMuonsVec2) const
 

Detailed Description

Peformes the Trigger Board Ghost Buster and sorter algorithms. Because the class does not keep any data and GB is the same for every TB, there might be one and the same object of this class for all TBs.

Author
Karol Bunkowski (Warsaw)

Definition at line 13 of file RPCTBGhostBuster.h.

Member Function Documentation

◆ gBEta()

L1RpcTBMuonsVec RPCTBGhostBuster::gBEta ( L1RpcTBMuonsVec2 gbPhiMuonsVec2) const
Parameters
gbPhiMuonsVec2size() should be equal to 4 (max number of m_tower in TB). Performs the Eta Goustbuster - between muons from diferent towers. Calls RPCTBMuon::setPhiAddr() for each alive muon.
Returns
always 4 muons.

Definition at line 124 of file RPCTBGhostBuster.cc.

References funct::abs(), RPCConst::m_GBETA_OUT_MUONS_CNT, and jetUpdater_cfi::sort.

124  {
125  //----- killing ghosts ---------------------------------------
126  for (unsigned int iMuVec = 0; iMuVec < gbPhiMuonsVec2.size() - 1; iMuVec++) {
127  for (unsigned int iMu = 0; iMu < gbPhiMuonsVec2[iMuVec].size(); iMu++) {
128  if (gbPhiMuonsVec2[iMuVec][iMu].getCode() == 0)
129  break; //because muons are sorted
130 
131  for (unsigned int iMuNext = 0; iMuNext < gbPhiMuonsVec2[iMuVec + 1].size(); iMuNext++) {
132  if (abs(gbPhiMuonsVec2[iMuVec][iMu].getPhiAddr() - gbPhiMuonsVec2[iMuVec + 1][iMuNext].getPhiAddr()) <= 1) {
133  //comparing with next:
134  if (gbPhiMuonsVec2[iMuVec][iMu].getCode() < gbPhiMuonsVec2[iMuVec + 1][iMuNext].getCode()) {
135  gbPhiMuonsVec2[iMuVec][iMu].kill();
136  } else {
137  gbPhiMuonsVec2[iMuVec + 1][iMuNext].kill();
138  }
139  }
140  }
141  }
142  }
143 
144  //---------sorting-----------------------------------------
145  /* multiset<RPCTBMuon, RPCTBMuon::TMuonMore> liveMuonsSet;
146  for(unsigned int iMuVec = 0; iMuVec < gbPhiMuonsVec2.size(); iMuVec++)
147  for(unsigned int iMu = 0; iMu < gbPhiMuonsVec2[iMuVec].size(); iMu++)
148  if(gbPhiMuonsVec2[iMuVec][iMu].isLive()) {
149  gbPhiMuonsVec2[iMuVec][iMu].setEtaAddr(iMuVec);
150  liveMuonsSet.insert(gbPhiMuonsVec2[iMuVec][iMu]);
151  }
152  L1RpcTBMuonsVec outputMuons(liveMuonsSet.begin(), liveMuonsSet.end()); */
153 
154  L1RpcTBMuonsVec outputMuons;
155  for (unsigned int iMuVec = 0; iMuVec < gbPhiMuonsVec2.size(); iMuVec++)
156  for (unsigned int iMu = 0; iMu < gbPhiMuonsVec2[iMuVec].size(); iMu++)
157  if (gbPhiMuonsVec2[iMuVec][iMu].isLive()) {
158  gbPhiMuonsVec2[iMuVec][iMu].setEtaAddr(iMuVec);
159  outputMuons.push_back(gbPhiMuonsVec2[iMuVec][iMu]);
160  }
161  sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
162 
163  //-------setting size to m_GBETA_OUT_MUONS_CNT----------------
164  while (outputMuons.size() < RPCConst::m_GBETA_OUT_MUONS_CNT)
165  outputMuons.push_back(RPCTBMuon());
166  while (outputMuons.size() > RPCConst::m_GBETA_OUT_MUONS_CNT)
167  outputMuons.pop_back();
168 
169  return outputMuons;
170 }
static const unsigned int m_GBETA_OUT_MUONS_CNT
m_Number of muon candidates return by Trigger Board&#39;s eta Ghost Buster
Definition: RPCConst.h:157
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:218
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Used in sorting.
Definition: RPCTBMuon.h:89

◆ gBPhi()

L1RpcTBMuonsVec RPCTBGhostBuster::gBPhi ( L1RpcTBMuonsVec pacMuonsVec) const
Parameters
pacMuonsVecpacMuonsVec.size() should be equal to 12 (Segment in given TB count) or 0, Performs Phi Goustbuster - between muons in one sector of the same m_tower.
Returns
if pacMuonsVec has size = 0, returns L1RpcTBMuonsVec with size 0, otherwise returns vector of size = 4. Calls RPCTBMuon::setPhiAddr() for each alive muon.

Definition at line 51 of file RPCTBGhostBuster.cc.

References RPCConst::m_GBPHI_OUT_MUONS_CNT, RPCConst::m_SEGMENTS_IN_SECTOR_CNT, and jetUpdater_cfi::sort.

51  {
52  if (pacMuonsVec.empty())
53  return L1RpcTBMuonsVec(); //empty vector;
54  //--------- killing ghosts ---------------------------------------
55  pacMuonsVec.push_back(RPCTBMuon()); //adding empty muon to the end,
56 
57  for (unsigned int iMu = 0; iMu < RPCConst::m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
58  if (pacMuonsVec[iMu].getCode() == 0)
59  ;
60  else if (pacMuonsVec[iMu].getCode() < pacMuonsVec[iMu + 1].getCode())
61  pacMuonsVec[iMu].kill();
62  else if (pacMuonsVec[iMu].getCode() == pacMuonsVec[iMu + 1].getCode()) {
63  if (pacMuonsVec[iMu].wasKilled())
64  pacMuonsVec[iMu + 1].kill();
65  else
66  pacMuonsVec[iMu].kill();
67  } else //>
68  pacMuonsVec[iMu + 1].kill();
69  }
70 
71  pacMuonsVec.pop_back(); //removing empty muon from the end,
72 
73  //-------setting the m_GBData ----------------------------------
74  if (pacMuonsVec[0].isLive())
75  pacMuonsVec[0].setGBDataKilledFirst();
76  else if (pacMuonsVec[0].wasKilled())
77  for (unsigned int iMu = 0; iMu < RPCConst::m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
78  if (pacMuonsVec[iMu].isLive()) {
79  pacMuonsVec[iMu].setGBDataKilledFirst();
80  break;
81  }
82  }
83 
84  if (pacMuonsVec[RPCConst::m_SEGMENTS_IN_SECTOR_CNT - 1].isLive())
85  pacMuonsVec[RPCConst::m_SEGMENTS_IN_SECTOR_CNT - 1].setGBDataKilledLast();
86  else if (pacMuonsVec[RPCConst::m_SEGMENTS_IN_SECTOR_CNT - 1].wasKilled())
87  for (int iMu = RPCConst::m_SEGMENTS_IN_SECTOR_CNT - 1; iMu >= 0; iMu--) {
88  if (pacMuonsVec[iMu].isLive()) {
89  pacMuonsVec[iMu].setGBDataKilledLast();
90  break;
91  }
92  }
93  //-------------sorting ------------------------------------------
94  /*
95  multiset<RPCTBMuon, RPCTBMuon::TMuonMore> liveMuonsSet;
96  for(int iMu = 0; iMu < m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
97  if(pacMuonsVec[iMu].isLive()) {
98  pacMuonsVec[iMu].setPhiAddr(iMu);
99  liveMuonsSet.insert(pacMuonsVec[iMu]);
100  }
101  }
102  L1RpcTBMuonsVec outputMuons(liveMuonsSet.begin(), liveMuonsSet.end());*/
103 
104  L1RpcTBMuonsVec outputMuons;
105  for (unsigned int iMu = 0; iMu < RPCConst::m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
106  if (pacMuonsVec[iMu].isLive()) {
107  pacMuonsVec[iMu].setPhiAddr(iMu);
108  outputMuons.push_back(pacMuonsVec[iMu]);
109  }
110  }
111  sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
112 
113  //-------setting size to m_GBPHI_OUT_MUONS_CNT----------------
114  while (outputMuons.size() < RPCConst::m_GBPHI_OUT_MUONS_CNT)
115  outputMuons.push_back(RPCTBMuon());
116  while (outputMuons.size() > RPCConst::m_GBPHI_OUT_MUONS_CNT)
117  outputMuons.pop_back();
118 
119  return outputMuons;
120 }
static const unsigned int m_SEGMENTS_IN_SECTOR_CNT
m_Number of Logic Segments in one Logic Sector, defines also the number of Logic Cones for one Logic ...
Definition: RPCConst.h:153
static const unsigned int m_GBPHI_OUT_MUONS_CNT
m_Number of muon candidates return by Trigger Board&#39;s phi Ghost Buster
Definition: RPCConst.h:155
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:218
Used in sorting.
Definition: RPCTBMuon.h:89

◆ run()

L1RpcTBMuonsVec RPCTBGhostBuster::run ( L1RpcTBMuonsVec2 pacMuonsVec2) const

Calls gBPhi and gBEta.

Parameters
pacMuonsVec2pacMuonsVec2[0..3][0..11] (4 Towers x 12 Segments (PACs) ), if pacMuonsVec2[i].size() == 0, means no nonempty muon.
Returns
always 4 muons.

Definition at line 15 of file RPCTBGhostBuster.cc.

Referenced by RPCTriggerBoard::runTBGB().

15  {
16  L1RpcTBMuonsVec2 gbPhiMuonsVec2;
17  for (unsigned int iTow = 0; iTow < pacMuonsVec2.size(); iTow++) {
18  gbPhiMuonsVec2.push_back(gBPhi(pacMuonsVec2[iTow]));
19  }
20 
21  return gBEta(gbPhiMuonsVec2);
22 }
L1RpcTBMuonsVec gBEta(L1RpcTBMuonsVec2 &gbPhiMuonsVec2) const
std::vector< L1RpcTBMuonsVec > L1RpcTBMuonsVec2
Definition: RPCTBMuon.h:219
L1RpcTBMuonsVec gBPhi(L1RpcTBMuonsVec &pacMuonsVec) const