ATLAS Offline Software
Loading...
Searching...
No Matches
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"
10
11HIClusterCopier::HIClusterCopier(const std::string& name, ISvcLocator* pSvcLocator)
12 : AthReentrantAlgorithm(name,pSvcLocator)
13{
14}
15
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
25StatusCode HIClusterCopier::execute(const EventContext &ctx) const
26{
27 // retrieve input
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
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
57{
58 return StatusCode::SUCCESS;
59}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
An algorithm that can be simultaneously executed in multiple threads.
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_inputKey
Name of input CaloClusterContainer, e.g HIClusters.
virtual StatusCode finalize()
virtual StatusCode execute(const EventContext &ctx) const
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputKey
Name of output CaloClusterContainer, e.g. DFHIClusters.
virtual StatusCode initialize()
HIClusterCopier(const std::string &name, ISvcLocator *pSvcLocator)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.