ATLAS Offline Software
Functions
TrigT2Jet.cxx File Reference
#include "TrigCaloEvent/TrigT2Jet.h"
#include "TrigCaloEvent/Trig3Momentum.h"
Include dependency graph for TrigT2Jet.cxx:

Go to the source code of this file.

Functions

bool operator== (const TrigT2Jet &a, const TrigT2Jet &b)
 Operator comparing two objects for equality. More...
 
std::string str (const TrigT2Jet &a)
 conversion to formatted string: multi-line! More...
 
MsgStream & operator<< (MsgStream &m, const TrigT2Jet &d)
 formatted output More...
 
void diff (const TrigT2Jet &a, const TrigT2Jet &b, std::map< std::string, double > &variableChange)
 Comparison with feedback. More...
 

Function Documentation

◆ diff()

void diff ( const TrigT2Jet a,
const TrigT2Jet b,
std::map< std::string, double > &  variableChange 
)

Comparison with feedback.

Definition at line 61 of file TrigT2Jet.cxx.

62  {
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 }

◆ operator<<()

MsgStream& operator<< ( MsgStream &  m,
const TrigT2Jet d 
)

formatted output

Definition at line 57 of file TrigT2Jet.cxx.

57  {
58  return ( m << str( d ) );
59 }

◆ operator==()

bool operator== ( const TrigT2Jet a,
const TrigT2Jet b 
)

Operator comparing two objects for equality.

Definition at line 16 of file TrigT2Jet.cxx.

16  {
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 }

◆ str()

std::string str ( const TrigT2Jet a)

conversion to formatted string: multi-line!

Definition at line 37 of file TrigT2Jet.cxx.

37  {
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 }
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
hist_file_dump.d
d
Definition: hist_file_dump.py:137
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
str
std::string str(const TrigT2Jet &a)
conversion to formatted string: multi-line!
Definition: TrigT2Jet.cxx:37
a
TList * a
Definition: liststreamerinfos.cxx:10