ATLAS Offline Software
TrigMuonEF.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 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 
32  P4IPtCotThPhiM( 0., 0., 0., 0. ),
33  m_muonCode(0){
34 }
35 
36 TrigMuonEF::TrigMuonEF(double theIPt, double theCotTh, double thePhi, double theM) :
37  P4IPtCotThPhiM(theIPt , theCotTh, thePhi ,theM ),
38  m_muonCode(0){
39 }
40 
42 void TrigMuonEF::set_muonCode(int theMuonCode){
43  m_muonCode = theMuonCode;
44 }
45 
47 void TrigMuonEF::set_RoINum(const std::string& theRoINum){
48  m_roi = theRoINum;
49 }
50 
52 void TrigMuonEF::set_Charge(double theCharge){
53  m_charge = theCharge;
54 }
55 
58 
59 //
60 // I use the standard eta-phi-pt parameters in the printouts and comparisons,
61 // because iPt and CotTh don't tell me much on first sight. Besides, iPt values
62 // are usually too small for a meaningful direct comparison.
63 //
64 
65 std::string str( const TrigMuonEF& d ) {
66 
67  std::stringstream stream;
68  stream << "MuonCode: " << d.MuonCode()
69  << "; RoINum: " << d.RoINum()
70  << "; eta: " << d.eta()
71  << "; phi: " << d.phi()
72  << "; pt: " << d.pt()
73  << "; charge: " << d.charge();
74 
75  return stream.str();
76 }
77 
78 MsgStream& operator<< ( MsgStream& m, const TrigMuonEF& d ) {
79 
80  return ( m << str( d ) );
81 
82 }
83 
84 bool operator== ( const TrigMuonEF& a, const TrigMuonEF& b ) {
85 
86  if( a.MuonCode() != b.MuonCode() )
87  return false;
88  if( std::abs( a.charge() - b.charge() ) > DELTA )
89  return false;
90  if( std::abs( a.pt() - b.pt() ) > DELTA )
91  return false;
92  if( std::abs( a.eta() - b.eta() ) > DELTA )
93  return false;
94  if( std::abs( a.phi() - b.phi() ) > DELTA )
95  return false;
96  if( std::abs( a.m() - b.m() ) > DELTA )
97  return false;
98 
99  return true;
100 }
101 
102 void diff( const TrigMuonEF& a, const TrigMuonEF& b,
103  std::map< std::string, double >& variableChange ) {
104 
105  if( a.MuonCode() != b.MuonCode() ) {
106  variableChange[ "MuonCode" ] = static_cast< double >( a.MuonCode() - b.MuonCode() );
107  }
108  if( std::abs( a.charge() - b.charge() ) > DELTA ) {
109  variableChange[ "Charge" ] = a.charge() - b.charge();
110  }
111  if( std::abs( a.pt() - b.pt() ) > DELTA ) {
112  variableChange[ "Pt" ] = a.pt() - b.pt();
113  }
114  if( std::abs( a.eta() - b.eta() ) > DELTA ) {
115  variableChange[ "Eta" ] = a.eta() - b.eta();
116  }
117  if( std::abs( a.phi() - b.phi() ) > DELTA ) {
118  variableChange[ "Phi" ] = a.phi() - b.phi();
119  }
120  if( std::abs( a.m() - b.m() ) > DELTA ) {
121  variableChange[ "Mass" ] = a.m() - b.m();
122  }
123 
124  return;
125 
126 }
TrigMuonEF::~TrigMuonEF
~TrigMuonEF()
Destructor.
Definition: TrigMuonEF.cxx:57
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:84
operator<<
MsgStream & operator<<(MsgStream &m, const TrigMuonEF &d)
Helper operator for printing the object.
Definition: TrigMuonEF.cxx:78
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:47
TrigMuonEF
Definition: TrigMuonEF.h:26
TrigMuonEF::set_muonCode
void set_muonCode(int theMuonCode)
Set MuonCode.
Definition: TrigMuonEF.cxx:42
str
std::string str(const TrigMuonEF &d)
Helper function for printing the object.
Definition: TrigMuonEF.cxx:65
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:102
a
TList * a
Definition: liststreamerinfos.cxx:10
TrigMuonEF::set_Charge
void set_Charge(double theCharge)
Set Charge.
Definition: TrigMuonEF.cxx:52
TrigMuonEF::TrigMuonEF
TrigMuonEF()
Default constructor.
Definition: TrigMuonEF.cxx:31