ATLAS Offline Software
Loading...
Searching...
No Matches
TrkToActsConvertorAlg.cxx
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include "Acts/EventData/VectorTrackContainer.hpp"
14
23
25 const EventContext& ctx) const {
26
27 ATH_MSG_VERBOSE("About to create trackContainer");
28 Acts::VectorTrackContainer trackBackend;
29 Acts::VectorMultiTrajectory trackStateBackend;
30 ActsTrk::MutableTrackContainer tc( std::move(trackBackend),
31 std::move(trackStateBackend) );
32
33 const GeometryContext* gcx{};
35 Acts::GeometryContext tgContext = gcx->context();
36
37
38 ATH_MSG_VERBOSE("Loop over track collections");
39 for (auto handle : m_trackCollectionKeys.makeHandles(ctx)) {
40 ATH_CHECK(handle.isValid());
41 ATH_MSG_VERBOSE("Got back " << handle->size() << " tracks from "<< handle.key());
42
43 m_convertorTool->trkTrackCollectionToActsTrackContainer(
44 tc, *handle, tgContext);
45 ATH_MSG_VERBOSE("multiTraj has " << tc.trackStateContainer().size() << " states");
46 }
47
48 Acts::ConstVectorTrackContainer ctrackBackend( std::move(tc.container()) );
49 Acts::ConstVectorMultiTrajectory ctrackStateBackend( std::move(tc.trackStateContainer()) );
50 std::unique_ptr< ActsTrk::TrackContainer > constTrackContainer = std::make_unique< ActsTrk::TrackContainer >( std::move(ctrackBackend),
51 std::move(ctrackStateBackend) );
52
53 auto trackContainerHandle = SG::makeHandle(m_trackContainerKey, ctx);
54 ATH_MSG_VERBOSE("Saving " << constTrackContainer->size() << " tracks to "<< trackContainerHandle.key());
55 ATH_CHECK(trackContainerHandle.record(std::move(constTrackContainer)));
56 return StatusCode::SUCCESS;
57}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
static Double_t tc
Acts::GeometryContext context() const
virtual StatusCode initialize() override
ToolHandle< IActsToTrkConverterTool > m_convertorTool
virtual StatusCode execute(const EventContext &ctx) const override
ActsTrk::MutableTrackContainerHandlesHelper m_trackContainerBackendsHelper
SG::ReadHandleKey< GeometryContext > m_geometryContextKey
SG::ReadHandleKeyArray< TrackCollection > m_trackCollectionKeys
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
std::string prefixFromTrackContainerName(const std::string &tracks)
Parse TrackContainer name to get the prefix for backends The name has to contain XYZTracks,...
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())