File indexing completed on 2024-04-06 12:21:41
0001
0002
0003
0004
0005
0006
0007 #include "L1Trigger/RPCTrigger/interface/RPCPacTrigger.h"
0008 #include "L1Trigger/RPCTrigger/interface/MuonsGrabber.h"
0009
0010 RPCPacTrigger::RPCPacTrigger(RPCTriggerConfiguration* triggerConfig)
0011 : m_FinalSorter(triggerConfig), m_HalfSorters(triggerConfig) {
0012 m_TrigCnfg = triggerConfig;
0013 for (int iTC = 0; iTC < m_TrigCnfg->getTCsCnt(); iTC++) {
0014 m_TriggerCratesVec.push_back(RPCTriggerCrate(m_TrigCnfg, iTC));
0015 }
0016 }
0017
0018
0019
0020 L1RpcTBMuonsVec2 RPCPacTrigger::runEvent(const L1RpcLogConesVec& logConesVec, edm::ESHandle<L1RPCHsbConfig> hsbConf) {
0021 m_GBFinalMuons.clear();
0022
0023 if (m_TrigCnfg->getDebugLevel() != 0) {
0024 #ifdef _STAND_ALONE
0025 std::cout << "---TBMuons in new event" << std::endl;
0026 #endif
0027 }
0028 for (unsigned int iLC = 0; iLC < logConesVec.size(); iLC++) {
0029 if (logConesVec[iLC].getFiredPlanesCnt() >= 3) {
0030 m_TriggerCratesVec[m_TrigCnfg->getTCNum(logConesVec[iLC].getConeCrdnts())].runCone(logConesVec[iLC]);
0031 }
0032 }
0033
0034 L1RpcTBMuonsVec2 tcsMuonsVec2;
0035 for (unsigned int iTC = 0; iTC < m_TriggerCratesVec.size(); iTC++) {
0036 tcsMuonsVec2.push_back(m_TriggerCratesVec[iTC].runTCGBSorter());
0037 }
0038
0039 if (m_TrigCnfg->getDebugLevel() != 0) {
0040 for (unsigned int iTC = 0; iTC < tcsMuonsVec2.size(); iTC++) {
0041 for (unsigned int iTB = 0; iTB < tcsMuonsVec2[iTC].size(); iTB++) {
0042 #ifdef _STAND_ALONE
0043 std::cout << "GB 2 " << iTB << " " << tcsMuonsVec2[iTC][iTB].printDebugInfo(m_TrigCnfg->getDebugLevel())
0044 << std::endl;
0045 #else
0046
0047
0048 MuonsGrabber::Instance().addMuon(tcsMuonsVec2[iTC][iTB], 2, -1, -1, iTB);
0049
0050 #endif
0051 }
0052 }
0053 }
0054
0055
0056 L1RpcTBMuonsVec2 halfMuons = m_HalfSorters.run(tcsMuonsVec2, hsbConf);
0057 m_GBFinalMuons = m_FinalSorter.run(halfMuons);
0058
0059 #ifdef GETCONES
0060 bool foundMuons = false;
0061 L1RpcTBMuonsVec bMuons = m_GBFinalMuons[0];
0062 L1RpcTBMuonsVec fMuons = m_GBFinalMuons[1];
0063
0064 std::cout << "------------" << std::endl;
0065 for (unsigned int i = 0; i < bMuons.size(); i++) {
0066 if (bMuons[i].getPtCode() != 0) {
0067
0068
0069
0070
0071
0072
0073 foundMuons = true;
0074 }
0075 }
0076 for (unsigned int i = 0; i < fMuons.size(); i++) {
0077 if (fMuons[i].getPtCode() != 0) {
0078
0079
0080
0081
0082
0083 foundMuons = true;
0084 }
0085 }
0086 if (!foundMuons) {
0087 for (unsigned int iLC = 0; iLC < logConesVec.size(); iLC++) {
0088 if (logConesVec[iLC].getFiredPlanesCnt() >= 3) {
0089 std::cout << logConesVec[iLC].toString();
0090 }
0091 }
0092 }
0093 #endif
0094
0095 return m_GBFinalMuons;
0096 }
0097
0098
0099
0100 L1RpcTBMuonsVec RPCPacTrigger::getNotEmptyMuons() {
0101 L1RpcTBMuonsVec notEmptyMuonsVec;
0102 for (unsigned int iMu = 0; iMu < m_GBFinalMuons[0].size(); iMu++)
0103 if (m_GBFinalMuons[0][iMu].getCode() != 0)
0104 notEmptyMuonsVec.push_back(m_GBFinalMuons[0][iMu]);
0105
0106 for (unsigned int iMu = 0; iMu < m_GBFinalMuons[1].size(); iMu++)
0107 if (m_GBFinalMuons[1][iMu].getCode() != 0)
0108 notEmptyMuonsVec.push_back(m_GBFinalMuons[1][iMu]);
0109
0110 return notEmptyMuonsVec;
0111 }