CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
L1MuGMTCand.cc
Go to the documentation of this file.
1 //-------------------------------------------------
2 //
3 // Class: L1MuGMTCand
4 //
5 // Description: L1 Global Muon Trigger Candidate
6 //
7 //
8 //
9 // Author :
10 // N. Neumeister CERN EP
11 //
12 // Migrated to CMSSW:
13 // I. Mikulec
14 //
15 //--------------------------------------------------
16 
17 //-----------------------
18 // This Class's Header --
19 //-----------------------
20 
22 
23 //---------------
24 // C++ Headers --
25 //---------------
26 
27 #include <iostream>
28 #include <iomanip>
29 #include <cmath>
30 
31 //-------------------------------
32 // Collaborating Class Headers --
33 //-------------------------------
34 
36 
37 //---------------------------------
38 // class L1MuGMTCand
39 //---------------------------------
40 
41 using namespace std;
42 
43 const float L1MuGMTCand::m_invalidValue = -10.;
44 
45 //----------------
46 // Constructors --
47 //----------------
48 
49 L1MuGMTCand::L1MuGMTCand() : m_name("L1MuGMTCand"), m_bx(0), m_dataWord(0) {
53 }
54 
55 
59 }
60 
61 L1MuGMTCand::L1MuGMTCand(unsigned data, int bx) :
62  m_name("L1MuGMTCand"), m_bx(bx) , m_dataWord(data) {
63 
67 
68 }
69 
70 //--------------
71 // Destructor --
72 //--------------
74 
75  reset();
76 
77 }
78 
79 
80 //--------------
81 // Operations --
82 //--------------
83 
84 //
85 // reset Muon Track Candidate
86 //
88 
89  m_bx = 0;
90  m_dataWord = 0;
94 
95 }
96 
97 //
98 // return phi of track candidate in radians
99 //
100 float L1MuGMTCand::phiValue() const {
101 
102  if(m_phiValue == m_invalidValue) {
103  edm::LogWarning("ValueInvalid") <<
104  "L1MuGMTCand::phiValue requested physical value is invalid";
105  }
106  return m_phiValue;
107 
108 }
109 
110 
111 //
112 // return eta of track candidate
113 //
114 float L1MuGMTCand::etaValue() const {
115 
116  if(m_etaValue == m_invalidValue) {
117  edm::LogWarning("ValueInvalid") <<
118  "L1MuGMTCand::etaValue requested physical value is invalid";
119  }
120  return m_etaValue;
121 
122 }
123 
124 
125 //
126 // return pt-value of track candidate in GeV
127 //
128 float L1MuGMTCand::ptValue() const {
129 
130  if(m_ptValue == m_invalidValue) {
131  edm::LogWarning("ValueInvalid") <<
132  "L1MuRegionalCand::ptValue requested physical value is invalid";
133  }
134  return m_ptValue;
135 
136 }
137 
138 //
139 // Equal operator
140 //
142 
143  if ( m_bx != cand.m_bx ) return false;
144  if ( m_dataWord != cand.m_dataWord ) return false;
145  return true;
146 
147 }
148 
149 
150 //
151 // Unequal operator
152 //
154 
155  if ( m_bx != cand.m_bx ) return true;
156  if ( m_dataWord != cand.m_dataWord ) return true;
157  return false;
158 
159 }
160 
161 
162 //
163 // print parameters of track candidate
164 //
165 void L1MuGMTCand::print() const {
166 
167  if ( !empty() ) {
168  if(m_phiValue == m_invalidValue ||
171  edm::LogVerbatim("GMT_Candidate_info")
172  << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed)
173  << "bx = " << setw(2) << bx() << " " << endl
174  << "pt(index) = " << setw(2) << ptIndex() << " "
175  << "charge = " << setw(2) << charge() << " "
176  << "eta(index) = " << setw(2) << etaIndex() << " "
177  << "phi(index) = " << setw(3) << phiIndex() << " "
178  << "quality = " << setw(1) << quality() << " "
179  << "isolated = " << setw(1) << isol() << " "
180  << "mip = " << setw(1) << mip() << endl;
181  } else {
182  edm::LogVerbatim("GMT_Candidate_info")
183  << setiosflags(ios::right | ios::adjustfield | ios::showpoint | ios::fixed)
184  << "bx = " << setw(2) << bx() << " " << endl
185  << "pt = " << setw(5) << setprecision(1) << ptValue() << " GeV "
186  << "charge = " << setw(2) << charge() << " "
187  << "eta = " << setw(5) << setprecision(2) << etaValue() << " "
188  << "phi = " << setw(5) << setprecision(3) << phiValue() << " rad "
189  << "quality = " << setw(1) << quality() << " "
190  << "isolated = " << setw(1) << isol() << " "
191  << "mip = " << setw(1) << mip() << endl;
192  }
193  }
194 
195 }
196 
197 
198 //
199 // output stream operator for track candidate
200 //
201 ostream& operator<<(ostream& s, const L1MuGMTCand& id) {
202 
203  if ( !id.empty() ) {
204  s << setiosflags(ios::showpoint | ios::fixed)
205  << "bx = " << setw(2) << id.bx() << " "
206  << "pt = " << setw(5) << setprecision(1) << id.ptValue() << " GeV "
207  << "charge = " << setw(2) << id.charge() << " "
208  << "eta = " << setw(5) << setprecision(2) << id.etaValue() << " "
209  << "phi = " << setw(5) << setprecision(3) << id.phiValue() << " rad "
210  << "quality = " << setw(1) << id.quality() << " "
211  << "isolated = " << setw(1) << id.isol() << " "
212  << "mip = " << setw(1) << id.mip() << " ";
213  }
214  return s;
215 
216 }
217 
218 
219 
220 
221 
222 
223 
224 
float etaValue() const
Definition: L1MuGMTCand.cc:114
float phiValue() const
Definition: L1MuGMTCand.cc:100
unsigned int phiIndex() const
get phi-code
Definition: L1MuGMTCand.h:73
void reset()
reset muon candidate
Definition: L1MuGMTCand.cc:87
bool operator!=(const L1MuGMTCand &) const
unequal operator
Definition: L1MuGMTCand.cc:153
unsigned int etaIndex() const
get eta-code
Definition: L1MuGMTCand.h:108
float m_ptValue
Definition: L1MuGMTCand.h:219
friend std::ostream & operator<<(std::ostream &, const L1MuGMTCand &)
output stream operator
bool isol() const
get isolation
Definition: L1MuGMTCand.h:114
L1MuGMTCand()
constructor
Definition: L1MuGMTCand.cc:49
float m_etaValue
Definition: L1MuGMTCand.h:218
float m_phiValue
Definition: L1MuGMTCand.h:217
bool empty() const
is it an empty muon candidate?
Definition: L1MuGMTCand.h:64
static const float m_invalidValue
Definition: L1MuGMTCand.h:220
int bx() const
get bunch crossing identifier
Definition: L1MuGMTCand.h:120
std::string m_name
Definition: L1MuGMTCand.h:213
const int mu
Definition: Constants.h:22
bool mip() const
get mip
Definition: L1MuGMTCand.h:117
unsigned m_dataWord
Definition: L1MuGMTCand.h:215
float ptValue() const
Definition: L1MuGMTCand.cc:128
unsigned int quality() const
get quality
Definition: L1MuGMTCand.h:93
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
bool operator==(const L1MuGMTCand &) const
equal operator
Definition: L1MuGMTCand.cc:141
virtual ~L1MuGMTCand()
destructor
Definition: L1MuGMTCand.cc:73
unsigned int ptIndex() const
get pt-code
Definition: L1MuGMTCand.h:76
void print() const
print parameters of muon candidate
Definition: L1MuGMTCand.cc:165
int charge() const
get charge (+1 -1)
Definition: L1MuGMTCand.h:135