ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
HeavyIonRec
HIJetRec
src
HIClusterCopier.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
HIClusterCopier.h
"
6
#include "
CaloUtils/CaloClusterStoreHelper.h
"
7
#include "
xAODBase/IParticleHelpers.h
"
8
#include "
xAODCore/ShallowAuxContainer.h
"
9
#include "
xAODCore/ShallowCopy.h
"
10
11
HIClusterCopier::HIClusterCopier
(
const
std::string& name, ISvcLocator* pSvcLocator)
12
:
AthReentrantAlgorithm
(name,pSvcLocator)
13
{
14
}
15
16
StatusCode
HIClusterCopier::initialize
()
17
{
18
//First we initialize keys - after initialization they are frozen
19
ATH_CHECK
(
m_inputKey
.initialize() );
20
ATH_CHECK
(
m_outputKey
.initialize() );
21
22
return
StatusCode::SUCCESS;
23
}
24
25
StatusCode
HIClusterCopier::execute
(
const
EventContext &ctx)
const
26
{
27
// retrieve input
28
SG::ReadHandle<xAOD::CaloClusterContainer>
inputClusterHandle(
m_inputKey
, ctx);
29
30
if
(inputClusterHandle.
isValid
()) {
31
ATH_MSG_DEBUG
(
"Retrieval of CaloClusterContainer was OK"
);
32
}
else
{
33
ATH_MSG_ERROR
(
"Retrieval of CaloClusterContainer failed"
);
34
return
StatusCode::FAILURE;
35
}
36
37
ATH_MSG_DEBUG
(
"Copying CaloClusters"
);
38
39
//make the container
40
SG::WriteHandle<xAOD::CaloClusterContainer>
outputClusterColl (
m_outputKey
, ctx );
41
ATH_CHECK
(
CaloClusterStoreHelper::AddContainerWriteHandle
(outputClusterColl));
42
// deep copy
43
std::unique_ptr<xAOD::CaloClusterContainer> copiedClusters = std::make_unique<xAOD::CaloClusterContainer>();
44
std::unique_ptr<xAOD::CaloClusterAuxContainer> copiedClustersAux = std::make_unique<xAOD::CaloClusterAuxContainer>();
45
46
copiedClusters->setStore (copiedClustersAux.get());
47
48
for
(
const
xAOD::CaloCluster
* cl : *inputClusterHandle){
49
std::unique_ptr<xAOD::CaloCluster> copiedCl = std::make_unique<xAOD::CaloCluster>(*cl);
50
outputClusterColl->push_back(std::move(copiedCl));
51
}
52
53
return
StatusCode::SUCCESS;
54
}
55
56
StatusCode
HIClusterCopier::finalize
()
57
{
58
return
StatusCode::SUCCESS;
59
}
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
HIClusterCopier.h
IParticleHelpers.h
ShallowAuxContainer.h
ShallowCopy.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
CaloClusterStoreHelper::AddContainerWriteHandle
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
Definition
CaloClusterStoreHelper.cxx:53
HIClusterCopier::m_inputKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inputKey
Name of input CaloClusterContainer, e.g HIClusters.
Definition
HIClusterCopier.h:32
HIClusterCopier::finalize
virtual StatusCode finalize()
Definition
HIClusterCopier.cxx:56
HIClusterCopier::execute
virtual StatusCode execute(const EventContext &ctx) const
Definition
HIClusterCopier.cxx:25
HIClusterCopier::m_outputKey
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputKey
Name of output CaloClusterContainer, e.g. DFHIClusters.
Definition
HIClusterCopier.h:34
HIClusterCopier::initialize
virtual StatusCode initialize()
Definition
HIClusterCopier.cxx:16
HIClusterCopier::HIClusterCopier
HIClusterCopier(const std::string &name, ISvcLocator *pSvcLocator)
Definition
HIClusterCopier.cxx:11
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
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