ATLAS Offline Software
TrigMuonEF.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 Name : TrigMuonEF.cxx
7 Package : offline/Trigger/TrigEvent/TrigMuonEvent
8 Author : Gabriella Cataldi
9 Created : November 2006
10 Note : Simple Trigger AOD for EF Muon (TrigMoore)
11 
12 DESCRIPTION:
13 
14 Nov.2006: A simple AOD containing just track parameters and status for re-running
15  hypothesis with FEX off.
16 *****************************************************************************/
17 
18 // STL include(s):
19 #include <sstream>
20 #include <cmath>
21 
22 // Gaudi/Athena include(s):
23 #include "GaudiKernel/MsgStream.h"
24 
25 // Local include(s):
27 
28 // "Distance" used by the comparison operator(s):
29 static const double DELTA = 0.001;
30 
31 
32 TrigMuonEF::TrigMuonEF(double theIPt, double theCotTh, double thePhi, double theM) :
33  P4IPtCotThPhiM(theIPt , theCotTh, thePhi ,theM ) {
34 }
35 
37 void TrigMuonEF::set_muonCode(int theMuonCode){
38  m_muonCode = theMuonCode;
39 }
40 
42 void TrigMuonEF::set_RoINum(const std::string& theRoINum){
43  m_roi = theRoINum;
44 }
45 
47 void TrigMuonEF::set_Charge(double theCharge){
48  m_charge = theCharge;
49 }
50 
53 
54 //
55 // I use the standard eta-phi-pt parameters in the printouts and comparisons,
56 // because iPt and CotTh don't tell me much on first sight. Besides, iPt values
57 // are usually too small for a meaningful direct comparison.
58 //
59 
60 std::string str( const TrigMuonEF& d ) {
61 
62  std::stringstream stream;
63  stream << "MuonCode: " << d.MuonCode()
64  << "; RoINum: " << d.RoINum()
65  << "; eta: " << d.eta()
66  << "; phi: " << d.phi()
67  << "; pt: " << d.pt()
68  << "; charge: " << d.charge();
69 
70  return stream.str();
71 }
72 
73 MsgStream& operator<< ( MsgStream& m, const TrigMuonEF& d ) {
74 
75  return ( m << str( d ) );
76 
77 }
78 
79 bool operator== ( const TrigMuonEF& a, const TrigMuonEF& b ) {
80 
81  if( a.MuonCode() != b.MuonCode() )
82  return false;
83  if( std::abs( a.charge() - b.charge() ) > DELTA )
84  return false;
85  if( std::abs( a.pt() - b.pt() ) > DELTA )
86  return false;
87  if( std::abs( a.eta() - b.eta() ) > DELTA )
88  return false;
89  if( std::abs( a.phi() - b.phi() ) > DELTA )
90  return false;
91  if( std::abs( a.m() - b.m() ) > DELTA )
92  return false;
93 
94  return true;
95 }
96 
97 void diff( const TrigMuonEF& a, const TrigMuonEF& b,
98  std::map< std::string, double >& variableChange ) {
99 
100  if( a.MuonCode() != b.MuonCode() ) {
101  variableChange[ "MuonCode" ] = static_cast< double >( a.MuonCode() - b.MuonCode() );
102  }
103  if( std::abs( a.charge() - b.charge() ) > DELTA ) {
104  variableChange[ "Charge" ] = a.charge() - b.charge();
105  }
106  if( std::abs( a.pt() - b.pt() ) > DELTA ) {
107  variableChange[ "Pt" ] = a.pt() - b.pt();
108  }
109  if( std::abs( a.eta() - b.eta() ) > DELTA ) {
110  variableChange[ "Eta" ] = a.eta() - b.eta();
111  }
112  if( std::abs( a.phi() - b.phi() ) > DELTA ) {
113  variableChange[ "Phi" ] = a.phi() - b.phi();
114  }
115  if( std::abs( a.m() - b.m() ) > DELTA ) {
116  variableChange[ "Mass" ] = a.m() - b.m();
117  }
118 
119  return;
120 
121 }
TrigMuonEF::~TrigMuonEF
virtual ~TrigMuonEF()
Destructor.
Definition: TrigMuonEF.cxx:52
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
hist_file_dump.d
d
Definition: hist_file_dump.py:137
P4IPtCotThPhiM
Definition: P4IPtCotThPhiM.h:27
operator==
bool operator==(const TrigMuonEF &a, const TrigMuonEF &b)
Operator comparing two TrigMuonEF objects for equality.
Definition: TrigMuonEF.cxx:79
TrigMuonEF::TrigMuonEF
TrigMuonEF()=default
Default constructor.
operator<<
MsgStream & operator<<(MsgStream &m, const TrigMuonEF &d)
Helper operator for printing the object.
Definition: TrigMuonEF.cxx:73
TrigMuonEF::m_muonCode
int m_muonCode
what kind of track we are dealing with (Moore, StandAlone, Combined)
Definition: TrigMuonEF.h:68
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
TrigMuonEF.h
TrigMuonEF::set_RoINum
void set_RoINum(const std::string &theRoINum)
Set RoINum.
Definition: TrigMuonEF.cxx:42
TrigMuonEF
Definition: TrigMuonEF.h:26
TrigMuonEF::set_muonCode
void set_muonCode(int theMuonCode)
Set MuonCode.
Definition: TrigMuonEF.cxx:37
str
std::string str(const TrigMuonEF &d)
Helper function for printing the object.
Definition: TrigMuonEF.cxx:60
TrigMuonEF::m_charge
double m_charge
Definition: TrigMuonEF.h:70
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
TrigMuonEF::m_roi
std::string m_roi
Definition: TrigMuonEF.h:69
diff
void diff(const TrigMuonEF &a, const TrigMuonEF &b, std::map< std::string, double > &variableChange)
Comparison with feedback.
Definition: TrigMuonEF.cxx:97
a
TList * a
Definition: liststreamerinfos.cxx:10
TrigMuonEF::set_Charge
void set_Charge(double theCharge)
Set Charge.
Definition: TrigMuonEF.cxx:47