ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloLongWeights_v2.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
NAME: CaloLongWeights_v2.cxx
8
PACKAGE: offline/Calorimter/CaloClusterCorrection
9
10
AUTHORS: Mohamed Aharrouche
11
CREATED: Jan 25, 2006
12
13
PURPOSE: correction for the energy lost in the dead material
14
15
********************************************************************/
16
#include "
CaloLongWeights_v2.h
"
17
#include "
CaloClusterCorrection/interpolate.h
"
18
19
20
using
xAOD::CaloCluster
;
21
using
CaloClusterCorr::interpolate
;
22
23
void
CaloLongWeights_v2::makeTheCorrection
(
const
Context& myctx,
24
CaloCluster
* cluster,
25
const
CaloDetDescrElement
*
/*elt*/
,
26
float
eta
,
27
float
/*adj_eta*/
,
28
float
/*phi*/
,
29
float
/*phi*/
,
30
CaloSampling::CaloSample
/*samp*/
)
const
31
{
32
float
the_eta = std::abs (
eta
);
33
if
(the_eta >=
m_etamax
(myctx))
return
;
34
35
36
bool
inBarrel =
false
;
37
if
(the_eta <
m_barrel_frontier
(myctx))
38
inBarrel=
true
;
39
else
if
(the_eta <=
m_endcap_frontier
(myctx))
40
return
;
41
42
const
CxxUtils::Array<3>
correction =
m_correction
(myctx);
43
const
CxxUtils::Array<1>
energies =
m_energies
(myctx);
44
const
int
degree =
m_degree
(myctx);
45
46
//initial cluster energy
47
float
energy = cluster->
e
();
48
49
//Weights
50
float
coefs[5];
51
52
//eta bin
53
int
etaIndex = (int) (the_eta * (1./0.025));
54
55
//samples
56
unsigned
int
n_samples = energies.
size
();
57
if
(n_samples == 0) {
58
ATH_MSG_ERROR
(
"Empty energies vector"
);
59
return
;
60
}
61
62
unsigned
int
shape[] = {n_samples, 6};
63
CaloRec::WritableArrayData<2>
vectParm (shape);
64
65
66
for
(
unsigned
int
i=0;i<n_samples;i++)
67
{
68
vectParm[i][0] = energies[i];
69
for
(
unsigned
int
j=0;j<5;j++)
70
{
71
vectParm[i][j+1] = correction[i][etaIndex][j+1];
72
}
73
}
74
75
for
(
unsigned
int
k=0; k<5;k++)
76
{
77
if
(energy < energies[0])
78
coefs[k] = vectParm[0][k+1];
79
else
if
(energy > energies[n_samples-1])
80
coefs[k] = vectParm[n_samples-1][k+1];
81
else
82
coefs[k] = interpolate (vectParm, energy, degree, k+1);
83
}
84
85
86
87
typedef
CaloSampling::CaloSample
Samplingmap[4];
88
static
const
Samplingmap LBarrel = { CaloSampling::PreSamplerB,
89
CaloSampling::EMB1, CaloSampling::EMB2, CaloSampling::EMB3 };
90
static
const
Samplingmap LEndcap = { CaloSampling::PreSamplerE,
91
CaloSampling::EME1, CaloSampling::EME2, CaloSampling::EME3 };
92
const
Samplingmap& L = inBarrel ? LBarrel : LEndcap;
93
94
95
float
Egap=0.0;
96
97
if
(cluster->
eSample
(L[0])*cluster->
eSample
(L[1])>0.)
98
Egap=coefs[3]*std::sqrt(cluster->
eSample
(L[0])*cluster->
eSample
(L[1]));
99
100
101
cluster->setEnergy ( L[0],cluster->
eSample
(L[0])*coefs[0]);
102
103
float
Eleak = cluster->
eSample
(L[3])*coefs[1];
104
105
//total energy
106
float
Erec = 0.0;
107
for
(
int
iSample=1; iSample < 4 ; ++iSample)
108
{
109
Erec += cluster->
eSample
(L[iSample]);
110
}
111
112
113
cluster->
setE
(coefs[4]*Erec + cluster->
eSample
(L[0]) + Eleak + coefs[2]+ Egap);
114
115
}
116
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
CaloLongWeights_v2.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
CaloLongWeights_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
CaloLongWeights_v2.cxx:23
CaloLongWeights_v2::m_correction
Constant< CxxUtils::Array< 3 > > m_correction
Definition
CaloLongWeights_v2.h:45
CaloLongWeights_v2::m_etamax
Constant< float > m_etamax
Definition
CaloLongWeights_v2.h:48
CaloLongWeights_v2::m_barrel_frontier
Constant< float > m_barrel_frontier
Definition
CaloLongWeights_v2.h:49
CaloLongWeights_v2::m_energies
Constant< CxxUtils::Array< 1 > > m_energies
Definition
CaloLongWeights_v2.h:46
CaloLongWeights_v2::m_degree
Constant< int > m_degree
Definition
CaloLongWeights_v2.h:47
CaloLongWeights_v2::m_endcap_frontier
Constant< float > m_endcap_frontier
Definition
CaloLongWeights_v2.h:50
CaloSampling::CaloSample
CaloSample
Definition
Calorimeter/CaloGeoHelpers/CaloGeoHelpers/CaloSampling.h:22
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