ATLAS Offline Software
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 
10 MergeEFMuonsAlg::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 
24 StatusCode 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 }
xAOD::muon
@ muon
Definition: TrackingPrimitives.h:195
MergeEFMuonsAlg.h
MergeEFMuonsAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
execute the filter alg
Definition: MergeEFMuonsAlg.cxx:24
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MergeEFMuonsAlg::MergeEFMuonsAlg
MergeEFMuonsAlg(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Definition: MergeEFMuonsAlg.cxx:10
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce
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)
Definition: AthCommonDataStore.h:380
xAOD::Muon_v1
Class describing a Muon.
Definition: Muon_v1.h:38
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
MuonAuxContainer.h
MergeEFMuonsAlg::m_muonInsideOutContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonInsideOutContainerKey
Definition: MergeEFMuonsAlg.h:31
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MergeEFMuonsAlg::m_muonOutputKey
SG::WriteHandleKey< xAOD::MuonContainer > m_muonOutputKey
Definition: MergeEFMuonsAlg.h:32
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::ReadHandle::ptr
const_pointer_type ptr()
Dereference the pointer.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
MergeEFMuonsAlg::initialize
virtual StatusCode initialize() override
initialize
Definition: MergeEFMuonsAlg.cxx:15
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
MergeEFMuonsAlg::m_muonCBContainerKey
SG::ReadHandleKey< xAOD::MuonContainer > m_muonCBContainerKey
Definition: MergeEFMuonsAlg.h:30