CMS 3D CMS Logo

L1Track.cc
Go to the documentation of this file.
2 #include <iostream>
3 
4 namespace csc {
5 
6  L1Track::L1Track(const csc::L1TrackId& id) : m_name("csc::L1Track") {
7  m_endcap = id.endcap();
8  m_sector = id.sector();
9  setType(2);
10  setPtPacked(0);
11  }
12 
14  : L1MuRegionalCand(rhs.type_idx(),
15  rhs.phi_packed(),
16  rhs.eta_packed(),
17  rhs.pt_packed(),
18  rhs.charge_packed(),
19  rhs.charge_valid_packed(),
20  rhs.finehalo_packed(),
21  rhs.quality_packed(),
22  rhs.bx()),
23  m_name(rhs.m_name) {
24  this->setBx(rhs.bx());
25  this->setDataWord(rhs.getDataWord());
26  m_name = rhs.m_name;
27  this->setType(rhs.type_idx());
28  this->setPhiPacked(rhs.phi_packed());
29  this->setEtaPacked(rhs.eta_packed());
30  this->setPtPacked(rhs.pt_packed());
31  this->setChargePacked(rhs.charge_packed());
34  this->setQualityPacked(rhs.quality_packed());
35  m_empty = rhs.m_empty;
36  m_lphi = rhs.m_lphi;
37  m_endcap = rhs.m_endcap;
38  m_sector = rhs.m_sector;
40  m_rank = rhs.m_rank;
41  me1_id = rhs.me1_id;
42  me2_id = rhs.me2_id;
43  me3_id = rhs.me3_id;
44  me4_id = rhs.me4_id;
45  mb1_id = rhs.mb1_id;
46  m_me1Tbin = rhs.m_me1Tbin;
47  m_me2Tbin = rhs.m_me2Tbin;
48  m_me3Tbin = rhs.m_me3Tbin;
49  m_me4Tbin = rhs.m_me4Tbin;
50  m_mbTbin = rhs.m_mbTbin;
52  m_winner = rhs.m_winner;
53  m_fr = rhs.m_fr;
54  m_se = rhs.m_se;
55  m_bx0 = rhs.m_bx0;
56  m_bc0 = rhs.m_bc0;
57  }
58 
60 
62  if (this != &rhs) {
63  m_fr = rhs.m_fr;
64  m_se = rhs.m_se;
65  m_bx0 = rhs.m_bx0;
66  m_bc0 = rhs.m_bc0;
67  m_empty = rhs.m_empty;
68  this->setBx(rhs.bx());
69  this->setDataWord(rhs.getDataWord());
70  m_name = rhs.m_name;
71  m_lphi = rhs.m_lphi;
72  this->setType(rhs.type_idx());
73  this->setPhiPacked(rhs.phi_packed());
74  this->setEtaPacked(rhs.eta_packed());
75  this->setPtPacked(rhs.pt_packed());
76  this->setChargePacked(rhs.charge_packed());
79  this->setQualityPacked(rhs.quality_packed());
80  m_endcap = rhs.m_endcap;
81  m_sector = rhs.m_sector;
83  m_rank = rhs.m_rank;
84  me1_id = rhs.me1_id;
85  me2_id = rhs.me2_id;
86  me3_id = rhs.me3_id;
87  me4_id = rhs.me4_id;
88  mb1_id = rhs.mb1_id;
89  m_me1Tbin = rhs.m_me1Tbin;
90  m_me2Tbin = rhs.m_me2Tbin;
91  m_me3Tbin = rhs.m_me3Tbin;
92  m_me4Tbin = rhs.m_me4Tbin;
93  m_mbTbin = rhs.m_mbTbin;
95  m_winner = rhs.m_winner;
96  }
97  return *this;
98  }
99 
100  unsigned L1Track::rank() const { return m_rank; }
101 
103  const unsigned& me1, const unsigned& me2, const unsigned& me3, const unsigned& me4, const unsigned& mb1) {
104  me1_id = me1;
105  me2_id = me2;
106  me3_id = me3;
107  me4_id = me4;
108  mb1_id = mb1;
109  }
110 
111  unsigned L1Track::encodeRank(const unsigned& pt, const unsigned& quality) {
112  if (pt == 0)
113  return 0;
114  return pt | (quality << L1MuRegionalCand::PT_LENGTH);
115  }
116 
117  void L1Track::decodeRank(const unsigned& rank, unsigned& pt, unsigned& quality) {
118  if (rank == 0) {
119  quality = 0;
120  pt = 0;
121  } else {
123  pt = rank & ((1 << L1MuRegionalCand::PT_LENGTH) - 1);
124  }
125  }
126 
127  bool L1Track::operator>(const csc::L1Track& rhs) const { return (rank() > rhs.rank()); }
128 
129  bool L1Track::operator<(const csc::L1Track& rhs) const { return (rank() < rhs.rank()); }
130 
131  bool L1Track::operator>=(const csc::L1Track& rhs) const { return (rank() >= rhs.rank()); }
132 
133  bool L1Track::operator<=(const csc::L1Track& rhs) const { return (rank() <= rhs.rank()); }
134 
135  bool L1Track::operator==(const csc::L1Track& rhs) const { return (rank() == rhs.rank()); }
136 
137  bool L1Track::operator!=(const csc::L1Track& rhs) const { return (rank() != rhs.rank()); }
138 
139  void L1Track::Print() const {
140  if (!empty()) {
141  std::cout << "\t Pt(int): "
142  << " " << pt_packed() << " Phi(int): "
143  << " " << phi_packed() << " Eta(int): "
144  << " " << eta_packed() << " Quality: "
145  << " " << quality_packed() << " charge: "
146  << " " << charge_packed() << " side: "
147  << " " << endcap() << " bx: "
148  << " " << BX() << " Winner: "
149  << " " << winner() << std::endl;
150  } else {
151  std::cout << "\t Empty track!\n";
152  std::cout << "\t Pt(int): "
153  << " "
154  << "unassigned or zero"
155  << " Phi(int): "
156  << " " << phi_packed() << " Eta(int): "
157  << " " << eta_packed() << " Quality: "
158  << " "
159  << "unassigned or zero"
160  << " charge: "
161  << " " << charge_packed() << " side: "
162  << " " << endcap() << " bx: "
163  << " " << BX() << " Winner: "
164  << " " << winner() << std::endl;
165  }
166  }
167 
168  unsigned L1Track::modeExtended(void) const {
169  unsigned modeExt = mode();
170  unsigned fr = (m_ptAddress >> 21) & 0x1;
171 
172  if (modeExt == 11 && fr == 1)
173  modeExt = 17;
174  else if (modeExt == 12 && fr == 1)
175  modeExt = 18;
176  else if (modeExt == 14 && fr == 1)
177  modeExt = 16;
178  return modeExt;
179  }
180 } // namespace csc
unsigned m_me2Tbin
Definition: L1Track.h:133
std::string m_name
Definition: L1Track.h:118
unsigned rank() const
Definition: L1Track.cc:100
unsigned int quality_packed() const
return quality packed as in hardware
unsigned m_ptAddress
Definition: L1Track.h:123
unsigned pt_packed() const
return pt packed as in hardware
unsigned int quality() const
return quality
bool m_bc0
Definition: L1Track.h:132
unsigned m_me3Tbin
Definition: L1Track.h:133
unsigned me3_id
Definition: L1Track.h:125
bool m_se
Definition: L1Track.h:132
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
unsigned m_mbTbin
Definition: L1Track.h:133
unsigned getDataWord() const
return data word
unsigned phi_packed() const
return phi packed as in hardware
unsigned mb1_id
Definition: L1Track.h:125
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
static unsigned encodeRank(const unsigned &pt, const unsigned &quality)
Definition: L1Track.cc:111
bool operator>(const csc::L1Track &) const
Definition: L1Track.cc:127
void setBx(int bx)
Set Bunch Crossing.
unsigned m_me1Tbin
Definition: L1Track.h:133
int BX() const
Definition: L1Track.h:53
unsigned me2_id
Definition: L1Track.h:125
unsigned me1_id
Definition: L1Track.h:125
unsigned m_sector
Definition: L1Track.h:120
void setDataWord(unsigned dataword)
Set data word.
bool operator==(const csc::L1Track &) const
Definition: L1Track.cc:135
unsigned m_output_link
Definition: L1Track.h:127
unsigned m_me4Tbin
Definition: L1Track.h:133
unsigned charge_valid_packed() const
return charge valid packed as in hardware (1=valid, 0=not valid)
bool operator<(const csc::L1Track &) const
Definition: L1Track.cc:129
unsigned m_rank
Definition: L1Track.h:126
bool operator<=(const csc::L1Track &) const
Definition: L1Track.cc:133
unsigned eta_packed() const
return eta packed as in hardware
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
virtual bool empty() const
return empty flag
void Print() const
Definition: L1Track.cc:139
bool winner() const
Definition: L1Track.h:65
Definition: L1Track.h:19
const csc::L1Track & operator=(const csc::L1Track &)
Definition: L1Track.cc:61
static void decodeRank(const unsigned &rank, unsigned &pt, unsigned &quality)
Definition: L1Track.cc:117
void setChargePacked(unsigned ch)
Set Charge (0=pos, 1=neg)
unsigned m_fr
Definition: L1Track.h:124
void setPtPacked(unsigned pt)
Set Pt: 0..31.
unsigned m_lphi
Definition: L1Track.h:122
~L1Track() override
Definition: L1Track.cc:59
unsigned me4_id
Definition: L1Track.h:125
unsigned mode(void) const
Definition: L1Track.h:90
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
bool m_bx0
Definition: L1Track.h:132
unsigned endcap() const
Definition: L1Track.h:46
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
unsigned modeExtended(void) const
Definition: L1Track.cc:168
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
unsigned finehalo_packed() const
return eta-fine (for DT) / halo (for CSC) bit
void setFineHaloPacked(unsigned fh)
Set Fine / Halo.
void setStationIds(const unsigned &me1, const unsigned &me2, const unsigned &me3, const unsigned &me4, const unsigned &mb1)
Definition: L1Track.cc:102
unsigned m_endcap
Definition: L1Track.h:120
string quality
bool operator!=(const csc::L1Track &) const
Definition: L1Track.cc:137
bool operator>=(const csc::L1Track &) const
Definition: L1Track.cc:131
int bx() const
return bunch crossing identifier
bool m_winner
Definition: L1Track.h:129
bool m_empty
Definition: L1Track.h:128
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC