ATLAS Offline Software
TrigT2Jet.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
7 #include "GaudiKernel/MsgStream.h"
8 
10  m_e(), m_ehad0(), m_eem0(), m_eta(), m_phi(), m_grid(0), m_roiWord(), m_nLeadingCells(), m_hecf(), m_jetQuality(), m_emf(), m_jetTimeCells()
11 {}
12 
14  delete m_grid;
15 }
16 
17 bool operator== ( const TrigT2Jet& a, const TrigT2Jet& b ) {
18 
19  const double DELTA=1e-3; // distance used to compare floats
20 
21  if ( std::abs(a.e() - b.e()) > DELTA) return false;
22  if ( std::abs(a.ehad0() - b.ehad0()) > DELTA) return false;
23  if ( std::abs(a.eem0() - b.eem0()) > DELTA) return false;
24  if ( std::abs(a.eta() - b.eta()) > DELTA) return false;
25  if ( std::abs(a.phi() - b.phi()) > DELTA) return false;
26  if( a.RoIword() != b.RoIword() ) return false;
27  // Cleaning:
28  if( a.nLeadingCells() != b.nLeadingCells() ) return false;
29  if( std::abs(a.hecf() - b.hecf()) > DELTA ) return false;
30  if( std::abs(a.jetQuality() - b.jetQuality()) > DELTA ) return false;
31  if( std::abs(a.emf() - b.emf()) > DELTA ) return false;
32  if( std::abs(a.jetTimeCells() - b.jetTimeCells()) > DELTA ) return false;
33 
34 
35  return true;
36 }
37 
38 std::string str (const TrigT2Jet& a){
39 
40  std::string s="";
41  char buff[1024];
42 
43  std::sprintf(buff,"L2 Jet E = %10.2f MeV\n", a.e()); s += buff;
44  std::sprintf(buff,"L2 Jet EHad0 = %10.2f MeV\n", a.ehad0()); s += buff;
45  std::sprintf(buff,"L2 Jet EEM0 = %10.2f MeV\n", a.eem0()); s += buff;
46  std::sprintf(buff,"L2 Jet Eta = %10.2f \n", a.eta()); s += buff;
47  std::sprintf(buff,"L2 Jet Phi = %10.2f \n", a.phi()); s += buff;
48 
49  if(a.grid()) {
50  std::sprintf(buff,"Grid Members = %4d\n", (int)a.grid()->size()); s += buff;
51  }
52 
53  return s;
54 
55 }
56 
57 
58 MsgStream& operator<< (MsgStream& m, const TrigT2Jet& d) {
59  return ( m << str( d ) );
60 }
61 
62 void diff(const TrigT2Jet& a, const TrigT2Jet& b,
63  std::map<std::string, double>& variableChange){
64  const double DELTA=1e-3; // distance used to compare floats
65 
66  unsigned long aRoI = (unsigned long) a.RoIword();
67  unsigned long bRoI = (unsigned long) b.RoIword();
68  if( aRoI != bRoI )
69  variableChange[ "RoIwordsXOR" ] = aRoI ^ bRoI;
70 
71  float aE = a.e();
72  float bE = b.e();
73  if( fabsf(aE - bE) > DELTA )
74  variableChange[ "E" ] = aE - bE;
75 
76  float aEHad0 = a.ehad0();
77  float bEHad0 = b.ehad0();
78  if( fabsf(aEHad0 - bEHad0) > DELTA )
79  variableChange[ "EHad0" ] = aEHad0 - bEHad0;
80 
81  float aEEM0 = a.eem0();
82  float bEEM0 = b.eem0();
83  if( fabsf(aEEM0 - bEEM0) > DELTA )
84  variableChange[ "EEM0" ] = aEEM0 - bEEM0;
85 
86  float aEta = a.eta();
87  float bEta = b.eta();
88  if( fabsf(aEta - bEta) > DELTA )
89  variableChange[ "Eta" ] = aEta - bEta;
90 
91  float aPhi = a.phi();
92  float bPhi = b.phi();
93  if( fabsf(aPhi - bPhi) > DELTA )
94  variableChange[ "Phi" ] = aPhi - bPhi;
95 
96  // Cleaning:
97  int diffLeadingCells = a.nLeadingCells() - b.nLeadingCells();
98  if( diffLeadingCells != 0){
99  variableChange[ "nLeadCells" ] = diffLeadingCells;
100  }
101 
102  float diffhecf = a.hecf() - b.hecf();
103  if( fabsf(diffhecf) > DELTA){
104  variableChange[ "hecf" ] = diffhecf;
105  }
106 
107  float diffjetQuality = a.jetQuality() - b.jetQuality();
108  if( fabsf(diffjetQuality) > DELTA){
109  variableChange[ "jetQual" ] = diffjetQuality;
110  }
111 
112  float diffemf = a.emf() - b.emf();
113  if( fabsf(diffemf) > DELTA){
114  variableChange[ "emf" ] = diffemf;
115  }
116 
117  float diffjetTime = a.jetTimeCells() - b.jetTimeCells();
118  if( fabsf(diffjetTime) > DELTA ){
119  variableChange[ "jetTime" ] = diffjetTime;
120  }
121 
122 
123  return;
124 }
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
get_hdefs.buff
buff
Definition: get_hdefs.py:61
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
TrigT2Jet
LVL2 Trigger Jet Class.
Definition: TrigT2Jet.h:32
hist_file_dump.d
d
Definition: hist_file_dump.py:137
diff
void diff(const TrigT2Jet &a, const TrigT2Jet &b, std::map< std::string, double > &variableChange)
Comparison with feedback.
Definition: TrigT2Jet.cxx:62
TrigT2Jet::~TrigT2Jet
~TrigT2Jet()
Destructor.
Definition: TrigT2Jet.cxx:13
TrigT2Jet::m_grid
std::vector< Trig3Momentum > * m_grid
Jet coneRadius.
Definition: TrigT2Jet.h:121
Trig3Momentum.h
operator==
bool operator==(const TrigT2Jet &a, const TrigT2Jet &b)
Operator comparing two objects for equality.
Definition: TrigT2Jet.cxx:17
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
str
std::string str(const TrigT2Jet &a)
conversion to formatted string: multi-line!
Definition: TrigT2Jet.cxx:38
TrigT2Jet::TrigT2Jet
TrigT2Jet()
Constructor.
Definition: TrigT2Jet.cxx:9
a
TList * a
Definition: liststreamerinfos.cxx:10
operator<<
MsgStream & operator<<(MsgStream &m, const TrigT2Jet &d)
formatted output
Definition: TrigT2Jet.cxx:58
TrigT2Jet.h