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 }
L1MuDTTrackSegLoc
Definition: L1MuDTTrackSegLoc.h:41
L1MuDTTrackSegPhi::m_location
L1MuDTTrackSegLoc m_location
Definition: L1MuDTTrackSegPhi.h:131
L1MuDTTrackSegPhi::~L1MuDTTrackSegPhi
virtual ~L1MuDTTrackSegPhi()
destructor
Definition: L1MuDTTrackSegPhi.cc:91
L1MuDTTrackSegPhi::m_tag
bool m_tag
Definition: L1MuDTTrackSegPhi.h:135
L1MuDTTrackSegPhi::Null
Definition: L1MuDTTrackSegPhi.h:39
L1MuDTTrackSegPhi::m_phib
int m_phib
Definition: L1MuDTTrackSegPhi.h:133
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
L1MuDTTrackSegPhi::Lo
Definition: L1MuDTTrackSegPhi.h:39
L1MuDTTrackSegPhi.h
reco::Null
Definition: TrackInfoEnum.h:16
L1MuDTTrackSegPhi::reset
void reset()
reset phi track segment
Definition: L1MuDTTrackSegPhi.cc:100
alignCSCRings.s
s
Definition: alignCSCRings.py:92
L1MuDTTrackSegPhi::m_etaFlag
bool m_etaFlag
Definition: L1MuDTTrackSegPhi.h:137
L1MuDTTrackSegLoc.h
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
L1MuDTTrackSegPhi::operator==
bool operator==(const L1MuDTTrackSegPhi &) const
equal operator
Definition: L1MuDTTrackSegPhi.cc:142
L1MuDTTrackSegPhi::m_quality
TSQuality m_quality
Definition: L1MuDTTrackSegPhi.h:134
L1MuDTTrackSegPhi::LL
Definition: L1MuDTTrackSegPhi.h:39
PVValHelper::phi
Definition: PVValidationHelpers.h:68
L1MuDTTrackSegPhi::TSQuality
TSQuality
quality code of DTBX phi track segments
Definition: L1MuDTTrackSegPhi.h:39
L1MuDTTrackSegPhi::HL
Definition: L1MuDTTrackSegPhi.h:39
L1MuDTTrackSegPhi::phibValue
double phibValue() const
return phib-value in global coordinates [0,2pi]
Definition: L1MuDTTrackSegPhi.cc:121
L1MuDTTrackSegPhi::L1MuDTTrackSegPhi
L1MuDTTrackSegPhi()
default constructor
Definition: L1MuDTTrackSegPhi.cc:44
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
operator<<
ostream & operator<<(ostream &s, const L1MuDTTrackSegPhi::TSQuality &quality)
Definition: L1MuDTTrackSegPhi.cc:176
L1MuDTTrackSegPhi::m_phi
int m_phi
Definition: L1MuDTTrackSegPhi.h:132
L1MuDTTrackSegPhi::Ho
Definition: L1MuDTTrackSegPhi.h:39
std
Definition: JetResolutionObject.h:76
qcdUeDQM_cfi.quality
quality
Definition: qcdUeDQM_cfi.py:31
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
L1MuDTTrackSegLoc::sector
int sector() const
return sector (30 deg)
Definition: L1MuDTTrackSegLoc.h:59
L1MuDTTrackSegPhi::operator!=
bool operator!=(const L1MuDTTrackSegPhi &) const
unequal operator
Definition: L1MuDTTrackSegPhi.cc:159
L1MuDTTrackSegPhi::Li
Definition: L1MuDTTrackSegPhi.h:39
L1MuDTTrackSegPhi::Hi
Definition: L1MuDTTrackSegPhi.h:39
L1MuDTTrackSegPhi::HH
Definition: L1MuDTTrackSegPhi.h:39
L1MuDTTrackSegPhi
Definition: L1MuDTTrackSegPhi.h:36
L1MuDTTrackSegPhi::quality
int quality() const
return quality code
Definition: L1MuDTTrackSegPhi.h:98
L1MuDTTrackSegPhi::phiValue
double phiValue() const
return phi-value in global coordinates [0,2pi]
Definition: L1MuDTTrackSegPhi.cc:112
L1MuDTTrackSegPhi::m_bx
int m_bx
Definition: L1MuDTTrackSegPhi.h:136
L1MuDTTrackSegPhi::operator=
L1MuDTTrackSegPhi & operator=(const L1MuDTTrackSegPhi &)
assignment operator
Definition: L1MuDTTrackSegPhi.cc:126