ATLAS Offline Software
TrigMuonEFCbTrack.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 /*****************************************************************************
6 Name : TrigMuonEFCbTrack.cxx
7 Package : offline/Trigger/TrigEvent/TrigMuonEvent
8 Author : Sergio Grancagnolo
9 Created : November 2008
10 Note : Simple Trigger AOD for EF Muon (TrigMuonEF)
11 
12 DESCRIPTION:
13 
14 Nov.2008: A TrigMuonEFTrack overloading that contains the match chi2.
15 *****************************************************************************/
16 
17 // STL include(s):
18 #include <sstream>
19 #include <cmath>
20 
21 // Gaudi/Athena include(s):
22 #include "GaudiKernel/MsgStream.h"
24 #include "Particle/TrackParticle.h"
25 
26 // Local include(s):
28 
29 // "Distance" used by the comparison operator(s):
30 static const double DELTA = 0.001;
31 
33  TrigMuonEFTrack( 0., 0., 0., 0. ),
34  m_matchChi2(-999.),
35  m_nIdSctHits (0),
36  m_nIdPixelHits(0),
37  m_nTrtHits(0),
38  m_idTrackLink()
39 {
40 }
41 
42 TrigMuonEFCbTrack::TrigMuonEFCbTrack(double theIPt, double theCotTh, double thePhi, double theM) :
43  TrigMuonEFTrack(theIPt, theCotTh, thePhi ,theM ),
44  m_matchChi2(-999.),
45  m_nIdSctHits (0),
46  m_nIdPixelHits(0),
47  m_nTrtHits(0),
48  m_idTrackLink()
49 {
50 }
51 
53  I4Momentum(rhs),
54  P4IPtCotThPhiMBase( rhs ),
55  INavigable(rhs),
58  TrigMuonEFTrack(rhs),
59  m_matchChi2( rhs.m_matchChi2 ),
60  m_nIdSctHits (rhs.m_nIdSctHits),
61  m_nIdPixelHits(rhs.m_nIdPixelHits),
62  m_nTrtHits(rhs.m_nTrtHits),
63  m_idTrackLink(rhs.m_idTrackLink)
64 { }
65 
67  I4Momentum(rhs),
68  P4IPtCotThPhiMBase( rhs ),
69  INavigable(rhs),
72  TrigMuonEFTrack(rhs),
73  m_matchChi2(-999.),
74  m_nIdSctHits (0),
75  m_nIdPixelHits(0),
76  m_nTrtHits(0),
77  m_idTrackLink()
78  { }
79 
81 void TrigMuonEFCbTrack::setMatchChi2(double theMatchChi2){
82  m_matchChi2 = theMatchChi2;
83 }
84 
87 
92  if(!m_idTrackLink.isValid()) return 0; //possible since old data has no link
93  return *(m_idTrackLink);
94 }
95 
103 void TrigMuonEFCbTrack::setIDTrack(const Rec::TrackParticleContainer* cont, unsigned int itrk) {
104  m_idTrackLink.toIndexedElement(*cont, itrk);
105 }
106 
113  m_idTrackLink = link;
114 }
115 
117 // helper operators
118 
123 std::string str( const TrigMuonEFCbTrack& d ) {
124  std::stringstream ss;
125  ss << str( ( TrigMuonEFTrack& ) d )
126  << "; chi2 match: " << d.matchChi2();
127 
128  return ss.str();
129 }
130 
131 MsgStream& operator<< ( MsgStream& m, const TrigMuonEFCbTrack& d ) {
132 
133  return ( m << str( d ) );
134 }
135 
141 
142  if( ( TrigMuonEFTrack& ) a != ( TrigMuonEFTrack& ) b )
143  return false;
144  if( std::abs( a.matchChi2() - b.matchChi2() ) > DELTA )
145  return false;
146 
147  return true;
148 }
149 
160  std::map< std::string, double >& variableChange ) {
161 
162  // Call the function operating on the base class:
163  diff( ( TrigMuonEFTrack& ) a, ( TrigMuonEFTrack& ) b, variableChange );
164 
165  if( std::abs( a.matchChi2() - b.matchChi2() ) > DELTA ) {
166  variableChange[ "MatchChi2" ] = a.matchChi2() - b.matchChi2();
167  }
168 
169  return;
170 }
P4IPtCotThPhiMBase
Definition: P4IPtCotThPhiMBase.h:28
I4Momentum
Definition: I4Momentum.h:31
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TrigMuonEFCbTrack::getIDTrackParticle
const Rec::TrackParticle * getIDTrackParticle() const
Get associated ID track.
Definition: TrigMuonEFCbTrack.cxx:91
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
TrackParticle.h
TrigMuonEFTrack
Definition: TrigMuonEFTrack.h:27
hist_file_dump.d
d
Definition: hist_file_dump.py:137
str
std::string str(const TrigMuonEFCbTrack &d)
This function uses the function str(TrigMuonEFTrack&) to print the "base class part" of the object.
Definition: TrigMuonEFCbTrack.cxx:123
TrigMuonEFCbTrack.h
TrigMuonEFCbTrack::TrigMuonEFCbTrack
TrigMuonEFCbTrack()
Default constructor.
Definition: TrigMuonEFCbTrack.cxx:32
TrigMuonEFCbTrack::setIDTrackElementLink
void setIDTrackElementLink(const ElementLink< Rec::TrackParticleContainer > &link)
Set associated ID track.
Definition: TrigMuonEFCbTrack.cxx:112
TrigMuonEFCbTrack::m_matchChi2
double m_matchChi2
Definition: TrigMuonEFCbTrack.h:91
INavigable
Definition: INavigable.h:18
diff
void diff(const TrigMuonEFCbTrack &a, const TrigMuonEFCbTrack &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: TrigMuonEFCbTrack.cxx:159
IAthenaBarCode
Definition: AthenaKernel/AthenaKernel/IAthenaBarCode.h:48
TrigMuonEFCbTrack::~TrigMuonEFCbTrack
~TrigMuonEFCbTrack()
Destructor.
Definition: TrigMuonEFCbTrack.cxx:86
TrigMuonEFCbTrack
Definition: TrigMuonEFCbTrack.h:28
TrigMuonEFCbTrack::setMatchChi2
void setMatchChi2(double theMatchChi2)
set data member
Definition: TrigMuonEFCbTrack.cxx:81
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
Rec::TrackParticleContainer
Definition: Reconstruction/Particle/Particle/TrackParticleContainer.h:33
TrigMuonEFCbTrack::setIDTrack
void setIDTrack(const Rec::TrackParticleContainer *cont, unsigned int itrk)
Set associated ID track.
Definition: TrigMuonEFCbTrack.cxx:103
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
a
TList * a
Definition: liststreamerinfos.cxx:10
INavigable4Momentum
Definition: INavigable4Momentum.h:21
operator<<
MsgStream & operator<<(MsgStream &m, const TrigMuonEFCbTrack &d)
Helper operator for printing the object.
Definition: TrigMuonEFCbTrack.cxx:131
operator==
bool operator==(const TrigMuonEFCbTrack &a, const TrigMuonEFCbTrack &b)
This operator uses the operator operator==(TrigMuonEFTrack&,TrigMuonEFTrack&) to compare the "base cl...
Definition: TrigMuonEFCbTrack.cxx:140
TrigMuonEFCbTrack::m_idTrackLink
ElementLink< Rec::TrackParticleContainer > m_idTrackLink
Link to the associated ID track.
Definition: TrigMuonEFCbTrack.h:97
TrackParticleContainer.h