ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetRecAlgs
InDetTrackPRD_Association
src
InDetTrackPRD_Association.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
InDetTrackPRD_Association/InDetTrackPRD_Association.h
"
6
#include "
TrkEventUtils/PRDtoTrackMap.h
"
7
9
// Constructor
11
12
InDet::InDetTrackPRD_Association::InDetTrackPRD_Association
13
(
const
std::string& name,ISvcLocator* pSvcLocator)
14
:
AthReentrantAlgorithm
(name, pSvcLocator)
15
{}
16
17
StatusCode
InDet::InDetTrackPRD_Association::initialize
()
18
{
19
20
21
ATH_CHECK
(
m_tracksName
.initialize());
22
ATH_CHECK
(
m_assoMapName
.initialize());
23
ATH_CHECK
(
m_assoTool
.retrieve());
24
25
return
StatusCode::SUCCESS;
26
}
27
28
StatusCode
InDet::InDetTrackPRD_Association::execute
(
const
EventContext& ctx)
const
29
{
30
// Associate tracks with PRDs
31
//
32
std::unique_ptr<Trk::PRDtoTrackMap> prd_to_track_map(
m_assoTool
->createPRDtoTrackMap());
33
34
for
(
const
SG::ReadHandleKey<TrackCollection>
& collKey :
m_tracksName
) {
35
SG::ReadHandle<TrackCollection>
tracks(collKey,ctx);
36
if
(!tracks.
isValid
())
return
StatusCode::FAILURE;
37
38
unsigned
tracksPRD=0;
39
unsigned
tracksPRDn=0;
40
41
for
(
const
Trk::Track
* t : *tracks) {
42
if
((
m_assoTool
->addPRDs(*prd_to_track_map,*t)).isFailure()){
43
++tracksPRDn;
44
}
45
else
{
46
++tracksPRD;
47
}
48
}
49
ATH_MSG_DEBUG
(
"Collection "
<< collKey.key() <<
": tracks with PRD "
<< tracksPRD
50
<<
", without PRD "
<< tracksPRDn);
51
}
52
SG::WriteHandle<Trk::PRDtoTrackMap>
write_handle(
m_assoMapName
, ctx);
53
if
(write_handle.
record
(
m_assoTool
->reduceToStorableMap(std::move(prd_to_track_map))).isFailure()) {
54
ATH_MSG_FATAL
(
"Failed to add PRD to track association map."
);
55
}
56
return
StatusCode::SUCCESS;
57
}
58
59
StatusCode
InDet::InDetTrackPRD_Association::finalize
() {
return
StatusCode::SUCCESS;}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:28
InDetTrackPRD_Association.h
PRDtoTrackMap.h
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition
AthReentrantAlgorithm.h:74
InDet::InDetTrackPRD_Association::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition
InDetTrackPRD_Association.cxx:28
InDet::InDetTrackPRD_Association::InDetTrackPRD_Association
InDetTrackPRD_Association(const std::string &name, ISvcLocator *pSvcLocator)
Definition
InDetTrackPRD_Association.cxx:13
InDet::InDetTrackPRD_Association::initialize
virtual StatusCode initialize() override
Definition
InDetTrackPRD_Association.cxx:17
InDet::InDetTrackPRD_Association::finalize
virtual StatusCode finalize() override
Definition
InDetTrackPRD_Association.cxx:59
InDet::InDetTrackPRD_Association::m_tracksName
SG::ReadHandleKeyArray< TrackCollection > m_tracksName
Name of track collections.
Definition
InDetTrackPRD_Association.h:53
InDet::InDetTrackPRD_Association::m_assoMapName
SG::WriteHandleKey< Trk::PRDtoTrackMap > m_assoMapName
the key given to the newly created association map
Definition
InDetTrackPRD_Association.h:60
InDet::InDetTrackPRD_Association::m_assoTool
ToolHandle< Trk::IPRDtoTrackMapTool > m_assoTool
Definition
InDetTrackPRD_Association.h:56
SG::ReadHandleKey
Property holding a SG store/key/clid from which a ReadHandle is made.
Definition
StoreGate/StoreGate/ReadHandleKey.h:40
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Trk::Track
The ATLAS Track class.
Definition
Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
Generated on
for ATLAS Offline Software by
1.17.0