CMS 3D CMS Logo

L1MuDTTrackSegPhi.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTTrackSegPhi
4 //
5 // Description: PHI Track Segment
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 //--------------------------------------------------
13 
14 //-----------------------
15 // This Class's Header --
16 //-----------------------
17 
19 
20 //---------------
21 // C++ Headers --
22 //---------------
23 
24 #include <iostream>
25 #include <iomanip>
26 #include <cmath>
27 
28 //-------------------------------
29 // Collaborating Class Headers --
30 //-------------------------------
31 
33 
34 using namespace std;
35 
36 // --------------------------------
37 // class L1MuDTTrackSegPhi
38 //---------------------------------
39 
40 //----------------
41 // Constructors --
42 //----------------
43 
45  : m_location(), m_phi(0), m_phib(0), m_quality(Null), m_tag(false), m_bx(0), m_etaFlag(false) {}
46 
48  int wheel_id, int sector_id, int station_id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag)
49  : m_location(wheel_id, sector_id, station_id),
50  m_phi(phi),
51  m_phib(phib),
52  m_quality(quality),
53  m_tag(false),
54  m_bx(bx),
55  m_etaFlag(etaFlag) {
56  if (phi < -2048 || phi > 2047) {
57  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
58  }
59  if (phib < -512 || phib > 511) {
60  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
61  }
62  if (quality > 7) {
63  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
64  }
65 }
66 
68  const L1MuDTTrackSegLoc& id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag)
69  : m_location(id), m_phi(phi), m_phib(phib), m_quality(quality), m_tag(tag), m_bx(bx), m_etaFlag(etaFlag) {
70  if (phi < -2048 || phi > 2047) {
71  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
72  }
73  if (phib < -512 || phib > 511) {
74  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
75  }
76  if (quality > 7) {
77  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
78  }
79 }
80 
82  : m_location(id.m_location),
83  m_phi(id.m_phi),
84  m_phib(id.m_phib),
85  m_quality(id.m_quality),
86  m_tag(id.m_tag),
87  m_bx(id.m_bx),
88  m_etaFlag(id.m_etaFlag) {}
89 
90 //--------------
91 // Destructor --
92 //--------------
94 
95 //--------------
96 // Operations --
97 //--------------
98 
99 //
100 // reset PHI Track Segment
101 //
103  m_phi = 0;
104  m_phib = 0;
105  m_quality = Null;
106  m_tag = false;
107  m_bx = 0;
108  m_etaFlag = false;
109 }
110 
111 //
112 // return phi in global coordinates [0,2pi]
113 //
115  double tmp = static_cast<double>(m_location.sector()) * M_PI / 6;
116  tmp += static_cast<double>(m_phi) / 4096;
117  return (tmp > 0) ? tmp : (2 * M_PI + tmp);
118 }
119 
120 //
121 // return phib in radians
122 //
123 double L1MuDTTrackSegPhi::phibValue() const { return static_cast<double>(m_phib) / 512; }
124 
125 //
126 // Assignment operator
127 //
129  if (this != &id) {
130  m_location = id.m_location;
131  m_phi = id.m_phi;
132  m_phib = id.m_phib;
133  m_quality = id.m_quality;
134  m_tag = id.m_tag;
135  m_bx = id.m_bx;
136  m_etaFlag = id.m_etaFlag;
137  }
138  return *this;
139 }
140 
141 //
142 // Equal operator
143 //
145  if (m_location != id.m_location)
146  return false;
147  if (m_phi != id.m_phi)
148  return false;
149  if (m_phib != id.m_phib)
150  return false;
151  if (m_quality != id.m_quality)
152  return false;
153  if (m_bx != id.m_bx)
154  return false;
155  return true;
156 }
157 
158 //
159 // Unequal operator
160 //
162  if (m_location != id.m_location)
163  return true;
164  if (m_phi != id.m_phi)
165  return true;
166  if (m_phib != id.m_phib)
167  return true;
168  if (m_quality != id.m_quality)
169  return true;
170  if (m_bx != id.m_bx)
171  return true;
172  return false;
173 }
174 
175 //
176 // output stream operator phi track segment quality
177 //
178 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi::TSQuality& quality) {
179  switch (quality) {
181  return s << "Li ";
183  return s << "Lo ";
185  return s << "Hi ";
187  return s << "Ho ";
189  return s << "LL ";
191  return s << "HL ";
193  return s << "HH ";
195  return s << "Null ";
196  default:
197  return s << "unknown TS phi Quality ";
198  }
199 }
200 
201 //
202 // output stream operator for phi track segments
203 //
204 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi& id) {
205  s.setf(ios::right, ios::adjustfield);
206  s << (id.m_location) << "\t"
207  << "phi : " << setw(5) << id.m_phi << " "
208  << "phib : " << setw(4) << id.m_phib << " "
209  << "quality : " << setw(4) << id.m_quality;
210 
211  return s;
212 }
virtual ~L1MuDTTrackSegPhi()
destructor
void reset()
reset phi track segment
ostream & operator<<(ostream &s, const L1MuDTTrackSegPhi::TSQuality &quality)
bool operator==(const L1MuDTTrackSegPhi &) const
equal operator
double phibValue() const
return phib-value in global coordinates [0,2pi]
#define M_PI
int sector() const
return sector (30 deg)
bool operator!=(const L1MuDTTrackSegPhi &) const
unequal operator
int quality() const
return quality code
TSQuality
quality code of DTBX phi track segments
L1MuDTTrackSegPhi()
default constructor
L1MuDTTrackSegLoc m_location
string quality
tmp
align.sh
Definition: createJobs.py:716
L1MuDTTrackSegPhi & operator=(const L1MuDTTrackSegPhi &)
assignment operator
double phiValue() const
return phi-value in global coordinates [0,2pi]