ATLAS Offline Software
Loading...
Searching...
No Matches
MuonFeature.cxx
Go to the documentation of this file.
1// -*- C++ -*-
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7
8// STL include(s):
9#include <sstream>
10#include <cmath>
11
12// Gaudi/Athena include(s):
13#include "GaudiKernel/MsgStream.h"
14
15// Local include(s):
17
18// "Distance" used by the comparison operator(s):
19static const double DELTA = 0.001;
20
22{
24 m_RoIId = -1;
25 m_saddress = 0;
26 m_pt = 0.;
27 m_radius = 0.;
28 m_eta = 0.;
29 m_phi = 0.;
30 m_dir_phi = 0.;
31 m_zeta = 0.;
32 m_dir_zeta = 0.;
33 m_beta = 0.;
34 m_sp1_r = 0.;
35 m_sp1_z = 0.;
36 m_sp1_slope = 0.;
37 m_sp2_r = 0.;
38 m_sp2_z = 0.;
39 m_sp2_slope = 0.;
40 m_sp3_r = 0.;
41 m_sp3_z = 0.;
42 m_sp3_slope = 0.;
43 m_br_radius = 0.;
44 m_br_sagitta = 0.;
45 m_ec_alpha = 0.;
46 m_ec_beta = 0.;
47 m_dq_var1 = 0.;
48 m_dq_var2 = 0.;
49}
50
51// --- keep for backward compartibility
53 float eta, float phi, float dir_phi, float zeta,
54 float dir_zeta, float beta):
58 m_sp1_r(0.), m_sp1_z(0.), m_sp1_slope(0.),
59 m_sp2_r(0.), m_sp2_z(0.), m_sp2_slope(0.),
60 m_sp3_r(0.), m_sp3_z(0.), m_sp3_slope(0.),
62 m_ec_alpha(0.), m_ec_beta(0.),
63 m_dq_var1(0.), m_dq_var2(0.)
64{}
65
66// --- new constructor
85
87{
88 m_algoId = muon_feature->algoId();
89 m_RoIId = muon_feature->roiId();
90 m_saddress = muon_feature->saddress();
91 m_pt = muon_feature->pt();
92 m_radius = muon_feature->radius();
93 m_eta = muon_feature->eta();
94 m_phi = muon_feature->phi();
95 m_dir_phi = muon_feature->dir_phi();
96 m_zeta = muon_feature->zeta();
97 m_dir_zeta = muon_feature->dir_zeta();
98 m_beta = muon_feature->beta();
99 m_sp1_r = muon_feature->sp1_r();
100 m_sp1_z = muon_feature->sp1_z();
101 m_sp1_slope = muon_feature->sp1_slope();
102 m_sp2_r = muon_feature->sp2_r();
103 m_sp2_z = muon_feature->sp2_z();
104 m_sp2_slope = muon_feature->sp2_slope();
105 m_sp3_r = muon_feature->sp3_r();
106 m_sp3_z = muon_feature->sp3_z();
107 m_sp3_slope = muon_feature->sp3_slope();
108 m_br_radius = muon_feature->br_radius();
109 m_br_sagitta = muon_feature->br_sagitta();
110 m_ec_alpha = muon_feature->ec_alpha();
111 m_ec_beta = muon_feature->ec_beta();
112 m_dq_var1 = muon_feature->dq_var1();
113 m_dq_var2 = muon_feature->dq_var2();
114}
115
117{
118 m_algoId = muon_feature.algoId();
119 m_RoIId = muon_feature.roiId();
120 m_saddress = muon_feature.saddress();
121 m_pt = muon_feature.pt();
122 m_radius = muon_feature.radius();
123 m_eta = muon_feature.eta();
124 m_phi = muon_feature.phi();
125 m_dir_phi = muon_feature.dir_phi();
126 m_zeta = muon_feature.zeta();
127 m_dir_zeta = muon_feature.dir_zeta();
128 m_beta = muon_feature.beta();
129 m_sp1_r = muon_feature.sp1_r();
130 m_sp1_z = muon_feature.sp1_z();
131 m_sp1_slope = muon_feature.sp1_slope();
132 m_sp2_r = muon_feature.sp2_r();
133 m_sp2_z = muon_feature.sp2_z();
134 m_sp2_slope = muon_feature.sp2_slope();
135 m_sp3_r = muon_feature.sp3_r();
136 m_sp3_z = muon_feature.sp3_z();
137 m_sp3_slope = muon_feature.sp3_slope();
138 m_br_radius = muon_feature.br_radius();
139 m_br_sagitta = muon_feature.br_sagitta();
140 m_ec_alpha = muon_feature.ec_alpha();
141 m_ec_beta = muon_feature.ec_beta();
142 m_dq_var1 = muon_feature.dq_var1();
143 m_dq_var2 = muon_feature.dq_var2();
144}
145
146
149{
150 m_algoId = muon_feature.algoId();
151 m_RoIId = muon_feature.roiId();
152 m_saddress = muon_feature.saddress();
153 m_pt = muon_feature.pt();
154 m_radius = muon_feature.radius();
155 m_eta = muon_feature.eta();
156 m_phi = muon_feature.phi();
157 m_dir_phi = muon_feature.dir_phi();
158 m_zeta = muon_feature.zeta();
159 m_dir_zeta = muon_feature.dir_zeta();
160 m_beta = muon_feature.beta();
161 m_sp1_r = muon_feature.sp1_r();
162 m_sp1_z = muon_feature.sp1_z();
163 m_sp1_slope = muon_feature.sp1_slope();
164 m_sp2_r = muon_feature.sp2_r();
165 m_sp2_z = muon_feature.sp2_z();
166 m_sp2_slope = muon_feature.sp2_slope();
167 m_sp3_r = muon_feature.sp3_r();
168 m_sp3_z = muon_feature.sp3_z();
169 m_sp3_slope = muon_feature.sp3_slope();
170 m_br_radius = muon_feature.br_radius();
171 m_br_sagitta = muon_feature.br_sagitta();
172 m_ec_alpha = muon_feature.ec_alpha();
173 m_ec_beta = muon_feature.ec_beta();
174 m_dq_var1 = muon_feature.dq_var1();
175 m_dq_var2 = muon_feature.dq_var2();
176
177 return *this;
178}
179
180std::string str( const MuonFeature& muon ) {
181
182 std::stringstream stream;
183 stream << "RoI ID: " << muon.roiId()
184 << "; saddress: " << muon.saddress()
185 << "; eta: " << muon.eta()
186 << "; phi: " << muon.phi()
187 << "; pt: " << muon.pt();
188
189 return stream.str();
190}
191
192MsgStream& operator<< ( MsgStream& m, const MuonFeature& muon ) {
193
194 return ( m << str( muon ) );
195
196}
197
198bool operator== ( const MuonFeature& left, const MuonFeature& right ) {
199
200 if( ( left.algoId() != right.algoId() ) ||
201 ( left.saddress() != right.saddress() ) ||
202 ( std::abs( left.pt() - right.pt() ) > DELTA ) ||
203 ( std::abs( left.radius() - right.radius() ) > DELTA ) ||
204 ( std::abs( left.eta() - right.eta() ) > DELTA ) ||
205 ( std::abs( left.phi() - right.phi() ) > DELTA ) ||
206 ( std::abs( left.dir_phi() - right.dir_phi() ) > DELTA ) ||
207 ( std::abs( left.zeta() - right.zeta() ) > DELTA ) ||
208 ( std::abs( left.dir_zeta() - right.dir_zeta() ) > DELTA ) ||
209 ( std::abs( left.beta() - right.beta() ) > DELTA ) ||
210 ( std::abs( left.sp1_r() - right.sp1_r() ) > DELTA ) ||
211 ( std::abs( left.sp1_z() - right.sp1_z() ) > DELTA ) ||
212 ( std::abs( left.sp1_slope() - right.sp1_slope() ) > DELTA ) ||
213 ( std::abs( left.sp2_r() - right.sp2_r() ) > DELTA ) ||
214 ( std::abs( left.sp2_z() - right.sp2_z() ) > DELTA ) ||
215 ( std::abs( left.sp2_slope() - right.sp2_slope() ) > DELTA ) ||
216 ( std::abs( left.sp3_r() - right.sp3_r() ) > DELTA ) ||
217 ( std::abs( left.sp3_z() - right.sp3_z() ) > DELTA ) ||
218 ( std::abs( left.sp3_slope() - right.sp3_slope() ) > DELTA ) ||
219 ( std::abs( left.br_radius() - right.br_radius() ) > DELTA ) ||
220 ( std::abs( left.br_sagitta() - right.br_sagitta() ) > DELTA ) ||
221 ( std::abs( left.ec_alpha() - right.ec_alpha() ) > DELTA ) ||
222 ( std::abs( left.ec_beta() - right.ec_beta() ) > DELTA ) ||
223 ( std::abs( left.dq_var1() - right.dq_var1() ) > DELTA ) ||
224 ( std::abs( left.dq_var2() - right.dq_var2() ) > DELTA ) ) {
225
226 return false;
227
228 } else {
229
230 return true;
231
232 }
233
234}
235
236void diff( const MuonFeature& left, const MuonFeature& right,
237 std::map< std::string, double >& varChange ) {
238
239 if( std::abs( left.algoId() - right.algoId() ) > DELTA ) {
240 varChange[ "algoId" ] = static_cast< double >( left.algoId() - right.algoId() );
241 }
242 if( left.saddress() != right.saddress() ) {
243 varChange[ "saddress" ] = static_cast< double >( left.saddress() - right.saddress() );
244 }
245 if( std::abs( left.pt() - right.pt() ) > DELTA ) {
246 varChange[ "pt" ] = left.pt() - right.pt();
247 }
248 if( std::abs( left.radius() - right.radius() ) > DELTA ) {
249 varChange[ "radius" ] = left.radius() - right.radius();
250 }
251 if( std::abs( left.eta() - right.eta() ) > DELTA ) {
252 varChange[ "eta" ] = left.eta() - right.eta();
253 }
254 if( std::abs( left.phi() - right.phi() ) > DELTA ) {
255 varChange[ "phi" ] = left.phi() - right.phi();
256 }
257 if( std::abs( left.dir_phi() - right.dir_phi() ) > DELTA ) {
258 varChange[ "dir_phi" ] = left.dir_phi() - right.dir_phi();
259 }
260 if( std::abs( left.zeta() - right.zeta() ) > DELTA ) {
261 varChange[ "zeta" ] = left.zeta() - right.zeta();
262 }
263 if( std::abs( left.dir_zeta() - right.dir_zeta() ) > DELTA ) {
264 varChange[ "dir_zeta" ] = left.dir_zeta() - right.dir_zeta();
265 }
266 if( std::abs( left.beta() - right.beta() ) > DELTA ) {
267 varChange[ "beta" ] = left.beta() - right.beta();
268 }
269 if( std::abs( left.sp1_r() - right.sp1_r() ) > DELTA ) {
270 varChange[ "sp1_r" ] = left.sp1_r() - right.sp1_r();
271 }
272 if( std::abs( left.sp1_z() - right.sp1_z() ) > DELTA ) {
273 varChange[ "sp1_z" ] = left.sp1_z() - right.sp1_z();
274 }
275 if( std::abs( left.sp1_slope() - right.sp1_slope() ) > DELTA ) {
276 varChange[ "sp1_slope" ] = left.sp1_slope() - right.sp1_slope();
277 }
278 if( std::abs( left.sp2_r() - right.sp2_r() ) > DELTA ) {
279 varChange[ "sp2_r" ] = left.sp2_r() - right.sp2_r();
280 }
281 if( std::abs( left.sp2_z() - right.sp2_z() ) > DELTA ) {
282 varChange[ "sp2_z" ] = left.sp2_z() - right.sp2_z();
283 }
284 if( std::abs( left.sp2_slope() - right.sp2_slope() ) > DELTA ) {
285 varChange[ "sp2_slope" ] = left.sp2_slope() - right.sp2_slope();
286 }
287 if( std::abs( left.sp3_r() - right.sp3_r() ) > DELTA ) {
288 varChange[ "sp3_r" ] = left.sp3_r() - right.sp3_r();
289 }
290 if( std::abs( left.sp3_z() - right.sp3_z() ) > DELTA ) {
291 varChange[ "sp3_z" ] = left.sp3_z() - right.sp3_z();
292 }
293 if( std::abs( left.sp3_slope() - right.sp3_slope() ) > DELTA ) {
294 varChange[ "sp3_slope" ] = left.sp3_slope() - right.sp3_slope();
295 }
296 if( std::abs( left.br_radius() - right.br_radius() ) > DELTA ) {
297 varChange[ "br_radius" ] = left.br_radius() - right.br_radius();
298 }
299 if( std::abs( left.br_sagitta() - right.br_sagitta() ) > DELTA ) {
300 varChange[ "br_sagitta" ] = left.br_sagitta() - right.br_sagitta();
301 }
302 if( std::abs( left.ec_alpha() - right.ec_alpha() ) > DELTA ) {
303 varChange[ "ec_alpha" ] = left.ec_alpha() - right.ec_alpha();
304 }
305 if( std::abs( left.ec_beta() - right.ec_beta() ) > DELTA ) {
306 varChange[ "ec_beta" ] = left.ec_beta() - right.ec_beta();
307 }
308 if( std::abs( left.dq_var1() - right.dq_var1() ) > DELTA ) {
309 varChange[ "dq_var1" ] = left.dq_var1() - right.dq_var1();
310 }
311 if( std::abs( left.dq_var2() - right.dq_var2() ) > DELTA ) {
312 varChange[ "dq_var2" ] = left.dq_var2() - right.dq_var2();
313 }
314
315 return;
316}
static const double DELTA
MsgStream & operator<<(MsgStream &m, const MuonFeature &muon)
Helper operator for printing the object.
void diff(const MuonFeature &left, const MuonFeature &right, std::map< std::string, double > &varChange)
Comparison with feedback.
bool operator==(const MuonFeature &left, const MuonFeature &right)
Operator comparing two MuonFeature objects for equality.
float zeta(void) const
Definition MuonFeature.h:53
float m_br_radius
float br_radius(void) const
Definition MuonFeature.h:65
float m_sp3_slope
float m_sp1_z
Definition MuonFeature.h:94
float sp2_z(void) const
Definition MuonFeature.h:60
float ec_alpha(void) const
Definition MuonFeature.h:67
float br_sagitta(void) const
Definition MuonFeature.h:66
float sp1_r(void) const
Definition MuonFeature.h:56
float m_sp2_slope
Definition MuonFeature.h:98
float sp2_r(void) const
Definition MuonFeature.h:59
int saddress(void) const
Definition MuonFeature.h:47
double dq_var1(void) const
Definition MuonFeature.h:69
float pt(void) const
Definition MuonFeature.h:48
AlgoId algoId(void) const
Definition MuonFeature.h:45
double m_dq_var1
float m_ec_alpha
float m_br_sagitta
int roiId(void) const
Definition MuonFeature.h:46
float beta(void) const
Definition MuonFeature.h:55
float phi(void) const
Definition MuonFeature.h:51
float m_dir_phi
Definition MuonFeature.h:89
float m_dir_zeta
Definition MuonFeature.h:91
double dq_var2(void) const
Definition MuonFeature.h:70
float sp1_z(void) const
Definition MuonFeature.h:57
float dir_zeta(void) const
Definition MuonFeature.h:54
float m_sp2_r
Definition MuonFeature.h:96
float ec_beta(void) const
Definition MuonFeature.h:68
float sp1_slope(void) const
Definition MuonFeature.h:58
float m_sp2_z
Definition MuonFeature.h:97
float m_sp1_slope
Definition MuonFeature.h:95
float radius(void) const
Definition MuonFeature.h:49
float m_radius
Definition MuonFeature.h:86
float sp2_slope(void) const
Definition MuonFeature.h:61
AlgoId m_algoId
Definition MuonFeature.h:82
float m_sp3_r
Definition MuonFeature.h:99
float sp3_slope(void) const
Definition MuonFeature.h:64
float dir_phi(void) const
Definition MuonFeature.h:52
double m_dq_var2
float m_ec_beta
float sp3_z(void) const
Definition MuonFeature.h:63
float eta(void) const
Definition MuonFeature.h:50
float m_sp1_r
Definition MuonFeature.h:93
float sp3_r(void) const
Definition MuonFeature.h:62
MuonFeature & operator=(const MuonFeature &muon_feature)