ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Reconstruction
MuonIdentification
MuonCombinedAlgs
src
MuonInDetExtensionMergerAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
MuonInDetExtensionMergerAlg.h
"
5
#include "
AthContainers/ConstDataVector.h
"
6
MuonInDetExtensionMergerAlg::MuonInDetExtensionMergerAlg
(
const
std::string& name, ISvcLocator* pSvcLocator) :
7
AthReentrantAlgorithm
(name, pSvcLocator) {}
8
9
StatusCode
MuonInDetExtensionMergerAlg::initialize
() {
10
ATH_CHECK
(
m_inputCandidates
.initialize());
11
ATH_CHECK
(
m_writeKey
.initialize());
12
return
StatusCode::SUCCESS;
13
}
14
15
StatusCode
MuonInDetExtensionMergerAlg::execute
(
const
EventContext& ctx)
const
{
16
ConstDataVector<InDetCandidateCollection>
merged{
SG::VIEW_ELEMENTS
};
17
for
(
const
SG::ReadHandleKey<InDetCandidateCollection>
& key :
m_inputCandidates
) {
18
SG::ReadHandle<InDetCandidateCollection>
readHandle{key, ctx};
19
if
(!readHandle.
isValid
()) {
20
ATH_MSG_FATAL
(
"Failed to retrieve InDetCandidates from storegate "
<<key.fullKey());
21
return
StatusCode::FAILURE;
22
}
23
merged.
insert
(merged.
end
(), readHandle->begin(), readHandle->end());
24
}
25
std::unique_ptr<InDetCandidateCollection> output_coll = std::make_unique<InDetCandidateCollection>(*merged.
asDataVector
());
26
SG::WriteHandle<InDetCandidateCollection>
writeHandle{
m_writeKey
, ctx};
27
ATH_CHECK
(writeHandle.
record
(std::move(output_coll)));
28
return
StatusCode::SUCCESS;
29
}
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.
MuonInDetExtensionMergerAlg.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
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.
MuonInDetExtensionMergerAlg::initialize
StatusCode initialize() override
Definition
MuonInDetExtensionMergerAlg.cxx:9
MuonInDetExtensionMergerAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition
MuonInDetExtensionMergerAlg.cxx:15
MuonInDetExtensionMergerAlg::MuonInDetExtensionMergerAlg
MuonInDetExtensionMergerAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition
MuonInDetExtensionMergerAlg.cxx:6
MuonInDetExtensionMergerAlg::m_inputCandidates
SG::ReadHandleKeyArray< InDetCandidateCollection > m_inputCandidates
Definition
MuonInDetExtensionMergerAlg.h:26
MuonInDetExtensionMergerAlg::m_writeKey
SG::WriteHandleKey< InDetCandidateCollection > m_writeKey
Output Key.
Definition
MuonInDetExtensionMergerAlg.h:28
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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.
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition
OwnershipPolicy.h:18
Generated on
for ATLAS Offline Software by
1.17.0