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
26
27StatusCode FPGATrackSim::FPGATrackSimPrototrackFitterAlg::execute(const EventContext & ctx) const
28{
29
32
33 if (!myProtoTracks.isValid()){
34 ATH_MSG_WARNING("no Prototrack collections");
35 return StatusCode::SUCCESS;
36 }
37 ATH_MSG_DEBUG("I received " <<myProtoTracks->size()<<" proto-tracks");
38
39
49 const Acts::GeometryContext tgContext = m_trackingGeometryTool->getGeometryContext(ctx).context();
50 const Acts::MagneticFieldContext mfContext = m_extrapolationTool->getMagneticFieldContext(ctx);
51 const Acts::CalibrationContext calContext{ActsTrk::getCalibrationContext(ctx)};
52
55 Acts::VectorTrackContainer trackBackend;
56 Acts::VectorMultiTrajectory trackStateBackend;
57 ActsTrk::MutableTrackContainer trackContainer( std::move(trackBackend),
58 std::move(trackStateBackend) );
59
60 if constexpr (enableBenchmark) m_chrono->chronoStart("FPGATrackSimPrototrackFitterAlg: ACTS KF");
61 // now we fit each of the proto tracks
62 for (auto & proto : *myProtoTracks){
63 auto res = m_actsFitter->fit(proto.measurements, *proto.parameters,
64 tgContext, mfContext, calContext);
65
66 if(!res) continue;
67 if (res->size() == 0 ) continue;
68 if(proto.measurements.empty()) continue;
69 ATH_MSG_DEBUG(".......Done track with size "<< proto.measurements.size());
70 const auto trackProxy = res->getTrack(0);
71 if (not trackProxy.hasReferenceSurface()) {
72 ATH_MSG_INFO("There is not reference surface for this track");
73 continue;
74 }
75 auto destProxy = trackContainer.getTrack(trackContainer.addTrack());
76 destProxy.copyFrom(trackProxy);
77 }
78 if constexpr (enableBenchmark) m_chrono->chronoStop("FPGATrackSimPrototrackFitterAlg: ACTS KF");
79
80 // convert to const
81 Acts::ConstVectorTrackContainer ctrackBackend( std::move(trackContainer.container()) );
82 Acts::ConstVectorMultiTrajectory ctrackStateBackend( std::move(trackContainer.trackStateContainer()) );
83 std::unique_ptr<ActsTrk::TrackContainer> constTracksContainer = std::make_unique<ActsTrk::TrackContainer>( std::move(ctrackBackend),
84 std::move(ctrackStateBackend) );
85
86 ATH_CHECK(trackContainerHandle.record(std::move(constTracksContainer)));
87
88 return StatusCode::SUCCESS;
89}
90
91
#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
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
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
PublicToolHandle< ActsTrk::ITrackingGeometryTool > m_trackingGeometryTool
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
Acts::CalibrationContext getCalibrationContext(const EventContext &ctx)
The Acts::Calibration context is piped through the Acts fitters to (re)calibrate the Acts::SourceLink...
constexpr bool enableBenchmark