ATLAS Offline Software
Loading...
Searching...
No Matches
MuonInDetExtensionMergerAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
6MuonInDetExtensionMergerAlg::MuonInDetExtensionMergerAlg(const std::string& name, ISvcLocator* pSvcLocator) :
7 AthReentrantAlgorithm(name, pSvcLocator) {}
8
10 ATH_CHECK(m_inputCandidates.initialize());
11 ATH_CHECK(m_writeKey.initialize());
12 return StatusCode::SUCCESS;
13}
14
15StatusCode MuonInDetExtensionMergerAlg::execute(const EventContext& ctx) const {
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());
27 ATH_CHECK(writeHandle.record(std::move(output_coll)));
28 return StatusCode::SUCCESS;
29}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
DataVector adapter that acts like it holds const pointers.
An algorithm that can be simultaneously executed in multiple threads.
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.
StatusCode execute(const EventContext &ctx) const override
MuonInDetExtensionMergerAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKeyArray< InDetCandidateCollection > m_inputCandidates
SG::WriteHandleKey< InDetCandidateCollection > m_writeKey
Output Key.
Property holding a SG store/key/clid from which a ReadHandle is made.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts