ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloClusterCorrection
src
CaloSwGap_g3.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: CaloSwGap_g3.cxx
8
PACKAGE: offline/Calorimeter/CaloClusterCorrection
9
10
AUTHORS: L. Carminati
11
CREATED: Feb 2003
12
13
PURPOSE: Correction for the barrel-endcap cracks
14
Tuned using 100 GeV photons
15
16
UPDATED: 10/04/03 MW
17
bug fix to take only the cells in near cluster for gap
18
correction
19
20
Updated: May 5, 2004 (Sven Menke)
21
base class changed from algo to tool
22
23
Updated: June, 2004 (sss)
24
Use ToolWithConstants to get correction constants.
25
********************************************************************/
26
27
#include "
CaloSwGap_g3.h
"
28
29
#include "
CaloEvent/CaloCell.h
"
30
#include "
CaloEvent/CaloCellContainer.h
"
31
32
#include "GaudiKernel/StatusCode.h"
33
34
35
#include "CLHEP/Units/PhysicalConstants.h"
36
#include "GaudiKernel/MsgStream.h"
37
#include <cmath>
38
#include <iostream>
39
#include <numbers>
40
41
using
xAOD::CaloCluster
;
42
using
std::numbers::pi;
43
44
namespace
{
45
46
inline
constexpr
double
twopi
= 2*
pi
;
47
inline
constexpr
double
deta = 0.2;
48
inline
constexpr
double
dphi =
twopi
/ 64. ;
49
50
}
51
55
StatusCode
CaloSwGap_g3::initialize
()
56
{
57
ATH_CHECK
(
CaloClusterCorrection::initialize
() );
58
ATH_CHECK
(
m_cells_name
.initialize() );
59
return
StatusCode::SUCCESS;
60
}
61
62
63
void
CaloSwGap_g3::makeCorrection
(
const
Context& myctx,
64
CaloCluster
* cluster)
const
65
{
66
float
eta
= cluster->
eta
();
67
float
phi
= cluster->
phi
();
68
69
float
aeta = fabs(
eta
);
70
71
const
float
etamin_crack =
m_etamin_crack
(myctx);
72
const
float
etamax_crack =
m_etamax_crack
(myctx);
73
if
(aeta < etamin_crack || aeta > etamax_crack)
74
return
;
// no correction required
75
76
const
CxxUtils::Array<1>
scint_weight =
m_scint_weight
(myctx);
77
const
CxxUtils::Array<1>
correction =
m_correction
(myctx);
78
assert (scint_weight.
size
() == correction.size());
79
if
(correction.size() == 0)
return
;
80
81
SG::ReadHandle<CaloCellContainer>
cc (
m_cells_name
, myctx.ctx());
82
83
double
eh_scint = 0;
84
if
(cc.isValid())
85
{
86
CaloCellContainer::const_iterator
f_cell =
87
cc->beginConstCalo(
CaloCell_ID::TILE
);
88
CaloCellContainer::const_iterator
l_cell =
89
cc->endConstCalo(
CaloCell_ID::TILE
);
90
91
for
( ; f_cell!=l_cell; ++f_cell)
92
{
93
const
CaloCell
* cell = (*f_cell) ;
94
95
int
inum = cell->caloDDE()->getSampling();
96
97
if
(CaloSampling::TileGap3 == inum ) {
98
double
phic = cell->phi();
99
double
etac = cell->eta();
100
if
(phic-
phi
< -
pi
) phic = phic +
twopi
;
101
if
(phic-
phi
>
pi
) phic = phic -
twopi
;
102
if
(etac >=
eta
-deta && etac <=
eta
+deta) {
103
if
(phic >=
phi
-dphi && phic <=
phi
+dphi) {
104
eh_scint += cell->e();
105
}
106
}
107
}
108
}
109
}
110
111
// make the correction
112
double
granularity = (etamax_crack - etamin_crack)/correction.size();
113
int
ind =
static_cast<
int
>
((aeta - etamin_crack)/granularity);
114
115
// Scintillator energy calibration
116
eh_scint = eh_scint * scint_weight[ind];
117
118
//Correct for normalization factor total cluster energy and samplings energies
119
double
energy = (cluster->
e
())*correction[ind];
120
setenergy
(cluster,energy);
121
122
// Add the scintillator energy to the cluster and correct the total energy
123
energy += eh_scint * correction[ind];
124
cluster->
setE
(energy);
125
}
126
127
132
StatusCode
133
CaloSwGap_g3::setCaloCellContainerName
134
(
const
std::string& name)
135
{
136
return
this->
setProperty
(StringProperty (
"cells_name"
, name));
137
}
eta
Scalar eta() const
pseudorapidity method
Definition
AmgMatrixBasePlugin.h:83
phi
Scalar phi() const
phi method
Definition
AmgMatrixBasePlugin.h:67
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CaloCellContainer.h
CaloCell.h
m_correction
Constant< CxxUtils::Array< 2 > > m_correction
Calibration constant: tabulated arrays of function parameters.
Definition
CaloSwEtamod_v2.h:142
CaloSwGap_g3.h
setProperty
void setProperty(columnar::PythonToolHandle &self, const std::string &key, nb::object value)
Definition
NanobindBindings.cxx:75
pi
#define pi
Definition
TileMuonFitter.cxx:65
twopi
constexpr double twopi
Definition
VertexPointEstimator.cxx:16
CaloCell_Base_ID::TILE
@ TILE
Definition
CaloCell_Base_ID.h:45
CaloCell
Data object for each calorimeter readout cell.
Definition
CaloCell.h:57
CaloClusterCorrection::setenergy
virtual void setenergy(xAOD::CaloCluster *cluster, float energy) const
Definition
CaloClusterCorrection.cxx:93
CaloClusterCorrection::initialize
virtual StatusCode initialize() override
Definition
CaloClusterCorrection.cxx:46
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
CaloCluster::eta
virtual double eta() const
Retrieve eta independent of signal state.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:755
CaloCluster::phi
virtual double phi() const
Retrieve phi independent of signal state.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:759
CaloCluster::setE
virtual void setE(double e)
Set energy.
Definition
Calorimeter/CaloEvent/CaloEvent/CaloCluster.h:767
CaloSwGap_g3::makeCorrection
virtual void makeCorrection(const Context &myctx, xAOD::CaloCluster *cluster) const override
Definition
CaloSwGap_g3.cxx:63
CaloSwGap_g3::setCaloCellContainerName
virtual StatusCode setCaloCellContainerName(const std::string &name) override
Change the name of the CaloCellContainer used by this tool.
Definition
CaloSwGap_g3.cxx:134
CaloSwGap_g3::m_etamax_crack
Constant< float > m_etamax_crack
Definition
CaloSwGap_g3.h:61
CaloSwGap_g3::m_cells_name
SG::ReadHandleKey< CaloCellContainer > m_cells_name
Property: The name of the container in which to look to find tile cells.
Definition
CaloSwGap_g3.h:67
CaloSwGap_g3::m_etamin_crack
Constant< float > m_etamin_crack
Definition
CaloSwGap_g3.h:60
CaloSwGap_g3::initialize
virtual StatusCode initialize() override
Standard Gaudi initialize method.
Definition
CaloSwGap_g3.cxx:55
CaloSwGap_g3::m_scint_weight
Constant< CxxUtils::Array< 1 > > m_scint_weight
Definition
CaloSwGap_g3.h:62
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.
DataVector< CaloCell >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
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