ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
HeavyIonRec
HIGlobal
src
CaloClustersCopier.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
xAODCaloEvent/CaloClusterAuxContainer.h
"
5
6
7
#include "
CaloClustersCopier.h
"
8
9
CaloClustersCopier::CaloClustersCopier
(
const
std::string& name, ISvcLocator* pSvcLocator) :
10
AthReentrantAlgorithm
(name, pSvcLocator)
11
{
12
}
13
14
CaloClustersCopier::~CaloClustersCopier
()
15
{
16
}
17
18
StatusCode
CaloClustersCopier::initialize
()
19
{
20
ATH_CHECK
(
m_HIEventShapeKey
.initialize());
21
ATH_CHECK
(
m_inputClustersKey
.initialize());
22
ATH_CHECK
(
m_outputClustersKey
.initialize());
23
24
return
StatusCode::SUCCESS;
25
}
26
27
StatusCode
CaloClustersCopier::finalize
()
28
{
29
return
StatusCode::SUCCESS;
30
}
31
32
StatusCode
CaloClustersCopier::execute
(
const
EventContext& context)
const
33
{
34
35
auto
esHandle =
SG::makeHandle
(
m_HIEventShapeKey
, context);
36
ATH_CHECK
(esHandle.isValid());
37
auto
inputClustersHandle =
SG::makeHandle
(
m_inputClustersKey
, context);
38
ATH_CHECK
(inputClustersHandle.isValid());
39
40
// construct and record output clusters in each event
41
auto
outputClusters = std::make_unique<xAOD::CaloClusterContainer>();
42
auto
outputClustersAux = std::make_unique<xAOD::CaloClusterAuxContainer>();
43
outputClusters->setStore(outputClustersAux.get());
44
45
// calculate energy in fcal
46
double
fcalEt = 0;
47
48
for
(
const
xAOD::HIEventShape
* es : *esHandle) {
49
if
(es->layer() == 21 || es->layer() == 22 || es->layer() == 23) {
// Example: FCal layers
50
fcalEt += es->et();
51
}
52
}
53
54
if
( fcalEt <
m_fcalEtCut
) {
55
for
(
auto
inCluster: *inputClustersHandle ) {
56
xAOD::CaloCluster
* outCluster =
new
xAOD::CaloCluster
();
57
outputClusters->push_back(outCluster);
58
*outCluster = *inCluster;
59
}
60
}
61
62
auto
outputClustersHandle =
SG::makeHandle
(
m_outputClustersKey
, context);
63
ATH_CHECK
( outputClustersHandle.record(std::move(outputClusters), std::move(outputClustersAux)) );
64
65
return
StatusCode::SUCCESS;
66
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
CaloClusterAuxContainer.h
CaloClustersCopier.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CaloClustersCopier::CaloClustersCopier
CaloClustersCopier(const std::string &name, ISvcLocator *pSvcLocator)
Definition
CaloClustersCopier.cxx:9
CaloClustersCopier::initialize
virtual StatusCode initialize() override
Definition
CaloClustersCopier.cxx:18
CaloClustersCopier::m_HIEventShapeKey
SG::ReadHandleKey< xAOD::HIEventShapeContainer > m_HIEventShapeKey
Definition
CaloClustersCopier.h:31
CaloClustersCopier::execute
virtual StatusCode execute(const EventContext &context) const override
Definition
CaloClustersCopier.cxx:32
CaloClustersCopier::m_fcalEtCut
Gaudi::Property< float > m_fcalEtCut
Definition
CaloClustersCopier.h:30
CaloClustersCopier::finalize
virtual StatusCode finalize() override
Definition
CaloClustersCopier.cxx:27
CaloClustersCopier::~CaloClustersCopier
virtual ~CaloClustersCopier() override
Definition
CaloClustersCopier.cxx:14
CaloClustersCopier::m_outputClustersKey
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputClustersKey
Definition
CaloClustersCopier.h:33
CaloClustersCopier::m_inputClustersKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inputClustersKey
Definition
CaloClustersCopier.h:32
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
xAOD::HIEventShape
HIEventShape_v2 HIEventShape
Definition of the latest event info version.
Definition
HIEventShape.h:16
Generated on
for ATLAS Offline Software by
1.17.0