ATLAS Offline Software
TileMuFeature.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // *****************************************************************************
6 // Filename : TileMuFeature.cxx
7 // Author : Heuijin Lim
8 // Created : Sep. 2007
9 //
10 // DESCRIPTION:
11 // Contain the muon candidates from TileCal and the combined tracks from
12 // Inner-Detector.
13 //
14 // HISTORY:
15 //
16 // BUGS:
17 //
18 //*****************************************************************************
19 
20 #include <iostream>
21 #include <sstream>
22 #include <iomanip>
23 #include <cmath>
24 
25 // Gaudi/Athena includes:
26 #include "GaudiKernel/MsgStream.h"
27 
28 // Trigger includes:
30 
32 static const double DELTA = 0.001;
33 
35 {
36  m_eta = -999.9;
37  m_phi = -999.9;
38  m_energy_deposited.clear();
39  m_quality_factor = -999.9;
40 }
41 
42 TileMuFeature::TileMuFeature ( float eta, float phi, const std::vector<float> & ener, float qual )
43  : m_eta(eta)
44  , m_phi(phi)
45  , m_energy_deposited(ener)
46  , m_quality_factor(qual)
47 {
48 }
49 
50 TileMuFeature::TileMuFeature ( float eta, float phi, std::vector<float> && ener, float qual )
51  : m_eta(eta)
52  , m_phi(phi)
53  , m_energy_deposited(std::move(ener))
54  , m_quality_factor(qual)
55 {
56 }
57 
59  m_eta = muon_feature->eta();
60  m_phi = muon_feature->phi();
61  m_energy_deposited = muon_feature->enedep();
62  m_quality_factor = muon_feature->quality();
63 }
64 
66  m_eta = muon_feature.eta();
67  m_phi = muon_feature.phi();
68  m_energy_deposited = muon_feature.enedep();
69  m_quality_factor = muon_feature.quality();
70 }
71 
74 {
75  if (this != &muon_feature) {
76  m_eta = muon_feature.eta();
77  m_phi = muon_feature.phi();
78  m_energy_deposited = muon_feature.enedep();
79  m_quality_factor = muon_feature.quality();
80  }
81 
82  return *this;
83 }
84 
87 {
88  if (this != &muon_feature) {
89  m_eta = muon_feature.eta();
90  m_phi = muon_feature.phi();
91  m_energy_deposited = std::move(muon_feature.m_energy_deposited);
92  m_quality_factor = muon_feature.quality();
93  }
94 
95  return *this;
96 }
97 
100 std::string str ( const TileMuFeature& d )
101 {
102  std::stringstream ss;
103 
104  ss << "eta: " << d.eta()
105  << "; phi: " << d.phi()
106  << "; quality: " << d.quality();
107 
108  return ss.str();
109 }
110 
111 MsgStream& operator<< ( MsgStream& m, const TileMuFeature& d )
112 {
113  return ( m << str( d ) );
114 }
115 
116 bool operator== ( const TileMuFeature& a, const TileMuFeature& b )
117 {
118  if( std::abs( a.eta() - b.eta() ) > DELTA ) return false;
119  if( std::abs( a.phi() - b.phi() ) > DELTA ) return false;
120  if( std::abs( a.quality() - b.quality() ) > DELTA ) return false;
121 
122  return true;
123 }
124 
125 void diff( const TileMuFeature& a, const TileMuFeature& b, std::map< std::string, double >& variableChange )
126 {
127  if( std::abs( a.eta() - b.eta() ) > DELTA ) {
128  variableChange[ "eta" ] = a.eta() - b.eta();
129  }
130  if( std::abs( a.phi() - b.phi() ) > DELTA ) {
131  variableChange[ "phi" ] = a.phi() - b.phi();
132  }
133  if( ( a.quality() - b.quality() ) > DELTA ) {
134  variableChange[ "quality" ] = a.quality() - b.quality();
135  }
136 
137  return;
138 }
139 
140 /*
141 void TileMuFeature::Set( float eta, float phi, std::vector<float> & ener, float qual )
142 {
143  m_eta = eta;
144  m_phi = phi;
145  m_energy_deposited = ener;
146  m_quality_factor = qual;
147 }
148 
149 void TileMuFeature::print() const
150 {
151  std::cout << (std::string) (*this) << std::endl;
152 }
153 
154 TileMuFeature::operator std::string() const
155 {
156  const int MAX_BUF = 1024;
157  char buf[MAX_BUF];
158  std::ostringstream text(buf);
159 
160  //text << whoami();
161  text << " eta=" << m_eta;
162  text << " phi=" << m_phi;
163  for (unsigned int i=0; i<m_energy_deposited.size(); ++i)
164  text << " ene[" << i << "]=" << m_energy_deposited[i];
165  text << " qual=" << m_quality_factor;
166 
167  return text.str();
168 }
169 */
170 
171 /*
172 void TileMuFeature::SetIDTrk(float Pt_IDTrk, float Eta_IDTrk, float EtaTR_IDTrk, float Phi_IDTrk, float PhiTR_IDTrk, float zPos_IDTrk, int Typ_IDTrk)
173 {
174  m_Pt_IDTrk = Pt_IDTrk;
175  m_Eta_IDTrk = Eta_IDTrk;
176  m_EtaTR_IDTrk = EtaTR_IDTrk;
177  m_Phi_IDTrk = Phi_IDTrk;
178  m_PhiTR_IDTrk = PhiTR_IDTrk;
179  m_zPos_IDTrk = zPos_IDTrk;
180  m_IDTrk = Typ_IDTrk;
181 }
182 */
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:64
TileMuFeature::phi
float phi() const
Definition: TileMuFeature.h:56
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
hist_file_dump.d
d
Definition: hist_file_dump.py:137
diff
void diff(const TileMuFeature &a, const TileMuFeature &b, std::map< std::string, double > &variableChange)
Comparison with feedback.
Definition: TileMuFeature.cxx:125
TileMuFeature::m_energy_deposited
std::vector< float > m_energy_deposited
Definition: TileMuFeature.h:80
TileMuFeature::enedep
const std::vector< float > & enedep() const
Definition: TileMuFeature.h:57
operator<<
MsgStream & operator<<(MsgStream &m, const TileMuFeature &d)
Helper operator for printing the object.
Definition: TileMuFeature.cxx:111
TileMuFeature::m_quality_factor
float m_quality_factor
Definition: TileMuFeature.h:81
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TileMuFeature::quality
float quality() const
Definition: TileMuFeature.h:58
operator==
bool operator==(const TileMuFeature &a, const TileMuFeature &b)
Operator comparing two CombinedMuonFeature objects for equality.
Definition: TileMuFeature.cxx:116
a
TList * a
Definition: liststreamerinfos.cxx:10
TileMuFeature::m_phi
float m_phi
Definition: TileMuFeature.h:79
str
std::string str(const TileMuFeature &d)
Helper operators.
Definition: TileMuFeature.cxx:100
TileMuFeature::operator=
TileMuFeature & operator=(const TileMuFeature &muon_feature)
Assignement operator.
Definition: TileMuFeature.cxx:73
TileMuFeature::eta
float eta() const
Accessor.
Definition: TileMuFeature.h:55
TileMuFeature.h
beamspotman.qual
qual
Definition: beamspotman.py:481
TileMuFeature::TileMuFeature
TileMuFeature()
Definition: TileMuFeature.cxx:34
TileMuFeature::m_eta
float m_eta
Definition: TileMuFeature.h:78
TileMuFeature
Definition: TileMuFeature.h:30