File indexing completed on 2024-04-06 12:21:41
0001 #include "L1Trigger/RPCTrigger/interface/RPCTCGhostBusterSorter.h"
0002
0003 #include <algorithm>
0004
0005 using namespace std;
0006
0007
0008 RPCTCGhostBusterSorter::RPCTCGhostBusterSorter(RPCTriggerConfiguration* triggerConfig) {
0009 m_TriggerConfig = triggerConfig;
0010 }
0011
0012 L1RpcTBMuonsVec RPCTCGhostBusterSorter::run(L1RpcTBMuonsVec2& tbMuonsVec2) {
0013 for (unsigned int iTB = 0; iTB < tbMuonsVec2.size() - 1; iTB++) {
0014 for (unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++) {
0015 if (tbMuonsVec2[iTB][iMu].getPtCode() == 0)
0016 break;
0017
0018
0019 if (tbMuonsVec2[iTB][iMu].getEtaAddr() == (m_TriggerConfig->getTowsCntOnTB(iTB) - 1)) {
0020 for (unsigned int iMuN = 0; iMuN < tbMuonsVec2[iTB + 1].size(); iMuN++) {
0021 if (tbMuonsVec2[iTB + 1][iMuN].getPtCode() == 0)
0022 break;
0023
0024
0025 if (tbMuonsVec2[iTB + 1][iMuN].getEtaAddr() == 0) {
0026 if (abs(tbMuonsVec2[iTB][iMu].getPhiAddr() - tbMuonsVec2[iTB + 1][iMuN].getPhiAddr()) <= 1) {
0027 if (tbMuonsVec2[iTB][iMu].getCode() < tbMuonsVec2[iTB + 1][iMuN].getCode()) {
0028 tbMuonsVec2[iTB][iMu].kill();
0029 } else {
0030 tbMuonsVec2[iTB + 1][iMuN].kill();
0031 }
0032 }
0033 }
0034 }
0035 }
0036 }
0037 }
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054 L1RpcTBMuonsVec outputMuons;
0055 for (unsigned int iTB = 0; iTB < tbMuonsVec2.size(); iTB++)
0056 for (unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++)
0057 if (tbMuonsVec2[iTB][iMu].isLive()) {
0058 int etaAddr = tbMuonsVec2[iTB][iMu].getEtaAddr() | (iTB << 2);
0059 etaAddr = m_TriggerConfig->towAddr2TowNum(etaAddr);
0060
0061 etaAddr = m_TriggerConfig->towNum2TowNum2Comp(etaAddr);
0062 tbMuonsVec2[iTB][iMu].setEtaAddr(etaAddr);
0063
0064 outputMuons.push_back(tbMuonsVec2[iTB][iMu]);
0065 }
0066
0067 sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
0068
0069
0070 while (outputMuons.size() < RPCConst::m_TCGB_OUT_MUONS_CNT)
0071 outputMuons.push_back(RPCTBMuon());
0072 while (outputMuons.size() > RPCConst::m_TCGB_OUT_MUONS_CNT)
0073 outputMuons.pop_back();
0074
0075 return outputMuons;
0076 }