CMS 3D CMS Logo

RPCPacTrigger.cc
Go to the documentation of this file.
1 /*******************************************************************************
2 * *
3 * Karol Bunkowski *
4 * Warsaw University 2004 *
5 * *
6 *******************************************************************************/
9 
11  : m_FinalSorter(triggerConfig), m_HalfSorters(triggerConfig) {
12  m_TrigCnfg = triggerConfig;
13  for (int iTC = 0; iTC < m_TrigCnfg->getTCsCnt(); iTC++) {
15  }
16 }
17 
19 
21  m_GBFinalMuons.clear();
22 
23  if (m_TrigCnfg->getDebugLevel() != 0) {
24 #ifdef _STAND_ALONE
25  std::cout << "---TBMuons in new event" << std::endl;
26 #endif // _STAND_ALONE
27  }
28  for (unsigned int iLC = 0; iLC < logConesVec.size(); iLC++) {
29  if (logConesVec[iLC].getFiredPlanesCnt() >= 3) {
30  m_TriggerCratesVec[m_TrigCnfg->getTCNum(logConesVec[iLC].getConeCrdnts())].runCone(logConesVec[iLC]);
31  }
32  }
33 
34  L1RpcTBMuonsVec2 tcsMuonsVec2;
35  for (unsigned int iTC = 0; iTC < m_TriggerCratesVec.size(); iTC++) {
36  tcsMuonsVec2.push_back(m_TriggerCratesVec[iTC].runTCGBSorter());
37  }
38 
39  if (m_TrigCnfg->getDebugLevel() != 0) {
40  for (unsigned int iTC = 0; iTC < tcsMuonsVec2.size(); iTC++) {
41  for (unsigned int iTB = 0; iTB < tcsMuonsVec2[iTC].size(); iTB++) {
42 #ifdef _STAND_ALONE
43  std::cout << "GB 2 " << iTB << " " << tcsMuonsVec2[iTC][iTB].printDebugInfo(m_TrigCnfg->getDebugLevel())
44  << std::endl;
45 #else
46  // LogDebug("RPCHwDebug") << "GB 2 " << iTB << " "
47  // <<tcsMuonsVec2[iTC][iTB].printDebugInfo(m_TrigCnfg->getDebugLevel());
48  MuonsGrabber::Instance().addMuon(tcsMuonsVec2[iTC][iTB], 2, -1, -1, iTB);
49 
50 #endif // _STAND_ALONE
51  }
52  }
53  }
54 
55  // It would be fine, if half sorters would just modify tcsMuonsVec2
56  L1RpcTBMuonsVec2 halfMuons = m_HalfSorters.run(tcsMuonsVec2, hsbConf);
57  m_GBFinalMuons = m_FinalSorter.run(halfMuons);
58 
59 #ifdef GETCONES
60  bool foundMuons = false;
61  L1RpcTBMuonsVec bMuons = m_GBFinalMuons[0];
62  L1RpcTBMuonsVec fMuons = m_GBFinalMuons[1];
63 
64  std::cout << "------------" << std::endl;
65  for (unsigned int i = 0; i < bMuons.size(); i++) {
66  if (bMuons[i].getPtCode() != 0) {
67  /*
68  std::cout<< "ptcode " << bMuons[i].getPtCode()
69  << " t " << bMuons[i].getTower()
70  << " sec " << bMuons[i].getLogSector()
71  << " seg " << bMuons[i].getLogSegment()
72  << std::endl;*/
73  foundMuons = true;
74  }
75  }
76  for (unsigned int i = 0; i < fMuons.size(); i++) {
77  if (fMuons[i].getPtCode() != 0) {
78  /*std::cout<< "ptcode " << fMuons[i].getPtCode()
79  << " t " << fMuons[i].getTower()
80  << " sec " << fMuons[i].getLogSector()
81  << " seg " << fMuons[i].getLogSegment()
82  << std::endl;*/
83  foundMuons = true;
84  }
85  }
86  if (!foundMuons) {
87  for (unsigned int iLC = 0; iLC < logConesVec.size(); iLC++) {
88  if (logConesVec[iLC].getFiredPlanesCnt() >= 3) {
89  std::cout << logConesVec[iLC].toString();
90  }
91  }
92  }
93 #endif
94 
95  return m_GBFinalMuons;
96 }
97 
99 
101  L1RpcTBMuonsVec notEmptyMuonsVec;
102  for (unsigned int iMu = 0; iMu < m_GBFinalMuons[0].size(); iMu++)
103  if (m_GBFinalMuons[0][iMu].getCode() != 0)
104  notEmptyMuonsVec.push_back(m_GBFinalMuons[0][iMu]);
105 
106  for (unsigned int iMu = 0; iMu < m_GBFinalMuons[1].size(); iMu++)
107  if (m_GBFinalMuons[1][iMu].getCode() != 0)
108  notEmptyMuonsVec.push_back(m_GBFinalMuons[1][iMu]);
109 
110  return notEmptyMuonsVec;
111 }
RPCHalfSorter m_HalfSorters
Definition: RPCPacTrigger.h:44
virtual int getTCsCnt()=0
returns count of Trigger Crates in system.
std::vector< RPCTriggerCrate > m_TriggerCratesVec
Definition: RPCPacTrigger.h:39
L1RpcTBMuonsVec2 m_GBFinalMuons
Definition: RPCPacTrigger.h:50
static MuonsGrabber & Instance()
Definition: MuonsGrabber.cc:48
L1RpcTBMuonsVec2 run(L1RpcTBMuonsVec2 &tcsMuonsVec2, edm::ESHandle< L1RPCHsbConfig > hsbConf)
std::vector< RPCTBMuon > L1RpcTBMuonsVec
Definition: RPCTBMuon.h:218
std::vector< L1RpcTBMuonsVec > L1RpcTBMuonsVec2
Definition: RPCTBMuon.h:219
RPCFinalSorter m_FinalSorter
Definition: RPCPacTrigger.h:43
L1RpcTBMuonsVec2 run(L1RpcTBMuonsVec2 &tcsMuonsVec2)
RPCPacTrigger(RPCTriggerConfiguration *triggerConfig)
void addMuon(RPCTBMuon &mu, int lvl, int region, int hs, int index)
virtual int getTCNum(const RPCConst::l1RpcConeCrdnts &coneCrdnts)=0
Returns the index of TC that should run given LogCone.
L1RpcTBMuonsVec2 runEvent(const L1RpcLogConesVec &logConesVec, edm::ESHandle< L1RPCHsbConfig > hsbConf)
RPCTriggerConfiguration * m_TrigCnfg
Definition: RPCPacTrigger.h:41
L1RpcTBMuonsVec getNotEmptyMuons()
std::vector< RPCLogCone > L1RpcLogConesVec
Definition: RPCLogCone.h:119