ATLAS Offline Software
Loading...
Searching...
No Matches
SegmentViewAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#include "SegmentViewAlg.h"
6namespace MuonR4 {
7
9 ATH_CHECK(m_readKeys.initialize());
10 ATH_CHECK(m_writeKey.initialize());
11 if (m_readKeys.empty()) {
12 ATH_MSG_FATAL("Please configure at least one read key");
13 return StatusCode::FAILURE;
14 }
15
16 return StatusCode::SUCCESS;
17 }
18 StatusCode SegmentViewAlg::execute(const EventContext& ctx) const {
19
22 const xAOD::MuonSegmentContainer* segCont{nullptr};
23 ATH_CHECK(SG::get(segCont, key, ctx));
24 viewCont.insert(viewCont.end(), segCont->begin(), segCont->end());
25 }
26 SG::WriteHandle writeHandle{m_writeKey, ctx};
27 ATH_CHECK(writeHandle.record(std::make_unique<xAOD::MuonSegmentContainer>(*viewCont.asDataVector())));
28 return StatusCode::SUCCESS;
29 }
30}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
DataVector adapter that acts like it holds const pointers.
DataVector adapter that acts like it holds const pointers.
iterator end() noexcept
Return an iterator pointing past the end of the collection.
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
SG::ReadHandleKeyArray< xAOD::MuonSegmentContainer > m_readKeys
StatusCode execute(const EventContext &ctx) const override final
StatusCode initialize() override final
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_writeKey
Property holding a SG store/key/clid from which a ReadHandle is made.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
This header ties the generic definitions in this package.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".