ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Tracking
Acts
ActsEventCnv
src
SeedToTrackCnvAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include <vector>
6
#include "
ActsGeometry/SurfaceOfMeasurementUtil.h
"
7
#include "Acts/Definitions/Algebra.hpp"
8
#include "
xAODMeasurementBase/MeasurementDefs.h
"
9
10
#include "
AthenaBaseComps/AthMsgStreamMacros.h
"
11
#include "
AthenaPoolUtilities/CondAttrListCollection.h
"
12
#include "Acts/Surfaces/PerigeeSurface.hpp"
13
#include "Acts/Surfaces/Surface.hpp"
14
#include "
StoreGate/WriteHandle.h
"
15
16
#include "
ActsCalibrators/xAODUncalibMeasCalibrator.h
"
17
18
19
#include "
SeedToTrackCnvAlg.h
"
20
21
namespace
ActsTrk
{
22
23
StatusCode
SeedToTrackCnvAlg::initialize
()
24
{
25
ATH_CHECK
(
m_seedContainerKey
.initialize());
26
ATH_CHECK
(
m_trackContainerKey
.initialize());
27
ATH_CHECK
(
m_tracksBackendHandlesHelper
.initialize(
ActsTrk::prefixFromTrackContainerName
(
m_trackContainerKey
.key())));
28
ATH_CHECK
(
m_actsTrackParamsKey
.initialize());
29
ATH_CHECK
(
m_trackingGeometrySvc
.retrieve());
30
m_surfAcc
=
detail::xAODUncalibMeasSurfAcc
{
m_trackingGeometrySvc
.get()};
31
if
(
m_seedContainerKey
.size() !=
m_actsTrackParamsKey
.size()) {
32
ATH_MSG_ERROR
(
"Seed and Parameter containers have different sizes: "
33
<<
m_seedContainerKey
.size() <<
" for seeds and "
34
<<
m_actsTrackParamsKey
.size() <<
" for the parameters"
);
35
return
StatusCode::FAILURE;
36
}
37
38
39
return
StatusCode::SUCCESS;
40
}
41
42
43
StatusCode
SeedToTrackCnvAlg::execute
(
const
EventContext& context)
const
{
44
Acts::VectorTrackContainer trackBackend;
45
Acts::VectorMultiTrajectory trackStateBackend;
46
ActsTrk::MutableTrackContainer
tracksContainer( std::move(trackBackend),
47
std::move(trackStateBackend) );
48
49
for
(std::size_t i(0); i<
m_seedContainerKey
.size(); ++i) {
50
ATH_MSG_DEBUG
(
"Retrieving Seed Collection with key: "
<<
m_seedContainerKey
.at(i).key());
51
ATH_MSG_DEBUG
(
"Retrieving Track Parameter Estimation Collection with key: "
<<
m_actsTrackParamsKey
.at(i).key());
52
SG::ReadHandle<ActsTrk::SeedContainer>
seedsHandle =
SG::makeHandle
(
m_seedContainerKey
.at(i), context);
53
SG::ReadHandle<ActsTrk::BoundTrackParametersContainer>
parameterHandle =
SG::makeHandle
(
m_actsTrackParamsKey
.at(i), context);
54
ATH_CHECK
(seedsHandle.
isValid
());
55
ATH_CHECK
(parameterHandle.
isValid
());
56
57
for
(std::size_t seedIndex = 0 ; seedIndex < seedsHandle->size() ;++seedIndex){
58
ActsTrk::Seed
seed = seedsHandle->at(seedIndex);
59
const
Acts::BoundTrackParameters* paramsPointer = parameterHandle->at(seedIndex);
60
61
if
(paramsPointer ==
nullptr
) {
62
ATH_MSG_DEBUG
(
"Track Parameters is nullptr"
);
63
continue
;
64
}
65
66
auto
actsTrack = tracksContainer.makeTrack();
67
auto
& trackStateContainer = tracksContainer.trackStateContainer();
68
69
actsTrack.parameters() = paramsPointer->parameters();
70
actsTrack.covariance() = (*paramsPointer->covariance());
71
actsTrack.setReferenceSurface(paramsPointer->referenceSurface().getSharedPtr());
72
std::size_t tsosPreviousIndex = Acts::kTrackIndexInvalid;
73
for
(
const
xAOD::SpacePoint_v1
*
spacepoint
: seed.sp()) {
74
const
auto
& measurements =
spacepoint
->measurements();
75
for
(
const
xAOD::UncalibratedMeasurement
*umeas : measurements) {
76
const
Acts::Surface *surf =
m_surfAcc
.get(umeas);
77
assert(surf);
78
auto
actsTSOS = trackStateContainer.getTrackState(trackStateContainer.addTrackState(Acts::TrackStatePropMask::None, tsosPreviousIndex));
79
actsTSOS.setReferenceSurface(surf->getSharedPtr());
80
actsTSOS.setUncalibratedSourceLink(
detail::MeasurementCalibratorBase::pack
(umeas));
81
actsTSOS.typeFlags().setIsMeasurement();
82
actsTrack.tipIndex() = actsTSOS.index();
83
tsosPreviousIndex = actsTrack.tipIndex();
84
}
85
}
86
}
87
88
}
89
90
Acts::ConstVectorTrackContainer ctrackBackend( std::move(tracksContainer.container()) );
91
Acts::ConstVectorMultiTrajectory ctrackStateBackend( std::move(tracksContainer.trackStateContainer()) );
92
std::unique_ptr< ActsTrk::TrackContainer > ctracksContainer = std::make_unique< ActsTrk::TrackContainer >( std::move(ctrackBackend),
93
std::move(ctrackStateBackend) );
94
95
SG::WriteHandle<ActsTrk::TrackContainer>
trackContainerHandle =
SG::makeHandle
(
m_trackContainerKey
, context);
96
ATH_MSG_DEBUG
(
"Tracks Container `"
<<
m_trackContainerKey
.key() <<
"` created ..."
);
97
ATH_MSG_DEBUG
(
"Created container with size: "
<< ctracksContainer->size());
98
ATH_CHECK
(trackContainerHandle.
record
(std::move(ctracksContainer)));
99
if
(!trackContainerHandle.
isValid
())
100
{
101
ATH_MSG_FATAL
(
"Failed to write TrackContainer with key "
<<
m_trackContainerKey
.key());
102
return
StatusCode::FAILURE;
103
}
104
return
StatusCode::SUCCESS;
105
}
106
107
}
// namespace ActsTrk
108
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
AthMsgStreamMacros.h
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition
AthMsgStreamMacros.h:33
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition
AthMsgStreamMacros.h:34
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CondAttrListCollection.h
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
HitType::spacepoint
@ spacepoint
Definition
FPGATrackSimHit.h:39
MeasurementDefs.h
SeedToTrackCnvAlg.h
WriteHandle.h
Handle class for recording to StoreGate.
SurfaceOfMeasurementUtil.h
ActsTrk::SeedToTrackCnvAlg::m_trackingGeometrySvc
ServiceHandle< ActsTrk::ITrackingGeometrySvc > m_trackingGeometrySvc
Definition
SeedToTrackCnvAlg.h:49
ActsTrk::SeedToTrackCnvAlg::execute
virtual StatusCode execute(const EventContext &context) const override
Definition
SeedToTrackCnvAlg.cxx:43
ActsTrk::SeedToTrackCnvAlg::m_surfAcc
detail::xAODUncalibMeasSurfAcc m_surfAcc
Definition
SeedToTrackCnvAlg.h:43
ActsTrk::SeedToTrackCnvAlg::m_actsTrackParamsKey
SG::ReadHandleKeyArray< ActsTrk::BoundTrackParametersContainer > m_actsTrackParamsKey
Definition
SeedToTrackCnvAlg.h:46
ActsTrk::SeedToTrackCnvAlg::m_trackContainerKey
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
Definition
SeedToTrackCnvAlg.h:48
ActsTrk::SeedToTrackCnvAlg::m_seedContainerKey
SG::ReadHandleKeyArray< ActsTrk::SeedContainer > m_seedContainerKey
Definition
SeedToTrackCnvAlg.h:45
ActsTrk::SeedToTrackCnvAlg::initialize
virtual StatusCode initialize() override
Definition
SeedToTrackCnvAlg.cxx:23
ActsTrk::SeedToTrackCnvAlg::m_tracksBackendHandlesHelper
ActsTrk::MutableTrackContainerHandlesHelper m_tracksBackendHandlesHelper
Definition
SeedToTrackCnvAlg.h:44
ActsTrk::detail::MeasurementCalibratorBase::pack
static Acts::SourceLink pack(const Ptr_t &measurement)
Pack the measurement type pointer to an Acts::SourceLink including the intermediate conversion into a...
ActsTrk::detail::xAODUncalibMeasSurfAcc
Helper class to access the Acts::surface associated with an Uncalibrated xAOD measurement.
Definition
xAODUncalibMeasSurfAcc.h:22
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:73
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
xAOD::SpacePoint_v1
Definition
SpacePoint_v1.h:19
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
xAOD::UncalibratedMeasurement
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
Definition
UncalibratedMeasurementFwd.h:13
ActsTrk::Seed
Definition
SeedContainer.h:44
xAODUncalibMeasCalibrator.h
Generated on
for ATLAS Offline Software by
1.17.0