CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CSCTFMuonSorter Class Reference

#include <CSCTFMuonSorter.h>

List of all members.

Public Member Functions

 CSCTFMuonSorter (const edm::ParameterSet &)
std::vector< L1MuRegionalCandrun (const CSCTriggerContainer< csc::L1Track > &) const

Private Member Functions

void decodeRank (const unsigned &rank, unsigned &quality, unsigned &pt) const

Private Attributes

int m_maxBX
int m_minBX

Detailed Description

Definition at line 9 of file CSCTFMuonSorter.h.


Constructor & Destructor Documentation

CSCTFMuonSorter::CSCTFMuonSorter ( const edm::ParameterSet pset)

Definition at line 5 of file CSCTFMuonSorter.cc.

References edm::ParameterSet::getParameter(), m_maxBX, and m_minBX.

{
  m_minBX = pset.getParameter<int>("MinBX");
  m_maxBX = pset.getParameter<int>("MaxBX");
}

Member Function Documentation

void CSCTFMuonSorter::decodeRank ( const unsigned &  rank,
unsigned &  quality,
unsigned &  pt 
) const [private]

Definition at line 60 of file CSCTFMuonSorter.cc.

References L1MuRegionalCand::PT_LENGTH.

Referenced by run().

{
  if(rank == 0)
    {
      quality = 0;
      pt = 0;
    }
  else
    {
      quality = rank >> L1MuRegionalCand::PT_LENGTH;
      pt = rank & ( (1<<L1MuRegionalCand::PT_LENGTH) - 1);
    }
}
std::vector< L1MuRegionalCand > CSCTFMuonSorter::run ( const CSCTriggerContainer< csc::L1Track > &  tracks) const

Definition at line 11 of file CSCTFMuonSorter.cc.

References decodeRank(), end, L1MuRegionalCand::ETA_LENGTH, CSCTriggerContainer< T >::get(), cuy::ii, LogDebug, m_maxBX, m_minBX, query::result, and python::multivaluedict::sort().

Referenced by CSCTFCandidateBuilder::buildCandidates().

{
  std::vector<L1MuRegionalCand> result;

  // First we sort and crop the incoming tracks based on their rank.
  for(int bx = m_minBX - 6; bx <= m_maxBX - 6; ++bx) // switch back into signed BX
    {
      std::vector<csc::L1Track> tks = tracks.get(bx);
      std::sort(tks.begin(),tks.end(),std::greater<csc::L1Track>());
      if(tks.size() > 4) tks.resize(4); // resize to max number of muons the MS can output
      
      std::vector<csc::L1Track>::iterator itr = tks.begin();
      std::vector<csc::L1Track>::const_iterator end = tks.end();
      for(; itr != end; itr++)
        {
          
          
          unsigned gbl_phi = itr->localPhi() + ((itr->sector() - 1)*24) + 6; // for now, convert using this.. LUT in the future
          if(gbl_phi > 143) gbl_phi -= 143;       
          itr->setPhiPacked(gbl_phi & 0xff);
          unsigned eta_sign = (itr->endcap() == 1 ? 0 : 1);

          int gbl_eta = itr->eta_packed() | eta_sign << (L1MuRegionalCand::ETA_LENGTH - 1);

          itr->setEtaPacked(gbl_eta & 0x3f);
          unsigned pt = 0, quality = 0;
          decodeRank(itr->rank(), quality, pt);

          itr->setQualityPacked(quality & 0x3);
          itr->setPtPacked(pt & 0x1f);

          if(!itr->empty()) result.push_back(*itr);
        }
    }

  std::vector<L1MuRegionalCand>::const_iterator ittr = result.begin();
  unsigned ii = 1;
  for(; ittr != result.end(); ittr++)
    {
      LogDebug("CSCTFMuonSorter:run()") << "TRACK " << ii++ << ": Eta: " << ittr->etaValue() 
                                        << " Phi: " << ittr->phiValue() << " Pt: " << ittr->ptValue()
                                        << " Quality: " << ittr->quality() << " BX: " << ittr->bx();
    }

  return result;
}

Member Data Documentation

int CSCTFMuonSorter::m_maxBX [private]

Definition at line 19 of file CSCTFMuonSorter.h.

Referenced by CSCTFMuonSorter(), and run().

int CSCTFMuonSorter::m_minBX [private]

Definition at line 19 of file CSCTFMuonSorter.h.

Referenced by CSCTFMuonSorter(), and run().