CMS 3D CMS Logo

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_tag(tag),
54  m_bx(bx),
55  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 
69  const L1MuBMTrackSegLoc& id, int phi, int phib, TSQuality quality, bool tag, int bx, bool etaFlag)
70  : m_location(id), m_phi(phi), m_phib(phib), m_quality(quality), m_tag(tag), m_bx(bx), m_etaFlag(etaFlag) {
71  /*
72  if ( phi < -2048 || phi > 2047 ) {
73  cerr << "TrackSegPhi : phi out of range: " << phi << endl;
74  }
75  if ( phib < -512 || phib > 511 ) {
76  cerr << "TrackSegPhi : phib out of range: " << phib << endl;
77  }
78  if ( quality > 7 ) {
79  cerr << "TrackSegPhi : quality out of range: " << quality << endl;
80  }
81 */
82 }
83 
84 //--------------
85 // Destructor --
86 //--------------
88 
89 //--------------
90 // Operations --
91 //--------------
92 
93 //
94 // reset PHI Track Segment
95 //
97  m_phi = 0;
98  m_phib = 0;
99  m_quality = Null;
100  m_tag = false;
101  m_bx = 0;
102  m_etaFlag = false;
103 }
104 
105 //
106 // return phi in global coordinates [0,2pi]
107 //
109  double tmp = static_cast<double>(m_location.sector()) * M_PI / 6;
110  tmp += static_cast<double>(m_phi) / 4096;
111  return (tmp > 0) ? tmp : (2 * M_PI + tmp);
112 }
113 
114 //
115 // return phib in radians
116 //
117 double L1MuBMTrackSegPhi::phibValue() const { return static_cast<double>(m_phib) / 512; }
118 
119 //
120 // Equal operator
121 //
123  if (m_location != id.m_location)
124  return false;
125  if (m_phi != id.m_phi)
126  return false;
127  if (m_phib != id.m_phib)
128  return false;
129  if (m_quality != id.m_quality)
130  return false;
131  if (m_bx != id.m_bx)
132  return false;
133  return true;
134 }
135 
136 //
137 // Unequal operator
138 //
140  if (m_location != id.m_location)
141  return true;
142  if (m_phi != id.m_phi)
143  return true;
144  if (m_phib != id.m_phib)
145  return true;
146  if (m_quality != id.m_quality)
147  return true;
148  if (m_bx != id.m_bx)
149  return true;
150  return false;
151 }
152 
153 //
154 // output stream operator phi track segment quality
155 //
156 ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi::TSQuality& quality) {
157  switch (quality) {
159  return s << "Li ";
161  return s << "Lo ";
163  return s << "Hi ";
165  return s << "Ho ";
167  return s << "LL ";
169  return s << "HL ";
171  return s << "HH ";
173  return s << "Null ";
174  default:
175  return s << "unknown TS phi Quality ";
176  }
177 }
178 
179 //
180 // output stream operator for phi track segments
181 //
182 ostream& operator<<(ostream& s, const L1MuBMTrackSegPhi& id) {
183  s.setf(ios::right, ios::adjustfield);
184  s << (id.m_location) << "\t"
185  << "phi : " << setw(5) << id.m_phi << " "
186  << "phib : " << setw(4) << id.m_phib << " "
187  << "quality : " << setw(4) << id.m_quality;
188 
189  return s;
190 }
L1MuBMTrackSegLoc m_location
bool operator!=(const L1MuBMTrackSegPhi &) const
unequal operator
double phiValue() const
return phi-value in global coordinates [0,2pi]
L1MuBMTrackSegPhi()
default constructor
void reset()
reset phi track segment
int sector() const
return sector (30 deg)
bool operator==(const L1MuBMTrackSegPhi &) const
equal operator
TSQuality
quality code of BBMX phi track segments
#define M_PI
double phibValue() const
return phib-value in global coordinates [0,2pi]
string quality
tmp
align.sh
Definition: createJobs.py:716
virtual ~L1MuBMTrackSegPhi()
destructor
ostream & operator<<(ostream &s, const L1MuBMTrackSegPhi::TSQuality &quality)