ATLAS Offline Software
Loading...
Searching...
No Matches
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
6
8
9constexpr bool enableBenchmark =
10#ifdef BENCHMARK_FPGATRACKSIM
11 true;
12#else
13 false;
14#endif
15
25
26StatusCode FPGATrackSim::FPGATrackSimPrototrackFitterAlg::execute(const EventContext & ctx) const
27{
28
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
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
std::pair< std::vector< unsigned int >, bool > res
SG::WriteHandleKey< ActsTrk::TrackContainer > m_trackContainerKey
virtual StatusCode execute(const EventContext &ctx) const override final
SG::ReadHandleKey< ActsTrk::ProtoTrackCollection > m_ProtoTrackCollectionFromFPGAKey
ActsTrk::MutableTrackContainerHandlesHelper m_tracksBackendHandlesHelper
virtual StatusCode initialize() override final
uncomment and implement methods as required
ActsTrk::ContextUtility m_ctxProvider
Utility to fetch the geometry, magnetic field and calibration context in the event.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
std::string prefixFromTrackContainerName(const std::string &tracks)
Parse TrackContainer name to get the prefix for backends The name has to contain XYZTracks,...
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
constexpr bool enableBenchmark