ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
EFTracking
FPGATrackSim
FPGATrackSimPrototrackFitter
src
FPGATrackSimPrototrackFitterAlg.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
FPGATrackSimPrototrackFitterAlg.h
"
6
7
#include "
ActsCalibBase/CalibrationContext.h
"
8
9
constexpr
bool
enableBenchmark
=
10
#ifdef BENCHMARK_FPGATRACKSIM
11
true
;
12
#else
13
false
;
14
#endif
15
16
StatusCode
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::initialize
() {
17
ATH_CHECK
(
m_trackContainerKey
.initialize());
18
ATH_CHECK
(
m_tracksBackendHandlesHelper
.initialize(
ActsTrk::prefixFromTrackContainerName
(
m_trackContainerKey
.key())));
19
ATH_CHECK
(
m_actsFitter
.retrieve());
20
ATH_CHECK
(
m_ctxProvider
.initialize());
21
ATH_CHECK
(
m_ProtoTrackCollectionFromFPGAKey
.initialize());
22
ATH_CHECK
(
m_chrono
.retrieve());
23
return
StatusCode::SUCCESS;
24
}
25
26
StatusCode
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::execute
(
const
EventContext & ctx)
const
27
{
28
29
SG::WriteHandle<ActsTrk::TrackContainer>
trackContainerHandle (
m_trackContainerKey
, ctx);
30
SG::ReadHandle<ActsTrk::ProtoTrackCollection>
myProtoTracks(
m_ProtoTrackCollectionFromFPGAKey
,ctx);
31
32
if
(!myProtoTracks.
isValid
()){
33
ATH_MSG_WARNING
(
"no Prototrack collections"
);
34
return
StatusCode::SUCCESS;
35
}
36
ATH_MSG_DEBUG
(
"I received "
<<myProtoTracks->size()<<
" proto-tracks"
);
37
38
48
const
Acts::GeometryContext tgContext =
m_ctxProvider
.getGeometryContext(ctx);
49
const
Acts::MagneticFieldContext mfContext =
m_ctxProvider
.getMagneticFieldContext(ctx);
50
const
Acts::CalibrationContext calContext{
m_ctxProvider
.getCalibrationContext(ctx)};
51
54
Acts::VectorTrackContainer trackBackend;
55
Acts::VectorMultiTrajectory trackStateBackend;
56
ActsTrk::MutableTrackContainer
trackContainer( std::move(trackBackend),
57
std::move(trackStateBackend) );
58
59
if
constexpr
(
enableBenchmark
)
m_chrono
->chronoStart(
"FPGATrackSimPrototrackFitterAlg: ACTS KF"
);
60
61
bool
initializedColumns =
false
;
62
// now we fit each of the proto tracks
63
for
(
auto
& proto : *myProtoTracks){
64
auto
res
=
m_actsFitter
->fit(proto.measurements, *proto.parameters,
65
tgContext, mfContext, calContext);
66
67
if
(!
res
)
continue
;
68
if
(
res
->size() == 0 )
continue
;
69
if
(proto.measurements.empty())
continue
;
70
ATH_MSG_DEBUG
(
".......Done track with size "
<< proto.measurements.size());
71
const
auto
trackProxy =
res
->getTrack(0);
72
if
(not trackProxy.hasReferenceSurface()) {
73
ATH_MSG_INFO
(
"There is not reference surface for this track"
);
74
continue
;
75
}
76
if
(!initializedColumns) {
77
trackContainer.ensureDynamicColumns(*
res
);
78
initializedColumns =
true
;
79
}
80
81
auto
destProxy = trackContainer.getTrack(trackContainer.addTrack());
82
destProxy.copyFrom(trackProxy);
83
}
84
if
constexpr
(
enableBenchmark
)
m_chrono
->chronoStop(
"FPGATrackSimPrototrackFitterAlg: ACTS KF"
);
85
86
// convert to const
87
Acts::ConstVectorTrackContainer ctrackBackend( std::move(trackContainer.container()) );
88
Acts::ConstVectorMultiTrajectory ctrackStateBackend( std::move(trackContainer.trackStateContainer()) );
89
std::unique_ptr<ActsTrk::TrackContainer> constTracksContainer = std::make_unique<ActsTrk::TrackContainer>( std::move(ctrackBackend),
90
std::move(ctrackStateBackend) );
91
92
ATH_CHECK
(trackContainerHandle.
record
(std::move(constTracksContainer)));
93
94
return
StatusCode::SUCCESS;
95
}
96
97
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CalibrationContext.h
FPGATrackSimPrototrackFitterAlg.h
res
std::pair< std::vector< unsigned int >, bool > res
Definition
JetGroupProductTest.cxx:11
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::m_trackContainerKey
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
Definition
FPGATrackSimPrototrackFitterAlg.h:38
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::m_actsFitter
ToolHandle< ActsTrk::IFitterTool > m_actsFitter
Definition
FPGATrackSimPrototrackFitterAlg.h:36
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::execute
virtual StatusCode execute(const EventContext &ctx) const override final
Definition
FPGATrackSimPrototrackFitterAlg.cxx:26
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::m_ProtoTrackCollectionFromFPGAKey
SG::ReadHandleKey< ActsTrk::ProtoTrackCollection > m_ProtoTrackCollectionFromFPGAKey
Definition
FPGATrackSimPrototrackFitterAlg.h:42
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::m_tracksBackendHandlesHelper
ActsTrk::MutableTrackContainerHandlesHelper m_tracksBackendHandlesHelper
Definition
FPGATrackSimPrototrackFitterAlg.h:40
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::initialize
virtual StatusCode initialize() override final
uncomment and implement methods as required
Definition
FPGATrackSimPrototrackFitterAlg.cxx:16
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::m_ctxProvider
ActsTrk::ContextUtility m_ctxProvider
Utility to fetch the geometry, magnetic field and calibration context in the event.
Definition
FPGATrackSimPrototrackFitterAlg.h:34
FPGATrackSim::FPGATrackSimPrototrackFitterAlg::m_chrono
ServiceHandle< IChronoStatSvc > m_chrono
Definition
FPGATrackSimPrototrackFitterAlg.h:44
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.
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:21
ActsTrk::MutableTrackContainer
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
Definition
TrackContainer.h:25
enableBenchmark
constexpr bool enableBenchmark
Definition
xAODClusterMaker.cxx:13
Generated on
for ATLAS Offline Software by
1.17.0