CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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  {
8  m_endcap = id.endcap();
9  m_sector = id.sector();
10  m_lphi = 0;
11  m_ptAddress = 0;
12  m_empty = true;
13  setType(2);
14  setPtPacked(0);
15  m_rank = 0;
16  me1_id = 0;
17  me2_id = 0;
18  me3_id = 0;
19  me4_id = 0;
20  mb1_id = 0;
21  m_me1Tbin = 0;
22  m_me2Tbin = 0;
23  m_me3Tbin = 0;
24  m_me4Tbin = 0;
25  m_mbTbin = 0;
26  m_output_link = 0;
27  m_winner = false;
28  m_fr=0;
29  m_se=true; m_bx0=true; m_bc0=true;
30  }
31 
32  L1Track::L1Track(const csc::L1Track& rhs) : L1MuRegionalCand(rhs.type_idx(),rhs.phi_packed(),rhs.eta_packed(),
33  rhs.pt_packed(),rhs.charge_packed(),
34  rhs.charge_valid_packed(),rhs.finehalo_packed(),
35  rhs.quality_packed(),rhs.bx()),
36  m_name(rhs.m_name)
37  {
38  this->setBx(rhs.bx());
39  this->setDataWord(rhs.getDataWord());
40  m_name = rhs.m_name;
41  this->setType(rhs.type_idx());
42  this->setPhiPacked(rhs.phi_packed());
43  this->setEtaPacked(rhs.eta_packed());
44  this->setPtPacked(rhs.pt_packed());
45  this->setChargePacked(rhs.charge_packed());
48  this->setQualityPacked(rhs.quality_packed());
49  m_empty = rhs.m_empty;
50  m_lphi = rhs.m_lphi;
51  m_endcap = rhs.m_endcap;
52  m_sector = rhs.m_sector;
54  m_rank = rhs.m_rank;
55  me1_id = rhs.me1_id;
56  me2_id = rhs.me2_id;
57  me3_id = rhs.me3_id;
58  me4_id = rhs.me4_id;
59  mb1_id = rhs.mb1_id;
60  m_me1Tbin = rhs.m_me1Tbin;
61  m_me2Tbin = rhs.m_me2Tbin;
62  m_me3Tbin = rhs.m_me3Tbin;
63  m_me4Tbin = rhs.m_me4Tbin;
64  m_mbTbin = rhs.m_mbTbin;
66  m_winner = rhs.m_winner;
67  m_fr=rhs.m_fr;
68  m_se=rhs.m_se;
69  m_bx0=rhs.m_bx0;
70  m_bc0=rhs.m_bc0;
71  }
72 
74  {
75  }
76 
78  {
79  if(this != &rhs)
80  {
81  m_fr=rhs.m_fr;
82  m_se=rhs.m_se;
83  m_bx0=rhs.m_bx0;
84  m_bc0=rhs.m_bc0;
85  m_empty = rhs.m_empty;
86  this->setBx(rhs.bx());
87  this->setDataWord(rhs.getDataWord());
88  m_name = rhs.m_name;
89  m_lphi = rhs.m_lphi;
90  this->setType(rhs.type_idx());
91  this->setPhiPacked(rhs.phi_packed());
92  this->setEtaPacked(rhs.eta_packed());
93  this->setPtPacked(rhs.pt_packed());
94  this->setChargePacked(rhs.charge_packed());
97  this->setQualityPacked(rhs.quality_packed());
98  m_endcap = rhs.m_endcap;
99  m_sector = rhs.m_sector;
100  m_ptAddress = rhs.m_ptAddress;
101  m_rank = rhs.m_rank;
102  me1_id = rhs.me1_id;
103  me2_id = rhs.me2_id;
104  me3_id = rhs.me3_id;
105  me4_id = rhs.me4_id;
106  mb1_id = rhs.mb1_id;
107  m_me1Tbin = rhs.m_me1Tbin;
108  m_me2Tbin = rhs.m_me2Tbin;
109  m_me3Tbin = rhs.m_me3Tbin;
110  m_me4Tbin = rhs.m_me4Tbin;
111  m_mbTbin = rhs.m_mbTbin;
113  m_winner = rhs.m_winner;
114  }
115  return *this;
116  }
117 
118  unsigned L1Track::rank() const
119  {
120  return m_rank;
121  }
122 
123  void L1Track::setStationIds(const unsigned& me1, const unsigned& me2,
124  const unsigned& me3, const unsigned& me4,
125  const unsigned& mb1)
126  {
127  me1_id = me1;
128  me2_id = me2;
129  me3_id = me3;
130  me4_id = me4;
131  mb1_id = mb1;
132  }
133 
134  unsigned L1Track::encodeRank(const unsigned& pt, const unsigned& quality)
135  {
136  if(pt == 0) return 0;
137  return pt | (quality << L1MuRegionalCand::PT_LENGTH);
138  }
139 
140  void L1Track::decodeRank(const unsigned& rank, unsigned& pt, unsigned& quality)
141  {
142  if(rank == 0)
143  {
144  quality = 0;
145  pt = 0;
146  }
147  else
148  {
149  quality = rank >> L1MuRegionalCand::PT_LENGTH;
150  pt = rank & ( (1<<L1MuRegionalCand::PT_LENGTH) - 1);
151  }
152  }
153 
154  bool L1Track::operator>(const csc::L1Track &rhs) const
155  {
156  return (rank() > rhs.rank());
157  }
158 
159  bool L1Track::operator<(const csc::L1Track& rhs) const
160  {
161  return (rank() < rhs.rank());
162  }
163 
164  bool L1Track::operator>=(const csc::L1Track& rhs) const
165  {
166  return (rank() >= rhs.rank());
167  }
168 
169  bool L1Track::operator<=(const csc::L1Track& rhs) const
170  {
171  return (rank() <= rhs.rank());
172  }
173 
174  bool L1Track::operator==(const csc::L1Track& rhs) const
175  {
176  return (rank() == rhs.rank());
177  }
178 
179  bool L1Track::operator!=(const csc::L1Track& rhs) const
180  {
181  return (rank() != rhs.rank());
182  }
183 
184  void L1Track::Print() const
185  {
186  if (!empty())
187  {
188  std::cout << "\t Pt(int): " << " " << pt_packed()
189  << " Phi(int): " << " " << phi_packed()
190  << " Eta(int): " << " " << eta_packed()
191  << " Quality: " << " " << quality_packed()
192  << " charge: " << " " << charge_packed()
193  << " side: " << " " << endcap()
194  << " bx: " << " " << BX()
195  << " Winner: " << " " << winner()
196  << std::endl;
197  }
198  else
199  {
200  std::cout <<"\t Empty track!\n";
201  std::cout << "\t Pt(int): " << " " << "unassigned or zero"
202  << " Phi(int): " << " " << phi_packed()
203  << " Eta(int): " << " " << eta_packed()
204  << " Quality: " << " " << "unassigned or zero"
205  << " charge: " << " " << charge_packed()
206  << " side: " << " " << endcap()
207  << " bx: " << " " << BX()
208  << " Winner: " << " " << winner()
209  << std::endl;
210  }
211  }
212 
213  unsigned L1Track::modeExtended(void) const
214  {
215  unsigned modeExt = mode();
216  unsigned fr = (m_ptAddress>>21)&0x1;
217 
218  if (modeExt ==11 && fr==1)
219  modeExt = 17;
220  else if (modeExt==12 && fr==1)
221  modeExt = 18;
222  else if (modeExt==14 && fr==1)
223  modeExt = 16;
224  return modeExt;
225  }
226 }
unsigned m_me2Tbin
Definition: L1Track.h:122
bool operator<=(const csc::L1Track &) const
Definition: L1Track.cc:169
unsigned charge_valid_packed() const
return charge valid packed as in hardware (1=valid, 0=not valid)
std::string m_name
Definition: L1Track.h:107
unsigned mode(void) const
Definition: L1Track.h:88
unsigned modeExtended(void) const
Definition: L1Track.cc:213
unsigned m_ptAddress
Definition: L1Track.h:112
bool m_bc0
Definition: L1Track.h:121
unsigned m_me3Tbin
Definition: L1Track.h:122
void Print() const
Definition: L1Track.cc:184
virtual bool empty() const
return empty flag
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
unsigned me3_id
Definition: L1Track.h:114
bool m_se
Definition: L1Track.h:121
unsigned m_mbTbin
Definition: L1Track.h:122
bool operator==(const csc::L1Track &) const
Definition: L1Track.cc:174
unsigned mb1_id
Definition: L1Track.h:114
void setChargeValidPacked(unsigned valid)
Set Charge Valid.
static unsigned encodeRank(const unsigned &pt, const unsigned &quality)
Definition: L1Track.cc:134
void setBx(int bx)
Set Bunch Crossing.
unsigned m_me1Tbin
Definition: L1Track.h:122
unsigned me2_id
Definition: L1Track.h:114
unsigned me1_id
Definition: L1Track.h:114
unsigned m_sector
Definition: L1Track.h:109
void setDataWord(unsigned dataword)
Set data word.
unsigned getDataWord() const
return data word
unsigned m_output_link
Definition: L1Track.h:116
unsigned m_me4Tbin
Definition: L1Track.h:122
unsigned m_rank
Definition: L1Track.h:115
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 ~L1Track()
Definition: L1Track.cc:73
const csc::L1Track & operator=(const csc::L1Track &)
Definition: L1Track.cc:77
unsigned finehalo_packed() const
return eta-fine (for DT) / halo (for CSC) bit
static void decodeRank(const unsigned &rank, unsigned &pt, unsigned &quality)
Definition: L1Track.cc:140
unsigned rank() const
Definition: L1Track.cc:118
void setChargePacked(unsigned ch)
Set Charge (0=pos, 1=neg)
unsigned m_fr
Definition: L1Track.h:113
bool winner() const
Definition: L1Track.h:63
void setPtPacked(unsigned pt)
Set Pt: 0..31.
bool operator>(const csc::L1Track &) const
Definition: L1Track.cc:154
unsigned m_lphi
Definition: L1Track.h:111
unsigned me4_id
Definition: L1Track.h:114
void setPhiPacked(unsigned phi)
Set Phi: 0..143.
bool m_bx0
Definition: L1Track.h:121
unsigned int quality_packed() const
return quality packed as in hardware
int bx() const
return bunch crossing identifier
void setQualityPacked(unsigned qual)
Set Quality: 0..7.
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
unsigned endcap() const
Definition: L1Track.h:44
bool operator>=(const csc::L1Track &) const
Definition: L1Track.cc:164
void setFineHaloPacked(unsigned fh)
Set Fine / Halo.
tuple cout
Definition: gather_cfg.py:145
void setStationIds(const unsigned &me1, const unsigned &me2, const unsigned &me3, const unsigned &me4, const unsigned &mb1)
Definition: L1Track.cc:123
unsigned m_endcap
Definition: L1Track.h:109
unsigned pt_packed() const
return pt packed as in hardware
unsigned type_idx() const
return type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC
bool operator!=(const csc::L1Track &) const
Definition: L1Track.cc:179
int BX() const
Definition: L1Track.h:51
bool m_winner
Definition: L1Track.h:118
bool m_empty
Definition: L1Track.h:117
unsigned phi_packed() const
return phi packed as in hardware
bool operator<(const csc::L1Track &) const
Definition: L1Track.cc:159