ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloCalibHitRec
src
CaloCalibClusterDecoratorTool.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
#include "
CaloCalibHitRec/CaloCalibClusterDecoratorTool.h
"
6
7
#include "
StoreGate/WriteDecorHandle.h
"
8
9
StatusCode
CaloCalibClusterDecoratorTool::initialize
() {
10
11
ATH_CHECK
(
m_mapIdentifierToCalibHitsReadHandleKey
.initialize());
12
13
ATH_CHECK
(
m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
.initialize());
14
15
ATH_CHECK
(
m_truthAttributerTool
.retrieve());
16
17
return
StatusCode::SUCCESS;
18
}
19
20
StatusCode
CaloCalibClusterDecoratorTool::execute
(
21
const
EventContext& ctx,
22
[[maybe_unused]]
xAOD::CaloClusterContainer
* theClusColl)
const
{
23
24
SG::ReadHandle<std::map<Identifier,std::vector<const CaloCalibrationHit*>
> >
25
mapIdentifierToCalibHitsReadHandle(
m_mapIdentifierToCalibHitsReadHandleKey
, ctx);
26
27
if
(!mapIdentifierToCalibHitsReadHandle.
isValid
()) {
28
ATH_MSG_WARNING
(
"Could not retrieve map between Identifier and calibraiton hits from Storegae"
);
29
return
StatusCode::FAILURE;
30
}
31
32
SG::WriteDecorHandle
<
xAOD::CaloClusterContainer
,
33
std::vector<std::pair<unsigned int, double> > >
34
caloClusterWriteDecorHandleNLeadingTruthParticles(
35
m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
, ctx);
36
37
for
(
const
auto
* thisCaloCluster : *caloClusterWriteDecorHandleNLeadingTruthParticles) {
38
39
std::vector<std::pair<unsigned int, double> > newTruthIDTruthPairs;
40
41
ATH_CHECK
(
42
m_truthAttributerTool
->calculateTruthEnergies(
43
*thisCaloCluster,
44
m_numTruthParticles
,
45
*mapIdentifierToCalibHitsReadHandle,
46
newTruthIDTruthPairs));
47
48
for
(
const
auto
& thisPair : newTruthIDTruthPairs) {
49
ATH_MSG_DEBUG
(
50
"Cluster Final loop: Particle with truthID "
<< thisPair.first
51
<<
" has truth energy of "
<< thisPair.second
52
<<
" for cluster with e, eta "
<< thisCaloCluster->e()
53
<<
" and "
<< thisCaloCluster->eta());
54
}
55
56
caloClusterWriteDecorHandleNLeadingTruthParticles(*thisCaloCluster)
57
= std::move(newTruthIDTruthPairs);
58
}
59
60
return
StatusCode::SUCCESS;
61
}
62
63
StatusCode
CaloCalibClusterDecoratorTool::finalize
() {
64
return
StatusCode::SUCCESS;
65
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x,...)
Definition
AthMsgStreamMacros.h:43
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x,...)
Definition
AthMsgStreamMacros.h:46
CaloCalibClusterDecoratorTool.h
WriteDecorHandle.h
Handle class for adding a decoration to an object.
CaloCalibClusterDecoratorTool::initialize
virtual StatusCode initialize() override
Definition
CaloCalibClusterDecoratorTool.cxx:9
CaloCalibClusterDecoratorTool::finalize
virtual StatusCode finalize() override
Definition
CaloCalibClusterDecoratorTool.cxx:63
CaloCalibClusterDecoratorTool::m_truthAttributerTool
ToolHandle< ICaloCalibClusterTruthAttributerTool > m_truthAttributerTool
Definition
CaloCalibClusterDecoratorTool.h:55
CaloCalibClusterDecoratorTool::execute
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *theClusColl) const override final
Definition
CaloCalibClusterDecoratorTool.cxx:20
CaloCalibClusterDecoratorTool::m_numTruthParticles
Gaudi::Property< unsigned int > m_numTruthParticles
Definition
CaloCalibClusterDecoratorTool.h:63
CaloCalibClusterDecoratorTool::m_mapIdentifierToCalibHitsReadHandleKey
SG::ReadHandleKey< std::map< Identifier, std::vector< const CaloCalibrationHit * > > > m_mapIdentifierToCalibHitsReadHandleKey
Definition
CaloCalibClusterDecoratorTool.h:40
CaloCalibClusterDecoratorTool::m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
SG::WriteDecorHandleKey< xAOD::CaloClusterContainer > m_caloClusterWriteDecorHandleKeyNLeadingTruthParticles
Definition
CaloCalibClusterDecoratorTool.h:48
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
xAOD::CaloClusterContainer
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterContainer.h:17
Generated on
for ATLAS Offline Software by
1.17.0