CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ( RPCTriggerConfiguration triggerConfig)

Definition at line 9 of file RPCTCGhostBusterSorter.cc.

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

Member Function Documentation

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 13 of file RPCTCGhostBusterSorter.cc.

References abs, RPCConst::m_TCGB_OUT_MUONS_CNT, and python.multivaluedict::sort().

Referenced by RPCTriggerCrate::runTCGBSorter().

13  {
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 }
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:162
#define abs(x)
Definition: mlp_lapack.h:159
virtual int towAddr2TowNum(int towAddr)=0
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:206
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:97

Member Data Documentation

RPCTriggerConfiguration* RPCTCGhostBusterSorter::m_TriggerConfig
private

Definition at line 26 of file RPCTCGhostBusterSorter.h.