CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCTFMuonSorter Class Reference

#include <CSCTFMuonSorter.h>

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.

6 {
7  m_minBX = pset.getParameter<int>("MinBX");
8  m_maxBX = pset.getParameter<int>("MaxBX");
9 }
T getParameter(std::string const &) const

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().

62 {
63  if(rank == 0)
64  {
65  quality = 0;
66  pt = 0;
67  }
68  else
69  {
71  pt = rank & ( (1<<L1MuRegionalCand::PT_LENGTH) - 1);
72  }
73 }
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, EnergyCorrector::pt, HLT_25ns14e33_v1_cff::quality, query::result, and python.multivaluedict::sort().

Referenced by CSCTFCandidateBuilder::buildCandidates().

12 {
13  std::vector<L1MuRegionalCand> result;
14 
15  // First we sort and crop the incoming tracks based on their rank.
16  for(int bx = m_minBX - 6; bx <= m_maxBX - 6; ++bx) // switch back into signed BX
17  {
18  std::vector<csc::L1Track> tks = tracks.get(bx);
19  std::sort(tks.begin(),tks.end(),std::greater<csc::L1Track>());
20  if(tks.size() > 4) tks.resize(4); // resize to max number of muons the MS can output
21 
22  std::vector<csc::L1Track>::iterator itr = tks.begin();
23  std::vector<csc::L1Track>::const_iterator end = tks.end();
24  for(; itr != end; itr++)
25  {
26 
27 
28  unsigned gbl_phi = itr->localPhi() + ((itr->sector() - 1)*24) + 6; // for now, convert using this.. LUT in the future
29  if(gbl_phi > 143) gbl_phi -= 143;
30  itr->setPhiPacked(gbl_phi & 0xff);
31  unsigned eta_sign = (itr->endcap() == 1 ? 0 : 1);
32 
33  int gbl_eta = itr->eta_packed() | eta_sign << (L1MuRegionalCand::ETA_LENGTH - 1);
34 
35  itr->setEtaPacked(gbl_eta & 0x3f);
36  unsigned pt = 0, quality = 0;
37  decodeRank(itr->rank(), quality, pt);
38 
39  itr->setQualityPacked(quality & 0x3);
40  itr->setPtPacked(pt & 0x1f);
41 
42  if(!itr->empty()) result.push_back(*itr);
43  }
44  }
45 
46  std::vector<L1MuRegionalCand>::const_iterator ittr = result.begin();
47  unsigned ii = 1;
48  for(; ittr != result.end(); ittr++)
49  {
50  LogDebug("CSCTFMuonSorter:run()") << "TRACK " << ii++ << ": Eta: " << ittr->etaValue()
51  << " Phi: " << ittr->phiValue() << " Pt: " << ittr->ptValue()
52  << " Quality: " << ittr->quality() << " BX: " << ittr->bx();
53  }
54 
55  return result;
56 }
#define LogDebug(id)
std::vector< T > get() const
int ii
Definition: cuy.py:588
tuple result
Definition: query.py:137
#define end
Definition: vmac.h:37
void decodeRank(const unsigned &rank, unsigned &quality, unsigned &pt) const

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().