ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
egamma
egammaTools
src
egammaSwTool.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
#include "
egammaSwTool.h
"
6
7
#include "
CaloUtils/CaloClusterStoreHelper.h
"
8
#include "
CaloUtils/CaloLayerCalculator.h
"
9
#include "
xAODCaloEvent/CaloCluster.h
"
10
11
#include "GaudiKernel/TypeNameString.h"
12
13
#include <algorithm>
14
15
16
egammaSwTool::egammaSwTool
(
const
std::string&
type
,
17
const
std::string& name,
18
const
IInterface* parent)
19
:
AthAlgTool
(
type
, name, parent)
20
{
21
22
// declare interface
23
declareInterface<IegammaSwTool>(
this
);
24
}
25
26
StatusCode
27
egammaSwTool::initialize
()
28
{
29
ATH_CHECK
(
m_clusterCorrectionPointersEle35
.retrieve());
30
ATH_CHECK
(
m_clusterCorrectionPointersEle37
.retrieve());
31
ATH_CHECK
(
m_clusterCorrectionPointersEle55
.retrieve());
32
//
33
ATH_CHECK
(
m_clusterCorrectionPointersGam35
.retrieve());
34
ATH_CHECK
(
m_clusterCorrectionPointersGam37
.retrieve());
35
ATH_CHECK
(
m_clusterCorrectionPointersGam55
.retrieve());
36
//
37
ATH_CHECK
(
m_clusterCorrectionPointersEconv35
.retrieve());
38
ATH_CHECK
(
m_clusterCorrectionPointersEconv37
.retrieve());
39
ATH_CHECK
(
m_clusterCorrectionPointersEconv55
.retrieve());
40
// SuperCluster
41
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterEle35
.retrieve());
42
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterEle37
.retrieve());
43
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterEle55
.retrieve());
44
//
45
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterGam35
.retrieve());
46
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterGam37
.retrieve());
47
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterGam55
.retrieve());
48
//
49
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterEconv35
.retrieve());
50
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterEconv37
.retrieve());
51
ATH_CHECK
(
m_clusterCorrectionPointersSuperClusterEconv55
.retrieve());
52
return
StatusCode::SUCCESS;
53
}
54
55
StatusCode
56
egammaSwTool::execute
(
const
EventContext& ctx,
xAOD::CaloCluster
* cluster)
const
57
{
58
ATH_MSG_DEBUG
(
"Executing egammaSwTool"
);
59
60
// protection against bad clusters
61
if
(cluster ==
nullptr
)
62
return
StatusCode::SUCCESS;
63
64
xAOD::CaloCluster::ClusterSize
requestedSize = cluster->
clusterSize
();
65
switch
(requestedSize) {
66
case
xAOD::CaloCluster::SW_55ele
: {
67
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersEle55
, cluster));
68
break
;
69
}
70
case
xAOD::CaloCluster::SW_35ele
: {
71
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersEle35
, cluster));
72
break
;
73
}
74
case
xAOD::CaloCluster::SW_37ele
: {
75
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersEle37
, cluster));
76
break
;
77
}
78
case
xAOD::CaloCluster::SW_35gam
: {
79
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersGam35
, cluster));
80
break
;
81
}
82
case
xAOD::CaloCluster::SW_55gam
: {
83
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersGam55
, cluster));
84
break
;
85
}
86
case
xAOD::CaloCluster::SW_37gam
: {
87
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersGam37
, cluster));
88
break
;
89
}
90
case
xAOD::CaloCluster::SW_55Econv
: {
91
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersEconv55
, cluster));
92
break
;
93
}
94
case
xAOD::CaloCluster::SW_35Econv
: {
95
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersEconv35
, cluster));
96
break
;
97
}
98
case
xAOD::CaloCluster::SW_37Econv
: {
99
ATH_CHECK
(
processTools
(ctx,
m_clusterCorrectionPointersEconv37
, cluster));
100
break
;
101
}
102
default
: {
103
ATH_MSG_ERROR
(
104
"Inexisting cluster type and calibration requested: "
<< requestedSize);
105
return
StatusCode::FAILURE;
106
}
107
}
108
return
StatusCode::SUCCESS;
109
}
110
// ==============================================================
111
// ATHENA EXECUTE METHOD for superClusters
112
113
StatusCode
114
egammaSwTool::execute
(
const
EventContext& ctx,
115
xAOD::CaloCluster
* cluster,
116
xAOD::EgammaParameters::EgammaType
egType,
117
bool
isBarrel)
const
118
{
119
// protection against bad clusters
120
if
(cluster ==
nullptr
) {
121
return
StatusCode::SUCCESS;
122
}
123
124
if
(isBarrel) {
125
switch
(egType) {
126
case
xAOD::EgammaParameters::electron
: {
127
ATH_CHECK
(
processTools
(
128
ctx,
m_clusterCorrectionPointersSuperClusterEle37
, cluster));
129
break
;
130
}
131
case
xAOD::EgammaParameters::unconvertedPhoton
: {
132
ATH_CHECK
(
processTools
(
133
ctx,
m_clusterCorrectionPointersSuperClusterGam37
, cluster));
134
break
;
135
}
136
case
xAOD::EgammaParameters::convertedPhoton
: {
137
ATH_CHECK
(
processTools
(
138
ctx,
m_clusterCorrectionPointersSuperClusterEconv37
, cluster));
139
break
;
140
}
141
default
: {
142
ATH_MSG_ERROR
(
"Inexisting correction requested for egType: "
143
<< egType <<
" isBarrel: "
<< isBarrel);
144
return
StatusCode::FAILURE;
145
break
;
146
}
147
}
148
}
else
{
149
switch
(egType) {
150
case
xAOD::EgammaParameters::electron
: {
151
ATH_CHECK
(
processTools
(
152
ctx,
m_clusterCorrectionPointersSuperClusterEle55
, cluster));
153
break
;
154
}
155
case
xAOD::EgammaParameters::unconvertedPhoton
: {
156
ATH_CHECK
(
processTools
(
157
ctx,
m_clusterCorrectionPointersSuperClusterGam55
, cluster));
158
break
;
159
}
160
case
xAOD::EgammaParameters::convertedPhoton
: {
161
ATH_CHECK
(
processTools
(
162
ctx,
m_clusterCorrectionPointersSuperClusterEconv55
, cluster));
163
break
;
164
}
165
default
: {
166
ATH_MSG_ERROR
(
"Inexisting correction requested for egType: "
167
<< egType <<
" isBarrel: "
<< isBarrel);
168
return
StatusCode::FAILURE;
169
}
170
}
171
}
172
return
StatusCode::SUCCESS;
173
}
174
175
StatusCode
176
egammaSwTool::processTools
(
const
EventContext& ctx,
177
const
ToolHandleArray<CaloClusterProcessor>&
tools
,
178
xAOD::CaloCluster
* cluster)
const
179
{
180
auto
firstTool =
tools
.begin();
181
auto
lastTool =
tools
.end();
182
// loop tools
183
for
(; firstTool != lastTool; ++firstTool) {
184
ATH_CHECK
((*firstTool)->execute(ctx, cluster));
185
}
186
return
StatusCode::SUCCESS;
187
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloClusterStoreHelper.h
CaloLayerCalculator.h
Calculate total energy, position, etc. for a given layer of a cluster.
CaloCluster.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
egammaSwTool::m_clusterCorrectionPointersGam35
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersGam35
Definition
egammaSwTool.h:72
egammaSwTool::m_clusterCorrectionPointersSuperClusterEle37
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterEle37
Definition
egammaSwTool.h:142
egammaSwTool::m_clusterCorrectionPointersSuperClusterEle55
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterEle55
Definition
egammaSwTool.h:123
egammaSwTool::m_clusterCorrectionPointersGam55
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersGam55
Definition
egammaSwTool.h:77
egammaSwTool::m_clusterCorrectionPointersSuperClusterGam35
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterGam35
Definition
egammaSwTool.h:116
egammaSwTool::m_clusterCorrectionPointersEle37
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersEle37
Definition
egammaSwTool.h:67
egammaSwTool::m_clusterCorrectionPointersSuperClusterEle35
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterEle35
Definition
egammaSwTool.h:104
egammaSwTool::m_clusterCorrectionPointersEle35
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersEle35
Definition
egammaSwTool.h:62
egammaSwTool::egammaSwTool
egammaSwTool(const std::string &type, const std::string &name, const IInterface *parent)
Default constructor.
Definition
egammaSwTool.cxx:16
egammaSwTool::m_clusterCorrectionPointersEconv35
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersEconv35
Definition
egammaSwTool.h:92
egammaSwTool::m_clusterCorrectionPointersSuperClusterGam37
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterGam37
Definition
egammaSwTool.h:148
egammaSwTool::m_clusterCorrectionPointersGam37
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersGam37
Definition
egammaSwTool.h:82
egammaSwTool::processTools
StatusCode processTools(const EventContext &ctx, const ToolHandleArray< CaloClusterProcessor > &tools, xAOD::CaloCluster *cluster) const
Definition
egammaSwTool.cxx:176
egammaSwTool::execute
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloCluster *cluster) const override final
execute method
Definition
egammaSwTool.cxx:56
egammaSwTool::m_clusterCorrectionPointersEle55
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersEle55
a list of names for tools to correct clusters
Definition
egammaSwTool.h:57
egammaSwTool::m_clusterCorrectionPointersSuperClusterEconv35
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterEconv35
Definition
egammaSwTool.h:110
egammaSwTool::m_clusterCorrectionPointersEconv55
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersEconv55
Definition
egammaSwTool.h:87
egammaSwTool::m_clusterCorrectionPointersSuperClusterEconv55
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterEconv55
Definition
egammaSwTool.h:135
egammaSwTool::initialize
virtual StatusCode initialize() override
initialize method
Definition
egammaSwTool.cxx:27
egammaSwTool::m_clusterCorrectionPointersSuperClusterGam55
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterGam55
Definition
egammaSwTool.h:129
egammaSwTool::m_clusterCorrectionPointersSuperClusterEconv37
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersSuperClusterEconv37
Definition
egammaSwTool.h:154
egammaSwTool::m_clusterCorrectionPointersEconv37
ToolHandleArray< CaloClusterProcessor > m_clusterCorrectionPointersEconv37
Definition
egammaSwTool.h:97
xAOD::CaloCluster_v1::clusterSize
ClusterSize clusterSize() const
Get cluster size.
Definition
CaloCluster_v1.cxx:364
xAOD::CaloCluster_v1::ClusterSize
ClusterSize
Enumeration to identify different cluster sizes.
Definition
CaloCluster_v1.h:89
xAOD::CaloCluster_v1::SW_55ele
@ SW_55ele
Definition
CaloCluster_v1.h:91
xAOD::CaloCluster_v1::SW_55Econv
@ SW_55Econv
Definition
CaloCluster_v1.h:99
xAOD::CaloCluster_v1::SW_37gam
@ SW_37gam
Definition
CaloCluster_v1.h:97
xAOD::CaloCluster_v1::SW_35gam
@ SW_35gam
Definition
CaloCluster_v1.h:96
xAOD::CaloCluster_v1::SW_37ele
@ SW_37ele
Definition
CaloCluster_v1.h:93
xAOD::CaloCluster_v1::SW_35ele
@ SW_35ele
Definition
CaloCluster_v1.h:92
xAOD::CaloCluster_v1::SW_37Econv
@ SW_37Econv
Definition
CaloCluster_v1.h:101
xAOD::CaloCluster_v1::SW_35Econv
@ SW_35Econv
Definition
CaloCluster_v1.h:100
xAOD::CaloCluster_v1::SW_55gam
@ SW_55gam
Definition
CaloCluster_v1.h:95
egammaSwTool.h
tools
Definition
DataQuality/ZLumiScripts/python/tools/__init__.py:1
xAOD::EgammaParameters::EgammaType
EgammaType
Definition
EgammaEnums.h:17
xAOD::EgammaParameters::convertedPhoton
@ convertedPhoton
Definition
EgammaEnums.h:20
xAOD::EgammaParameters::unconvertedPhoton
@ unconvertedPhoton
Definition
EgammaEnums.h:19
xAOD::EgammaParameters::electron
@ electron
Definition
EgammaEnums.h:18
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
type
Generated on
for ATLAS Offline Software by
1.17.0