ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsCollectionAlgs
src
TrackContainerReader.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "Acts/Geometry/TrackingGeometry.hpp"
6
7
#include "
TrackContainerReader.h
"
8
9
namespace
ActsTrk
{
10
11
StatusCode
TrackContainerReader::initialize
()
12
{
13
ATH_CHECK
(
m_trackingGeometrySvc
.retrieve());
14
ATH_CHECK
(
m_tracksKey
.initialize());
15
ATH_CHECK
(
m_ctxProvider
.initialize());
16
ATH_CHECK
(
m_tracksKey
.key().find(
"Tracks"
) != std::string::npos);
17
ATH_CHECK
(
m_tracksBackendHandlesHelper
.initialize(
ActsTrk::prefixFromTrackContainerName
(
m_tracksKey
.key())));
18
19
return
StatusCode::SUCCESS;
20
}
21
22
StatusCode
TrackContainerReader::execute
(
const
EventContext& context)
const
23
{
24
std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry =
m_trackingGeometrySvc
->trackingGeometry();
25
Acts::GeometryContext geoContext =
m_ctxProvider
.getGeometryContext(context);
26
27
// Create persistent (i.e. xAOD backended) track collection
28
std::unique_ptr<ActsTrk::PersistentTrackContainer> trackContainer =
m_tracksBackendHandlesHelper
.build(trackingGeometry.get(), geoContext, context);
29
ATH_MSG_DEBUG
(
"read track container size "
<< trackContainer->size());
30
31
// We convert to non-xAOD backend for StoreGate
32
// Transient declination
33
Acts::VectorTrackContainer trackBackend;
34
Acts::VectorMultiTrajectory trackStateBackend;
35
ActsTrk::MutableTrackContainer
tc
( std::move(trackBackend),
36
std::move(trackStateBackend) );
37
38
// copy
39
for
(
auto
track : *trackContainer ) {
40
auto
destProxy =
tc
.makeTrack();
41
destProxy.copyFrom(track);
42
}
43
44
// Constant declination
45
Acts::ConstVectorTrackContainer ctrackBackend( std::move(
tc
.container()) );
46
Acts::ConstVectorMultiTrajectory ctrackStateBackend( std::move(
tc
.trackStateContainer()) );
47
std::unique_ptr<ActsTrk::TrackContainer> ctc = std::make_unique<ActsTrk::TrackContainer>( std::move(ctrackBackend),
48
std::move(ctrackStateBackend) );
49
ATH_MSG_DEBUG
(
"store track container size "
<< ctc->size());
50
51
// Store
52
auto
handle =
SG::makeHandle
(
m_tracksKey
, context);
53
ATH_CHECK
(handle.record(std::move(ctc)));
54
return
StatusCode::SUCCESS;
55
}
56
57
}
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
tc
static Double_t tc
Definition
LArPhysWaveHECTool.cxx:38
TrackContainerReader.h
ActsTrk::TrackContainerReader::m_trackingGeometrySvc
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
Definition
TrackContainerReader.h:33
ActsTrk::TrackContainerReader::m_ctxProvider
ActsTrk::ContextUtility m_ctxProvider
Context provider for geometry, magnetic field and calibration contexts.
Definition
TrackContainerReader.h:37
ActsTrk::TrackContainerReader::m_tracksKey
SG::WriteHandleKey< ActsTrk::TrackContainer > m_tracksKey
Definition
TrackContainerReader.h:35
ActsTrk::TrackContainerReader::execute
virtual StatusCode execute(const EventContext &context) const override final
Definition
TrackContainerReader.cxx:22
ActsTrk::TrackContainerReader::m_tracksBackendHandlesHelper
ActsTrk::ConstTrackContainerHandlesHelper m_tracksBackendHandlesHelper
Definition
TrackContainerReader.h:34
ActsTrk::TrackContainerReader::initialize
virtual StatusCode initialize() override final
Definition
TrackContainerReader.cxx:11
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition
MdtCalibInput.h:31
ActsTrk::prefixFromTrackContainerName
std::string prefixFromTrackContainerName(const std::string &tracks)
Parse TrackContainer name to get the prefix for backends The name has to contain XYZTracks,...
Definition
TrackContainerHandlesHelper.cxx:20
ActsTrk::MutableTrackContainer
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
Definition
TrackContainer.h:25
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition
ReadCondHandle.h:269
Generated on
for ATLAS Offline Software by
1.17.0