ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloSwLongWeights.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
NAME: CaloSwLongWeights.cxx
8
PACKAGE: offline/Calorimter/CaloSwLongWeights
9
10
AUTHORS: K.Loureiro, S.Paganis
11
CREATED: July 5, 2004
12
13
PURPOSE: Optimization correction for the weights in the
14
different layers of the EM calorimeter.
15
The weights are tuned on electrons at
16
20,50,100 and 150 GeV, from -2.5 <eta < 2.5
17
with fixed vertex
18
base class: CaloClusterCorrectionCommon
19
Uses ToolWithConstants to get corrections constants
20
21
********************************************************************/
22
#include "
CaloSwLongWeights.h
"
23
#include "
CaloClusterCorrection/interpolate.h
"
24
25
26
using
xAOD::CaloCluster
;
27
using
CaloClusterCorr::interpolate
;
28
29
50
void
CaloSwLongWeights::makeTheCorrection
51
(
const
Context& myctx,
52
CaloCluster
* cluster,
53
const
CaloDetDescrElement
*
/*elt*/
,
54
float
eta
,
55
float
adj_eta,
56
float
/*phi*/
,
57
float
/*adj_phi*/
,
58
CaloSampling::CaloSample
/*samp*/
)
const
59
{
60
const
float
eta_start_crack =
m_eta_start_crack
(myctx);
61
const
float
eta_end_crack =
m_eta_end_crack
(myctx);
62
63
// ??? In principle, we should use adj_eta for the interpolation
64
// and range checks. However, the v2 corrections were derived
65
// using regular eta instead.
66
float
the_aeta;
67
if
(
m_use_raw_eta
(myctx))
68
the_aeta = std::abs (adj_eta);
69
else
70
the_aeta = std::abs (
eta
);
71
72
const
float
etamax =
m_etamax
(myctx);
73
if
(the_aeta >= etamax)
return
;
74
75
int
si;
76
if
(the_aeta < eta_start_crack)
77
si = 0;
78
else
if
(the_aeta > eta_end_crack)
79
si = 1;
80
else
{
81
// No corrections are applied for the crack region.
82
return
;
83
}
84
85
const
CxxUtils::Array<2>
correction =
m_correction
(myctx);
86
const
int
degree =
m_degree
(myctx);
87
88
unsigned
int
shape[] = {2};
89
CaloRec::WritableArrayData<1>
interp_barriers (shape);
90
interp_barriers[0] = eta_start_crack;
91
interp_barriers[1] = eta_end_crack;
92
93
float
pars[4];
94
int
ibin =
static_cast<
int
>
(the_aeta / etamax * correction.size());
95
pars[0] = correction[ibin][1];
96
pars[1] = correction[ibin][2];
97
for
(
int
i=2; i<4; i++)
98
pars[i] = interpolate (correction,
99
the_aeta,
100
degree,
101
i+1,
102
interp_barriers);
103
104
static
const
105
CaloSampling::CaloSample
samps[2][4] = {
106
{ CaloSampling::PreSamplerB,
107
CaloSampling::EMB1,
108
CaloSampling::EMB2,
109
CaloSampling::EMB3 },
110
{ CaloSampling::PreSamplerE,
111
CaloSampling::EME1,
112
CaloSampling::EME2,
113
CaloSampling::EME3 }
114
};
115
116
float
e_offset = 0;
117
if
(
m_preserve_offset
(myctx)) {
118
double
total0 = 0;
119
for
(
int
sampling=0; sampling<4; ++sampling)
120
total0 += cluster->
eSample
(samps[si][sampling]);
121
e_offset = cluster->
e
() - total0;
122
}
123
124
cluster->setEnergy (samps[si][0], cluster->
eSample
(samps[si][0]) * pars[0]);
125
cluster->setEnergy (samps[si][3], cluster->
eSample
(samps[si][3]) * pars[1]);
126
127
double
total = e_offset;
128
for
(
int
sampling=0; sampling<4; ++sampling)
129
total += cluster->
eSample
(samps[si][sampling]);
130
131
cluster->
setE
(pars[2] * (pars[3] + total));
132
}
133
134
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Definition
CaloSwEtamod_v2.h:142
CaloSwLongWeights.h
CaloCluster
Principal data class for CaloCell clusters.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:79
CaloCluster::eSample
double eSample(sampling_type sampling) const
Retrieve energy in a given sampling.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:975
CaloCluster::e
virtual double e() const
Retrieve energy independent of signal state.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:753
CaloCluster::setE
virtual void setE(double e)
Set energy.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:767
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
CaloSwLongWeights::m_degree
Constant< int > m_degree
Definition
CaloSwLongWeights.h:68
CaloSwLongWeights::m_etamax
Constant< float > m_etamax
Definition
CaloSwLongWeights.h:67
CaloSwLongWeights::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
CaloSwLongWeights.cxx:51
CaloSwLongWeights::m_use_raw_eta
Constant< bool > m_use_raw_eta
Definition
CaloSwLongWeights.h:69
CaloSwLongWeights::m_eta_end_crack
Constant< float > m_eta_end_crack
Definition
CaloSwLongWeights.h:66
CaloSwLongWeights::m_eta_start_crack
Constant< float > m_eta_start_crack
Definition
CaloSwLongWeights.h:65
CaloSwLongWeights::m_preserve_offset
Constant< bool > m_preserve_offset
Definition
CaloSwLongWeights.h:70
CxxUtils::Array
Read-only multidimensional array.
Definition
Control/CxxUtils/CxxUtils/Array.h:135
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