CMS 3D CMS Logo

Public Member Functions | Private Attributes

RPCTCGhostBusterSorter Class Reference

#include <RPCTCGhostBusterSorter.h>

List of all members.

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.

                                                                                     {
  m_TriggerConfig = 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().

                                                                         {
  for (unsigned int iTB = 0; iTB < tbMuonsVec2.size()-1; iTB++) {
    for(unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++) {
      if(tbMuonsVec2[iTB][iMu].getPtCode() == 0)
        break; //becouse muons are sorted
      
      //muon from this TB is on positive edge of TB (last m_tower of this tb):
      if(tbMuonsVec2[iTB][iMu].getEtaAddr() == (m_TriggerConfig->getTowsCntOnTB(iTB)-1)) {  
        for(unsigned int iMuN = 0; iMuN < tbMuonsVec2[iTB + 1].size(); iMuN++) {
          if(tbMuonsVec2[iTB + 1][iMuN].getPtCode() == 0)
            break; //becouse muons are sorted
          
          //muon from next TB is on negative edge (first m_tower of this TB):
          if(tbMuonsVec2[iTB+1][iMuN].getEtaAddr() == 0) {  
            if( abs(tbMuonsVec2[iTB][iMu].getPhiAddr() - tbMuonsVec2[iTB+1][iMuN].getPhiAddr()) <= 1)
            {
              if(tbMuonsVec2[iTB][iMu].getCode() < tbMuonsVec2[iTB+1][iMuN].getCode())
              {
                tbMuonsVec2[iTB][iMu].kill();
              }
              else
              {
                tbMuonsVec2[iTB+1][iMuN].kill();
              }
            }
          }
        }
      }
    }
  }

//---------sorting-----------------------------------------
/*  multiset<RPCTBMuon, RPCTBMuon::TMuonMore> liveMuonsSet;
  for(unsigned int iTB = 0; iTB < tbMuonsVec2.size(); iTB++)
  for(unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++)
      if(tbMuonsVec2[iTB][iMu].isLive()) {

        int etaAddr = tbMuonsVec2[iTB][iMu].getEtaAddr() | (iTB<<2); //m_tower number natural
        etaAddr = m_TriggerConfig->towAddr2TowNum(etaAddr); //m_tower number: -16 : 16
        etaAddr = etaAddr + 16;                     // m_tower number continous 0 : 32
        tbMuonsVec2[iTB][iMu].setEtaAddr(etaAddr);

        liveMuonsSet.insert(tbMuonsVec2[iTB][iMu]);
      }
  L1RpcTBMuonsVec outputMuons(liveMuonsSet.begin(), liveMuonsSet.end()); */

  L1RpcTBMuonsVec outputMuons;
  for(unsigned int iTB = 0; iTB < tbMuonsVec2.size(); iTB++)
    for(unsigned int iMu = 0; iMu < tbMuonsVec2[iTB].size(); iMu++)
      if(tbMuonsVec2[iTB][iMu].isLive()) {
        int etaAddr = tbMuonsVec2[iTB][iMu].getEtaAddr() | (iTB<<2); //m_tower number natural <0...35>
        etaAddr = m_TriggerConfig->towAddr2TowNum(etaAddr); //m_tower number: -16 : 16
        //etaAddr = etaAddr + 16;                     // m_tower number continous 0 : 32
        etaAddr = m_TriggerConfig->towNum2TowNum2Comp(etaAddr); // 10 oct 2006 - moved from FS
        tbMuonsVec2[iTB][iMu].setEtaAddr(etaAddr);

        outputMuons.push_back(tbMuonsVec2[iTB][iMu]);
      }

  sort(outputMuons.begin(), outputMuons.end(), RPCTBMuon::TMuonMore());
  
//-------setting size to m_GBETA_OUT_MUONS_CNT----------------
  while(outputMuons.size() < RPCConst::m_TCGB_OUT_MUONS_CNT)
    outputMuons.push_back(RPCTBMuon());
  while(outputMuons.size() > RPCConst::m_TCGB_OUT_MUONS_CNT)
    outputMuons.pop_back();

  return outputMuons;
}

Member Data Documentation

Definition at line 26 of file RPCTCGhostBusterSorter.h.