ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
eflowRec
src
eflowEEtaBinBase.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
/********************************************************************
6
7
NAME: eflowEEtaBinBase.cxx
8
PACKAGE: offline/Reconstruction/eflowRec
9
10
AUTHOR: R Duxfield
11
CREATED: 17th May, 2006
12
13
********************************************************************/
14
15
#include <cmath>
16
#include "
eflowEEtaBinBase.h
"
17
18
20
// eflowBaseEEtaBinSystem //
22
23
const
double
eflowEEtaBinBase::m_errorReturnValue
= -999.0;
24
25
eflowEEtaBinBase::~eflowEEtaBinBase
() =
default
;
26
27
28
int
eflowEEtaBinBase::getEBinIndex
(
double
e)
const
{
29
int
nEBins =
getNumEBins
();
30
for
(
int
i = 0; i < (nEBins-1); i++) {
31
if
(e >
m_eBinBounds
[i] && e <
m_eBinBounds
[i + 1])
return
i;
32
}
33
//for the final bin we simply check if the track energy is greater than the lower bound
34
if
( !
m_eBinBounds
.empty() && e >
m_eBinBounds
.back() )
return
nEBins-1;
35
return
0;
36
}
37
38
int
eflowEEtaBinBase::getEBinIndexLegacy
(
double
e)
const
{
39
40
int
nEBins =
getNumEBins
();
41
int
bin
= 0;
42
for
(
int
i = nEBins - 1; i > 0; i--) {
43
if
(e > std::sqrt(
m_eBinBounds
[i - 1] *
m_eBinBounds
[i])) {
44
bin
= i;
45
break
;
46
}
47
}
48
return
bin
;
49
50
}
51
52
int
eflowEEtaBinBase::getEtaBinIndex
(
double
eta
)
const
{
53
if
(
m_useAbsEta
)
eta
= std::fabs(
eta
);
54
55
/* If eta is outside bin range, return highest/lowest bin to avoid binning failures
56
* (in practice we always use absEta, so it can only be too high) */
57
if
(
eta
>
m_etaBinBounds
.back()) {
58
return
m_etaBinBounds
.size()-2;
// Yes, it's minus *two* --> we need to return the index of the *low* edge of the bin
59
}
60
if
(
eta
<
m_etaBinBounds
[0]){
61
return
0;
62
}
63
64
return
getBinIndex
(
eta
,
m_etaBinBounds
);
65
}
66
67
int
eflowEEtaBinBase::getBinIndex
(
double
x
,
const
std::vector<double>& binBounds) {
68
int
nBins = binBounds.size() - 1;
69
int
bin
= -1;
70
for
(
int
i = 0; i < nBins; i++) {
71
if
(
x
>= binBounds[i] &&
x
< binBounds[i+1]) {
72
bin
= i;
73
break
;
74
}
75
}
76
return
bin
;
77
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
x
#define x
bin
Definition
BinsDiffFromStripMedian.h:43
eflowEEtaBinBase::getEBinIndexLegacy
int getEBinIndexLegacy(double e) const
Definition
eflowEEtaBinBase.cxx:38
eflowEEtaBinBase::m_useAbsEta
bool m_useAbsEta
Definition
eflowEEtaBinBase.h:48
eflowEEtaBinBase::~eflowEEtaBinBase
virtual ~eflowEEtaBinBase()
eflowEEtaBinBase::getEtaBinIndex
int getEtaBinIndex(double eta) const
Definition
eflowEEtaBinBase.cxx:52
eflowEEtaBinBase::m_errorReturnValue
static const double m_errorReturnValue
Definition
eflowEEtaBinBase.h:46
eflowEEtaBinBase::getEBinIndex
int getEBinIndex(double e) const
Definition
eflowEEtaBinBase.cxx:28
eflowEEtaBinBase::m_etaBinBounds
std::vector< double > m_etaBinBounds
Definition
eflowEEtaBinBase.h:50
eflowEEtaBinBase::getNumEBins
int getNumEBins() const
Definition
eflowEEtaBinBase.h:38
eflowEEtaBinBase::getBinIndex
static int getBinIndex(double x, const std::vector< double > &binBounds)
Definition
eflowEEtaBinBase.cxx:67
eflowEEtaBinBase::m_eBinBounds
std::vector< double > m_eBinBounds
Definition
eflowEEtaBinBase.h:49
eflowEEtaBinBase.h
Generated on
for ATLAS Offline Software by
1.17.0