CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
L1MuBMTrackSegPhi.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuBMTrackSegPhi
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 L1MuBMTrackSegPhi
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_bx(bx),
54  m_etaFlag(etaFlag) {
55  /*
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 L1MuBMTrackSegLoc& 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  /*
71  if ( phi < -2048 || phi > 2047 ) {
72  cerr << "TrackSegPhi : phi out of range: " << phi << endl;
73  }
74  if ( phib < -512 || phib > 511 ) {
75  cerr << "TrackSegPhi : phib out of range: " << phib << endl;
76  }
77  if ( quality > 7 ) {
78  cerr << "TrackSegPhi : quality out of range: " << quality << endl;
79  }
80 */
81 }
82 
84  : m_location(id.m_location),
85  m_phi(id.m_phi),
86  m_phib(id.m_phib),
87  m_quality(id.m_quality),
88  m_tag(id.m_tag),
89  m_bx(id.m_bx),
90  m_etaFlag(id.m_etaFlag) {}
91 
92 //--------------
93 // Destructor --
94 //--------------
96 
97 //--------------
98 // Operations --
99 //--------------
100 
101 //
102 // reset PHI Track Segment
103 //
105  m_phi = 0;
106  m_phib = 0;
107  m_quality = Null;
108  m_tag = false;
109  m_bx = 0;
110  m_etaFlag = false;
111 }
112 
113 //
114 // return phi in global coordinates [0,2pi]
115 //
117  double tmp = static_cast<double>(m_location.sector()) * M_PI / 6;
118  tmp += static_cast<double>(m_phi) / 4096;
119  return (tmp > 0) ? tmp : (2 * M_PI + tmp);
120 }
121 
122 //
123 // return phib in radians
124 //
125 double L1MuBMTrackSegPhi::phibValue() const { return static_cast<double>(m_phib) / 512; }
126 
127 //
128 // Assignment operator
129 //
131  if (this != &id) {
132  m_location = id.m_location;
133  m_phi = id.m_phi;
134  m_phib = id.m_phib;
135  m_quality = id.m_quality;
136  m_tag = id.m_tag;
137  m_bx = id.m_bx;
138  m_etaFlag = id.m_etaFlag;
139  }
140  return *this;
141 }
142 
143 //
144 // Equal operator
145 //
147  if (m_location != id.m_location)
148  return false;
149  if (m_phi != id.m_phi)
150  return false;
151  if (m_phib != id.m_phib)
152  return false;
153  if (m_quality != id.m_quality)
154  return false;
155  if (m_bx != id.m_bx)
156  return false;
157  return true;
158 }
159 
160 //
161 // Unequal operator
162 //
164  if (m_location != id.m_location)
165  return true;
166  if (m_phi != id.m_phi)
167  return true;
168  if (m_phib != id.m_phib)
169  return true;
170  if (m_quality != id.m_quality)
171  return true;
172  if (m_bx != id.m_bx)
173  return true;
174  return false;
175 }
176 
177 //
178 // output stream operator phi track segment quality
179 //
180 ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi::TSQuality& quality) {
181  switch (quality) {
183  return s << "Li ";
185  return s << "Lo ";
187  return s << "Hi ";
189  return s << "Ho ";
191  return s << "LL ";
193  return s << "HL ";
195  return s << "HH ";
197  return s << "Null ";
198  default:
199  return s << "unknown TS phi Quality ";
200  }
201 }
202 
203 //
204 // output stream operator for phi track segments
205 //
206 ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi& id) {
207  s.setf(ios::right, ios::adjustfield);
208  s << (id.m_location) << "\t"
209  << "phi : " << setw(5) << id.m_phi << " "
210  << "phib : " << setw(4) << id.m_phib << " "
211  << "quality : " << setw(4) << id.m_quality;
212 
213  return s;
214 }
L1MuBMTrackSegLoc m_location
bool operator!=(const L1MuBMTrackSegPhi &) const
unequal operator
bool operator==(const L1MuBMTrackSegPhi &) const
equal operator
uint32_t const *__restrict__ Quality * quality
double phiValue() const
return phi-value in global coordinates [0,2pi]
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
int sector() const
return sector (30 deg)
L1MuBMTrackSegPhi()
default constructor
void reset()
reset phi track segment
L1MuBMTrackSegPhi & operator=(const L1MuBMTrackSegPhi &)
assignment operator
TSQuality
quality code of BBMX phi track segments
#define M_PI
tmp
align.sh
Definition: createJobs.py:716
double phibValue() const
return phib-value in global coordinates [0,2pi]
virtual ~L1MuBMTrackSegPhi()
destructor