ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloSwClcon_v2.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
36
37
38
#include "
CaloSwClcon_v2.h
"
39
#include "
CaloClusterCorrection/interpolate.h
"
40
#include <cmath>
41
42
43
using
xAOD::CaloCluster
;
44
using
CaloClusterCorr::interpolate
;
45
46
67
void
CaloSwClcon_v2::makeTheCorrection
(
const
Context& myctx,
68
CaloCluster
* cluster,
69
const
CaloDetDescrElement
*
/*elt*/
,
70
float
eta
,
71
float
adj_eta,
72
float
/*phi*/
,
73
float
/*adj_phi*/
,
74
CaloSampling::CaloSample
/*samp*/
)
75
const
76
{
77
// ??? In principle, we should use adj_eta for the interpolation
78
// and range checks. However, the v2 corrections were derived
79
// using regular eta instead.
80
float
the_aeta;
81
if
(
m_use_raw_eta
(myctx))
82
the_aeta = std::abs (adj_eta);
83
else
84
the_aeta = std::abs (
eta
);
85
86
if
(the_aeta >=
m_etamax
(myctx))
87
return
;
88
89
const
CxxUtils::Array<2>
correction =
m_correction
(myctx);
90
const
CxxUtils::Array<1>
energies =
m_energies
(myctx);
91
92
// Calculate the correction for each energy.
93
unsigned
int
n_energies = energies.
size
();
94
unsigned
int
shape[] = {n_energies, 2};
95
CaloRec::WritableArrayData<2>
offstab (shape);
96
if
(n_energies == 0) {
97
ATH_MSG_ERROR
(
"Empty energies vector"
);
98
return
;
99
}
100
101
for
(
unsigned
int
i=0; i<n_energies; i++) {
102
offstab[i][0] = energies[i];
103
offstab[i][1] = interpolate (correction,
104
the_aeta,
105
m_degree
(myctx),
106
i+1);
107
}
108
109
// Find the median correction.
110
float
energy = cluster->
e
() * offstab[n_energies/2][1];
111
112
// Now interpolate in energy.
113
float
corr;
114
if
(energy <= offstab[0][0])
115
corr = offstab[0][1];
116
else
if
(energy >= offstab[n_energies-1][0])
117
corr = offstab[n_energies-1][1];
118
else
119
corr = interpolate (offstab, energy,
m_energy_degree
(myctx));
120
121
// Do the correction
122
setenergy
(cluster, corr * cluster->
e
());
123
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
CaloSwClcon_v2.h
EM calorimeter containment correction.
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition
CaloClusterCorrection.cxx:93
CaloCluster
Principal data class for CaloCell clusters.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloCluster::e
virtual double e() const
Retrieve energy independent of signal state.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:753
CaloDetDescrElement
This class groups all DetDescr information related to a CaloCell.
Definition
Calorimeter/CaloDetDescr/CaloDetDescr/CaloDetDescrElement.h:66
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
CaloSwClcon_v2::m_degree
Constant< int > m_degree
Calibration constant: degree of the polynomial interpolation.
Definition
CaloSwClcon_v2.h:113
CaloSwClcon_v2::makeTheCorrection
virtual void makeTheCorrection(const Context &myctx, xAOD::CaloCluster *cluster, const CaloDetDescrElement *elt, float eta, float adj_eta, float phi, float adj_phi, CaloSampling::CaloSample samp) const override
Virtual function for the correction-specific code.
Definition
CaloSwClcon_v2.cxx:67
CaloSwClcon_v2::m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Definition
CaloSwClcon_v2.h:117
CaloSwClcon_v2::m_energies
Constant< CxxUtils::Array< 1 > > m_energies
Calibration constant: table of energies at which the correction was tabulated.
Definition
CaloSwClcon_v2.h:122
CaloSwClcon_v2::m_use_raw_eta
Constant< bool > m_use_raw_eta
Calibration constant: If true, tabulated values are in terms of raw (local) eta.
Definition
CaloSwClcon_v2.h:131
CaloSwClcon_v2::m_energy_degree
Constant< int > m_energy_degree
Calibration constant: degree of the polynomial interpolation in energy.
Definition
CaloSwClcon_v2.h:126
CaloSwClcon_v2::m_etamax
Constant< float > m_etamax
Calibration constant: maximum eta for which this correction is defined.
Definition
CaloSwClcon_v2.h:109
CxxUtils::Array
Read-only multidimensional array.
Definition
Control/CxxUtils/CxxUtils/Array.h:135
CxxUtils::Array::size
unsigned int size(unsigned int dim=0) const
Return the size of the array along one dimension.
CxxUtils::WritableArrayData
Definition
Control/CxxUtils/CxxUtils/Array.h:775
interpolate.h
Polynomial interpolation in a table.
CaloClusterCorr::interpolate
float interpolate(const CaloRec::Array< 2 > &a, float x, unsigned int degree, unsigned int ycol=1, const CaloRec::Array< 1 > ®ions=CaloRec::Array< 1 >(), int n_points=-1, bool fixZero=false)
Polynomial interpolation in a table.
Definition
interpolate.cxx:74
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
Generated on
for ATLAS Offline Software by
1.17.0