ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloSwPhimod_g3.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: CaloSwPhimod_g3.cxx
8
PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10
AUTHORS: H. Ma, S. Rajagopalan
11
CREATED: Dec. 15, 1999
12
13
PURPOSE: correction for the modulations with the position in phi
14
(Tuned using 50 GeV Et photons)
15
base class: CaloClusterCorrection
16
Correction tuned on G3 samples.
17
18
Atrecon Orig: emreco/qphimod.F
19
20
Updated: May 10, 2000 (SR, HM)
21
Migrated to Athena Framework from PASO
22
23
Updated: Jan 5, 2001 (HM)
24
QA.
25
26
Updated: May 5, 2004 (Sven Menke)
27
base class changed from algo to tool
28
29
Updated: June, 2004 (sss)
30
Use ToolWithConstants to get correction constants.
31
********************************************************************/
32
#include "
CaloSwPhimod_g3.h
"
33
#include <cmath>
34
35
36
37
// make correction to one cluster
38
void
CaloSwPhimod_g3::makeCorrection
(
const
Context& myctx,
39
xAOD::CaloCluster
* cluster)
const
40
{
41
42
float
eta2 = cluster->
etaBE
(2);
// use second sampling
43
float
phi2 = cluster->
phiBE
(2);
// use the average over Bar and EC.
44
if
(eta2 < -900 || phi2 < -900)
45
return
;
46
47
float
aeta2 = fabs(eta2);
48
float
nabs;
49
if
(aeta2 < 1.5)
50
nabs = 1024;
51
else
if
(aeta2 < 2.5)
52
nabs = 768;
53
else
54
nabs = 256.;
55
56
std::vector<float> tab =
qphmop
(myctx, aeta2);
57
assert (tab.size() == 5);
58
float
qphimod =
59
tab[0] +
60
tab[1] * cos(nabs*phi2) +
61
tab[2] * cos(2.*nabs*phi2)+
62
tab[3] * cos(3.*nabs*phi2)+
63
tab[4] * sin(nabs*phi2);
64
65
// set energy, and rescale each sampling
66
setenergy
(cluster, qphimod * cluster->
e
());
67
68
69
}
70
71
std::vector<float>
CaloSwPhimod_g3::qphmop
(
const
Context& myctx,
72
float
aeta)
const
73
{
74
std::vector<float> coef;
75
76
const
CxxUtils::Array<2>
correction =
m_correction
(myctx);
77
if
(correction.size() == 0) {
78
ATH_MSG_ERROR
(
"Empty correction array"
);
79
coef.resize(5);
80
return
coef;
81
}
82
83
coef.resize (correction.size(1)-1);
84
85
int
i1 = 0;
86
int
i2 = 0;
87
if
(aeta < correction[0][0]) {
88
for
(
unsigned
int
j = 1; j < correction.size(1); j++)
89
coef[j-1] = correction[0][j];
90
return
coef;
91
}
92
93
else
if
(aeta >= correction[0][0]) {
94
for
(
unsigned
int
i = 0; i < correction.size()-1; i++) {
95
if
(aeta >= correction[i][0] && aeta < correction[i+1][0]) {
96
i1 = i;
97
i2 = i+1;
98
break
;
99
}
100
}
101
}
102
if
(i1 == i2) {
103
i2 = correction.size()-1;
104
i1 = i2-1;
105
}
106
107
float
deta = correction[i2][0] - correction[i1][0];
108
if
(deta == 0)
109
deta = 1;
110
111
float
m = (aeta - correction[i1][0]) / deta;
112
for
(
unsigned
int
j = 1; j < correction.size(1); j++) {
113
float
dy = correction[i2][j] - correction[i1][j];
114
coef[j-1] = (correction[i1][j] + dy * m);
115
}
116
117
return
coef;
118
}
119
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Definition
CaloSwEtamod_v2.h:142
CaloSwPhimod_g3.h
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition
CaloClusterCorrection.cxx:93
CaloSwPhimod_g3::qphmop
std::vector< float > qphmop(const Context &myctx, float eta) const
Definition
CaloSwPhimod_g3.cxx:71
CaloSwPhimod_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition
CaloSwPhimod_g3.cxx:38
CxxUtils::Array
Read-only multidimensional array.
Definition
Control/CxxUtils/CxxUtils/Array.h:135
xAOD::CaloCluster_v1::phiBE
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
Definition
CaloCluster_v1.cxx:634
xAOD::CaloCluster_v1::e
virtual double e() const
The total energy of the particle.
Definition
CaloCluster_v1.cxx:265
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition
CaloCluster_v1.cxx:628
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