ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
egamma
egammaAlgs
src
egammaSuperClusterBuilder.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
egammaSuperClusterBuilder.h
"
6
7
#include "
CaloDetDescr/CaloDetDescrManager.h
"
8
#include "
CaloUtils/CaloClusterStoreHelper.h
"
9
#include "
StoreGate/ReadHandle.h
"
10
#include "
StoreGate/WriteHandle.h
"
11
#include "
xAODCaloEvent/CaloCluster.h
"
12
#include "
xAODCaloEvent/CaloClusterAuxContainer.h
"
13
#include "
xAODEgamma/Egamma.h
"
14
#include "
xAODEgamma/EgammaEnums.h
"
15
#include "
xAODEgamma/EgammaxAODHelpers.h
"
16
17
#include <cmath>
18
#include <memory>
19
20
egammaSuperClusterBuilder::egammaSuperClusterBuilder
(
const
std::string& name,
21
ISvcLocator* pSvcLocator)
22
:
egammaSuperClusterBuilderBase
(name, pSvcLocator)
23
,
m_egTypeForCalibration
(
xAOD
::EgammaParameters::electron)
24
{
25
}
26
27
StatusCode
28
egammaSuperClusterBuilder::initialize
()
29
{
30
ATH_MSG_DEBUG
(
" Initializing egammaSuperClusterBuilder"
);
31
32
// the data handle keys
33
if
(
m_calibrationType
==
"electron"
) {
34
m_egTypeForCalibration
=
xAOD::EgammaParameters::electron
;
35
}
else
if
(
m_calibrationType
==
"photon"
) {
36
m_egTypeForCalibration
=
xAOD::EgammaParameters::unconvertedPhoton
;
37
}
else
{
38
ATH_MSG_ERROR
(
"Unsupported calibration for "
<<
m_calibrationType
);
39
return
StatusCode::FAILURE;
40
}
41
42
return
egammaSuperClusterBuilderBase::initialize
();
43
}
44
45
xAOD::EgammaParameters::EgammaType
46
egammaSuperClusterBuilder::getEgammaRecType
([[maybe_unused]]
const
egammaRec
*egRec)
const
{
47
return
m_egTypeForCalibration
;
48
}
49
50
// assume egammaRecs != 0, since the ReadHadler is valid
51
// assume seed egammaRec has a valid cluster, since it has been already used
52
std::vector<std::size_t>
53
egammaSuperClusterBuilder::searchForSecondaryClusters
(
54
std::size_t seedIndex,
55
const
EgammaRecContainer
* egammaRecs,
56
std::vector<bool>& isUsed)
const
57
{
58
59
std::vector<std::size_t> secondaryIndices;
60
61
const
auto
*
const
seedEgammaRec = (*egammaRecs)[seedIndex];
62
const
xAOD::CaloCluster
*
const
seedCaloClus = seedEgammaRec->caloCluster();
63
64
// for stats
65
int
nWindowClusters = 0;
66
// Now loop over the potential secondary clusters
67
for
(std::size_t i = 0; i < egammaRecs->
size
(); ++i) {
68
// if already used continue
69
if
(isUsed[i]) {
70
continue
;
71
}
72
const
auto
*
const
secEgammaRec = (*egammaRecs)[i];
73
const
xAOD::CaloCluster
*
const
secClus = secEgammaRec->caloCluster();
74
if
(!secClus) {
75
ATH_MSG_WARNING
(
76
"The potentially secondary egammaRec does not have a cluster"
);
77
continue
;
78
}
79
bool
addCluster =
false
;
80
if
(
matchesInWindow
(seedCaloClus, secClus)) {
81
ATH_MSG_DEBUG
(
"Cluster with Et: "
<< secClus->
et
()
82
<<
" matched in window"
);
83
++nWindowClusters;
84
addCluster =
true
;
85
}
86
// Add it to the list of secondary clusters if it matches.
87
if
(addCluster) {
88
secondaryIndices.push_back(i);
89
isUsed[i] =
true
;
90
}
91
}
92
ATH_MSG_DEBUG
(
"Found: "
<< secondaryIndices.size() <<
" secondaries"
);
93
ATH_MSG_DEBUG
(
"window clusters: "
<< nWindowClusters);
94
return
secondaryIndices;
95
}
96
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloClusterAuxContainer.h
CaloClusterStoreHelper.h
CaloDetDescrManager.h
Definition of CaloDetDescrManager.
EgammaEnums.h
Egamma.h
EgammaxAODHelpers.h
CaloCluster.h
ReadHandle.h
Handle class for reading from StoreGate.
WriteHandle.h
Handle class for recording to StoreGate.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
egammaRec
Represent an egamma object for internal egamma usage during reconstruction.
Definition
egammaRec.h:31
egammaSuperClusterBuilderBase::egammaSuperClusterBuilderBase
egammaSuperClusterBuilderBase(const std::string &name, ISvcLocator *pSvcLocator)
Protected constructor since this class should not be instantiated by itself.
Definition
egammaSuperClusterBuilderBase.cxx:35
egammaSuperClusterBuilderBase::matchesInWindow
bool matchesInWindow(const xAOD::CaloCluster *ref, const xAOD::CaloCluster *clus) const
Is clus in window center around ref?
Definition
egammaSuperClusterBuilderBase.cxx:241
egammaSuperClusterBuilderBase::initialize
virtual StatusCode initialize() override
should be called by the derived class in the initialize phase
Definition
egammaSuperClusterBuilderBase.cxx:43
egammaSuperClusterBuilder::egammaSuperClusterBuilder
egammaSuperClusterBuilder(const std::string &name, ISvcLocator *pSvcLocator)
Definition
egammaSuperClusterBuilder.cxx:20
egammaSuperClusterBuilder::getEgammaRecType
virtual xAOD::EgammaParameters::EgammaType getEgammaRecType(const egammaRec *egRec) const override final
Definition
egammaSuperClusterBuilder.cxx:46
egammaSuperClusterBuilder::m_calibrationType
Gaudi::Property< std::string > m_calibrationType
type to be assumed for calibration
Definition
egammaSuperClusterBuilder.h:92
egammaSuperClusterBuilder::m_egTypeForCalibration
xAOD::EgammaParameters::EgammaType m_egTypeForCalibration
Definition
egammaSuperClusterBuilder.h:89
egammaSuperClusterBuilder::initialize
virtual StatusCode initialize() override final
should be called by the derived class in the initialize phase
Definition
egammaSuperClusterBuilder.cxx:28
egammaSuperClusterBuilder::searchForSecondaryClusters
virtual std::vector< std::size_t > searchForSecondaryClusters(std::size_t egammaInd, const EgammaRecContainer *egammaRecs, std::vector< bool > &isUsed) const override final
Return extra clusters that can be added to make supercluster.
Definition
egammaSuperClusterBuilder.cxx:53
xAOD::CaloCluster_v1::et
double et() const
Definition
CaloCluster_v1.h:859
EgammaRecContainer
DataVector< egammaRec > EgammaRecContainer
The container is a simple typedef for now.
Definition
egammaRecContainer.h:19
egammaSuperClusterBuilder.h
xAOD::EgammaParameters::EgammaType
EgammaType
Definition
EgammaEnums.h:17
xAOD::EgammaParameters::unconvertedPhoton
@ unconvertedPhoton
Definition
EgammaEnums.h:19
xAOD::EgammaParameters::electron
@ electron
Definition
EgammaEnums.h:18
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
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