test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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"
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()), m_name("L1MuBMTrack"), m_empty(true),
52  m_tc(UNDEF),
53  m_addArray(), m_tsphiList(), m_tsetaList() {
54 
55  m_tsphiList.reserve(4);
56  m_tsetaList.reserve(3);
57 
58  //setType(0);
59  //setChargeValid(true);
60  setHwSignValid(1);
61 
62 }
63 
64 
66  //L1MuRegionalCand(0,0),-->
67  l1t::RegionalMuonCand(),
68  m_spid(spid), m_name("L1MuBMTrack"), m_empty(true),
69  m_tc(UNDEF),
70  m_addArray(), m_tsphiList(), m_tsetaList() {
71 
72  m_tsphiList.reserve(4);
73  m_tsetaList.reserve(3);
74  //setType(0);
75  //setChargeValid(true);
76  setHwSignValid(1);
77 
78 }
79 
80 
82  //L1MuRegionalCand(id),-->
83  l1t::RegionalMuonCand(id),
84  m_spid(id.m_spid), m_name(id.m_name), m_empty(id.m_empty),
85  m_tc(id.m_tc),
86  m_addArray(id.m_addArray),
87  m_tsphiList(id.m_tsphiList), m_tsetaList(id.m_tsetaList) {}
88 
89 
90 //--------------
91 // Destructor --
92 //--------------
94 
95 
96 //--------------
97 // Operations --
98 //--------------
99 
100 //
101 // reset Muon Track Candidate
102 //
104 
105  //L1MuRegionalCand::reset();
106  m_empty = true;
107  m_tc = UNDEF;
108  m_addArray.reset();
109  m_tsphiList.clear();
110  m_tsetaList.clear();
111 
112 }
113 
114 
115 //
116 // set (packed) eta-code of muon candidate
117 //
119 
120  // eta is a signed integer [-115,118],
121  setHwHF(false);
122  setHwEta(eta);
123 
124 
125 }
126 
127 
128 //
129 // return start phi track segment
130 //
132 
133  return m_tsphiList.front();
134 
135 }
136 
137 
138 //
139 // return end phi track segment
140 //
142 
143  return m_tsphiList.back();
144 
145 }
146 
147 
148 //
149 // return start eta track segment
150 //
152 
153  return m_tsetaList.front();
154 
155 }
156 
157 
158 //
159 // return end eta track segment
160 //
162 
163  return m_tsetaList.back();
164 
165 }
166 
167 
168 //
169 // set phi track segments used to form the muon candidate
170 //
171 void L1MuBMTrack::setTSphi(const vector<const L1MuBMTrackSegPhi*>& tsList) {
172 
173  if ( !tsList.empty() ) {
174  vector<const L1MuBMTrackSegPhi*>::const_iterator iter;
175  for ( iter = tsList.begin(); iter != tsList.end(); iter++ ) {
176  if ( *iter ) m_tsphiList.push_back(**iter);
177  }
178  }
179 
180 }
181 
182 
183 //
184 // set eta track segments used to form the muon candidate
185 //
186 void L1MuBMTrack::setTSeta(const vector<const L1MuBMTrackSegEta*>& tsList) {
187 
188  if ( !tsList.empty() ) {
189  vector<const L1MuBMTrackSegEta*>::const_iterator iter;
190  for ( iter = tsList.begin(); iter != tsList.end(); iter++ ) {
191  if ( *iter ) m_tsetaList.push_back(**iter);
192  }
193  }
194 
195 }
196 
197 
198 //
199 // convert pt value in GeV to pt code
200 //
201 unsigned int L1MuBMTrack::triggerScale(float value, const edm::EventSetup& c) const {
202 
203  /*const float eps = 1.e-5; // add an epsilon so that setting works with low edge value
204 
205  edm::ESHandle< L1MuTriggerPtScale > theTriggerScales;
206  c.get< L1MuTriggerPtScaleRcd >().get( theTriggerScales );
207  unsigned int t_Scale = theTriggerScales->getPtScale()->getPacked( value + eps );
208 
209  return t_Scale;*/
210  return (unsigned int)0.5;
211 }
212 
213 
214 //
215 // Assignment operator
216 //
218 
219  if ( this != &track ) {
220  this->setBx(track.bx());
221  //this->setDataWord(track.getDataWord());
222  m_spid = track.m_spid;
223  m_empty = track.m_empty;
224  m_name = track.m_name;
225  m_tc = track.m_tc;
226  m_addArray = track.m_addArray;
227  m_tsphiList = track.m_tsphiList;
228  m_tsetaList = track.m_tsetaList;
229  }
230  return *this;
231 
232 }
233 
234 
235 //
236 // Equal operator
237 //
238 bool L1MuBMTrack::operator==(const L1MuBMTrack& track) const {
239 
240  if ( m_spid != track.m_spid ) return false;
241  if ( m_empty != track.m_empty ) return false;
242  if ( m_tc != track.m_tc ) return false;
243  if ( bx() != track.bx() ) return false;
244  if ( phi() != track.phi() ) return false;
245  if ( eta() != track.eta() ) return false;
246  if ( fineEtaBit() != track.fineEtaBit() ) return false;
247  if ( pt() != track.pt() ) return false;
248  if ( charge() != track.charge() ) return false;
249  if ( quality() != track.quality() ) return false;
250  if ( m_addArray != track.m_addArray ) return false;
251  return true;
252 
253 }
254 
255 
256 //
257 // Unequal operator
258 //
259 bool L1MuBMTrack::operator!=(const L1MuBMTrack& track) const {
260 
261  if ( m_spid != track.m_spid ) return true;
262  if ( m_empty != track.m_empty ) return true;
263  if ( m_tc != track.m_tc ) return true;
264  if ( bx() != track.bx() ) return true;
265  if ( phi() != track.phi() ) return true;
266  if ( eta() != track.eta() ) return true;
267  if ( fineEtaBit() != track.fineEtaBit() ) return true;
268  if ( pt() != track.pt() ) return true;
269  if ( charge() != track.charge() ) return true;
270  if ( quality() != track.quality() ) return true;
271  if ( m_addArray != track.m_addArray ) return true;
272  return false;
273 
274 }
275 
276 
277 //
278 // print parameters of track candidate
279 //
280 void L1MuBMTrack::print() const {
281 
282  if ( !empty() ) {
283  cout.setf(ios::showpoint);
284  cout.setf(ios::right,ios::adjustfield);
285  cout << setiosflags(ios::showpoint | ios::fixed);
286  cout << "MUON : "
287  << "pt = " << setw(3) << hwPt() << " "
288  << "charge = " << setw(2) << hwSign() << " "
289  << "eta = " << setw(2) << hwEta()
290  //<< " (" << setw(1) << finehalo_packed() << ") "
291  << "phi = " << setw(3) << hwPhi() << " "
292  << "quality = " << setw(1) << hwQual() << '\t'
293  << "class = " << tc() << " "
294  << "bx = " << setw(2) << bx() << endl;
295  cout << " found in " << m_spid << " with phi track segments :" << endl;
296  vector<L1MuBMTrackSegPhi>::const_iterator iter;
297  for ( iter = m_tsphiList.begin(); iter != m_tsphiList.end(); iter++ ) {
298  cout << " " << (*iter) << endl;
299  }
300  }
301 
302 }
303 
304 
305 //
306 // output stream operator for track candidate
307 //
308 ostream& operator<<(ostream& s, const L1MuBMTrack& id) {
309 
310  if ( !id.empty() ) {
311  s << setiosflags(ios::showpoint | ios::fixed)
312  << "pt = " << setw(3) << id.hwPt() << " "
313  << "charge = " << setw(2) << id.hwSign() << " "
314  << "eta = " << setw(2) << id.hwEta()
315  //<< " (" << setw(1) << id.finehalo_packed() << ") "
316  << "phi = " << setw(3) << id.hwPhi() << " "
317  << "quality = " << setw(1) << id.hwQual() << '\t'
318  << "bx = " << setw(2) << id.bx();
319  }
320  return s;
321 
322 }
323 
unsigned int pt() const
get pt-code (5 bits)
Definition: L1MuBMTrack.h:76
bool operator!=(const L1MuBMTrack &) const
unequal operator
Definition: L1MuBMTrack.cc:259
L1MuBMTrack & operator=(const L1MuBMTrack &)
assignment operator
Definition: L1MuBMTrack.cc:217
const L1MuBMTrackSegPhi & getStartTSphi() const
return start phi track segment of muon candidate
Definition: L1MuBMTrack.cc:131
const L1MuBMTrackSegEta & getEndTSeta() const
return end eta track segment of muon candidate
Definition: L1MuBMTrack.cc:161
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
std::vector< L1MuBMTrackSegEta > m_tsetaList
Definition: L1MuBMTrack.h:218
L1MuBMSecProcId m_spid
Definition: L1MuBMTrack.h:210
int charge() const
get charge (1 bit)
Definition: L1MuBMTrack.h:88
const int hwQual() const
Get quality code.
TrackClass tc() const
get track-class
Definition: L1MuBMTrack.h:94
unsigned int triggerScale(float value, const edm::EventSetup &c) const
convert pt value in GeV to pt code
Definition: L1MuBMTrack.cc:201
void setTSeta(const std::vector< const L1MuBMTrackSegEta * > &tsList)
set eta track segments used to form the muon candidate
Definition: L1MuBMTrack.cc:186
virtual ~L1MuBMTrack()
destructor
Definition: L1MuBMTrack.cc:93
unsigned int phi() const
get phi-code (8 bits)
Definition: L1MuBMTrack.h:79
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:163
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:109
TrackClass m_tc
Definition: L1MuBMTrack.h:213
unsigned int quality() const
get quality
Definition: L1MuBMTrack.h:91
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:171
void reset()
reset address array
void reset()
reset muon candidate
Definition: L1MuBMTrack.cc:103
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:141
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:238
tuple cout
Definition: gather_cfg.py:145
int eta() const
get eta-code (6 bits)
Definition: L1MuBMTrack.h:82
std::vector< L1MuBMTrackSegPhi > m_tsphiList
Definition: L1MuBMTrack.h:217
void print() const
print parameters of muon candidate
Definition: L1MuBMTrack.cc:280
bool fineEtaBit() const
get fine eta bit
Definition: L1MuBMTrack.h:85
std::string m_name
Definition: L1MuBMTrack.h:211
bool empty() const
is it an empty muon candidate?
Definition: L1MuBMTrack.h:97
const L1MuBMTrackSegEta & getStartTSeta() const
return start eta track segment of muon candidate
Definition: L1MuBMTrack.cc:151
L1MuBMAddressArray m_addArray
Definition: L1MuBMTrack.h:216
L1MuBMTrack()
default constructor
Definition: L1MuBMTrack.cc:48