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

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 126 of file RPCTBGhostBuster.cc.

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

126  {
127 //----- killing ghosts ---------------------------------------
128  for(unsigned int iMuVec = 0; iMuVec < gbPhiMuonsVec2.size() -1; iMuVec++) {
129  for(unsigned int iMu = 0; iMu < gbPhiMuonsVec2[iMuVec].size(); iMu++) {
130  if(gbPhiMuonsVec2[iMuVec][iMu].getCode() == 0)
131  break; //because muons are sorted
132 
133  for(unsigned int iMuNext = 0; iMuNext < gbPhiMuonsVec2[iMuVec+1].size(); iMuNext++) {
134  if(abs(gbPhiMuonsVec2[iMuVec][iMu].getPhiAddr()-gbPhiMuonsVec2[iMuVec+1][iMuNext].getPhiAddr())<=1)
135  {
136  //comparing with next:
137  if(gbPhiMuonsVec2[iMuVec][iMu].getCode() < gbPhiMuonsVec2[iMuVec+1][iMuNext].getCode())
138  {
139  gbPhiMuonsVec2[iMuVec][iMu].kill();
140  }
141  else
142  {
143  gbPhiMuonsVec2[iMuVec+1][iMuNext].kill();
144  }
145  }
146  }
147  }
148  }
149 
150 //---------sorting-----------------------------------------
151 /* multiset<RPCTBMuon, RPCTBMuon::TMuonMore> liveMuonsSet;
152  for(unsigned int iMuVec = 0; iMuVec < gbPhiMuonsVec2.size(); iMuVec++)
153  for(unsigned int iMu = 0; iMu < gbPhiMuonsVec2[iMuVec].size(); iMu++)
154  if(gbPhiMuonsVec2[iMuVec][iMu].isLive()) {
155  gbPhiMuonsVec2[iMuVec][iMu].setEtaAddr(iMuVec);
156  liveMuonsSet.insert(gbPhiMuonsVec2[iMuVec][iMu]);
157  }
158  L1RpcTBMuonsVec outputMuons(liveMuonsSet.begin(), liveMuonsSet.end()); */
159 
160  L1RpcTBMuonsVec outputMuons;
161  for(unsigned int iMuVec = 0; iMuVec < gbPhiMuonsVec2.size(); iMuVec++)
162  for(unsigned int iMu = 0; iMu < gbPhiMuonsVec2[iMuVec].size(); iMu++)
163  if(gbPhiMuonsVec2[iMuVec][iMu].isLive()) {
164  gbPhiMuonsVec2[iMuVec][iMu].setEtaAddr(iMuVec);
165  outputMuons.push_back(gbPhiMuonsVec2[iMuVec][iMu]);
166  }
167  sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
168 
169 //-------setting size to m_GBETA_OUT_MUONS_CNT----------------
170  while(outputMuons.size() < RPCConst::m_GBETA_OUT_MUONS_CNT)
171  outputMuons.push_back(RPCTBMuon());
172  while(outputMuons.size() > RPCConst::m_GBETA_OUT_MUONS_CNT)
173  outputMuons.pop_back();
174 
175  return outputMuons;
176 }
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:161
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:206
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Used in sorting.
Definition: RPCTBMuon.h:97
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 52 of file RPCTBGhostBuster.cc.

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

52  {
53  if(pacMuonsVec.empty())
54  return L1RpcTBMuonsVec(); //empty vector;
55 //--------- killing ghosts ---------------------------------------
56  pacMuonsVec.push_back(RPCTBMuon()); //adding empty muon to the end,
57 
58  for(unsigned int iMu = 0; iMu < RPCConst::m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
59  if(pacMuonsVec[iMu].getCode() == 0)
60  ;
61  else if(pacMuonsVec[iMu].getCode() < pacMuonsVec[iMu + 1].getCode())
62  pacMuonsVec[iMu].kill();
63  else if(pacMuonsVec[iMu].getCode() == pacMuonsVec[iMu + 1].getCode()) {
64  if(pacMuonsVec[iMu].wasKilled())
65  pacMuonsVec[iMu+1].kill();
66  else
67  pacMuonsVec[iMu].kill();
68  }
69  else //>
70  pacMuonsVec[iMu+1].kill();
71  }
72 
73  pacMuonsVec.pop_back(); //removing empty muon from the end,
74 
75 //-------setting the m_GBData ----------------------------------
76  if(pacMuonsVec[0].isLive())
77  pacMuonsVec[0].setGBDataKilledFirst();
78  else if(pacMuonsVec[0].wasKilled())
79  for(unsigned int iMu = 0; iMu < RPCConst::m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
80  if(pacMuonsVec[iMu].isLive()) {
81  pacMuonsVec[iMu].setGBDataKilledFirst();
82  break;
83  }
84  }
85 
86  if(pacMuonsVec[RPCConst::m_SEGMENTS_IN_SECTOR_CNT-1].isLive())
87  pacMuonsVec[RPCConst::m_SEGMENTS_IN_SECTOR_CNT-1].setGBDataKilledLast();
88  else if(pacMuonsVec[RPCConst::m_SEGMENTS_IN_SECTOR_CNT-1].wasKilled())
89  for(int iMu = RPCConst::m_SEGMENTS_IN_SECTOR_CNT -1; iMu >= 0 ; iMu--) {
90  if(pacMuonsVec[iMu].isLive()) {
91  pacMuonsVec[iMu].setGBDataKilledLast();
92  break;
93  }
94  }
95 //-------------sorting ------------------------------------------
96  /*
97  multiset<RPCTBMuon, RPCTBMuon::TMuonMore> liveMuonsSet;
98  for(int iMu = 0; iMu < m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
99  if(pacMuonsVec[iMu].isLive()) {
100  pacMuonsVec[iMu].setPhiAddr(iMu);
101  liveMuonsSet.insert(pacMuonsVec[iMu]);
102  }
103  }
104  L1RpcTBMuonsVec outputMuons(liveMuonsSet.begin(), liveMuonsSet.end());*/
105 
106  L1RpcTBMuonsVec outputMuons;
107  for(unsigned int iMu = 0; iMu < RPCConst::m_SEGMENTS_IN_SECTOR_CNT; iMu++) {
108  if(pacMuonsVec[iMu].isLive()) {
109  pacMuonsVec[iMu].setPhiAddr(iMu);
110  outputMuons.push_back(pacMuonsVec[iMu]);
111  }
112  }
113  sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
114 
115 //-------setting size to m_GBPHI_OUT_MUONS_CNT----------------
116  while (outputMuons.size() < RPCConst::m_GBPHI_OUT_MUONS_CNT)
117  outputMuons.push_back(RPCTBMuon());
118  while(outputMuons.size() > RPCConst::m_GBPHI_OUT_MUONS_CNT)
119  outputMuons.pop_back();
120 
121  return outputMuons;
122 }
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:159
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:160
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:206
Used in sorting.
Definition: RPCTBMuon.h:97
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:207
L1RpcTBMuonsVec gBPhi(L1RpcTBMuonsVec &pacMuonsVec) const