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_bx(0) {}
46 
47 
48 L1MuDTTrackSegPhi::L1MuDTTrackSegPhi(int wheel_id, int sector_id, int station_id,
49  int phi, int phib,
50  TSQuality quality, bool tag, int bx,
51  bool etaFlag) :
52  m_location(wheel_id, sector_id, station_id),
53  m_phi(phi), m_phib(phib), m_quality(quality), m_bx(bx), m_etaFlag(etaFlag) {
54 
55  if ( phi < -2048 || phi > 2047 ) {
56  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
57  }
58  if ( phib < -512 || phib > 511 ) {
59  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
60  }
61  if ( quality > 7 ) {
62  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
63  }
64 
65 }
66 
67 
69  int phi, int phib,
70  TSQuality quality, bool tag, int bx,
71  bool etaFlag) :
72  m_location(id), m_phi(phi), m_phib(phib),
73  m_quality(quality), m_tag(tag), m_bx(bx), m_etaFlag(etaFlag) {
74 
75  if ( phi < -2048 || phi > 2047 ) {
76  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
77  }
78  if ( phib < -512 || phib > 511 ) {
79  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
80  }
81  if ( quality > 7 ) {
82  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
83  }
84 
85 }
86 
87 
90  m_phi(id.m_phi), m_phib(id.m_phib), m_quality(id.m_quality),
91  m_tag(id.m_tag), m_bx(id.m_bx), m_etaFlag(id.m_etaFlag) {}
92 
93 
94 
95 //--------------
96 // Destructor --
97 //--------------
99 
100 
101 //--------------
102 // Operations --
103 //--------------
104 
105 //
106 // reset PHI Track Segment
107 //
109 
110  m_phi = 0;
111  m_phib = 0;
112  m_quality = Null;
113  m_tag = false;
114  m_bx = 0;
115  m_etaFlag = false;
116 
117 }
118 
119 
120 //
121 // return phi in global coordinates [0,2pi]
122 //
124 
125  double tmp = static_cast<double>(m_location.sector())*M_PI/6;
126  tmp += static_cast<double>(m_phi)/4096;
127  return (tmp > 0 ) ? tmp : (2*M_PI + tmp);
128 
129 }
130 
131 
132 //
133 // return phib in radians
134 //
136 
137  return static_cast<double>(m_phib)/512;
138 
139 }
140 
141 
142 //
143 // Assignment operator
144 //
146 
147  if ( this != &id ) {
148  m_location = id.m_location;
149  m_phi = id.m_phi;
150  m_phib = id.m_phib;
151  m_quality = id.m_quality;
152  m_tag = id.m_tag;
153  m_bx = id.m_bx;
154  m_etaFlag = id.m_etaFlag;
155  }
156  return *this;
157 
158 }
159 
160 
161 //
162 // Equal operator
163 //
165 
166  if ( m_location != id.m_location ) return false;
167  if ( m_phi != id.m_phi ) return false;
168  if ( m_phib != id.m_phib ) return false;
169  if ( m_quality != id.m_quality ) return false;
170  if ( m_bx != id.m_bx ) return false;
171  return true;
172 
173 }
174 
175 
176 //
177 // Unequal operator
178 //
180 
181  if ( m_location != id.m_location ) return true;
182  if ( m_phi != id.m_phi ) return true;
183  if ( m_phib != id.m_phib ) return true;
184  if ( m_quality != id.m_quality ) return true;
185  if ( m_bx != id.m_bx ) return true;
186  return false;
187 
188 }
189 
190 
191 //
192 // output stream operator phi track segment quality
193 //
194 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi::TSQuality& quality) {
195 
196  switch (quality) {
197  case L1MuDTTrackSegPhi::Li : return s << "Li ";
198  case L1MuDTTrackSegPhi::Lo : return s << "Lo ";
199  case L1MuDTTrackSegPhi::Hi : return s << "Hi ";
200  case L1MuDTTrackSegPhi::Ho : return s << "Ho ";
201  case L1MuDTTrackSegPhi::LL : return s << "LL ";
202  case L1MuDTTrackSegPhi::HL : return s << "HL ";
203  case L1MuDTTrackSegPhi::HH : return s << "HH ";
204  case L1MuDTTrackSegPhi::Null : return s << "Null ";
205  default :
206  return s << "unknown TS phi Quality ";
207  }
208 
209 }
210 
211 
212 //
213 // output stream operator for phi track segments
214 //
215 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi& id) {
216 
217  s.setf(ios::right,ios::adjustfield);
218  s << (id.m_location) << "\t"
219  << "phi : " << setw(5) << id.m_phi << " "
220  << "phib : " << setw(4) << id.m_phib << " "
221  << "quality : " << setw(4) << id.m_quality;
222 
223  return s;
224 
225 }
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]
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
L1MuDTTrackSegLoc m_location
L1MuDTTrackSegPhi & operator=(const L1MuDTTrackSegPhi &)
assignment operator