8#include "Acts/Propagator/SympyStepper.hpp"
9#include "Acts/Propagator/Navigator.hpp"
10#include "Acts/Propagator/Propagator.hpp"
11#include "Acts/Surfaces/PerigeeSurface.hpp"
12#include "Acts/Surfaces/Surface.hpp"
13#include "Acts/TrackFitting/KalmanFitter.hpp"
14#include "Acts/Utilities/Helpers.hpp"
15#include "Acts/Utilities/Logger.hpp"
16#include "Acts/Utilities/CalibrationContext.hpp"
17#include "Acts/EventData/VectorTrackContainer.hpp"
26#include "Acts/Propagator/DirectNavigator.hpp"
40 auto field = std::make_shared<ATLASMagneticFieldWrapper>();
43 Acts::SympyStepper stepper(field);
46 Acts::DirectNavigator directNavigator(
logger().cloneWithSuffix(
"DirectNavigator") );
47 Acts::Propagator<Acts::SympyStepper, Acts::DirectNavigator> directPropagator(std::move(stepper),
48 std::move(directNavigator),
49 logger().cloneWithSuffix(
"DirectPropagator"));
51 m_directFitter = std::make_unique<DirectFitter>(std::move(directPropagator),
52 logger().cloneWithSuffix(
"DirectKalmanFitter"));
56 logger().cloneWithSuffix(
"Navigator"));
57 Acts::Propagator<Acts::SympyStepper, Acts::Navigator> propagator(stepper,
59 logger().cloneWithSuffix(
"Prop"));
61 m_fitter = std::make_unique<Fitter>(std::move(propagator),
62 logger().cloneWithSuffix(
"KalmanFitter"));
80 configureMe = extensionTemplate;
82 configureMe.surfaceAccessor.connect<&detail::TrkMeasSurfaceAccessor::operator()>(&
m_trkSurfAcc);
90 configureMe = extensionTemplate;
92 configureMe.surfaceAccessor.connect<&detail::TrkPrepRawDataSurfaceAcc::operator()>(&
m_prdSurfAcc);
100 configureMe = extensionTemplate;
101 configureMe.surfaceAccessor.connect<&detail::xAODUncalibMeasSurfAcc::operator()>(&
m_unalibMeasSurfAcc);
104 return StatusCode::SUCCESS;
110 const Acts::MagneticFieldContext& mfContext,
111 const Acts::CalibrationContext& calContext,
112 const Acts::Surface* surface,
116 const auto& kfExtensions =
m_kfExtensions[Acts::toUnderlying(slType)];
118 Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
122 kfExtensions, propagationOption,
128std::unique_ptr< MutableTrackContainer >
130 const Acts::BoundTrackParameters& initialParams,
131 const Acts::GeometryContext& tgContext,
132 const Acts::MagneticFieldContext& mfContext,
133 const Acts::CalibrationContext& calContext,
134 const Acts::Surface* targetSurface)
const{
135 ATH_MSG_DEBUG(
"--> entering KalmanFitter::fit(xAODMeasure...things,TP,)");
137 std::vector<Acts::SourceLink> sourceLinks;
138 sourceLinks.reserve(clusterList.size());
142 return fit(sourceLinks, initialParams, tgContext, mfContext, calContext, targetSurface);
145std::unique_ptr< MutableTrackContainer >
147 const Acts::BoundTrackParameters& initialParams,
148 const Acts::GeometryContext& tgContext,
149 const Acts::MagneticFieldContext& mfContext,
150 const Acts::CalibrationContext& calContext,
151 const Acts::Surface& targetSurface)
const {
153 std::vector<const xAOD::UncalibratedMeasurement*> measList;
156 const auto& sps = seed.sp();
158 const auto& measurements =
sp->measurements();
160 measList.push_back(umeas);
163 return fit(measList, initialParams, tgContext, mfContext, calContext, &targetSurface);
168 const TrackContainer::ConstTrackProxy& ,
170 const Acts::PerigeeSurface& )
const
172 ATH_MSG_ERROR(
"Track refit method not implemented in KalmanFitterTool yet");
173 return StatusCode::FAILURE;
176std::unique_ptr< MutableTrackContainer >
178 const Acts::BoundTrackParameters& initialParams,
179 const Acts::GeometryContext& tgContext,
180 const Acts::MagneticFieldContext& mfContext,
181 const Acts::CalibrationContext& calContext,
182 const Acts::Surface* targetSurface)
const {
184 if (sourceLinks.empty()) {
190 std::shared_ptr<Acts::Surface> pSurface{
nullptr};
192 pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3::Zero());
193 targetSurface = pSurface.get();
198 Acts::KalmanFitterOptions kfOptions =
configureFit(tgContext, mfContext, calContext,
199 targetSurface, slType);
203 auto tracks = std::make_unique<MutableTrackContainer>(std::move(trackContainerBackEnd),
204 std::move(multiTrajBackEnd));
206 bool fitSuccess =
false;
209 std::vector<const Acts::Surface*> surfaces;
210 surfaces.reserve(sourceLinks.size());
213 std::ranges::for_each(sourceLinks, [
this, &surfaces](
const Acts::SourceLink& sl) {
219 std::ranges::for_each(sourceLinks, [
this, &surfaces](
const Acts::SourceLink& sl) {
225 std::ranges::for_each(sourceLinks, [
this, &surfaces](
const Acts::SourceLink& sl) {
231 ATH_MSG_ERROR(
"Unsupported source link type for KalmanFitterTool::fit");
235 fitSuccess =
m_directFitter->fit(sourceLinks.begin(), sourceLinks.end(),
236 initialParams, kfOptions, surfaces, *tracks.get()).ok();
240 fitSuccess =
m_fitter->fit(sourceLinks.begin(), sourceLinks.end(),
241 initialParams, kfOptions, *tracks.get()).ok();
250 for (
auto trkProxy : *tracks) {
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
static Acts::SourceLink pack(const Ptr_t &measurement)
Pack the measurement type pointer to an Acts::SourceLink including the intermediate conversion into a...
static SourceLinkType getType(const Acts::SourceLink &sl)
Returns the enumeration corresponding to the object type cached within the Acts::SourceLink.
void calibrate(const Acts::GeometryContext &geoctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &link, TrackStateProxy state) const
static OnTrackCalibrator NoCalibration(const ActsTrk::ITrackingGeometryTool *trackGeoTool)
Helper class to access the Acts::Surface for a given Acts::SourceLink which is poiniting to a Trk::Me...
void calibrate(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, proxy_t trackState) const
Calibrator delegate implementation to calibrate the ActsTrk fit from Trk::MeasurementBase objects.
Class to calibrate the Acts track states with uncalibrated Trk::PrepRaw data objects.
void calibrate(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, proxy_t trackState) const
Calibrator delegate implementation to calibrate the ActsTrk fit from Trk::PrepRawData objects.
Helper class to access the Acts::surface associated with a Trk::PrepRawData measurement.
Helper class to access the Acts::surface associated with an Uncalibrated xAOD measurement.
Acts::Result< void > gainMatrixUpdate(const Acts::GeometryContext &gctx, typename trajectory_t::TrackStateProxy trackState, const Acts::Logger &logger)
Acts::Result< void > mbfSmoother(const Acts::GeometryContext &gctx, trajectory_t &trajectory, size_t entryIndex, const Acts::Logger &logger)
SourceLinkType
Enumeration to distinguish between the ATLAS EDM -> Acts::SourceLink variants.
@ xAODUnCalibMeas
UnCalibrated Trk::PrepRawData objects.
@ TrkPrepRawData
Calibrated Trk::MeasurementBase objects.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Acts::VectorMultiTrajectory MutableTrackStateBackend
Acts::TrackContainer< MutableTrackBackend, MutableTrackStateBackend, Acts::detail::ValueHolder > MutableTrackContainer
Acts::VectorTrackContainer MutableTrackBackend
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
@ KalmanFitter
tracks produced by the Kalman Fitter
static void addFitterTypeProperty(track_container_t &tracksContainer)
add fitter column to the track container
static void setFitterType(trackproxy_t &trackProxy, xAOD::TrackFitter fitterType)
set fitter type of a track