ATLAS Offline Software
Loading...
Searching...
No Matches
MergeEFMuonsAlg.cxx
Go to the documentation of this file.
1/*
2 Merge muon containers from inside-out and outside-in reconstruction
3
4 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5*/
6
7#include "MergeEFMuonsAlg.h"
9
10MergeEFMuonsAlg::MergeEFMuonsAlg(const std::string& name, ISvcLocator* pSvcLocator )
11:AthReentrantAlgorithm(name, pSvcLocator)
12{
13}
14
16
17 ATH_CHECK(m_muonCBContainerKey.initialize());
20 ATH_CHECK(m_muonOutputKey.initialize());
21 return StatusCode::SUCCESS;
22}
23
24StatusCode MergeEFMuonsAlg::execute(const EventContext& ctx) const
25{
26
28 ATH_CHECK(wh_outmuons.record(std::make_unique<xAOD::MuonContainer>(), std::make_unique<xAOD::MuonAuxContainer>()));
29 xAOD::MuonContainer *muonsout = wh_outmuons.ptr();
30
32 if(rh_cbmuons.isValid()){
33 const xAOD::MuonContainer *cbMuons = rh_cbmuons.ptr();
34 ATH_MSG_DEBUG("adding outside-in muons with size: "<<cbMuons->size());
35 for(auto muon : *cbMuons){
36 muonsout->push_back(new xAOD::Muon(*muon));
37 }
38 }
39
41 if(rh_insideoutmuons.isValid()){
42 const xAOD::MuonContainer *insideOutMuons = rh_insideoutmuons.ptr();
43 ATH_MSG_DEBUG("adding inside-out muons with size: "<<insideOutMuons->size());
44 for(auto muon : *insideOutMuons){
45 muonsout->push_back(new xAOD::Muon(*muon));
46 }
47 }
48
49 return StatusCode::SUCCESS;
50
51}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
An algorithm that can be simultaneously executed in multiple threads.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
SG::WriteHandleKey< xAOD::MuonContainer > m_muonOutputKey
virtual StatusCode initialize() override
initialize
virtual StatusCode execute(const EventContext &ctx) const override
execute the filter alg
SG::ReadHandleKey< xAOD::MuonContainer > m_muonCBContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonInsideOutContainerKey
MergeEFMuonsAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
const_pointer_type ptr()
Dereference the pointer.
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.
pointer_type ptr()
Dereference the pointer.
Muon_v1 Muon
Reference the current persistent version:
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".