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