ATLAS Offline Software
IsoMuonFeature.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 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 
32 
33 //Assignment operator
36  if (this != &mfeature) {
37  m_sumet01 = mfeature.getsumet01();
38  m_sumet02 = mfeature.getsumet02();
39  m_sumet03 = mfeature.getsumet03();
40  m_sumet04 = mfeature.getsumet04();
41  m_sumpt01 = mfeature.getsumpt01();
42  m_sumpt02 = mfeature.getsumpt02();
43  m_sumpt03 = mfeature.getsumpt03();
44  m_sumpt04 = mfeature.getsumpt04();
45  m_PtMuID = mfeature.getPtMuID();
46  m_MaxPtID = mfeature.getMaxPtID();
47  m_flag = mfeature.getFlag();
48  m_RoiIdMu = mfeature.getRoiIdMu();
49  m_PtMu = mfeature.pt();
50  m_QMu = mfeature.getQMu();
51  m_EtaMu = mfeature.getEtaMu();
52  m_PhiMu = mfeature.getPhiMu();
53  }
54  return *this;
55 }
56 
58 
59  if (m_NTracksCone>0) return m_NTracksCone/100000;
60  else {
61  int a = static_cast<int>(m_flag/10000);
62  return a;
63  }
64 }
65 
67  int a = static_cast<int>(m_flag/10000);
68  int b = static_cast<int>(m_flag-a*10000);
69  return b;
70 }
71 
72 // Copy constructor (Note that also the base class is copied)
74  I4Momentum( *feat ),
75  INavigable( *feat ),
76  INavigable4Momentum( *feat ),
77  P4PtEtaPhiMBase ( *feat ),
79  m_sumet01 ( feat->getsumet01() ),
80  m_sumet02 ( feat->getsumet02() ),
81  m_sumet03 ( feat->getsumet03() ),
82  m_sumet04 ( feat->getsumet04() ),
83  m_sumpt01 ( feat->getsumpt01() ),
84  m_sumpt02 ( feat->getsumpt02() ),
85  m_sumpt03 ( feat->getsumpt03() ),
86  m_sumpt04 ( feat->getsumpt04() ),
87  m_PtMuID ( feat->getPtMuID() ),
88  m_MaxPtID ( feat->getMaxPtID() ),
89  m_flag ( feat->getFlag() ),
90  m_RoiIdMu ( feat->getRoiIdMu() ),
91  m_PtMu ( feat->pt() ),
92  m_QMu ( feat->getQMu() ),
93  m_EtaMu ( feat->getEtaMu() ),
94  m_PhiMu ( feat->getPhiMu() ) {}
95 
97  I4Momentum( feat ),
98  INavigable( feat ),
99  IAthenaBarCode( feat ),
100  INavigable4Momentum( feat ),
101  P4PtEtaPhiMBase ( feat ),
103  m_sumet01 ( feat.getsumet01() ),
104  m_sumet02 ( feat.getsumet02() ),
105  m_sumet03 ( feat.getsumet03() ),
106  m_sumet04 ( feat.getsumet04() ),
107  m_sumpt01 ( feat.getsumpt01() ),
108  m_sumpt02 ( feat.getsumpt02() ),
109  m_sumpt03 ( feat.getsumpt03() ),
110  m_sumpt04 ( feat.getsumpt04() ),
111  m_PtMuID ( feat.getPtMuID() ),
112  m_MaxPtID ( feat.getMaxPtID() ),
113  m_flag ( feat.getFlag() ),
114  m_RoiIdMu ( feat.getRoiIdMu() ),
115  m_PtMu ( feat.pt() ),
116  m_QMu ( feat.getQMu() ),
117  m_EtaMu ( feat.getEtaMu() ),
118  m_PhiMu ( feat.getPhiMu() ) {}
119 
121  std::cout << std::endl;
122  std::cout << "m_sumet01: " << m_sumet01 << std::endl;
123  std::cout << "m_sumet02: " << m_sumet02 << std::endl;
124  std::cout << "m_sumet03: " << m_sumet03 << std::endl;
125  std::cout << "m_sumet04: " << m_sumet04 << std::endl;
126  std::cout << "m_sumpt01: " << m_sumpt01 << std::endl;
127  std::cout << "m_sumpt02: " << m_sumpt02 << std::endl;
128  std::cout << "m_sumpt03: " << m_sumpt03 << std::endl;
129  std::cout << "m_sumpt04: " << m_sumpt04 << std::endl;
130  std::cout << "m_PtMuID: " << m_PtMuID << std::endl;
131  std::cout << "m_MaxPtID: " << m_MaxPtID << std::endl;
132  std::cout << "m_flag: " << m_flag << std::endl;
133  std::cout << "m_RoiIdMu: " << m_RoiIdMu << std::endl;
134  std::cout << "m_PtMu: " << m_PtMu << std::endl;
135  std::cout << "m_QMu: " << m_QMu << std::endl;
136  std::cout << "m_EtaMu: " << m_EtaMu << std::endl;
137  std::cout << "m_PhiMu: " << m_PhiMu << std::endl;
138  std::cout << std::endl;
139 }
140 
141 void IsoMuonFeature::print ( MsgStream& log ) {
142  log << MSG::DEBUG << "m_sumet01: " << m_sumet01 << "; ";
143  log << MSG::DEBUG << "m_sumet02: " << m_sumet02 << "; ";
144  log << MSG::DEBUG << "m_sumet03: " << m_sumet03 << "; ";
145  log << MSG::DEBUG << "m_sumet04: " << m_sumet04 << "; ";
146  log << MSG::DEBUG << "m_sumpt01: " << m_sumpt01 << "; ";
147  log << MSG::DEBUG << "m_sumpt02: " << m_sumpt02 << "; ";
148  log << MSG::DEBUG << "m_sumpt03: " << m_sumpt03 << "; ";
149  log << MSG::DEBUG << "m_sumpt04: " << m_sumpt04 << "; ";
150  log << MSG::DEBUG << "m_PtMuID: " << m_PtMuID << "; ";
151  log << MSG::DEBUG << "m_MaxPtID: " << m_MaxPtID << "; ";
152  log << MSG::DEBUG << "m_flag: " << m_flag << "; ";
153  log << MSG::DEBUG << "m_RoiIdMu: " << m_RoiIdMu << "; ";
154  log << MSG::DEBUG << "m_PtMu: " << m_PtMu << "; ";
155  log << MSG::DEBUG << "m_QMu: " << m_QMu << "; ";
156  log << MSG::DEBUG << "m_EtaMu: " << m_EtaMu << "; ";
157  log << MSG::DEBUG << "m_PhiMu: " << m_PhiMu << "; ";
158  log << endmsg;
159 }
160 
162 // helper operators
163 
164 std::string str( const IsoMuonFeature& d ) {
165  std::stringstream ss;
166  ss << "sumet01: " << d.getsumet01()
167  << "; sumet02: " << d.getsumet02()
168  << "; sumet03: " << d.getsumet03()
169  << "; sumet04: " << d.getsumet04()
170  << "; sumpt01: " << d.getsumpt01()
171  << "; sumpt02: " << d.getsumpt02()
172  << "; sumpt03: " << d.getsumpt03()
173  << "; sumpt04: " << d.getsumpt04()
174  << "; PtMuID: " << d.getPtMuID()
175  << "; MaxPtID: " << d.getMaxPtID()
176  << "; flag: " << d.getFlag()
177  << "; RoiIdMu: " << d.getRoiIdMu()
178  << "; RoiIdMu: " << d.getRoiIdMu()
179  << "; PtMu: " << d.pt()
180  << "; QMu: " << d.getQMu()
181  << "; EtaMu: " << d.getEtaMu()
182  << "; PhiMu: " << d.getPhiMu();
183 
184  return ss.str();
185 }
186 
187 MsgStream& operator<< ( MsgStream& m, const IsoMuonFeature& d ) {
188 
189  return ( m << str( d ) );
190 }
191 
192 bool operator== ( const IsoMuonFeature& a, const IsoMuonFeature& b ) {
193 
194  if( std::abs( a.getsumet01() - b.getsumet01() ) > DELTA )
195  return false;
196  if( std::abs( a.getsumet02() - b.getsumet02() ) > DELTA )
197  return false;
198  if( std::abs( a.getsumet03() - b.getsumet03() ) > DELTA )
199  return false;
200  if( std::abs( a.getsumet04() - b.getsumet04() ) > DELTA )
201  return false;
202  if( std::abs( a.getsumpt01() - b.getsumpt01() ) > DELTA )
203  return false;
204  if( std::abs( a.getsumpt02() - b.getsumpt02() ) > DELTA )
205  return false;
206  if( std::abs( a.getsumpt03() - b.getsumpt03() ) > DELTA )
207  return false;
208  if( std::abs( a.getsumpt04() - b.getsumpt04() ) > DELTA )
209  return false;
210  if( std::abs( a.getPtMuID() - b.getPtMuID() ) > DELTA )
211  return false;
212  if( std::abs( a.getMaxPtID() - b.getMaxPtID() ) > DELTA )
213  return false;
214  if( a.getFlag() != b.getFlag() )
215  return false;
216  if( a.getRoiIdMu() != b.getRoiIdMu() )
217  return false;
218  if( std::abs( a.pt() - b.pt() ) > DELTA )
219  return false;
220  if( std::abs( a.getQMu() - b.getQMu() ) > DELTA )
221  return false;
222  if( std::abs( a.getEtaMu() - b.getEtaMu() ) > DELTA )
223  return false;
224  if( std::abs( a.getPhiMu() - b.getPhiMu() ) > DELTA )
225  return false;
226 
227  return true;
228 }
229 
239 void diff( const IsoMuonFeature& a, const IsoMuonFeature& b,
240  std::map< std::string, double >& variableChange ) {
241 
242  if( std::abs( a.getsumet01() - b.getsumet01() ) > DELTA ) {
243  variableChange[ "sumet01" ] = a.getsumet01() - b.getsumet01();
244  }
245  if( std::abs( a.getsumet02() - b.getsumet02() ) > DELTA ) {
246  variableChange[ "sumet02" ] = a.getsumet02() - b.getsumet02();
247  }
248  if( std::abs( a.getsumet03() - b.getsumet03() ) > DELTA ) {
249  variableChange[ "sumet03" ] = a.getsumet03() - b.getsumet03();
250  }
251  if( std::abs( a.getsumet04() - b.getsumet04() ) > DELTA ) {
252  variableChange[ "sumet04" ] = a.getsumet04() - b.getsumet04();
253  }
254  if( std::abs( a.getsumpt01() - b.getsumpt01() ) > DELTA ) {
255  variableChange[ "sumpt01" ] = a.getsumpt01() - b.getsumpt01();
256  }
257  if( std::abs( a.getsumet02() - b.getsumet02() ) > DELTA ) {
258  variableChange[ "sumet02" ] = a.getsumet02() - b.getsumpt02();
259  }
260  if( std::abs( a.getsumpt03() - b.getsumpt03() ) > DELTA ) {
261  variableChange[ "sumpt03" ] = a.getsumpt03() - b.getsumpt03();
262  }
263  if( std::abs( a.getsumpt04() - b.getsumpt04() ) > DELTA ) {
264  variableChange[ "sumpt04" ] = a.getsumpt04() - b.getsumpt04();
265  }
266  if( a.getFlag() != b.getFlag() ) {
267  variableChange[ "flag" ] = static_cast< double >( a.getFlag() -
268  b.getFlag() );
269  }
270  if( a.getRoiIdMu() != b.getRoiIdMu() ) {
271  variableChange[ "RoiIdMu" ] = static_cast< double >( a.getRoiIdMu() -
272  b.getRoiIdMu() );
273  }
274  if( std::abs( a.pt() - b.pt() ) > DELTA ) {
275  variableChange[ "PtMu" ] = a.pt() - b.pt();
276  }
277  if( std::abs( a.getQMu() - b.getQMu() ) > DELTA ) {
278  variableChange[ "QMu" ] = a.getQMu() - b.getQMu();
279  }
280  if( std::abs( a.getEtaMu() - b.getEtaMu() ) > DELTA ) {
281  variableChange[ "EtaMu" ] = a.getEtaMu() - b.getEtaMu();
282  }
283  if( std::abs( a.getPhiMu() - b.getPhiMu() ) > DELTA ) {
284  variableChange[ "PhiMu" ] = a.getPhiMu() - b.getPhiMu();
285  }
286 
287  return;
288 }
289 
290 // 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:57
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:31
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:187
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:239
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:120
IsoMuonFeature::operator=
IsoMuonFeature & operator=(const IsoMuonFeature &mfeature)
Assignement operator.
Definition: IsoMuonFeature.cxx:35
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:66
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:164
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:192
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