ATLAS Offline Software
Loading...
Searching...
No Matches
ActsToXAODTrackConverterAlg.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7namespace ActsTrk {
8
10 ISvcLocator *pSvcLocator)
11 : AthReentrantAlgorithm(name, pSvcLocator)
12 {}
13
15 {
16 ATH_MSG_DEBUG( "Initializing " << name() << " ..." );
17
18 ATH_CHECK( m_inputTrackContainerKey.initialize() );
20
23
24 return StatusCode::SUCCESS;
25 }
26
27 StatusCode ActsToXAODTrackConverterAlg::execute(const EventContext &ctx) const
28 {
29 ATH_MSG_DEBUG( "Executing " << name() << " ..." );
30
31 // Read inputs
33 ATH_CHECK( inputTracksHandle.isValid() );
34 const ActsTrk::TrackContainer* actsTracks = inputTracksHandle.cptr();
35
36 // Convert to xAOD version
38 for ( auto track : *actsTracks ) {
39 auto destProxy = tracksContainer.makeTrack();
40 destProxy.copyFrom(track);
41 }
42 ATH_MSG_DEBUG(" \\__ Converted " << tracksContainer.size() << " tracks");
43
44 // Make const
45 std::unique_ptr< ActsTrk::PersistentTrackContainer > constTracksContainer = m_tracksBackendHandlesHelper.moveToConst( std::move(tracksContainer),
46 m_trackingGeometryTool->getGeometryContext(ctx).context(),
47 ctx );
48
49 // Store into StoreGate
51 ATH_CHECK( trackContainerHandle.record(std::move(constTracksContainer)) );
52 return StatusCode::SUCCESS;
53 }
54
55} // namespace
56
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
SG::WriteHandleKey< ActsTrk::PersistentTrackContainer > m_outputTrackContainerKey
virtual StatusCode execute(const EventContext &ctx) const override
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
ActsTrk::MutableTrackContainerHandlesHelper m_tracksBackendHandlesHelper
ActsToXAODTrackConverterAlg(const std::string &name, ISvcLocator *pSvcLocator)
SG::ReadHandleKey< ActsTrk::TrackContainer > m_inputTrackContainerKey
An algorithm that can be simultaneously executed in multiple threads.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::string prefixFromTrackContainerName(const std::string &tracks)
Parse TrackContainer name to get the prefix for backends The name has to contain XYZTracks,...
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())