ATLAS Offline Software
Loading...
Searching...
No Matches
TrigCaloCluster.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6/*******************************************************
7
8NAME: TrigCaloCluster.cxx
9PACKAGE: Trigger/TrigEvent/TrigCaloEvent
10AUTHORS: Denis O. Damazio, Carlos Osuna, Xin Wu
11
12PURPOSE: Keep the important output variables
13 from the Calorimeter LVL2 Trigger.
14 Optionally seed ID Trigger and EF.
15 Variables here should be RAW variables
16 not corrected.
17KNOWTOINHERIT: TrigEmCluster, TrigTauCluster,
18 TrigJetCluster
19DATE: October 17th, 2005
20
21******************************************************/
22
24#include <cmath>
25
26// Constructor
28 float phi, long roi_word) :
29 m_rawEnergy ( energy ), m_rawEt ( 0. ),
30 m_rawEta ( eta ), m_rawPhi ( phi ),
31 m_roiWord ( roi_word ), m_numberUsedCells ( 0 ),
32 m_quality ( 0 )
33{
34 for ( int i = 0 ; i < MAXSIZE ; i++ )
36}
37
38// Destructor
41
42// Copy constructor
44 m_rawEnergy ( tcc->rawEnergy() ), m_rawEt ( tcc->rawEt() ),
45 m_rawEta ( tcc->rawEta() ) , m_rawPhi ( tcc->rawPhi() ),
46 m_roiWord ( tcc->RoIword() ),
47 m_numberUsedCells ( tcc->nCells() ) ,
48 m_quality ( tcc->quality() )
49{
50 for ( int i = 0 ; i < MAXSIZE ; i++ )
53}
54
55// Simple debug method
56void
57TrigCaloCluster::print ( void ) const {
58
59 std::cout << "m_rawEnergy : " << m_rawEnergy << "; ";
60 std::cout << "m_rawEt : " << m_rawEt << "; ";
61 std::cout << "m_rawEta : " << m_rawEta << "; ";
62 std::cout << "m_rawPhi : " << m_rawPhi << "; ";
63 std::cout << std::hex;
64 std::cout << "m_roiWord : 0x" << m_roiWord << "; ";
65 std::cout << std::dec;
66 std::cout << "m_numberUsedCells : " << m_numberUsedCells << "; ";
67 std::cout << "m_quality : " << m_quality << "; ";
68 std::cout << "m_rawEnergyS : ";
69 for ( int i = 0 ; i < MAXSIZE ; i++ )
70 std::cout << rawEnergy((CaloSampling::CaloSample)i) << "; ";
71 std::cout << std::endl;
72}
73
74// Simple debug method using MsgStream
75void
76TrigCaloCluster::print ( MsgStream& log ) const {
77
78 log <<MSG::DEBUG<<"m_rawEnergy : " << m_rawEnergy << "; ";
79 log <<MSG::DEBUG<<"m_rawEt : " << m_rawEt << "; ";
80 log <<MSG::DEBUG<<"m_rawEta : " << m_rawEta << "; ";
81 log <<MSG::DEBUG<<"m_rawPhi : " << m_rawPhi << "; ";
82 log << MSG::hex;
83 log <<MSG::DEBUG<<"m_roiWord : " << m_roiWord << "; ";
84 log << MSG::dec;
85 log <<MSG::DEBUG<<"m_numberUsedCells : " << m_numberUsedCells << "; ";
86 log <<MSG::DEBUG<<"m_quality : " << m_quality << "; ";
87 log <<MSG::DEBUG<<"m_rawEnergyS : ";
88 for ( int i = 0 ; i < MAXSIZE ; i++ )
89 log <<MSG::DEBUG<< rawEnergy((CaloSampling::CaloSample)i) << "; ";
90 log << endmsg;
91}
92
93// stream output
94std::string str( const TrigCaloCluster& d ) {
95 std::stringstream log;
96 log <<"m_rawEnergy : " << d.rawEnergy() << "; ";
97 log <<"m_rawEt : " << d.rawEt() << "; ";
98 log <<"m_rawEta : " << d.rawEta() << "; ";
99 log <<"m_rawPhi : " << d.rawPhi() << "; ";
100 log << std::hex;
101 log <<"m_roiWord : " << d.RoIword() << "; ";
102 log << std::dec;
103 log <<"m_numberUsedCells : " << d.nCells() << "; ";
104 log <<"m_quality : " << d.quality() << "; ";
105 log <<"m_rawEnergyS : ";
106 for ( int i = 0 ; i < MAXSIZE ; i++ )
107 log << d.rawEnergy((CaloSampling::CaloSample)i) << "; ";
108 return log.str();
109}
110
111MsgStream& operator<< ( MsgStream& m, const TrigCaloCluster& d ) {
112 m << str(d);
113 return m;
114}
115
116// comparison
118 double ep=0.001; // arbitrary , but seems to be reasonable
119 if ( std::fabs( a.RoIword() - b.RoIword() )>ep ) return false;
120 if ( std::fabs( a.rawEta() - b.rawEta() )>ep ) return false;
121 if ( std::fabs( a.rawPhi() - b.rawPhi() )>ep ) return false;
122 if ( std::fabs( a.rawEt() - b.rawEt() )>ep ) return false;
123 if ( std::fabs( a.quality() - b.quality() )>ep ) return false;
124 return true;
125}
126
127void diff( const TrigCaloCluster& a, const TrigCaloCluster& b,
128 std::map< std::string, double >& varChange ) {
129
130 double ep=0.001; // arbitrary , but seems to be reasonable
131 if ( std::fabs( a.RoIword() - b.RoIword() )>ep ) {
132 varChange[ "RoIword" ] =a.RoIword() - b.RoIword();
133 }
134 if ( std::fabs( a.rawEta() - b.rawEta() )>ep ) {
135 varChange[ "rawEta" ] =a.rawEta() - b.rawEta();
136 }
137 if ( std::fabs( a.rawPhi() - b.rawPhi() )>ep ) {
138 varChange[ "rawPhi" ] =a.rawPhi() - b.rawPhi();
139 }
140 if ( std::fabs( a.rawEt() - b.rawEt() )>ep ) {
141 varChange[ "rawEt" ] =a.rawEt() - b.rawEt();
142 }
143 if ( std::fabs( a.quality() - b.quality() )>ep ) {
144 varChange[ "quality" ] =a.quality() - b.quality();
145 }
146
147 return;
148}
149// End of TrigCaloCluster
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define endmsg
static Double_t a
bool operator==(const TrigCaloCluster &a, const TrigCaloCluster &b)
MsgStream & operator<<(MsgStream &m, const TrigCaloCluster &d)
void diff(const TrigCaloCluster &a, const TrigCaloCluster &b, std::map< std::string, double > &varChange)
TrigCaloCluster(float energy=0.0, float eta=-10.0, float phi=-10.0, long roi_word=0)
Constructor, please note the default values.
unsigned int m_quality
quality of cluster built (to be defined)
void print(void) const
Prints out cluster variables to std::cout.
void setRawEnergy(float energy)
set Raw Energy (no calibration)
unsigned int quality() const
get quality of cluster built (to be defined)
float rawEnergy() const
get Raw Energy (no calibration)
~TrigCaloCluster()
Destructor.
int nCells() const
get number of cells used from RoI