ATLAS Offline Software
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"
9 #include "xAODCore/ShallowCopy.h"
10 
11 HIClusterCopier::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
21 
22  return StatusCode::SUCCESS;
23 }
24 
25 StatusCode 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 }
ShallowCopy.h
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
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
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
ShallowAuxContainer.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:74
HIClusterCopier::m_outputKey
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputKey
Name of output CaloClusterContainer, e.g. DFHIClusters.
Definition: HIClusterCopier.h:34
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:62
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
HIClusterCopier::initialize
virtual StatusCode initialize()
Definition: HIClusterCopier.cxx:16
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
HIClusterCopier.h
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:240
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
CaloClusterStoreHelper.h
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
HIClusterCopier::execute
virtual StatusCode execute(const EventContext &ctx) const
Definition: HIClusterCopier.cxx:25
IParticleHelpers.h
HIClusterCopier::HIClusterCopier
HIClusterCopier(const std::string &name, ISvcLocator *pSvcLocator)
Definition: HIClusterCopier.cxx:11
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:25