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");
29  SG::ReadHandle<ActsGeometryContext> gcx(m_geometryContextKey, ctx);
30  ATH_CHECK(gcx.isPresent());
31  Acts::GeometryContext tgContext = gcx->context();
32 
33 
34  ATH_MSG_VERBOSE("Loop over track collections");
35  for (auto handle : m_trackCollectionKeys.makeHandles(ctx)) {
36  ATH_CHECK(handle.isValid());
37  ATH_MSG_VERBOSE("Got back " << handle->size() << " tracks from "<< handle.key());
38 
39  m_convertorTool->trkTrackCollectionToActsTrackContainer(
40  tc, *handle, tgContext);
41  ATH_MSG_VERBOSE("multiTraj has " << tc.trackStateContainer().size() << " states");
42  }
43 
44  // // Let's dump some information for debugging (will be removed later)
45  ATH_MSG_VERBOSE("TrackStateContainer has " << tc.trackStateContainer().trackStatesAux()->size() << " states");
46  ATH_MSG_VERBOSE("TrackParametersContainer has " << tc.trackStateContainer().trackParametersAux()->size() << " parameters");
47 
48  std::unique_ptr<ActsTrk::TrackContainer> constTrackContainer = m_trackContainerBackendsHelper.moveToConst(std::move(tc), tgContext, ctx);
49  auto trackContainerHandle = SG::makeHandle(m_trackContainerKey, ctx);
50  ATH_MSG_VERBOSE("Saving " << constTrackContainer->size() << " tracks to "<< trackContainerHandle.key());
51  ATH_CHECK(trackContainerHandle.record(std::move(constTrackContainer)));
52  return StatusCode::SUCCESS;
53 }
ActsTrk::TrkToActsConvertorAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrkToActsConvertorAlg.cxx:24
TrackStateAuxContainer.h
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
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:18
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:51
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
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
SG::VarHandleBase::isPresent
bool isPresent() const
Is the referenced object present in SG?
Definition: StoreGate/src/VarHandleBase.cxx:394
ActsTrk::TrkToActsConvertorAlg::m_trackCollectionKeys
SG::ReadHandleKeyArray< TrackCollection > m_trackCollectionKeys
Definition: TrkToActsConvertorAlg.h:31
TrackJacobianAuxContainer.h
ActsTrk::MutableTrackContainer
Definition: TrackContainer.h:122
TrackParametersAuxContainer.h
IActsTrackingGeometryTool.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