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