ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
eflowRec
src
eflowEEtaBinnedParameters.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: eflowEEtaBinnedParameters.h
8
PACKAGE: offline/Reconstruction/eflowRec
9
10
AUTHORS: M.Hodgkinson, R Duxfield (based on R.Duxfields Root package)
11
CREATED: 18th Aug, 2005
12
13
********************************************************************/
14
15
//Athena Headers
16
#include "
eflowEEtaBinnedParameters.h
"
17
#include "
eflowFirstIntParameters.h
"
18
#include "
eflowRingSubtractionManager.h
"
19
20
#include "GaudiKernel/SystemOfUnits.h"
21
22
//C++ Headers
23
#include <float.h>
24
#include <cmath>
25
#include <stdexcept>
26
27
using namespace
std
;
29
// eflowEEtaBinnedParameters //
31
32
33
void
eflowEEtaBinnedParameters::initialise
(
const
std::vector<double>& eBinBounds,
const
std::vector<double>& etaBinBounds,
bool
useAbsEta) {
34
m_useAbsEta
= useAbsEta;
35
m_eBinBounds
= eBinBounds;
36
m_etaBinBounds
= etaBinBounds;
37
38
/* Create all the bins */
39
int
nEBins =
getNumEBins
();
40
int
nEtaBins =
getNumEtaBins
()-1;
41
m_bins
.reserve(nEBins);
42
for
(
int
iEBin = 0; iEBin < nEBins; iEBin++) {
43
std::vector<std::unique_ptr<eflowParameters> > tempVector;
44
tempVector.reserve(nEtaBins);
45
for
(
int
iEtaBin = 0; iEtaBin < nEtaBins; iEtaBin++) {
46
tempVector.push_back(std::make_unique<eflowParameters>());
47
}
48
m_bins
.push_back(std::move(tempVector));
49
}
50
}
51
52
double
eflowEEtaBinnedParameters::getInterpolation
(
const
eflowParameters
** bin1,
53
const
eflowParameters
**
bin2
,
54
double
e,
double
eta
,
bool
useLegacyEnergyBinIndexing)
const
{
55
double
weight;
56
int
eBin = 0;
57
if
(useLegacyEnergyBinIndexing) {
58
eBin =
getEBinIndexLegacy
(e);
59
}
else
{
60
eBin =
getEBinIndex
(e);
61
}
62
int
etaBin =
getEtaBinIndex
(
eta
);
63
64
/* Check for invalid bins */
65
if
(eBin < 0 || etaBin < 0) {
66
*bin1 =
nullptr
;
67
*
bin2
=
nullptr
;
68
weight = -1.0;
69
return
weight;
70
}
71
72
if
((0 == eBin && e <=
m_eBinBounds
[eBin]) ||
73
(eBin ==
getNumEBins
() - 1 && e >=
m_eBinBounds
[
getNumEBins
() - 1])) {
74
/* If e is below the lowest (above the highest) pinpoint, just return the lowest (highest) bin; no interpolation in this case. */
75
*bin1 =
m_bins
[eBin][etaBin].get();
76
*
bin2
=
m_bins
[eBin][etaBin].get();
77
weight = 1.0;
78
}
else
{
79
/* The "normal" case: interpolate between two energies */
80
int
lowEBin = eBin;
81
int
highEBin = eBin;
82
83
if
(e >=
m_eBinBounds
[eBin]) {
84
highEBin = eBin + 1;
85
}
else
{
86
lowEBin = eBin - 1;
87
}
88
auto
outOfRange = [
this
](
int
bin
)->
bool
{
89
return
(
bin
<0) or (
bin
>=std::ssize(
m_bins
));
90
};
91
92
if
(outOfRange(lowEBin) or outOfRange(highEBin)){
93
throw
std::out_of_range(
"Attempt to access element out of range in eflowEEtaBinnedParameters::getInterpolation"
);
94
}
95
*bin1 =
m_bins
[lowEBin][etaBin].get();
96
*
bin2
=
m_bins
[highEBin][etaBin].get();
97
98
double
higherEBound =
m_eBinBounds
[highEBin];
99
double
lowerEBound =
m_eBinBounds
[lowEBin];
100
//deals with e = 0 bin to avoid dividing by zero
101
if
(lowerEBound < FLT_MIN) lowerEBound = FLT_MIN;
102
103
weight = std::log(higherEBound / e) / std::log(higherEBound / lowerEBound);
104
}
105
return
weight;
106
}
107
108
eflowFirstIntENUM
109
eflowEEtaBinnedParameters::adjustLFI
(
double
e,
double
eta
,
110
eflowFirstIntENUM
j1st,
bool
useLegacyEnergyBinIndexing)
const
{
111
112
113
int
eBinIndex = 0;
114
if
(useLegacyEnergyBinIndexing) {
115
eBinIndex =
getEBinIndexLegacy
(e);
116
}
else
{
117
eBinIndex =
getEBinIndex
(e);
118
}
119
120
//hard code this check - needs to be rechecked if ever remake e/p tables
121
//if e.g track extrapolation slightly off can have inconsistent j1st and eta (e.g eta = 1.52, j1st = EMB2) and hence fudgeMean is zero
122
if
(0 <= eBinIndex && eBinIndex <= 5) {
123
if
(std::fabs(
eta
) < 1.5) {
124
if
(
eflowFirstIntRegions::EME1
== j1st) j1st =
eflowFirstIntRegions::EMB1
;
125
if
(
eflowFirstIntRegions::EME2
== j1st) j1st =
eflowFirstIntRegions::EMB2
;
126
if
(
eflowFirstIntRegions::EME3
== j1st) j1st =
eflowFirstIntRegions::EMB3
;
127
if
(
eflowFirstIntRegions::HEC
== j1st) j1st =
eflowFirstIntRegions::Tile
;
128
}
129
if
(std::fabs(
eta
) >= 1.6) {
130
if
(
eflowFirstIntRegions::EMB1
== j1st) j1st =
eflowFirstIntRegions::EME1
;
131
if
(
eflowFirstIntRegions::EMB2
== j1st) j1st =
eflowFirstIntRegions::EME2
;
132
if
(
eflowFirstIntRegions::EMB3
== j1st) j1st =
eflowFirstIntRegions::EME3
;
133
if
(
eflowFirstIntRegions::Tile
== j1st) j1st =
eflowFirstIntRegions::HEC
;
134
}
135
136
}
137
138
if
(0 == eBinIndex || 1 == eBinIndex) {
139
if
(std::fabs(
eta
) >= 1.0 && std::fabs(
eta
) < 1.1) {
140
if
(
eflowFirstIntRegions::Tile
== j1st) j1st =
eflowFirstIntRegions::EMB3
;
141
}
142
else
if
(std::fabs(
eta
) >= 1.2 && std::fabs(
eta
) < 1.3) {
143
if
(
eflowFirstIntRegions::Tile
== j1st) j1st =
eflowFirstIntRegions::EMB3
;
144
}
145
else
if
(std::fabs(
eta
) >= 1.5 && std::fabs(
eta
) < 1.6) {
146
if
(
eflowFirstIntRegions::EMB3
== j1st) j1st =
eflowFirstIntRegions::EME3
;
147
}
148
149
}
else
if
(2 == eBinIndex) {
150
if
(std::fabs(
eta
) >= 1.5 && std::fabs(
eta
) < 1.6) {
151
if
(
eflowFirstIntRegions::EMB2
== j1st) j1st =
eflowFirstIntRegions::EME2
;
152
}
153
154
}
else
if
(3 == eBinIndex) {
155
if
(std::fabs(
eta
) >= 1.5 && fabs(
eta
) < 1.6) {
156
if
(
eflowFirstIntRegions::EMB2
== j1st) j1st =
eflowFirstIntRegions::EME2
;
157
if
(
eflowFirstIntRegions::EMB1
== j1st) j1st =
eflowFirstIntRegions::EME1
;
158
}
159
160
}
else
if
(4 == eBinIndex || 5 == eBinIndex) {
161
if
(std::fabs(
eta
) >= 1.5 && std::fabs(
eta
) < 1.6) {
162
if
(
eflowFirstIntRegions::EMB1
== j1st) j1st =
eflowFirstIntRegions::EME1
;
163
}
164
}
165
166
return
j1st;
167
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
bin2
Definition
KillBinsByStrip.h:34
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::getEtaBinIndex
int getEtaBinIndex(double eta) const
Definition
eflowEEtaBinBase.cxx:52
eflowEEtaBinBase::getEBinIndex
int getEBinIndex(double e) const
Definition
eflowEEtaBinBase.cxx:28
eflowEEtaBinBase::m_etaBinBounds
std::vector< double > m_etaBinBounds
Definition
eflowEEtaBinBase.h:50
eflowEEtaBinBase::getNumEtaBins
int getNumEtaBins() const
Definition
eflowEEtaBinBase.h:39
eflowEEtaBinBase::getNumEBins
int getNumEBins() const
Definition
eflowEEtaBinBase.h:38
eflowEEtaBinBase::m_eBinBounds
std::vector< double > m_eBinBounds
Definition
eflowEEtaBinBase.h:49
eflowEEtaBinnedParameters::adjustLFI
eflowFirstIntENUM adjustLFI(double e, double eta, eflowFirstIntENUM j1st, bool useLegacyEnergyBinIndexing) const
Definition
eflowEEtaBinnedParameters.cxx:109
eflowEEtaBinnedParameters::m_bins
std::vector< std::vector< std::unique_ptr< eflowParameters > > > m_bins
Definition
eflowEEtaBinnedParameters.h:90
eflowEEtaBinnedParameters::initialise
void initialise(const std::vector< double > &eBinBounds, const std::vector< double > &etaBinBounds, bool useAbsEta=true)
Definition
eflowEEtaBinnedParameters.cxx:33
eflowEEtaBinnedParameters::getInterpolation
double getInterpolation(const eflowParameters **bin1, const eflowParameters **bin2, double e, double eta, bool useLegacyEnergyBinIndexing) const
Definition
eflowEEtaBinnedParameters.cxx:52
eflowFirstIntRegions::HEC
@ HEC
Definition
eflowCaloRegions.h:61
eflowFirstIntRegions::EMB2
@ EMB2
Definition
eflowCaloRegions.h:59
eflowFirstIntRegions::EME1
@ EME1
Definition
eflowCaloRegions.h:60
eflowFirstIntRegions::Tile
@ Tile
Definition
eflowCaloRegions.h:62
eflowFirstIntRegions::EMB3
@ EMB3
Definition
eflowCaloRegions.h:59
eflowFirstIntRegions::EMB1
@ EMB1
Definition
eflowCaloRegions.h:59
eflowFirstIntRegions::EME2
@ EME2
Definition
eflowCaloRegions.h:60
eflowFirstIntRegions::EME3
@ EME3
Definition
eflowCaloRegions.h:60
eflowParameters
Definition
eflowEEtaBinnedParameters.h:30
eflowFirstIntENUM
eflowFirstIntRegions::J1STLAYER eflowFirstIntENUM
Definition
eflowCaloRegions.h:79
eflowEEtaBinnedParameters.h
eflowFirstIntParameters.h
eflowRingSubtractionManager.h
std
STL namespace.
Generated on
for ATLAS Offline Software by
1.17.0