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 
44 L1MuDTTrackSegPhi::L1MuDTTrackSegPhi() : m_location(), m_phi(0), m_phib(0), m_quality(Null), m_bx(0) {}
45 
47  int wheel_id, int sector_id, int station_id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag)
48  : m_location(wheel_id, sector_id, station_id),
49  m_phi(phi),
50  m_phib(phib),
51  m_quality(quality),
52  m_bx(bx),
53  m_etaFlag(etaFlag) {
54  if (phi < -2048 || phi > 2047) {
55  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
56  }
57  if (phib < -512 || phib > 511) {
58  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
59  }
60  if (quality > 7) {
61  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
62  }
63 }
64 
66  const L1MuDTTrackSegLoc& id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag)
67  : m_location(id), m_phi(phi), m_phib(phib), m_quality(quality), m_tag(tag), m_bx(bx), m_etaFlag(etaFlag) {
68  if (phi < -2048 || phi > 2047) {
69  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
70  }
71  if (phib < -512 || phib > 511) {
72  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
73  }
74  if (quality > 7) {
75  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
76  }
77 }
78 
80  : m_location(id.m_location),
81  m_phi(id.m_phi),
82  m_phib(id.m_phib),
83  m_quality(id.m_quality),
84  m_tag(id.m_tag),
85  m_bx(id.m_bx),
86  m_etaFlag(id.m_etaFlag) {}
87 
88 //--------------
89 // Destructor --
90 //--------------
92 
93 //--------------
94 // Operations --
95 //--------------
96 
97 //
98 // reset PHI Track Segment
99 //
101  m_phi = 0;
102  m_phib = 0;
103  m_quality = Null;
104  m_tag = false;
105  m_bx = 0;
106  m_etaFlag = false;
107 }
108 
109 //
110 // return phi in global coordinates [0,2pi]
111 //
113  double tmp = static_cast<double>(m_location.sector()) * M_PI / 6;
114  tmp += static_cast<double>(m_phi) / 4096;
115  return (tmp > 0) ? tmp : (2 * M_PI + tmp);
116 }
117 
118 //
119 // return phib in radians
120 //
121 double L1MuDTTrackSegPhi::phibValue() const { return static_cast<double>(m_phib) / 512; }
122 
123 //
124 // Assignment operator
125 //
127  if (this != &id) {
128  m_location = id.m_location;
129  m_phi = id.m_phi;
130  m_phib = id.m_phib;
131  m_quality = id.m_quality;
132  m_tag = id.m_tag;
133  m_bx = id.m_bx;
134  m_etaFlag = id.m_etaFlag;
135  }
136  return *this;
137 }
138 
139 //
140 // Equal operator
141 //
143  if (m_location != id.m_location)
144  return false;
145  if (m_phi != id.m_phi)
146  return false;
147  if (m_phib != id.m_phib)
148  return false;
149  if (m_quality != id.m_quality)
150  return false;
151  if (m_bx != id.m_bx)
152  return false;
153  return true;
154 }
155 
156 //
157 // Unequal operator
158 //
160  if (m_location != id.m_location)
161  return true;
162  if (m_phi != id.m_phi)
163  return true;
164  if (m_phib != id.m_phib)
165  return true;
166  if (m_quality != id.m_quality)
167  return true;
168  if (m_bx != id.m_bx)
169  return true;
170  return false;
171 }
172 
173 //
174 // output stream operator phi track segment quality
175 //
176 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi::TSQuality& quality) {
177  switch (quality) {
179  return s << "Li ";
181  return s << "Lo ";
183  return s << "Hi ";
185  return s << "Ho ";
187  return s << "LL ";
189  return s << "HL ";
191  return s << "HH ";
193  return s << "Null ";
194  default:
195  return s << "unknown TS phi Quality ";
196  }
197 }
198 
199 //
200 // output stream operator for phi track segments
201 //
202 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi& id) {
203  s.setf(ios::right, ios::adjustfield);
204  s << (id.m_location) << "\t"
205  << "phi : " << setw(5) << id.m_phi << " "
206  << "phib : " << setw(4) << id.m_phib << " "
207  << "quality : " << setw(4) << id.m_quality;
208 
209  return s;
210 }
int tag() const
return tag (second TS tag)
virtual ~L1MuDTTrackSegPhi()
destructor
bool operator!=(const L1MuDTTrackSegPhi &) const
unequal operator
int quality() const
return quality code
bool etaFlag() const
return eta flag
int sector() const
return sector (30 deg)
void reset()
reset phi track segment
int phi() const
return phi
int bx() const
return bunch crossing
double phiValue() const
return phi-value in global coordinates [0,2pi]
friend std::ostream & operator<<(std::ostream &, const TSQuality &)
overload output stream operator for phi track segment quality
int phib() const
return phib
#define M_PI
bool operator==(const L1MuDTTrackSegPhi &) const
equal operator
TSQuality
quality code of DTBX phi track segments
L1MuDTTrackSegPhi()
default constructor
double phibValue() const
return phib-value in global coordinates [0,2pi]
L1MuDTTrackSegLoc m_location
tmp
align.sh
Definition: createJobs.py:716
L1MuDTTrackSegPhi & operator=(const L1MuDTTrackSegPhi &)
assignment operator