ATLAS Offline Software
TrkToActsConvertorAlg.cxx
Go to the documentation of this file.
1 /*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 #include "Acts/EventData/VectorTrackContainer.hpp"
14 
16  ATH_CHECK(m_trackCollectionKeys.initialize());
18  ATH_CHECK(m_convertorTool.retrieve());
21  return StatusCode::SUCCESS;
22 }
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  SG::ReadHandle<ActsGeometryContext> gcx = SG::makeHandle(m_geometryContextKey, ctx);
34  ATH_CHECK(gcx.isPresent());
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 }
ActsTrk::TrkToActsConvertorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrkToActsConvertorAlg.cxx:24
TrackStateAuxContainer.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
ActsTrk::MutableTrackContainer
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
Definition: TrackContainer.h:26
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
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
ActsTrk::MutableTrackContainerHandlesHelper::initialize
StatusCode initialize(const std::string &prefix)
Sets up the handles.
Definition: TrackContainerHandlesHelper.cxx:47
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
ActsGeometryContext::context
Acts::GeometryContext context() const
Definition: ActsGeometryContext.h:45
ActsTrk::TrkToActsConvertorAlg::m_trackContainerBackendsHelper
ActsTrk::MutableTrackContainerHandlesHelper m_trackContainerBackendsHelper
Definition: TrkToActsConvertorAlg.h:39
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ActsTrk::TrkToActsConvertorAlg::m_convertorTool
ToolHandle< IActsToTrkConverterTool > m_convertorTool
Definition: TrkToActsConvertorAlg.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TrkToActsConvertorAlg.h
TrackMeasurementAuxContainer.h
MultiTrajectory.h
ActsTrk::TrkToActsConvertorAlg::m_geometryContextKey
SG::ReadHandleKey< ActsGeometryContext > m_geometryContextKey
Definition: TrkToActsConvertorAlg.h:36
ITrackingGeometryTool.h
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:400
ActsTrk::TrkToActsConvertorAlg::m_trackCollectionKeys
SG::ReadHandleKeyArray< TrackCollection > m_trackCollectionKeys
Definition: TrkToActsConvertorAlg.h:31
TrackJacobianAuxContainer.h
TrackParametersAuxContainer.h
ActsTrk::TrkToActsConvertorAlg::initialize
virtual StatusCode initialize() override
Definition: TrkToActsConvertorAlg.cxx:15
ActsTrk::TrkToActsConvertorAlg::m_trackContainerKey
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
Definition: TrkToActsConvertorAlg.h:38