CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuDTTrackSegPhi.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuDTTrackSegPhi
4 //
5 // Description: PHI Track Segment
6 //
7 //
8 // $Date: 2007/02/27 11:44:00 $
9 // $Revision: 1.2 $
10 //
11 // Author :
12 // N. Neumeister CERN EP
13 //
14 //--------------------------------------------------
15 
16 //-----------------------
17 // This Class's Header --
18 //-----------------------
19 
21 
22 //---------------
23 // C++ Headers --
24 //---------------
25 
26 #include <iostream>
27 #include <iomanip>
28 #include <cmath>
29 
30 //-------------------------------
31 // Collaborating Class Headers --
32 //-------------------------------
33 
35 
36 using namespace std;
37 
38 // --------------------------------
39 // class L1MuDTTrackSegPhi
40 //---------------------------------
41 
42 //----------------
43 // Constructors --
44 //----------------
45 
47  m_location(), m_phi(0), m_phib(0), m_quality(Null), m_bx(0) {}
48 
49 
50 L1MuDTTrackSegPhi::L1MuDTTrackSegPhi(int wheel_id, int sector_id, int station_id,
51  int phi, int phib,
52  TSQuality quality, bool tag, int bx,
53  bool etaFlag) :
54  m_location(wheel_id, sector_id, station_id),
55  m_phi(phi), m_phib(phib), m_quality(quality), m_bx(bx), m_etaFlag(etaFlag) {
56 
57  if ( phi < -2048 || phi > 2047 ) {
58  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
59  }
60  if ( phib < -512 || phib > 511 ) {
61  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
62  }
63  if ( quality > 7 ) {
64  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
65  }
66 
67 }
68 
69 
71  int phi, int phib,
72  TSQuality quality, bool tag, int bx,
73  bool etaFlag) :
74  m_location(id), m_phi(phi), m_phib(phib),
75  m_quality(quality), m_tag(tag), m_bx(bx), m_etaFlag(etaFlag) {
76 
77  if ( phi < -2048 || phi > 2047 ) {
78  // cerr << "TrackSegPhi : phi out of range: " << phi << endl;
79  }
80  if ( phib < -512 || phib > 511 ) {
81  // cerr << "TrackSegPhi : phib out of range: " << phib << endl;
82  }
83  if ( quality > 7 ) {
84  // cerr << "TrackSegPhi : quality out of range: " << quality << endl;
85  }
86 
87 }
88 
89 
91  m_location(id.m_location),
92  m_phi(id.m_phi), m_phib(id.m_phib), m_quality(id.m_quality),
93  m_tag(id.m_tag), m_bx(id.m_bx), m_etaFlag(id.m_etaFlag) {}
94 
95 
96 
97 //--------------
98 // Destructor --
99 //--------------
101 
102 
103 //--------------
104 // Operations --
105 //--------------
106 
107 //
108 // reset PHI Track Segment
109 //
111 
112  m_phi = 0;
113  m_phib = 0;
114  m_quality = Null;
115  m_tag = false;
116  m_bx = 0;
117  m_etaFlag = false;
118 
119 }
120 
121 
122 //
123 // return phi in global coordinates [0,2pi]
124 //
126 
127  double tmp = static_cast<double>(m_location.sector())*M_PI/6;
128  tmp += static_cast<const double>(m_phi)/4096;
129  return (tmp > 0 ) ? tmp : (2*M_PI + tmp);
130 
131 }
132 
133 
134 //
135 // return phib in radians
136 //
138 
139  return static_cast<const double>(m_phib)/512;
140 
141 }
142 
143 
144 //
145 // Assignment operator
146 //
148 
149  if ( this != &id ) {
150  m_location = id.m_location;
151  m_phi = id.m_phi;
152  m_phib = id.m_phib;
153  m_quality = id.m_quality;
154  m_tag = id.m_tag;
155  m_bx = id.m_bx;
156  m_etaFlag = id.m_etaFlag;
157  }
158  return *this;
159 
160 }
161 
162 
163 //
164 // Equal operator
165 //
167 
168  if ( m_location != id.m_location ) return false;
169  if ( m_phi != id.m_phi ) return false;
170  if ( m_phib != id.m_phib ) return false;
171  if ( m_quality != id.m_quality ) return false;
172  if ( m_bx != id.m_bx ) return false;
173  return true;
174 
175 }
176 
177 
178 //
179 // Unequal operator
180 //
182 
183  if ( m_location != id.m_location ) return true;
184  if ( m_phi != id.m_phi ) return true;
185  if ( m_phib != id.m_phib ) return true;
186  if ( m_quality != id.m_quality ) return true;
187  if ( m_bx != id.m_bx ) return true;
188  return false;
189 
190 }
191 
192 
193 //
194 // output stream operator phi track segment quality
195 //
196 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi::TSQuality& quality) {
197 
198  switch (quality) {
199  case L1MuDTTrackSegPhi::Li : return s << "Li ";
200  case L1MuDTTrackSegPhi::Lo : return s << "Lo ";
201  case L1MuDTTrackSegPhi::Hi : return s << "Hi ";
202  case L1MuDTTrackSegPhi::Ho : return s << "Ho ";
203  case L1MuDTTrackSegPhi::LL : return s << "LL ";
204  case L1MuDTTrackSegPhi::HL : return s << "HL ";
205  case L1MuDTTrackSegPhi::HH : return s << "HH ";
206  case L1MuDTTrackSegPhi::Null : return s << "Null ";
207  default :
208  return s << "unknown TS phi Quality ";
209  }
210 
211 }
212 
213 
214 //
215 // output stream operator for phi track segments
216 //
217 ostream& operator<<(ostream& s, const L1MuDTTrackSegPhi& id) {
218 
219  s.setf(ios::right,ios::adjustfield);
220  s << (id.m_location) << "\t"
221  << "phi : " << setw(5) << id.m_phi << " "
222  << "phib : " << setw(4) << id.m_phib << " "
223  << "quality : " << setw(4) << id.m_quality;
224 
225  return s;
226 
227 }
virtual ~L1MuDTTrackSegPhi()
destructor
bool operator!=(const L1MuDTTrackSegPhi &) const
unequal operator
int sector() const
return sector (30 deg)
void reset()
reset phi track segment
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
double phiValue() const
return phi-value in global coordinates [0,2pi]
bool operator==(const L1MuDTTrackSegPhi &) const
equal operator
#define M_PI
Definition: BFit3D.cc:3
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
string s
Definition: asciidump.py:422
L1MuDTTrackSegLoc m_location
L1MuDTTrackSegPhi & operator=(const L1MuDTTrackSegPhi &)
assignment operator
Definition: DDAxes.h:10