ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsEventCnv
src
xAODtoTrkConverterAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
#include "
xAODtoTrkConverterAlg.h
"
5
6
#include "
StoreGate/ReadHandle.h
"
7
#include "
StoreGate/WriteDecorHandle.h
"
8
#include "
StoreGate/WriteHandle.h
"
9
10
#include "
ActsEvent/Decoration.h
"
11
12
namespace
ActsTrk
{
13
StatusCode
xAODtoTrkConverterAlg::initialize
() {
14
ATH_CHECK
(
m_trackKey
.initialize());
15
ATH_CHECK
(
m_linkKey
.initialize());
16
ATH_CHECK
(
m_writeKey
.initialize());
17
ATH_CHECK
(
m_ATLASConverterTool
.retrieve());
18
return
StatusCode::SUCCESS;
19
}
20
StatusCode
xAODtoTrkConverterAlg::execute
(
const
EventContext& ctx)
const
{
21
const
xAOD::TrackParticleContainer
* inputTracks{
nullptr
};
22
ATH_CHECK
(
SG::get
(inputTracks,
m_trackKey
, ctx));
23
auto
convertedTracks = std::make_unique<TrackCollection>();
24
25
using
Link_t
=
ElementLink<TrackCollection>
;
26
SG::WriteDecorHandle<xAOD::TrackParticleContainer, Link_t>
dec_link{
m_linkKey
, ctx};
27
for
(
const
xAOD::TrackParticle
* inTrack: *inputTracks) {
28
// Create the dummy link
29
Link_t
& link = dec_link(*inTrack);
30
// Fetch the Acts track from the decorator
31
auto
actsTrk =
getActsTrack
(*inTrack);
32
if
(!actsTrk) {
33
ATH_MSG_ERROR
(
"Track particle without ACTS track decoration"
);
34
return
StatusCode::FAILURE;
35
}
36
// convert into trk track
37
auto
track =
m_ATLASConverterTool
->convertTrack(ctx, *actsTrk);
38
if
(!track) {
39
ATH_MSG_ERROR
(
"Track conversion failed."
);
40
return
StatusCode::FAILURE;
41
}
42
link =
Link_t
{*convertedTracks, convertedTracks->size()};
43
convertedTracks->push_back(std::move(track));
44
}
45
SG::WriteHandle
writeHandle{
m_writeKey
, ctx};
46
ATH_CHECK
(writeHandle.
record
(std::move(convertedTracks)));
47
return
StatusCode::SUCCESS;
48
}
49
50
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
Decoration.h
Link_t
ElementLink< xAOD::TruthParticleContainer > Link_t
Definition
MuonToTruthAssocAlg.cxx:14
ReadHandle.h
Handle class for reading from StoreGate.
WriteDecorHandle.h
Handle class for adding a decoration to an object.
WriteHandle.h
Handle class for recording to StoreGate.
ActsTrk::xAODtoTrkConverterAlg::m_trackKey
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackKey
Input read handle key collection.
Definition
xAODtoTrkConverterAlg.h:30
ActsTrk::xAODtoTrkConverterAlg::m_ATLASConverterTool
ToolHandle< ITrackConverterTool > m_ATLASConverterTool
Conversion tool to convert from Acts -> Trk tracks.
Definition
xAODtoTrkConverterAlg.h:36
ActsTrk::xAODtoTrkConverterAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
xAODtoTrkConverterAlg.cxx:20
ActsTrk::xAODtoTrkConverterAlg::m_linkKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_linkKey
Declare the data dependency on the trackLink.
Definition
xAODtoTrkConverterAlg.h:32
ActsTrk::xAODtoTrkConverterAlg::initialize
virtual StatusCode initialize() override final
Definition
xAODtoTrkConverterAlg.cxx:13
ActsTrk::xAODtoTrkConverterAlg::m_writeKey
SG::WriteHandleKey< TrackCollection > m_writeKey
Declare the output container of the track collection.
Definition
xAODtoTrkConverterAlg.h:34
ElementLink
ElementLink implementation for ROOT usage.
Definition
A/AthLinks/ElementLink.h:40
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition
StoreGate/StoreGate/WriteDecorHandle.h:100
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.
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ActsTrk::getActsTrack
std::optional< ActsTrk::TrackContainer::ConstTrackProxy > getActsTrack(const xAOD::TrackParticle &trkPart)
Return the proxy to the Acts track from which the track particle was made frome.
Definition
Decoration.cxx:9
SG::get
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
Definition
ReadCondHandle.h:282
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::TrackParticleContainer
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Definition
Event/xAOD/xAODTracking/xAODTracking/TrackParticleContainer.h:14
xAODtoTrkConverterAlg.h
Generated on
for ATLAS Offline Software by
1.17.0