ATLAS Offline Software
IsoMuonFeature.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 
7 NAME: IsoMuonFeature.cxx
8 PACKAGE: Trigger/TrigEvent/TrigMuonEvent
9 AUTHORS: Stefano Giagu <stefano.giagu@cern.ch>
10 PURPOSE: Keep the important output variables
11  from the muon isolation trigger.
12 DATE: V3.0 January 28th, 2008
13 
14 ******************************************************/
15 
16 // STL include(s):
17 #include <sstream>
18 #include <cmath>
19 
20 // Gaudi/Athena include(s):
21 #include "GaudiKernel/MsgStream.h"
22 
23 // Local include(s):
25 
26 // "Distance" used by the comparison operator(s):
27 static const double DELTA = 0.001;
28 
30  m_sumet01(0.0),
31  m_sumet02(0.0),
32  m_sumet03(0.0),
33  m_sumet04(0.0),
34  m_sumpt01(0.0),
35  m_sumpt02(0.0),
36  m_sumpt03(0.0),
37  m_sumpt04(0.0),
38  m_PtMuID(0.0),
39  m_MaxPtID(0.0),
40  m_flag(0),
41  m_RoiIdMu(0),
42  m_PtMu(0.0),
43  m_QMu(0.0),
44  m_EtaMu(0.0),
45  m_PhiMu(0.0),
46  m_EtInnerConeEC(0.0),
47  m_EtOuterConeEC(0.0),
48  m_EtInnerConeHC(0.0),
49  m_EtOuterConeHC(0.0),
50  m_NTracksCone(0),
51  m_SumPtTracksCone(0.0),
52  m_PtMuTracksCone(0.0),
53  m_LAr_w(0.0),
54  m_Tile_w(0.0) {}
55 
57 
58 //Assignment operator
61  if (this != &mfeature) {
62  m_sumet01 = mfeature.getsumet01();
63  m_sumet02 = mfeature.getsumet02();
64  m_sumet03 = mfeature.getsumet03();
65  m_sumet04 = mfeature.getsumet04();
66  m_sumpt01 = mfeature.getsumpt01();
67  m_sumpt02 = mfeature.getsumpt02();
68  m_sumpt03 = mfeature.getsumpt03();
69  m_sumpt04 = mfeature.getsumpt04();
70  m_PtMuID = mfeature.getPtMuID();
71  m_MaxPtID = mfeature.getMaxPtID();
72  m_flag = mfeature.getFlag();
73  m_RoiIdMu = mfeature.getRoiIdMu();
74  m_PtMu = mfeature.pt();
75  m_QMu = mfeature.getQMu();
76  m_EtaMu = mfeature.getEtaMu();
77  m_PhiMu = mfeature.getPhiMu();
78  }
79  return *this;
80 }
81 
83 
84  if (m_NTracksCone>0) return m_NTracksCone/100000;
85  else {
86  int a = static_cast<int>(m_flag/10000);
87  return a;
88  }
89 }
90 
92  int a = static_cast<int>(m_flag/10000);
93  int b = static_cast<int>(m_flag-a*10000);
94  return b;
95 }
96 
97 // Copy constructor (Note that also the base class is copied)
99  I4Momentum( *feat ),
100  INavigable( *feat ),
101  INavigable4Momentum( *feat ),
102  P4PtEtaPhiMBase ( *feat ),
104  m_sumet01 ( feat->getsumet01() ),
105  m_sumet02 ( feat->getsumet02() ),
106  m_sumet03 ( feat->getsumet03() ),
107  m_sumet04 ( feat->getsumet04() ),
108  m_sumpt01 ( feat->getsumpt01() ),
109  m_sumpt02 ( feat->getsumpt02() ),
110  m_sumpt03 ( feat->getsumpt03() ),
111  m_sumpt04 ( feat->getsumpt04() ),
112  m_PtMuID ( feat->getPtMuID() ),
113  m_MaxPtID ( feat->getMaxPtID() ),
114  m_flag ( feat->getFlag() ),
115  m_RoiIdMu ( feat->getRoiIdMu() ),
116  m_PtMu ( feat->pt() ),
117  m_QMu ( feat->getQMu() ),
118  m_EtaMu ( feat->getEtaMu() ),
119  m_PhiMu ( feat->getPhiMu() ) {}
120 
122  I4Momentum( feat ),
123  INavigable( feat ),
124  IAthenaBarCode( feat ),
125  INavigable4Momentum( feat ),
126  P4PtEtaPhiMBase ( feat ),
128  m_sumet01 ( feat.getsumet01() ),
129  m_sumet02 ( feat.getsumet02() ),
130  m_sumet03 ( feat.getsumet03() ),
131  m_sumet04 ( feat.getsumet04() ),
132  m_sumpt01 ( feat.getsumpt01() ),
133  m_sumpt02 ( feat.getsumpt02() ),
134  m_sumpt03 ( feat.getsumpt03() ),
135  m_sumpt04 ( feat.getsumpt04() ),
136  m_PtMuID ( feat.getPtMuID() ),
137  m_MaxPtID ( feat.getMaxPtID() ),
138  m_flag ( feat.getFlag() ),
139  m_RoiIdMu ( feat.getRoiIdMu() ),
140  m_PtMu ( feat.pt() ),
141  m_QMu ( feat.getQMu() ),
142  m_EtaMu ( feat.getEtaMu() ),
143  m_PhiMu ( feat.getPhiMu() ) {}
144 
146  std::cout << std::endl;
147  std::cout << "m_sumet01: " << m_sumet01 << std::endl;
148  std::cout << "m_sumet02: " << m_sumet02 << std::endl;
149  std::cout << "m_sumet03: " << m_sumet03 << std::endl;
150  std::cout << "m_sumet04: " << m_sumet04 << std::endl;
151  std::cout << "m_sumpt01: " << m_sumpt01 << std::endl;
152  std::cout << "m_sumpt02: " << m_sumpt02 << std::endl;
153  std::cout << "m_sumpt03: " << m_sumpt03 << std::endl;
154  std::cout << "m_sumpt04: " << m_sumpt04 << std::endl;
155  std::cout << "m_PtMuID: " << m_PtMuID << std::endl;
156  std::cout << "m_MaxPtID: " << m_MaxPtID << std::endl;
157  std::cout << "m_flag: " << m_flag << std::endl;
158  std::cout << "m_RoiIdMu: " << m_RoiIdMu << std::endl;
159  std::cout << "m_PtMu: " << m_PtMu << std::endl;
160  std::cout << "m_QMu: " << m_QMu << std::endl;
161  std::cout << "m_EtaMu: " << m_EtaMu << std::endl;
162  std::cout << "m_PhiMu: " << m_PhiMu << std::endl;
163  std::cout << std::endl;
164 }
165 
166 void IsoMuonFeature::print ( MsgStream& log ) {
167  log << MSG::DEBUG << "m_sumet01: " << m_sumet01 << "; ";
168  log << MSG::DEBUG << "m_sumet02: " << m_sumet02 << "; ";
169  log << MSG::DEBUG << "m_sumet03: " << m_sumet03 << "; ";
170  log << MSG::DEBUG << "m_sumet04: " << m_sumet04 << "; ";
171  log << MSG::DEBUG << "m_sumpt01: " << m_sumpt01 << "; ";
172  log << MSG::DEBUG << "m_sumpt02: " << m_sumpt02 << "; ";
173  log << MSG::DEBUG << "m_sumpt03: " << m_sumpt03 << "; ";
174  log << MSG::DEBUG << "m_sumpt04: " << m_sumpt04 << "; ";
175  log << MSG::DEBUG << "m_PtMuID: " << m_PtMuID << "; ";
176  log << MSG::DEBUG << "m_MaxPtID: " << m_MaxPtID << "; ";
177  log << MSG::DEBUG << "m_flag: " << m_flag << "; ";
178  log << MSG::DEBUG << "m_RoiIdMu: " << m_RoiIdMu << "; ";
179  log << MSG::DEBUG << "m_PtMu: " << m_PtMu << "; ";
180  log << MSG::DEBUG << "m_QMu: " << m_QMu << "; ";
181  log << MSG::DEBUG << "m_EtaMu: " << m_EtaMu << "; ";
182  log << MSG::DEBUG << "m_PhiMu: " << m_PhiMu << "; ";
183  log << endmsg;
184 }
185 
187 // helper operators
188 
189 std::string str( const IsoMuonFeature& d ) {
190  std::stringstream ss;
191  ss << "sumet01: " << d.getsumet01()
192  << "; sumet02: " << d.getsumet02()
193  << "; sumet03: " << d.getsumet03()
194  << "; sumet04: " << d.getsumet04()
195  << "; sumpt01: " << d.getsumpt01()
196  << "; sumpt02: " << d.getsumpt02()
197  << "; sumpt03: " << d.getsumpt03()
198  << "; sumpt04: " << d.getsumpt04()
199  << "; PtMuID: " << d.getPtMuID()
200  << "; MaxPtID: " << d.getMaxPtID()
201  << "; flag: " << d.getFlag()
202  << "; RoiIdMu: " << d.getRoiIdMu()
203  << "; RoiIdMu: " << d.getRoiIdMu()
204  << "; PtMu: " << d.pt()
205  << "; QMu: " << d.getQMu()
206  << "; EtaMu: " << d.getEtaMu()
207  << "; PhiMu: " << d.getPhiMu();
208 
209  return ss.str();
210 }
211 
212 MsgStream& operator<< ( MsgStream& m, const IsoMuonFeature& d ) {
213 
214  return ( m << str( d ) );
215 }
216 
217 bool operator== ( const IsoMuonFeature& a, const IsoMuonFeature& b ) {
218 
219  if( std::abs( a.getsumet01() - b.getsumet01() ) > DELTA )
220  return false;
221  if( std::abs( a.getsumet02() - b.getsumet02() ) > DELTA )
222  return false;
223  if( std::abs( a.getsumet03() - b.getsumet03() ) > DELTA )
224  return false;
225  if( std::abs( a.getsumet04() - b.getsumet04() ) > DELTA )
226  return false;
227  if( std::abs( a.getsumpt01() - b.getsumpt01() ) > DELTA )
228  return false;
229  if( std::abs( a.getsumpt02() - b.getsumpt02() ) > DELTA )
230  return false;
231  if( std::abs( a.getsumpt03() - b.getsumpt03() ) > DELTA )
232  return false;
233  if( std::abs( a.getsumpt04() - b.getsumpt04() ) > DELTA )
234  return false;
235  if( std::abs( a.getPtMuID() - b.getPtMuID() ) > DELTA )
236  return false;
237  if( std::abs( a.getMaxPtID() - b.getMaxPtID() ) > DELTA )
238  return false;
239  if( a.getFlag() != b.getFlag() )
240  return false;
241  if( a.getRoiIdMu() != b.getRoiIdMu() )
242  return false;
243  if( std::abs( a.pt() - b.pt() ) > DELTA )
244  return false;
245  if( std::abs( a.getQMu() - b.getQMu() ) > DELTA )
246  return false;
247  if( std::abs( a.getEtaMu() - b.getEtaMu() ) > DELTA )
248  return false;
249  if( std::abs( a.getPhiMu() - b.getPhiMu() ) > DELTA )
250  return false;
251 
252  return true;
253 }
254 
264 void diff( const IsoMuonFeature& a, const IsoMuonFeature& b,
265  std::map< std::string, double >& variableChange ) {
266 
267  if( std::abs( a.getsumet01() - b.getsumet01() ) > DELTA ) {
268  variableChange[ "sumet01" ] = a.getsumet01() - b.getsumet01();
269  }
270  if( std::abs( a.getsumet02() - b.getsumet02() ) > DELTA ) {
271  variableChange[ "sumet02" ] = a.getsumet02() - b.getsumet02();
272  }
273  if( std::abs( a.getsumet03() - b.getsumet03() ) > DELTA ) {
274  variableChange[ "sumet03" ] = a.getsumet03() - b.getsumet03();
275  }
276  if( std::abs( a.getsumet04() - b.getsumet04() ) > DELTA ) {
277  variableChange[ "sumet04" ] = a.getsumet04() - b.getsumet04();
278  }
279  if( std::abs( a.getsumpt01() - b.getsumpt01() ) > DELTA ) {
280  variableChange[ "sumpt01" ] = a.getsumpt01() - b.getsumpt01();
281  }
282  if( std::abs( a.getsumet02() - b.getsumet02() ) > DELTA ) {
283  variableChange[ "sumet02" ] = a.getsumet02() - b.getsumpt02();
284  }
285  if( std::abs( a.getsumpt03() - b.getsumpt03() ) > DELTA ) {
286  variableChange[ "sumpt03" ] = a.getsumpt03() - b.getsumpt03();
287  }
288  if( std::abs( a.getsumpt04() - b.getsumpt04() ) > DELTA ) {
289  variableChange[ "sumpt04" ] = a.getsumpt04() - b.getsumpt04();
290  }
291  if( a.getFlag() != b.getFlag() ) {
292  variableChange[ "flag" ] = static_cast< double >( a.getFlag() -
293  b.getFlag() );
294  }
295  if( a.getRoiIdMu() != b.getRoiIdMu() ) {
296  variableChange[ "RoiIdMu" ] = static_cast< double >( a.getRoiIdMu() -
297  b.getRoiIdMu() );
298  }
299  if( std::abs( a.pt() - b.pt() ) > DELTA ) {
300  variableChange[ "PtMu" ] = a.pt() - b.pt();
301  }
302  if( std::abs( a.getQMu() - b.getQMu() ) > DELTA ) {
303  variableChange[ "QMu" ] = a.getQMu() - b.getQMu();
304  }
305  if( std::abs( a.getEtaMu() - b.getEtaMu() ) > DELTA ) {
306  variableChange[ "EtaMu" ] = a.getEtaMu() - b.getEtaMu();
307  }
308  if( std::abs( a.getPhiMu() - b.getPhiMu() ) > DELTA ) {
309  variableChange[ "PhiMu" ] = a.getPhiMu() - b.getPhiMu();
310  }
311 
312  return;
313 }
314 
315 // End of file IsoMuonFeature.cxx
IsoMuonFeature::m_NTracksCone
int m_NTracksCone
Definition: IsoMuonFeature.h:197
IsoMuonFeature::getsumet01
float getsumet01() const
Get Transverse Energy sum in cone.
Definition: IsoMuonFeature.h:111
I4Momentum
Definition: I4Momentum.h:31
IsoMuonFeature::m_QMu
float m_QMu
Muon Charge.
Definition: IsoMuonFeature.h:186
IsoMuonFeature::getsumet03
float getsumet03() const
Definition: IsoMuonFeature.h:113
IsoMuonFeature::getsumpt02
float getsumpt02() const
Definition: IsoMuonFeature.h:118
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
IsoMuonFeature::iso_strategy
int iso_strategy(void) const
Get Isolation strategy (1->CombinedMuon seeded, 2->muFast Muon seeded, 3->L1 muon seeded)
Definition: IsoMuonFeature.cxx:82
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
hist_file_dump.d
d
Definition: hist_file_dump.py:137
test_pyathena.pt
pt
Definition: test_pyathena.py:11
NavigableTerminalNode
Dummy type needed fro specialized implementation.
Definition: NavigableTerminalNode.h:19
IsoMuonFeature::m_RoiIdMu
int m_RoiIdMu
ROI ID.
Definition: IsoMuonFeature.h:182
IsoMuonFeature::getsumet02
float getsumet02() const
Definition: IsoMuonFeature.h:112
IsoMuonFeature::m_sumpt03
float m_sumpt03
Definition: IsoMuonFeature.h:170
IsoMuonFeature::~IsoMuonFeature
~IsoMuonFeature()
Destructor.
Definition: IsoMuonFeature.cxx:56
IsoMuonFeature::getPtMuID
float getPtMuID() const
Get Pt of charged track associated to muon.
Definition: IsoMuonFeature.h:123
IsoMuonFeature::m_sumpt01
float m_sumpt01
Track based isolation.
Definition: IsoMuonFeature.h:168
IsoMuonFeature::m_sumet01
float m_sumet01
Calo based isolation.
Definition: IsoMuonFeature.h:162
IsoMuonFeature::getRoiIdMu
int getRoiIdMu() const
Get Muon RoI Id.
Definition: IsoMuonFeature.h:135
IsoMuonFeature::m_flag
int m_flag
Definition: IsoMuonFeature.h:178
IsoMuonFeature::getEtaMu
float getEtaMu() const
Get Muon Eta.
Definition: IsoMuonFeature.h:141
IsoMuonFeature::m_PhiMu
float m_PhiMu
Muon Phi.
Definition: IsoMuonFeature.h:190
IsoMuonFeature::m_EtaMu
float m_EtaMu
Muon Eta.
Definition: IsoMuonFeature.h:188
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
IsoMuonFeature::getPhiMu
float getPhiMu() const
Get Muon Phi.
Definition: IsoMuonFeature.h:143
INavigable
Definition: INavigable.h:18
IsoMuonFeature.h
operator<<
MsgStream & operator<<(MsgStream &m, const IsoMuonFeature &d)
Helper operator for printing the object.
Definition: IsoMuonFeature.cxx:212
diff
void diff(const IsoMuonFeature &a, const IsoMuonFeature &b, std::map< std::string, double > &variableChange)
Function compares two objects and returns "semi verbose" output in the form of map where there are va...
Definition: IsoMuonFeature.cxx:264
IAthenaBarCode
Definition: AthenaKernel/AthenaKernel/IAthenaBarCode.h:48
IsoMuonFeature::m_sumet02
float m_sumet02
Definition: IsoMuonFeature.h:163
IsoMuonFeature::print
void print(void)
Prints out cluster variables to std::cout.
Definition: IsoMuonFeature.cxx:145
IsoMuonFeature::operator=
IsoMuonFeature & operator=(const IsoMuonFeature &mfeature)
Assignement operator.
Definition: IsoMuonFeature.cxx:60
IsoMuonFeature::m_sumpt02
float m_sumpt02
Definition: IsoMuonFeature.h:169
P4PtEtaPhiMBase
Definition: P4PtEtaPhiMBase.h:26
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
IsoMuonFeature::m_MaxPtID
float m_MaxPtID
pt of highest pt track in cone (excluded the one associated to the muon)
Definition: IsoMuonFeature.h:176
IsoMuonFeature::getsumpt04
float getsumpt04() const
Definition: IsoMuonFeature.h:120
IsoMuonFeature
Class with isolation variables for TrigmuIso algorithm.
Definition: IsoMuonFeature.h:41
IsoMuonFeature::m_sumet04
float m_sumet04
Definition: IsoMuonFeature.h:165
IsoMuonFeature::iso_errorFlag
int iso_errorFlag(void) const
Get Error Flag.
Definition: IsoMuonFeature.cxx:91
IsoMuonFeature::m_PtMu
float m_PtMu
Muon Pt.
Definition: IsoMuonFeature.h:184
IsoMuonFeature::getsumpt01
float getsumpt01() const
Get Transverse Pt sum in cone.
Definition: IsoMuonFeature.h:117
str
std::string str(const IsoMuonFeature &d)
Helper function for printing the object.
Definition: IsoMuonFeature.cxx:189
HLT::getFlag
const std::vector< bool > & getFlag(const TrigPassFlags *flags, const T *obj, const CONTAINER *container, const size_t position)
Returns the flag at index position.
Definition: TrigPassFlags.h:145
a
TList * a
Definition: liststreamerinfos.cxx:10
IsoMuonFeature::m_sumet03
float m_sumet03
Definition: IsoMuonFeature.h:164
IsoMuonFeature::m_sumpt04
float m_sumpt04
Definition: IsoMuonFeature.h:171
INavigable4Momentum
Definition: INavigable4Momentum.h:21
DEBUG
#define DEBUG
Definition: page_access.h:11
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
IsoMuonFeature::getMaxPtID
float getMaxPtID() const
Get Pt of max pt ID track in cone (muon excluded)
Definition: IsoMuonFeature.h:125
IsoMuonFeature::IsoMuonFeature
IsoMuonFeature()
Constructor.
Definition: IsoMuonFeature.cxx:29
IsoMuonFeature::getsumpt03
float getsumpt03() const
Definition: IsoMuonFeature.h:119
IsoMuonFeature::getsumet04
float getsumet04() const
Definition: IsoMuonFeature.h:114
operator==
bool operator==(const IsoMuonFeature &a, const IsoMuonFeature &b)
Operator comparing two IsoMuonFeature objects for equality.
Definition: IsoMuonFeature.cxx:217
IsoMuonFeature::m_PtMuID
float m_PtMuID
Pt of charged track associated to the muon.
Definition: IsoMuonFeature.h:174
IsoMuonFeature::getFlag
int getFlag() const
Definition: IsoMuonFeature.h:127
IsoMuonFeature::pt
double pt(void) const
transverse momentum
Definition: IsoMuonFeature.h:65
IsoMuonFeature::getQMu
float getQMu() const
Get Muon Q.
Definition: IsoMuonFeature.h:139