Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:40

0001 //---------------------------------------------------------------------------
0002 #include "L1Trigger/RPCTrigger/interface/RPCFinalSorter.h"
0003 
0004 #include "L1Trigger/RPCTrigger/interface/RPCConst.h"
0005 #include "L1Trigger/RPCTrigger/interface/MuonsGrabber.h"
0006 #include <algorithm>
0007 //---------------------------------------------------------------------------
0008 #include <set>
0009 using namespace std;
0010 
0011 /**
0012  *
0013  * Defualt constructor
0014  *
0015 */
0016 RPCFinalSorter::RPCFinalSorter(RPCTriggerConfiguration *triggerConfig) {
0017   m_TrigCnfg = triggerConfig;
0018   m_GBOutputMuons.assign(2, L1RpcTBMuonsVec());
0019 }
0020 /** 
0021  * Converts m_tower number (eta addr) from continous (0 - 32, m_tower 0 = 16)
0022  * to 2'complement.
0023  * @return 4 munons from barrel (m_GBOutputMuons[0]),
0024  * and 4 from endcaps (m_GBOutputMuons[1]).
0025 */
0026 L1RpcTBMuonsVec2 RPCFinalSorter::run(L1RpcTBMuonsVec2 &tcsMuonsVec2) {
0027   //m_GBOutputMuons[0].clear();
0028   //m_GBOutputMuons[1].clear();
0029 
0030   runFinalSorter(tcsMuonsVec2);  // modyfies  tcsMuonsVec2
0031 
0032   if (m_TrigCnfg->getDebugLevel() != 0) {
0033     for (unsigned int region = 0; region < tcsMuonsVec2.size(); ++region) {
0034       for (unsigned int iTB = 0; iTB < tcsMuonsVec2[region].size(); iTB++) {
0035 #ifndef _STAND_ALONE
0036         //  LogDebug("RPCHwDebug")<<"GB 4" << region
0037         //      << "0 " << iTB << " "
0038         //      << tcsMuonsVec2[region][iTB].printDebugInfo(m_TrigCnfg->getDebugLevel());
0039         MuonsGrabber::Instance().addMuon(tcsMuonsVec2[region][iTB], 4, region, 0, iTB);
0040 #else
0041         std::cout << "GB 4" << region << "0 " << iTB << " "
0042                   << tcsMuonsVec2[region][iTB].printDebugInfo(m_TrigCnfg->getDebugLevel()) << std::endl;
0043 #endif
0044       }
0045     }
0046   }
0047 
0048   return tcsMuonsVec2;
0049 }
0050 /*
0051  *
0052  *
0053  *
0054 */
0055 void RPCFinalSorter::runFinalSorter(L1RpcTBMuonsVec2 &finalMuons) {
0056   //---------sorting-----------------------------------------
0057   sort(finalMuons[0].begin(), finalMuons[0].end(), RPCTBMuon::TMuonMore());
0058   sort(finalMuons[1].begin(), finalMuons[1].end(), RPCTBMuon::TMuonMore());
0059 
0060   //-------setting size to m_GBETA_OUT_MUONS_CNT----------------
0061   while (finalMuons[0].size() > RPCConst::m_FINAL_OUT_MUONS_CNT) {
0062     finalMuons[0].pop_back();
0063     finalMuons[1].pop_back();
0064   }
0065 
0066   //-----setting 2'complement EtaAddr
0067   for (unsigned int iMu = 0; iMu < finalMuons[0].size(); iMu++) {
0068     // 10 oct 2006 - moved to RPCTCGhostBusterSorter::run
0069     //finalMuons[0][iMu].setEtaAddr(m_TrigCnfg->towNum2TowNum2Comp(finalMuons[0][iMu].getEtaAddr()));
0070     //finalMuons[1][iMu].setEtaAddr(m_TrigCnfg->towNum2TowNum2Comp(finalMuons[1][iMu].getEtaAddr()));
0071 
0072     // 9 July 2007 - temporarly moved to HS
0073     //finalMuons[0][iMu].setPhiAddr(finalMuons[0][iMu].getContinSegmAddr());
0074     //finalMuons[1][iMu].setPhiAddr(finalMuons[1][iMu].getContinSegmAddr());
0075   }
0076 }