ATLAS Offline Software
SegmentViewAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 #include "SegmentViewAlg.h"
6 namespace MuonR4 {
7 
8 
10  ATH_CHECK(m_readKeys.initialize());
11  ATH_CHECK(m_writeKey.initialize());
12  if (m_readKeys.empty()) {
13  ATH_MSG_FATAL("Please configure at least one read key");
14  return StatusCode::FAILURE;
15  }
16 
17  return StatusCode::SUCCESS;
18  }
19  StatusCode SegmentViewAlg::execute(const EventContext& ctx) const {
20 
23  SG::ReadHandle readHandle{key, ctx};
24  ATH_CHECK(readHandle.isPresent());
25  viewCont.insert(viewCont.end(), readHandle->begin(), readHandle->end());
26  }
27  SG::WriteHandle writeHandle{m_writeKey, ctx};
28  ATH_CHECK(writeHandle.record(std::make_unique<xAOD::MuonSegmentContainer>(*viewCont.asDataVector())));
29  return StatusCode::SUCCESS;
30  }
31 }
MuonR4::SegmentViewAlg::m_readKeys
SG::ReadHandleKeyArray< xAOD::MuonSegmentContainer > m_readKeys
Definition: SegmentViewAlg.h:19
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
SegmentViewAlg.h
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition: StoreGate/StoreGate/ReadHandleKey.h:39
MuonR4::SegmentViewAlg::execute
StatusCode execute(const EventContext &ctx) const override final
Definition: SegmentViewAlg.cxx:19
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonR4::SegmentViewAlg::initialize
StatusCode initialize() override final
Definition: SegmentViewAlg.cxx:9
MuonR4::SegmentViewAlg::m_writeKey
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_writeKey
Definition: SegmentViewAlg.h:20
MuonR4
This header ties the generic definitions in this package.
Definition: HoughEventData.h:16
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37