CMS 3D CMS Logo

L1MuDTTrack.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTTrack
4 //
5 // Description: Muon Track Candidate
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 // J. Troconiz UAM Madrid
12 //
13 //--------------------------------------------------
14 
15 //-----------------------
16 // This Class's Header --
17 //-----------------------
18 
20 
21 //---------------
22 // C++ Headers --
23 //---------------
24 
25 #include <iostream>
26 #include <iomanip>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
31 
38 
39 using namespace std;
40 
41 // --------------------------------
42 // class L1MuDTTrack
43 //---------------------------------
44 
45 //----------------
46 // Constructors --
47 //----------------
49  : L1MuRegionalCand(0, 0),
50  m_spid(L1MuDTSecProcId()),
51  m_name("L1MuDTTrack"),
52  m_empty(true),
53  m_tc(UNDEF),
54  m_addArray(),
55  m_tsphiList(),
56  m_tsetaList() {
57  m_tsphiList.reserve(4);
58  m_tsetaList.reserve(3);
59 
60  setType(0);
61  setChargeValid(true);
62 }
63 
65  : L1MuRegionalCand(0, 0),
66  m_spid(spid),
67  m_name("L1MuDTTrack"),
68  m_empty(true),
69  m_tc(UNDEF),
70  m_addArray(),
71  m_tsphiList(),
72  m_tsetaList() {
73  m_tsphiList.reserve(4);
74  m_tsetaList.reserve(3);
75 
76  setType(0);
77  setChargeValid(true);
78 }
79 
82  m_spid(id.m_spid),
83  m_name(id.m_name),
84  m_empty(id.m_empty),
85  m_tc(id.m_tc),
86  m_addArray(id.m_addArray),
87  m_tsphiList(id.m_tsphiList),
88  m_tsetaList(id.m_tsetaList) {}
89 
90 //--------------
91 // Destructor --
92 //--------------
94 
95 //--------------
96 // Operations --
97 //--------------
98 
99 //
100 // reset Muon Track Candidate
101 //
104  m_empty = true;
105  m_tc = UNDEF;
106  m_addArray.reset();
107  m_tsphiList.clear();
108  m_tsetaList.clear();
109 }
110 
111 //
112 // set (packed) eta-code of muon candidate
113 //
115  // eta is a signed integer [-32,31],
116  // representing 64 bins in an interval [-1.2,+1.2]
117  // first convert eta into an unsigned integer
120 }
121 
122 //
123 // return start phi track segment
124 //
125 const L1MuDTTrackSegPhi& L1MuDTTrack::getStartTSphi() const { return m_tsphiList.front(); }
126 
127 //
128 // return end phi track segment
129 //
130 const L1MuDTTrackSegPhi& L1MuDTTrack::getEndTSphi() const { return m_tsphiList.back(); }
131 
132 //
133 // return start eta track segment
134 //
135 const L1MuDTTrackSegEta& L1MuDTTrack::getStartTSeta() const { return m_tsetaList.front(); }
136 
137 //
138 // return end eta track segment
139 //
140 const L1MuDTTrackSegEta& L1MuDTTrack::getEndTSeta() const { return m_tsetaList.back(); }
141 
142 //
143 // set phi track segments used to form the muon candidate
144 //
145 void L1MuDTTrack::setTSphi(const vector<const L1MuDTTrackSegPhi*>& tsList) {
146  if (!tsList.empty()) {
147  vector<const L1MuDTTrackSegPhi*>::const_iterator iter;
148  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
149  if (*iter)
150  m_tsphiList.push_back(**iter);
151  }
152  }
153 }
154 
155 //
156 // set eta track segments used to form the muon candidate
157 //
158 void L1MuDTTrack::setTSeta(const vector<const L1MuDTTrackSegEta*>& tsList) {
159  if (!tsList.empty()) {
160  vector<const L1MuDTTrackSegEta*>::const_iterator iter;
161  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
162  if (*iter)
163  m_tsetaList.push_back(**iter);
164  }
165  }
166 }
167 
168 //
169 // Assignment operator
170 //
172  if (this != &track) {
173  this->setBx(track.bx());
174  this->setDataWord(track.getDataWord());
175  m_spid = track.m_spid;
176  m_empty = track.m_empty;
177  m_name = track.m_name;
178  m_tc = track.m_tc;
179  m_addArray = track.m_addArray;
180  m_tsphiList = track.m_tsphiList;
181  m_tsetaList = track.m_tsetaList;
182  }
183  return *this;
184 }
185 
186 //
187 // Equal operator
188 //
190  if (m_spid != track.m_spid)
191  return false;
192  if (m_empty != track.m_empty)
193  return false;
194  if (m_tc != track.m_tc)
195  return false;
196  if (bx() != track.bx())
197  return false;
198  if (phi() != track.phi())
199  return false;
200  if (eta() != track.eta())
201  return false;
202  if (fineEtaBit() != track.fineEtaBit())
203  return false;
204  if (pt() != track.pt())
205  return false;
206  if (charge() != track.charge())
207  return false;
208  if (quality() != track.quality())
209  return false;
210  if (m_addArray != track.m_addArray)
211  return false;
212  return true;
213 }
214 
215 //
216 // Unequal operator
217 //
219  if (m_spid != track.m_spid)
220  return true;
221  if (m_empty != track.m_empty)
222  return true;
223  if (m_tc != track.m_tc)
224  return true;
225  if (bx() != track.bx())
226  return true;
227  if (phi() != track.phi())
228  return true;
229  if (eta() != track.eta())
230  return true;
231  if (fineEtaBit() != track.fineEtaBit())
232  return true;
233  if (pt() != track.pt())
234  return true;
235  if (charge() != track.charge())
236  return true;
237  if (quality() != track.quality())
238  return true;
239  if (m_addArray != track.m_addArray)
240  return true;
241  return false;
242 }
243 
244 //
245 // print parameters of track candidate
246 //
247 void L1MuDTTrack::print() const {
248  if (!empty()) {
249  cout.setf(ios::showpoint);
250  cout.setf(ios::right, ios::adjustfield);
251  cout << setiosflags(ios::showpoint | ios::fixed);
252  cout << "MUON : "
253  << "pt = " << setw(2) << pt_packed() << " "
254  << "charge = " << setw(2) << charge_packed() << " "
255  << "eta = " << setw(2) << eta_packed() << " (" << setw(1) << finehalo_packed() << ") "
256  << "phi = " << setw(3) << phi_packed() << " "
257  << "quality = " << setw(1) << quality_packed() << '\t' << "class = " << tc() << " "
258  << "bx = " << setw(2) << bx() << endl;
259  cout << " found in " << m_spid << " with phi track segments :" << endl;
260  vector<L1MuDTTrackSegPhi>::const_iterator iter;
261  for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) {
262  cout << " " << (*iter) << endl;
263  }
264  }
265 }
266 
267 //
268 // output stream operator for track candidate
269 //
270 ostream& operator<<(ostream& s, const L1MuDTTrack& id) {
271  if (!id.empty()) {
272  s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(2) << id.pt_packed() << " "
273  << "charge = " << setw(2) << id.charge_packed() << " "
274  << "eta = " << setw(2) << id.eta_packed() << " (" << setw(1) << id.finehalo_packed() << ") "
275  << "phi = " << setw(3) << id.phi_packed() << " "
276  << "quality = " << setw(1) << id.quality_packed() << '\t' << "bx = " << setw(2) << id.bx();
277  }
278  return s;
279 }
void print() const override
print parameters of muon candidate
Definition: L1MuDTTrack.cc:247
std::vector< L1MuDTTrackSegEta > m_tsetaList
Definition: L1MuDTTrack.h:198
L1MuDTAddressArray m_addArray
Definition: L1MuDTTrack.h:196
unsigned int quality_packed() const
return quality packed as in hardware
~L1MuDTTrack() override
destructor
Definition: L1MuDTTrack.cc:93
unsigned int eta() const
get eta-code (6 bits)
Definition: L1MuDTTrack.h:72
unsigned pt_packed() const
return pt packed as in hardware
unsigned int pt() const
get pt-code (5 bits)
Definition: L1MuDTTrack.h:66
const L1MuDTTrackSegEta & getStartTSeta() const
return start eta track segment of muon candidate
Definition: L1MuDTTrack.cc:135
unsigned int quality() const
return quality
ostream & operator<<(ostream &s, const L1MuDTTrack &id)
Definition: L1MuDTTrack.cc:270
void setTSeta(const std::vector< const L1MuDTTrackSegEta *> &tsList)
set eta track segments used to form the muon candidate
Definition: L1MuDTTrack.cc:158
const L1MuDTTrackSegPhi & getEndTSphi() const
return end phi track segment of muon candidate
Definition: L1MuDTTrack.cc:130
void reset()
reset address array
bool fineEtaBit() const
get fine eta bit
Definition: L1MuDTTrack.h:75
const L1MuDTTrackSegEta & getEndTSeta() const
return end eta track segment of muon candidate
Definition: L1MuDTTrack.cc:140
unsigned charge_packed() const
return charge packed as in hardware (0=pos, 1=neg)
unsigned getDataWord() const
return data word
unsigned phi_packed() const
return phi packed as in hardware
std::string m_name
Definition: L1MuDTTrack.h:192
L1MuDTTrack & operator=(const L1MuDTTrack &)
assignment operator
Definition: L1MuDTTrack.cc:171
void setEta(int eta)
set eta-code of muon candidate
Definition: L1MuDTTrack.cc:114
void setBx(int bx)
Set Bunch Crossing.
void setDataWord(unsigned dataword)
Set data word.
void reset() override
reset muon candidate
Definition: L1MuDTTrack.cc:102
unsigned int phi() const
get phi-code (8 bits)
Definition: L1MuDTTrack.h:69
void setTSphi(const std::vector< const L1MuDTTrackSegPhi *> &tsList)
set phi track segments used to form the muon candidate
Definition: L1MuDTTrack.cc:145
unsigned eta_packed() const
return eta packed as in hardware
void setType(unsigned type)
Set Type: 0 DT, 1 bRPC, 2 CSC, 3 fRPC.
std::vector< L1MuDTTrackSegPhi > m_tsphiList
Definition: L1MuDTTrack.h:197
L1MuDTTrack()
default constructor
Definition: L1MuDTTrack.cc:48
bool operator!=(const L1MuDTTrack &) const
unequal operator
Definition: L1MuDTTrack.cc:218
int charge() const
get charge (1 bit)
Definition: L1MuDTTrack.h:78
unsigned packedFromIdx(int idx) const override
get the packed notation of a value, check range
Definition: L1MuPacking.h:109
bool empty() const override
is it an empty muon candidate?
Definition: L1MuDTTrack.h:84
void setEtaPacked(unsigned eta)
Set Eta: 6-bit code.
const L1MuDTTrackSegPhi & getStartTSphi() const
return start phi track segment of muon candidate
Definition: L1MuDTTrack.cc:125
unsigned finehalo_packed() const
return eta-fine (for DT) / halo (for CSC) bit
virtual void reset()
reset
bool operator==(const L1MuDTTrack &) const
equal operator
Definition: L1MuDTTrack.cc:189
void setChargeValid(bool valid)
Set Charge Valid.
TrackClass tc() const
get track-class
Definition: L1MuDTTrack.h:81
TrackClass m_tc
Definition: L1MuDTTrack.h:194
int bx() const
return bunch crossing identifier
L1MuDTSecProcId m_spid
Definition: L1MuDTTrack.h:191