ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
eflowRec
src
eflowRingSubtractionManager.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: eflowRingSubtractionManager.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 "
eflowRingSubtractionManager.h
"
17
#include "
eflowFirstIntParameters.h
"
18
#include "
eflowEEtaBinnedParameters.h
"
19
#include "
eflowRingThicknesses.h
"
20
21
#include <cmath>
22
#include <list>
23
24
eflowRingSubtractionManager::eflowRingSubtractionManager
() :
m_ringThickness
(
eflowCalo
::nRegions),
m_fudgeMean
(0),
m_fudgeStdDev
(-1) {}
25
26
double
eflowRingSubtractionManager::ringMeanRank
(
const
std::vector<double>& p,
double
rMin,
double
rMax) {
27
28
double
x1 = 0.0;
29
double
x2 = 0.0;
30
31
if
(0 != p[1] && 0 != p[3]){
32
x1 = std::exp(-rMin / p[1]) - std::exp(-rMax / p[1]);
33
x2 = std::exp(-rMin / p[3]) - std::exp(-rMax / p[3]);
34
}
35
36
return
(p[0] * p[1] * x1 + p[2] * p[3] * x2) / (rMax - rMin);
// hard coded 4-param model for now
37
}
38
39
std::vector<eflowCaloENUM>
eflowRingSubtractionManager::orderedLayersByShowerParam
(
40
const
eflowFirstIntParameters
& param,
unsigned
int
whichParam) {
41
/* Prepare a vector of calo layers which is ordered by the p0 parameter */
42
/* First prepare a list of all layers (which are not eflowCalo::Unknown i.e. 999) */
43
std::list<eflowCaloENUM> allLayers;
44
for
(
int
iLayer = 0; iLayer <
eflowCalo::nRegions
; iLayer++) {
45
if
(iLayer !=
eflowCalo::Unknown
) {
46
allLayers.push_back((
eflowCaloENUM
) (iLayer));
47
}
48
}
49
/* Loop over the list to find the layer with highest p0.
50
* Attach it to the end of the ordered vector and remove it from the list.
51
* Repeat until the list is empty */
52
std::vector<eflowCaloENUM> orderedLayers;
53
while
(!allLayers.empty()) {
54
std::list<eflowCaloENUM>::iterator itLayer = allLayers.begin();
55
std::list<eflowCaloENUM>::iterator itMaxP0Layer = itLayer;
56
double
p0Max = param.
getShapeParameter
(*itMaxP0Layer, whichParam);
57
/* Get current highest p0-layer */
58
for
(; itLayer != allLayers.end(); ++itLayer) {
59
double
p0 = param.
getShapeParameter
(*itLayer, whichParam);
60
if
(p0 > p0Max) {
61
itMaxP0Layer = itLayer;
62
p0Max = p0;
63
}
64
}
65
/* Attach to vector and remove from list */
66
orderedLayers.push_back(*itMaxP0Layer);
67
allLayers.erase(itMaxP0Layer);
68
}
69
return
orderedLayers;
70
}
71
72
void
eflowRingSubtractionManager::setParameters
(
const
eflowFirstIntParameters
& param,
const
std::vector<double>&
ringThickness
) {
73
/* Prepare a vector of calo layers which is ordered by the p0 parameter */
74
std::vector<eflowCaloENUM> orderedLayers =
orderedLayersByShowerParam
(param, 0);
75
76
/* Set e/p and ring thicknesses */
77
m_fudgeMean
= param.
fudgeMean
();
78
m_fudgeStdDev
= param.
fudgeStdDev
();
79
m_ringThickness
=
ringThickness
;
80
81
/* Populate the ring/rank map */
82
m_rankMap
.clear();
83
double
weight;
84
double
weightMax =
ringMeanRank
(param.
getShapeParameters
(orderedLayers[0]), 0.0,
ringThickness
[orderedLayers[0]])/
m_weightRange
;
85
for
(
const
auto
& layer : orderedLayers) {
86
/* Add weights to map (map does the ordering) */
87
const
int
nRings = (int)(
m_rMax
/
ringThickness
[layer]);
88
89
for
(
int
iRing = 0; iRing < nRings; iRing++) {
90
weight =
ringMeanRank
(param.
getShapeParameters
(layer), iRing*
ringThickness
[layer], (iRing+1)*
ringThickness
[layer]);
91
if
(weight == 0 || weight < weightMax) {
92
break
;
// only add weights within a factor (range) of weightMax (say 10^6)
93
}
else
{
94
m_rankMap
[1.0/weight] =
RingId
(layer, iRing);
95
}
96
}
97
}
98
}
99
100
bool
eflowRingSubtractionManager::getOrdering
(
const
eflowEEtaBinnedParameters
* binnedParameters,
double
e,
double
eta
,
eflowFirstIntENUM
j1st,
bool
useLegacyEnergyBinIndexing) {
101
const
eflowParameters
* bin1 =
nullptr
;
102
const
eflowParameters
*
bin2
=
nullptr
;
103
104
/* Get the left- and right-bin given (e,eta), return the weight of the two bins and fill the bins to &bin1 and &bin2 */
105
double
weight = binnedParameters->
getInterpolation
(&bin1, &
bin2
, e,
eta
, useLegacyEnergyBinIndexing);
106
if
(!(bin1 &&
bin2
)) {
return
false
; }
107
108
eflowFirstIntENUM
adjustedJ1st = binnedParameters->
adjustLFI
(e,
eta
, j1st, useLegacyEnergyBinIndexing);
109
110
/* Interpolate the firstInBins */
111
eflowFirstIntParameters
meanBin;
112
bool
isFailed = !(meanBin.
getWeightedParameters
(bin1->getFirstIntBin(adjustedJ1st),
bin2
->getFirstIntBin(adjustedJ1st), weight));
113
if
(isFailed) {
return
false
; }
114
115
/* Set the ring thicknesses */
116
std::vector<double> ringThicknesses(
eflowCalo::nRegions
);
117
for
(
int
i = 0; i <
eflowCalo::nRegions
; i++) {
118
//This was reviously interpolated - but the ring thickeness is a geometric property of the calorimeter without any energy dependence, so it was not needed.
119
ringThicknesses[i] =
eflowRingThicknesses::ringThickness
((
eflowCaloENUM
) i);
120
}
121
122
setParameters
(meanBin, ringThicknesses);
123
return
true
;
124
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
bin2
Definition
KillBinsByStrip.h:34
eflowCalo
This defines the eflowCalo enum, which is used to label calorimeter layers in a simplified scheme whi...
Definition
eflowCaloRegions.h:25
eflowCalo::Unknown
@ Unknown
Definition
eflowCaloRegions.h:34
eflowCalo::nRegions
static const int nRegions
Definition
eflowCaloRegions.h:37
eflowEEtaBinnedParameters
Inherits from eflowEEtaBinBase.
Definition
eflowEEtaBinnedParameters.h:56
eflowEEtaBinnedParameters::adjustLFI
eflowFirstIntENUM adjustLFI(double e, double eta, eflowFirstIntENUM j1st, bool useLegacyEnergyBinIndexing) const
Definition
eflowEEtaBinnedParameters.cxx:109
eflowEEtaBinnedParameters::getInterpolation
double getInterpolation(const eflowParameters **bin1, const eflowParameters **bin2, double e, double eta, bool useLegacyEnergyBinIndexing) const
Definition
eflowEEtaBinnedParameters.cxx:52
eflowFirstIntParameters
Extends eflowFirstInt to include parameters of the fits to radial shower profiles.
Definition
eflowFirstIntParameters.h:27
eflowFirstIntParameters::getShapeParameter
double getShapeParameter(eflowCaloENUM layer, int paramIndex) const
Definition
eflowFirstIntParameters.h:37
eflowFirstIntParameters::getWeightedParameters
bool getWeightedParameters(const eflowFirstIntParameters *bin1, const eflowFirstIntParameters *bin2, const double w1)
Definition
eflowFirstIntParameters.cxx:30
eflowFirstIntParameters::getShapeParameters
const std::vector< double > & getShapeParameters(eflowCaloENUM layer) const
Definition
eflowFirstIntParameters.h:36
eflowFirstInt::fudgeMean
double fudgeMean() const
Definition
eflowFirstInt.h:29
eflowFirstInt::fudgeStdDev
double fudgeStdDev() const
Definition
eflowFirstInt.h:30
eflowParameters
Definition
eflowEEtaBinnedParameters.h:30
eflowRingSubtractionManager::orderedLayersByShowerParam
static std::vector< eflowCaloENUM > orderedLayersByShowerParam(const eflowFirstIntParameters ¶m, unsigned int whichParam=0)
Definition
eflowRingSubtractionManager.cxx:39
eflowRingSubtractionManager::m_fudgeMean
double m_fudgeMean
Definition
eflowRingSubtractionManager.h:61
eflowRingSubtractionManager::m_weightRange
static constexpr double m_weightRange
Definition
eflowRingSubtractionManager.h:65
eflowRingSubtractionManager::ringMeanRank
static double ringMeanRank(const std::vector< double > &p, double rMin, double rMax)
Definition
eflowRingSubtractionManager.cxx:26
eflowRingSubtractionManager::getOrdering
bool getOrdering(const eflowEEtaBinnedParameters *binnedParameters, double e, double eta, eflowFirstIntENUM j1st, bool useLegacyEnergyBinIndexing)
Definition
eflowRingSubtractionManager.cxx:100
eflowRingSubtractionManager::m_ringThickness
std::vector< double > m_ringThickness
Definition
eflowRingSubtractionManager.h:60
eflowRingSubtractionManager::ringThickness
double ringThickness(eflowCaloENUM layer) const
Definition
eflowRingSubtractionManager.h:47
eflowRingSubtractionManager::m_rankMap
std::map< double, RingId > m_rankMap
Definition
eflowRingSubtractionManager.h:59
eflowRingSubtractionManager::m_fudgeStdDev
double m_fudgeStdDev
Definition
eflowRingSubtractionManager.h:62
eflowRingSubtractionManager::setParameters
void setParameters(const eflowFirstIntParameters ¶m, const std::vector< double > &ringThickness)
Definition
eflowRingSubtractionManager.cxx:72
eflowRingSubtractionManager::m_rMax
static constexpr double m_rMax
Definition
eflowRingSubtractionManager.h:64
eflowRingSubtractionManager::eflowRingSubtractionManager
eflowRingSubtractionManager()
Definition
eflowRingSubtractionManager.cxx:24
eflowRingThicknesses::ringThickness
static double ringThickness(const eflowCaloENUM &layer)
Definition
eflowRingThicknesses.cxx:5
eflowCaloENUM
eflowCalo::LAYER eflowCaloENUM
Definition
eflowCaloRegions.h:49
eflowFirstIntENUM
eflowFirstIntRegions::J1STLAYER eflowFirstIntENUM
Definition
eflowCaloRegions.h:79
eflowEEtaBinnedParameters.h
eflowFirstIntParameters.h
eflowRingSubtractionManager.h
RingId
std::pair< eflowCaloENUM, short > RingId
Definition
eflowRingSubtractionManager.h:26
eflowRingThicknesses.h
Generated on
for ATLAS Offline Software by
1.17.0