CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1MuBMTrack.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMTrack
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 
35 //#include "CondFormats/L1TObjects/interface/L1MuTriggerPtScale.h"
36 //#include "CondFormats/DataRecord/interface/L1MuTriggerPtScaleRcd.h"
37 //#include "CondFormats/L1TObjects/interface/L1MuPacking.h"
38 
39 using namespace std;
40 
41 // --------------------------------
42 // class L1MuBMTrack
43 //---------------------------------
44 
45 //----------------
46 // Constructors --
47 //----------------
49  : //L1MuRegionalCand(0,0),-->
50  l1t::RegionalMuonCand(),
51  m_spid(L1MuBMSecProcId()),
52  m_name("L1MuBMTrack"),
53  m_empty(true),
54  m_tc(UNDEF),
55  m_addArray(),
56  m_tsphiList(),
57  m_tsetaList() {
58  m_tsphiList.reserve(4);
59  m_tsetaList.reserve(3);
60 
61  //setType(0);
62  //setChargeValid(true);
63  setHwSignValid(1);
64 }
65 
67  : //L1MuRegionalCand(0,0),-->
68  l1t::RegionalMuonCand(),
69  m_spid(spid),
70  m_name("L1MuBMTrack"),
71  m_empty(true),
72  m_tc(UNDEF),
73  m_addArray(),
74  m_tsphiList(),
75  m_tsetaList() {
76  m_tsphiList.reserve(4);
77  m_tsetaList.reserve(3);
78  //setType(0);
79  //setChargeValid(true);
80  setHwSignValid(1);
81 }
82 
84  : //L1MuRegionalCand(id),-->
85  l1t::RegionalMuonCand(id),
86  m_spid(id.m_spid),
87  m_name(id.m_name),
88  m_empty(id.m_empty),
89  m_tc(id.m_tc),
90  m_addArray(id.m_addArray),
91  m_tsphiList(id.m_tsphiList),
92  m_tsetaList(id.m_tsetaList) {}
93 
94 //--------------
95 // Destructor --
96 //--------------
98 
99 //--------------
100 // Operations --
101 //--------------
102 
103 //
104 // reset Muon Track Candidate
105 //
107  //L1MuRegionalCand::reset();
108  m_empty = true;
109  m_tc = UNDEF;
110  m_addArray.reset();
111  m_tsphiList.clear();
112  m_tsetaList.clear();
113 }
114 
115 //
116 // set (packed) eta-code of muon candidate
117 //
119  // eta is a signed integer [-115,118],
120  setHwHF(false);
121  setHwEta(eta);
122 }
123 
124 //
125 // return start phi track segment
126 //
127 const L1MuBMTrackSegPhi& L1MuBMTrack::getStartTSphi() const { return m_tsphiList.front(); }
128 
129 //
130 // return end phi track segment
131 //
132 const L1MuBMTrackSegPhi& L1MuBMTrack::getEndTSphi() const { return m_tsphiList.back(); }
133 
134 //
135 // return start eta track segment
136 //
137 const L1MuBMTrackSegEta& L1MuBMTrack::getStartTSeta() const { return m_tsetaList.front(); }
138 
139 //
140 // return end eta track segment
141 //
142 const L1MuBMTrackSegEta& L1MuBMTrack::getEndTSeta() const { return m_tsetaList.back(); }
143 
144 //
145 // set phi track segments used to form the muon candidate
146 //
147 void L1MuBMTrack::setTSphi(const vector<const L1MuBMTrackSegPhi*>& tsList) {
148  if (!tsList.empty()) {
149  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
150  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
151  if (*iter)
152  m_tsphiList.push_back(**iter);
153  }
154  }
155 }
156 
157 //
158 // set eta track segments used to form the muon candidate
159 //
160 void L1MuBMTrack::setTSeta(const vector<const L1MuBMTrackSegEta*>& tsList) {
161  if (!tsList.empty()) {
162  vector<const L1MuBMTrackSegEta*>::const_iterator iter;
163  for (iter = tsList.begin(); iter != tsList.end(); iter++) {
164  if (*iter)
165  m_tsetaList.push_back(**iter);
166  }
167  }
168 }
169 
170 //
171 // Assignment operator
172 //
174  if (this != &track) {
175  this->setBx(track.bx());
176  //this->setDataWord(track.getDataWord());
177  m_spid = track.m_spid;
178  m_empty = track.m_empty;
179  m_name = track.m_name;
180  m_tc = track.m_tc;
181  m_addArray = track.m_addArray;
182  m_tsphiList = track.m_tsphiList;
183  m_tsetaList = track.m_tsetaList;
184  }
185  return *this;
186 }
187 
188 //
189 // Equal operator
190 //
192  if (m_spid != track.m_spid)
193  return false;
194  if (m_empty != track.m_empty)
195  return false;
196  if (m_tc != track.m_tc)
197  return false;
198  if (bx() != track.bx())
199  return false;
200  if (phi() != track.phi())
201  return false;
202  if (eta() != track.eta())
203  return false;
204  if (fineEtaBit() != track.fineEtaBit())
205  return false;
206  if (pt() != track.pt())
207  return false;
208  if (charge() != track.charge())
209  return false;
210  if (quality() != track.quality())
211  return false;
212  if (m_addArray != track.m_addArray)
213  return false;
214  return true;
215 }
216 
217 //
218 // Unequal operator
219 //
221  if (m_spid != track.m_spid)
222  return true;
223  if (m_empty != track.m_empty)
224  return true;
225  if (m_tc != track.m_tc)
226  return true;
227  if (bx() != track.bx())
228  return true;
229  if (phi() != track.phi())
230  return true;
231  if (eta() != track.eta())
232  return true;
233  if (fineEtaBit() != track.fineEtaBit())
234  return true;
235  if (pt() != track.pt())
236  return true;
237  if (charge() != track.charge())
238  return true;
239  if (quality() != track.quality())
240  return true;
241  if (m_addArray != track.m_addArray)
242  return true;
243  return false;
244 }
245 
246 //
247 // print parameters of track candidate
248 //
249 void L1MuBMTrack::print() const {
250  if (!empty()) {
251  cout.setf(ios::showpoint);
252  cout.setf(ios::right, ios::adjustfield);
253  cout << setiosflags(ios::showpoint | ios::fixed);
254  cout << "MUON : "
255  << "pt = " << setw(3) << hwPt() << " "
256  << "charge = " << setw(2) << hwSign() << " "
257  << "eta = " << setw(2)
258  << hwEta()
259  //<< " (" << setw(1) << finehalo_packed() << ") "
260  << "phi = " << setw(3) << hwPhi() << " "
261  << "quality = " << setw(1) << hwQual() << '\t' << "class = " << tc() << " "
262  << "bx = " << setw(2) << bx() << endl;
263  cout << " found in " << m_spid << " with phi track segments :" << endl;
264  vector<L1MuBMTrackSegPhi>::const_iterator iter;
265  for (iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++) {
266  cout << " " << (*iter) << endl;
267  }
268  }
269 }
270 
271 //
272 // output stream operator for track candidate
273 //
274 ostream& operator<<(ostream& s, const L1MuBMTrack& id) {
275  if (!id.empty()) {
276  s << setiosflags(ios::showpoint | ios::fixed) << "pt = " << setw(3) << id.hwPt() << " "
277  << "charge = " << setw(2) << id.hwSign() << " "
278  << "eta = " << setw(2)
279  << id.hwEta()
280  //<< " (" << setw(1) << id.finehalo_packed() << ") "
281  << "phi = " << setw(3) << id.hwPhi() << " "
282  << "quality = " << setw(1) << id.hwQual() << '\t' << "bx = " << setw(2) << id.bx();
283  }
284  return s;
285 }
unsigned int pt() const
get pt-code (5 bits)
Definition: L1MuBMTrack.h:70
bool operator!=(const L1MuBMTrack &) const
unequal operator
Definition: L1MuBMTrack.cc:220
L1MuBMTrack & operator=(const L1MuBMTrack &)
assignment operator
Definition: L1MuBMTrack.cc:173
const L1MuBMTrackSegPhi & getStartTSphi() const
return start phi track segment of muon candidate
Definition: L1MuBMTrack.cc:127
const L1MuBMTrackSegEta & getEndTSeta() const
return end eta track segment of muon candidate
Definition: L1MuBMTrack.cc:142
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
std::vector< L1MuBMTrackSegEta > m_tsetaList
Definition: L1MuBMTrack.h:209
L1MuBMSecProcId m_spid
Definition: L1MuBMTrack.h:201
int charge() const
get charge (1 bit)
Definition: L1MuBMTrack.h:82
const int hwQual() const
Get quality code.
TrackClass tc() const
get track-class
Definition: L1MuBMTrack.h:88
void setTSeta(const std::vector< const L1MuBMTrackSegEta * > &tsList)
set eta track segments used to form the muon candidate
Definition: L1MuBMTrack.cc:160
unsigned int phi() const
get phi-code (8 bits)
Definition: L1MuBMTrack.h:73
void setHwHF(bool bit)
Set HF (halo / fine eta) bit (EMTF: halo -&gt; 1; BMTF: fine eta -&gt; 1)
void setBx(int bx)
set charge of muon candidate
Definition: L1MuBMTrack.h:160
const int hwEta() const
Get compressed eta (returned int * 0.010875 = eta)
const int hwPhi() const
Get compressed local phi (returned int * 2*pi/576 = local phi in rad)
int bx() const
get the bunch crossing for this muon candidate
Definition: L1MuBMTrack.h:103
TrackClass m_tc
Definition: L1MuBMTrack.h:204
unsigned int quality() const
get quality
Definition: L1MuBMTrack.h:85
void setHwEta(int bits)
Set compressed eta as transmitted by hardware LSB = 0.010875 (9 bits)
void setTSphi(const std::vector< const L1MuBMTrackSegPhi * > &tsList)
set phi track segments used to form the muon candidate
Definition: L1MuBMTrack.cc:147
void reset()
reset address array
void reset()
reset muon candidate
Definition: L1MuBMTrack.cc:106
void setEta(int eta)
set eta-code of muon candidate
Definition: L1MuBMTrack.cc:118
const L1MuBMTrackSegPhi & getEndTSphi() const
return end phi track segment of muon candidate
Definition: L1MuBMTrack.cc:132
const int hwPt() const
Get compressed pT (returned int * 0.5 = pT (GeV))
const int hwSign() const
Get charge sign bit (charge = (-1)^(sign))
void setHwSignValid(int bits)
Set whether charge measurement is valid (0 for high pT muons)
bool operator==(const L1MuBMTrack &) const
equal operator
Definition: L1MuBMTrack.cc:191
tuple cout
Definition: gather_cfg.py:144
int eta() const
get eta-code (6 bits)
Definition: L1MuBMTrack.h:76
std::vector< L1MuBMTrackSegPhi > m_tsphiList
Definition: L1MuBMTrack.h:208
void print() const
print parameters of muon candidate
Definition: L1MuBMTrack.cc:249
bool fineEtaBit() const
get fine eta bit
Definition: L1MuBMTrack.h:79
std::string m_name
Definition: L1MuBMTrack.h:202
~L1MuBMTrack() override
destructor
Definition: L1MuBMTrack.cc:97
bool empty() const
is it an empty muon candidate?
Definition: L1MuBMTrack.h:91
const L1MuBMTrackSegEta & getStartTSeta() const
return start eta track segment of muon candidate
Definition: L1MuBMTrack.cc:137
L1MuBMAddressArray m_addArray
Definition: L1MuBMTrack.h:207
L1MuBMTrack()
default constructor
Definition: L1MuBMTrack.cc:48