ATLAS Offline Software
MuonCombinedMuonCandidateAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 MuonCombinedMuonCandidateAlg::MuonCombinedMuonCandidateAlg(const std::string& name, ISvcLocator* pSvcLocator) :
8  AthReentrantAlgorithm(name, pSvcLocator) {}
9 
11  ATH_CHECK(m_muonCandidateTool.retrieve());
14  ATH_CHECK(m_msOnlyTracks.initialize());
15  return StatusCode::SUCCESS;
16 }
17 
18 StatusCode MuonCombinedMuonCandidateAlg::execute(const EventContext& ctx) const {
19  // retrieve MuonSpectrometer tracks
21  if (!muonTrackParticles.isValid()) {
22  ATH_MSG_ERROR("Could not read " << m_muonTrackParticleLocation);
23  return StatusCode::FAILURE;
24  }
25  if (!muonTrackParticles.isPresent()) {
27  return StatusCode::SUCCESS;
28  }
30  ATH_CHECK(muonCandidates.record(std::make_unique<MuonCandidateCollection>()));
32  ATH_CHECK(msOnlyTracks.record(std::make_unique<TrackCollection>()));
33  m_muonCandidateTool->create(*muonTrackParticles, *muonCandidates, *msOnlyTracks, ctx);
34 
35  return StatusCode::SUCCESS;
36 }
MuonCombinedMuonCandidateAlg::m_msOnlyTracks
SG::WriteHandleKey< TrackCollection > m_msOnlyTracks
Definition: MuonCombinedMuonCandidateAlg.h:46
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
MuonCombinedMuonCandidateAlg::execute
StatusCode execute(const EventContext &ctx) const override
Definition: MuonCombinedMuonCandidateAlg.cxx:18
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
MuonCombinedMuonCandidateAlg::m_candidateCollectionName
SG::WriteHandleKey< MuonCandidateCollection > m_candidateCollectionName
Definition: MuonCombinedMuonCandidateAlg.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
MuonCombinedMuonCandidateAlg::MuonCombinedMuonCandidateAlg
MuonCombinedMuonCandidateAlg(const std::string &name, ISvcLocator *pSvcLocator)
Definition: MuonCombinedMuonCandidateAlg.cxx:7
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MuonCombinedMuonCandidateAlg::initialize
StatusCode initialize() override
Definition: MuonCombinedMuonCandidateAlg.cxx:10
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
MuonCombinedMuonCandidateAlg::m_muonTrackParticleLocation
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_muonTrackParticleLocation
Definition: MuonCombinedMuonCandidateAlg.h:34
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
MuonCombinedMuonCandidateAlg.h
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:397
MuonCombinedMuonCandidateAlg::m_muonCandidateTool
ToolHandle< MuonCombined::IMuonCandidateTool > m_muonCandidateTool
Definition: MuonCombinedMuonCandidateAlg.h:29