ATLAS Offline Software
TrkCollectionAliasAlg.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // TrkCollectionAliasAlg.cxx, (c) ATLAS Detector software
8 
10 
11 //================ Constructor =================================================
12 
13 Trk::TrkCollectionAliasAlg::TrkCollectionAliasAlg(const std::string& name, ISvcLocator* pSvcLocator) :
14  AthReentrantAlgorithm(name,pSvcLocator)
15 {
16  // template for property decalration
17  declareProperty("CollectionName", m_collectionName = "ResolvedTracks");
18  declareProperty("AliasName" , m_aliasName = "Tracks");
19 }
20 
21 //================ Destructor =================================================
22 
24 = default;
25 
26 
27 //================ Initialisation =================================================
28 
30 {
31  ATH_CHECK( m_collectionName.initialize() );
32  ATH_CHECK( m_aliasName.initialize() );
33 
34  return StatusCode::SUCCESS;
35 }
36 
37 //================ Finalisation =================================================
38 
40 {
41  return StatusCode::SUCCESS;
42 }
43 
44 //================ Execution ====================================================
45 
46 StatusCode Trk::TrkCollectionAliasAlg::execute(const EventContext& ctx) const
47 {
48  SG::ReadHandle<TrackCollection> tracks(m_collectionName, ctx );
49  return tracks.alias(m_aliasName);
50 }
51 
52 //============================================================================================
53 
Trk::TrkCollectionAliasAlg::execute
StatusCode execute(const EventContext &ctx) const
standard Athena-Algorithm method
Definition: TrkCollectionAliasAlg.cxx:46
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
Trk::TrkCollectionAliasAlg::finalize
StatusCode finalize()
standard Athena-Algorithm method
Definition: TrkCollectionAliasAlg.cxx:39
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
TrkCollectionAliasAlg.h
Trk::TrkCollectionAliasAlg::m_aliasName
SG::WriteHandleKey< TrackCollection > m_aliasName
Definition: TrkCollectionAliasAlg.h:54
Trk::TrkCollectionAliasAlg::m_collectionName
SG::ReadHandleKey< TrackCollection > m_collectionName
member variables for algorithm properties:
Definition: TrkCollectionAliasAlg.h:51
Trk::TrkCollectionAliasAlg::TrkCollectionAliasAlg
TrkCollectionAliasAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Definition: TrkCollectionAliasAlg.cxx:13
Trk::TrkCollectionAliasAlg::~TrkCollectionAliasAlg
~TrkCollectionAliasAlg()
Default Destructor.
Trk::TrkCollectionAliasAlg::initialize
StatusCode initialize()
standard Athena-Algorithm method
Definition: TrkCollectionAliasAlg.cxx:29
SG::ReadHandle::alias
StatusCode alias(const WriteHandleKey< T > &key)
Make an alias.