ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigT1
TrigT1CaloUtils
src
KeyUtilities.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
/***************************************************************************
5
KeyUtilities.cpp - description
6
-------------------
7
begin : Tue Sep 26 2000
8
email : e.moyse@qmw.ac.uk
9
***************************************************************************/
10
11
12
#ifndef TRIGGERSPACE
13
// running in Athena
14
#include "
TrigT1CaloUtils/KeyUtilities.h
"
15
16
#else
17
// running in TRIGGERSPACE
18
#include "
KeyUtilities.h
"
19
20
#endif
21
22
#include <cmath>
23
24
namespace
LVL1
{
25
29
//Del by KDevelop: KeyUtilities::KeyUtilities(double phi, double eta) {
30
//Del by KDevelop: m_phi=phi;
31
//Del by KDevelop: m_eta=eta;
32
//Del by KDevelop: convertCoordsToIntegers();
33
//Del by KDevelop: //std::cout << "m_ieta : "<<m_ieta<<std::endl;
34
//Del by KDevelop: }
35
37
KeyUtilities::KeyUtilities
() :
38
m_iphi
(0),
39
m_ieta
(0),
40
m_eta
(0.0),
41
m_phi
(0.0),
42
m_phiBin
(0),
43
m_etaBin
(0),
44
m_centralPhi
(0.0),
45
m_centralEta
(0.0),
46
m_debug
(false)
47
{
48
}
49
51
KeyUtilities::KeyUtilities
(
double
phi
,
double
eta
) :
52
m_iphi
(0),
53
m_ieta
(0),
54
m_eta
(
eta
),
55
m_phi
(
phi
),
56
m_phiBin
(0),
57
m_etaBin
(0),
58
m_centralPhi
(0.0),
59
m_centralEta
(0.0),
60
m_debug
(false)
61
{
62
}
63
64
KeyUtilities::~KeyUtilities
(){
65
}
66
68
//Del by KDevelop: unsigned int KeyUtilities::key() {
69
//Del by KDevelop: calculateTriggerBin();
70
//Del by KDevelop: unsigned int temp=(m_etaBin<<6) + m_phiBin;
71
//Del by KDevelop: //int temp=m_phiBin;
72
//Del by KDevelop: return temp;
73
//Del by KDevelop: }
74
77
unsigned
int
KeyUtilities::key
(
double
phi
,
double
eta
) {
78
m_eta
=
eta
;
79
m_phi
=
phi
;
80
ICoordinate
iCoord =
convertCoordsToIntegers
(
m_phi
,
m_eta
);
81
BinAndCoord
bandc =
calculateTriggerBin
(iCoord);
82
if
(
m_debug
) std::cout <<
"KU : key: got bandc "
<<std::endl;
83
m_phiBin
=bandc.
phiBin
();
84
m_etaBin
=bandc.
etaBin
();
85
m_centralPhi
=bandc.
coords
().
phi
();
86
m_centralEta
=bandc.
coords
().
eta
();
87
int
temp=((
m_etaBin
+50)<<6) +
m_phiBin
;
88
89
if
(
m_debug
) std::cout <<
"KU : key: returning - "
<<temp<<std::endl;
90
return
static_cast<
unsigned
int
>
(temp);
91
}
92
94
unsigned
int
KeyUtilities::key
(
const
Coordinate
&
coord
) {
95
return
key
(
coord
.phi(),
coord
.eta());
96
}
97
103
ICoordinate
KeyUtilities::convertCoordsToIntegers
(
double
phi
,
double
eta
){
104
105
double
phiBinWidth=((2*
M_PI
)/64.0);
106
// there are a maximum of 64 cells in the phi direction
107
// stretching from 0 to ~2*PI.
108
if
(
m_debug
) std::cout <<
"KU : (phi, eta) ("
<<
phi
<<
","
<<
eta
<<
")"
<<std::endl;
109
int
iphi=
sharpRound
(
phi
/phiBinWidth);
110
int
ieta=0;
111
112
// Now check that m_iphi is between 0 and 64.
113
iphi = iphi%64;
114
if
(iphi<0) iphi = 64+iphi;
115
116
// Make m_ieta symmetrical:
117
// o no cell at m_ieta=0
118
// o first cells at +-1
119
// o last cells at about +- 50
120
// this gives us a more useful numerical symmetry.
121
122
// So to get integer value we do:
123
int
temp_sign=
sign
(
eta
);
124
double
temp_abs=
eta
*temp_sign;
125
126
double
temp_double=(temp_abs*10.0+1.0)*temp_sign;
127
if
(
m_debug
) std::cout <<
"KU : temp_abs, temp_sign, temp_double : "
<<temp_abs<<
","
<<temp_sign<<
","
<<temp_double<<std::endl;
128
// if (m_eta>=0.0){
129
// temp_double=m_eta*10.0+1.0;
130
// }else{
131
// temp_double=m_eta*10.0-1.0;
132
// }
133
134
ieta=
static_cast<
int
>
(temp_double);
135
if
(
m_debug
) std::cout <<
"KU : (iphi, ieta) ("
<<iphi<<
","
<<ieta<<
")"
<<std::endl;
136
return
ICoordinate
(iphi, ieta,
eta
);
137
}
138
139
142
double
LVL1::KeyUtilities::eta
()
const
{
143
return
m_centralEta
;
144
}
145
146
147
148
151
double
LVL1::KeyUtilities::phi
()
const
{
152
return
m_centralPhi
;
153
}
154
156
int
LVL1::KeyUtilities::sign
(
int
temp)
const
{
157
return
((temp >= 0) ? 1 : -1);
158
}
159
161
int
LVL1::KeyUtilities::sign
(
double
temp)
const
{
162
return
((temp >= 0.0) ? 1 : -1);
163
}
164
165
void
LVL1::KeyUtilities::setupThisKeyValues
(){
166
ICoordinate
iCoord =
convertCoordsToIntegers
(
m_phi
,
m_eta
);
167
BinAndCoord
bandc =
calculateTriggerBin
(iCoord);
168
m_phiBin
=bandc.
phiBin
();
169
m_etaBin
=bandc.
etaBin
();
170
m_centralPhi
=bandc.
coords
().
phi
();
171
m_centralEta
=bandc.
coords
().
eta
();
172
}
173
175
int
LVL1::KeyUtilities::round
(
double
a
)
const
{
176
return
static_cast<
int
>
(
a
<0.0?ceil(
a
-0.5):
a
>0.0?floor(
a
+0.5):0.0);
177
}
178
180
int
LVL1::KeyUtilities::sharpRound
(
double
a
)
const
{
181
return
static_cast<
int
>
(
a
<0.0?(
a
-1.0):
a
>0.0?(
a
):0.0);
182
}
183
184
int
LVL1::KeyUtilities::sharpRound2
(
int
a
,
int
b)
const
{
185
int
temp=(abs(
a
)-1)/b+1;
186
return
temp*
sign
(
a
);
187
}
188
189
}
// end LVL1 namespace
190
191
192
194
LVL1::Coordinate
LVL1::KeyUtilities::coord
()
const
{
195
return
Coordinate
(
m_centralPhi
,
m_centralEta
);
196
}
M_PI
#define M_PI
Definition
ActiveFraction.h:14
KeyUtilities.h
a
static Double_t a
Definition
LArPhysWaveHECTool.cxx:38
sign
int sign(int a)
Definition
TRT_StrawNeighbourSvc.h:108
LVL1::BinAndCoord
Used to pass data between the methods of the Key Classes: Returns the Eta and Phi bins,...
Definition
BinAndCoord.h:35
LVL1::BinAndCoord::phiBin
int phiBin() const
Definition
BinAndCoord.h:44
LVL1::BinAndCoord::etaBin
int etaBin() const
Definition
BinAndCoord.h:45
LVL1::BinAndCoord::coords
const Coordinate & coords() const
Definition
BinAndCoord.h:46
LVL1::Coordinate
Coordinate class declaration.
Definition
TrigT1/TrigT1Interfaces/TrigT1Interfaces/Coordinate.h:45
LVL1::Coordinate::phi
double phi() const
return phi
Definition
Coordinate.cxx:45
LVL1::Coordinate::eta
double eta() const
return eta
Definition
Coordinate.cxx:40
LVL1::ICoordinate
Used by Key Classes, returns and integer coorginate for the bin Eta-Phi.
Definition
ICoordinate.h:26
LVL1::KeyUtilities::calculateTriggerBin
virtual BinAndCoord calculateTriggerBin(const ICoordinate &iCoord)=0
converts integer phi, eta coordinates to phi, eta trigger bins.
LVL1::KeyUtilities::eta
virtual double eta() const
returns the centre of the TT at eta_coord:
Definition
KeyUtilities.cxx:142
LVL1::KeyUtilities::sign
virtual int sign(int temp) const
returns -1 if temp is -ve and +1 if it is +ve.
Definition
KeyUtilities.cxx:156
LVL1::KeyUtilities::~KeyUtilities
virtual ~KeyUtilities()
Definition
KeyUtilities.cxx:64
LVL1::KeyUtilities::convertCoordsToIntegers
ICoordinate convertCoordsToIntegers(double phi, double eta)
converts the coordinates and corrects for overflows etc.
Definition
KeyUtilities.cxx:103
LVL1::KeyUtilities::m_phiBin
int m_phiBin
phi bin
Definition
KeyUtilities.h:104
LVL1::KeyUtilities::m_ieta
int m_ieta
integer eta coord
Definition
KeyUtilities.h:98
LVL1::KeyUtilities::sharpRound2
int sharpRound2(int a, int b) const
divides a/b and returns a number as follows (where +b means +ve b): if 0
Definition
KeyUtilities.cxx:184
LVL1::KeyUtilities::phi
virtual double phi() const
returns phi coordinate of centre of relevant trigger tower.
Definition
KeyUtilities.cxx:151
LVL1::KeyUtilities::m_etaBin
int m_etaBin
eta bin
Definition
KeyUtilities.h:106
LVL1::KeyUtilities::sharpRound
int sharpRound(double a) const
rounds number as follows (-1.0 to 0.0) -> -1, (0.0 to 1.0) -> 0, (1.0 to 2.0)->1 etc.
Definition
KeyUtilities.cxx:180
LVL1::KeyUtilities::m_iphi
int m_iphi
integer phi coord
Definition
KeyUtilities.h:96
LVL1::KeyUtilities::m_centralEta
double m_centralEta
this is the coordinate of the centre of the relevant trigger tower.
Definition
KeyUtilities.h:112
LVL1::KeyUtilities::round
int round(double a) const
rounds number to nearest whole number
Definition
KeyUtilities.cxx:175
LVL1::KeyUtilities::key
unsigned int key(double phi, double eta)
calculates a map key from passed phi, eta coordinates
Definition
KeyUtilities.cxx:77
LVL1::KeyUtilities::coord
Coordinate coord() const
return central coords of current key value.
Definition
KeyUtilities.cxx:194
LVL1::KeyUtilities::setupThisKeyValues
void setupThisKeyValues()
Definition
KeyUtilities.cxx:165
LVL1::KeyUtilities::m_centralPhi
double m_centralPhi
this is the coordinate of the centre of the relevant trigger tower.
Definition
KeyUtilities.h:109
LVL1::KeyUtilities::KeyUtilities
KeyUtilities()
the constructor is protected so a user can never make a KeyUtilities object
Definition
KeyUtilities.cxx:37
LVL1::KeyUtilities::m_debug
bool m_debug
turns DEBUG code on and off
Definition
KeyUtilities.h:114
LVL1::KeyUtilities::m_phi
double m_phi
phi coordinate of key
Definition
KeyUtilities.h:102
LVL1::KeyUtilities::m_eta
double m_eta
eta coordinate of key
Definition
KeyUtilities.h:100
LVL1
eFexTowerBuilder creates xAOD::eFexTowerContainer from supercells (LATOME) and triggerTowers (TREX) i...
Definition
IZdcDataAccess.h:13
Generated on
for ATLAS Offline Software by
1.17.0