ATLAS Offline Software
AFPSiCluster.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 AFPSiCluster::AFPSiCluster(const std::string& name, ISvcLocator* pSvcLocator) :
8  AthReentrantAlgorithm(name, pSvcLocator)
9 {
10 }
11 
13 {
14 }
15 
17 {
18  ATH_MSG_DEBUG("in AFPSiCluster::initialize()");
20 
21  // reco track tool
22  if (m_clusterRecoTool.retrieve().isFailure()) {
23  ATH_MSG_WARNING("Failed to retrieve tool " << m_clusterRecoTool );
24  return StatusCode::FAILURE;
25  } else {
26  ATH_MSG_DEBUG("Retrieved tool " << m_clusterRecoTool );
27  }
28 
29  CHECK( m_clusterContainerKey.initialize() );
30 
31  return StatusCode::SUCCESS;
32 }
33 
35 {
36  return StatusCode::SUCCESS;
37 }
38 
39 StatusCode AFPSiCluster::execute(const EventContext& ctx) const
40 {
41  // reconstruct clusters
42  auto clustr=std::make_unique<xAOD::AFPSiHitsClusterContainer>();
43  auto clustrAux=std::make_unique<xAOD::AFPSiHitsClusterAuxContainer>();
44  clustr->setStore(clustrAux.get());
45 
46  if (m_clusterRecoTool->clusterHits(clustr, ctx).isFailure() ) {
47  ATH_MSG_WARNING("Pixel clusters creation failed. Aborting cluster reconstruction.");
48 
49  // create empty containers first
50  auto clustr2=std::make_unique<xAOD::AFPSiHitsClusterContainer>();
51  auto clustr2Aux=std::make_unique<xAOD::AFPSiHitsClusterAuxContainer>();
52  clustr2->setStore(clustr2Aux.get());
54  ATH_CHECK( cluster2Container.record(std::move(clustr2), std::move(clustr2Aux)) );
55 
56  return StatusCode::SUCCESS;
57  }
58 
60  ATH_CHECK( clusterContainer.record(std::move(clustr), std::move(clustrAux)) );
61 
62  return StatusCode::SUCCESS;
63 }
AFPSiCluster::finalize
virtual StatusCode finalize() override
Definition: AFPSiCluster.cxx:34
AFPSiCluster::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: AFPSiCluster.cxx:39
initialize
void initialize()
Definition: run_EoverP.cxx:894
AFPSiCluster::~AFPSiCluster
virtual ~AFPSiCluster() override
Definition: AFPSiCluster.cxx:12
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
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
AFPSiCluster::m_clusterRecoTool
ToolHandle< IAFPSiClusterTool > m_clusterRecoTool
Definition: AFPSiCluster.h:34
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
AFPSiCluster::m_clusterContainerKey
SG::WriteHandleKey< xAOD::AFPSiHitsClusterContainer > m_clusterContainerKey
Definition: AFPSiCluster.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AFPSiCluster::initialize
virtual StatusCode initialize() override
Definition: AFPSiCluster.cxx:16
AFPSiCluster.h
AFPSiCluster::AFPSiCluster
AFPSiCluster(const std::string &name, ISvcLocator *pSvcLocator)
Definition: AFPSiCluster.cxx:7