CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCTCGhostBusterSorter.cc
Go to the documentation of this file.
2 //#include <set>
3 #include <algorithm>
4 
5 
6 using namespace std;
7 
8 //---------------------------------------------------------------------------
10  m_TriggerConfig = triggerConfig;
11 }
12 //---------------------------------------------------------------------------
14  for (unsigned int iTB = 0; iTB < tbMuonsVec2.size()-1; iTB++) {
15  for(unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++) {
16  if(tbMuonsVec2[iTB][iMu].getPtCode() == 0)
17  break; //becouse muons are sorted
18 
19  //muon from this TB is on positive edge of TB (last m_tower of this tb):
20  if(tbMuonsVec2[iTB][iMu].getEtaAddr() == (m_TriggerConfig->getTowsCntOnTB(iTB)-1)) {
21  for(unsigned int iMuN = 0; iMuN < tbMuonsVec2[iTB + 1].size(); iMuN++) {
22  if(tbMuonsVec2[iTB + 1][iMuN].getPtCode() == 0)
23  break; //becouse muons are sorted
24 
25  //muon from next TB is on negative edge (first m_tower of this TB):
26  if(tbMuonsVec2[iTB+1][iMuN].getEtaAddr() == 0) {
27  if( abs(tbMuonsVec2[iTB][iMu].getPhiAddr() - tbMuonsVec2[iTB+1][iMuN].getPhiAddr()) <= 1)
28  {
29  if(tbMuonsVec2[iTB][iMu].getCode() < tbMuonsVec2[iTB+1][iMuN].getCode())
30  {
31  tbMuonsVec2[iTB][iMu].kill();
32  }
33  else
34  {
35  tbMuonsVec2[iTB+1][iMuN].kill();
36  }
37  }
38  }
39  }
40  }
41  }
42  }
43 
44 //---------sorting-----------------------------------------
45 /* multiset<RPCTBMuon, RPCTBMuon::TMuonMore> liveMuonsSet;
46  for(unsigned int iTB = 0; iTB < tbMuonsVec2.size(); iTB++)
47  for(unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++)
48  if(tbMuonsVec2[iTB][iMu].isLive()) {
49 
50  int etaAddr = tbMuonsVec2[iTB][iMu].getEtaAddr() | (iTB<<2); //m_tower number natural
51  etaAddr = m_TriggerConfig->towAddr2TowNum(etaAddr); //m_tower number: -16 : 16
52  etaAddr = etaAddr + 16; // m_tower number continous 0 : 32
53  tbMuonsVec2[iTB][iMu].setEtaAddr(etaAddr);
54 
55  liveMuonsSet.insert(tbMuonsVec2[iTB][iMu]);
56  }
57  L1RpcTBMuonsVec outputMuons(liveMuonsSet.begin(), liveMuonsSet.end()); */
58 
59  L1RpcTBMuonsVec outputMuons;
60  for(unsigned int iTB = 0; iTB < tbMuonsVec2.size(); iTB++)
61  for(unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++)
62  if(tbMuonsVec2[iTB][iMu].isLive()) {
63  int etaAddr = tbMuonsVec2[iTB][iMu].getEtaAddr() | (iTB<<2); //m_tower number natural <0...35>
64  etaAddr = m_TriggerConfig->towAddr2TowNum(etaAddr); //m_tower number: -16 : 16
65  //etaAddr = etaAddr + 16; // m_tower number continous 0 : 32
66  etaAddr = m_TriggerConfig->towNum2TowNum2Comp(etaAddr); // 10 oct 2006 - moved from FS
67  tbMuonsVec2[iTB][iMu].setEtaAddr(etaAddr);
68 
69  outputMuons.push_back(tbMuonsVec2[iTB][iMu]);
70  }
71 
72  sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
73 
74 //-------setting size to m_GBETA_OUT_MUONS_CNT----------------
75  while(outputMuons.size() < RPCConst::m_TCGB_OUT_MUONS_CNT)
76  outputMuons.push_back(RPCTBMuon());
77  while(outputMuons.size() > RPCConst::m_TCGB_OUT_MUONS_CNT)
78  outputMuons.pop_back();
79 
80  return outputMuons;
81 }
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:162
#define abs(x)
Definition: mlp_lapack.h:159
L1RpcTBMuonsVec run(L1RpcTBMuonsVec2 &tbMuonsVec)
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:206
std::vector< L1RpcTBMuonsVec > L1RpcTBMuonsVec2
Definition: RPCTBMuon.h:207
RPCTCGhostBusterSorter(RPCTriggerConfiguration *triggerConfig)
Used in sorting.
Definition: RPCTBMuon.h:97