ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
MuonSpectrometer
MuonPhaseII
MuonCnv
xAODMuonViewAlgs
src
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
"
5
#include <
AthContainers/ConstDataVector.h
>
6
namespace
MuonR4
{
7
8
StatusCode
SegmentViewAlg::initialize
(){
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
20
ConstDataVector<xAOD::MuonSegmentContainer>
viewCont{
SG::VIEW_ELEMENTS
};
21
for
(
const
SG::ReadHandleKey<xAOD::MuonSegmentContainer>
& key :
m_readKeys
) {
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
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ConstDataVector.h
DataVector adapter that acts like it holds const pointers.
SegmentViewAlg.h
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition
ConstDataVector.h:76
ConstDataVector::end
iterator end() noexcept
Return an iterator pointing past the end of the collection.
ConstDataVector::insert
iterator insert(iterator position, value_type pElem)
Add a new element to the collection.
ConstDataVector::asDataVector
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
MuonR4::SegmentViewAlg::m_readKeys
SG::ReadHandleKeyArray< xAOD::MuonSegmentContainer > m_readKeys
Definition
SegmentViewAlg.h:19
MuonR4::SegmentViewAlg::execute
StatusCode execute(const EventContext &ctx) const override final
Definition
SegmentViewAlg.cxx:18
MuonR4::SegmentViewAlg::initialize
StatusCode initialize() override final
Definition
SegmentViewAlg.cxx:8
MuonR4::SegmentViewAlg::m_writeKey
SG::WriteHandleKey< xAOD::MuonSegmentContainer > m_writeKey
Definition
SegmentViewAlg.h:20
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
MuonR4
This header ties the generic definitions in this package.
Definition
GlobalPattern.h:14
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
xAOD::MuonSegmentContainer
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
Definition
MuonSegmentContainer.h:14
Generated on
for ATLAS Offline Software by
1.17.0