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"
41 if (trkGeo->geometryVersion() == Acts::TrackingGeometry::GeometryVersion::Gen3) {
44 case Acts::toUnderlying(
ITkExit):
51 }
case Acts::toUnderlying(
MsExit) : {
55 return StatusCode::FAILURE;
61 auto field = std::make_shared<ATLASMagneticFieldWrapper>();
64 Acts::SympyStepper stepper(field);
67 Acts::DirectNavigator directNavigator(
logger().cloneWithSuffix(
"DirectNavigator") );
68 Acts::Propagator<Acts::SympyStepper, Acts::DirectNavigator> directPropagator(std::move(stepper),
69 std::move(directNavigator),
70 logger().cloneWithSuffix(
"DirectPropagator"));
72 m_directFitter = std::make_unique<DirectFitter>(std::move(directPropagator),
73 logger().cloneWithSuffix(
"DirectKalmanFitter"));
76 Acts::Navigator navigator( Acts::Navigator::Config{trkGeo},
77 logger().cloneWithSuffix(
"Navigator"));
78 Acts::Propagator<Acts::SympyStepper, Acts::Navigator> propagator(stepper,
80 logger().cloneWithSuffix(
"Prop"));
82 m_fitter = std::make_unique<Fitter>(std::move(propagator),
83 logger().cloneWithSuffix(
"KalmanFitter"));
101 configureMe = extensionTemplate;
103 configureMe.surfaceAccessor.connect<&detail::TrkMeasSurfaceAccessor::operator()>(&
m_trkSurfAcc);
111 configureMe = extensionTemplate;
113 configureMe.surfaceAccessor.connect<&detail::TrkPrepRawDataSurfaceAcc::operator()>(&
m_prdSurfAcc);
125 for (
const auto muonType : {MdtDriftCircleType, RpcStripType, TgcStripType, MMClusterType, sTgcStripType}) {
129 for (
const auto idType: {PixelClusterType, StripClusterType, HGTDClusterType}) {
134 configureMe = extensionTemplate;
135 configureMe.surfaceAccessor.connect<&detail::xAODUncalibMeasSurfAcc::operator()>(&
m_unalibMeasSurfAcc);
138 return StatusCode::SUCCESS;
144 const Acts::MagneticFieldContext& mfContext,
145 const Acts::CalibrationContext& calContext,
146 const Acts::Surface* surface,
150 const auto& kfExtensions =
m_kfExtensions.at(Acts::toUnderlying(slType));
152 Acts::PropagatorPlainOptions propagationOption(tgContext, mfContext);
156 kfExtensions, propagationOption,
158 options.propagatorPlainOptions.endOfWorldVolumeIds.push_back(
m_endOfWorldId);
164std::unique_ptr< MutableTrackContainer >
166 const Acts::BoundTrackParameters& initialParams,
167 const Acts::GeometryContext& tgContext,
168 const Acts::MagneticFieldContext& mfContext,
169 const Acts::CalibrationContext& calContext,
170 const Acts::Surface* targetSurface)
const{
171 ATH_MSG_DEBUG(
"--> entering KalmanFitter::fit(xAODMeasure...things,TP,)");
173 std::vector<Acts::SourceLink> sourceLinks;
174 sourceLinks.reserve(clusterList.size());
178 return fit(sourceLinks, initialParams, tgContext, mfContext, calContext, targetSurface);
181std::unique_ptr< MutableTrackContainer >
183 const Acts::BoundTrackParameters& initialParams,
184 const Acts::GeometryContext& tgContext,
185 const Acts::MagneticFieldContext& mfContext,
186 const Acts::CalibrationContext& calContext,
187 const Acts::Surface& targetSurface)
const {
189 std::vector<const xAOD::UncalibratedMeasurement*> measList;
192 const auto& sps = seed.sp();
194 const auto& measurements =
sp->measurements();
196 measList.push_back(umeas);
199 return fit(measList, initialParams, tgContext, mfContext, calContext, &targetSurface);
204 const TrackContainer::ConstTrackProxy& ,
206 const Acts::PerigeeSurface& )
const
208 ATH_MSG_ERROR(
"Track refit method not implemented in KalmanFitterTool yet");
209 return StatusCode::FAILURE;
212std::unique_ptr< MutableTrackContainer >
214 const Acts::BoundTrackParameters& initialParams,
215 const Acts::GeometryContext& tgContext,
216 const Acts::MagneticFieldContext& mfContext,
217 const Acts::CalibrationContext& calContext,
218 const Acts::Surface* targetSurface)
const {
220 if (sourceLinks.empty()) {
226 std::shared_ptr<Acts::Surface> pSurface{
nullptr};
228 pSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(Acts::Vector3::Zero());
229 targetSurface = pSurface.get();
234 Acts::KalmanFitterOptions kfOptions =
configureFit(tgContext, mfContext, calContext,
235 targetSurface, slType);
239 auto tracks = std::make_unique<MutableTrackContainer>(std::move(trackContainerBackEnd),
240 std::move(multiTrajBackEnd));
242 bool fitSuccess =
false;
245 std::vector<const Acts::Surface*> surfaces;
246 surfaces.reserve(sourceLinks.size());
249 std::ranges::for_each(sourceLinks, [
this, &surfaces](
const Acts::SourceLink& sl) {
255 std::ranges::for_each(sourceLinks, [
this, &surfaces](
const Acts::SourceLink& sl) {
261 std::ranges::for_each(sourceLinks, [
this, &surfaces](
const Acts::SourceLink& sl) {
267 ATH_MSG_ERROR(
"Unsupported source link type for KalmanFitterTool::fit");
271 fitSuccess =
m_directFitter->fit(sourceLinks.begin(), sourceLinks.end(),
272 initialParams, kfOptions, surfaces, *tracks.get()).ok();
276 fitSuccess =
m_fitter->fit(sourceLinks.begin(), sourceLinks.end(),
277 initialParams, kfOptions, *tracks.get()).ok();
286 for (
auto trkProxy : *tracks) {
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_ERROR(x,...)
#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::ITrackingGeometrySvc *trackGeoSvc)
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.
void calibrate(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, const MutableTrackStateBackend::TrackStateProxy trackState) const
: Interface method for the Acts fitter to calibrate the trajectory track states from the source link ...
Helper class to access the Acts::surface associated with an Uncalibrated xAOD measurement.
virtual void calibrateSourceLink(const Acts::GeometryContext &geoctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &link, ActsTrk::MutableTrackStateBackend::TrackStateProxy state) const =0
Function that's hooked to the calibration delegate of the implemented Acts fitters.
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
SystemEnvelope
Define an enumeration to retrieve the envelope tracking volume from.
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
@ KalmanFitter
tracks produced by the Kalman Fitter
UncalibMeasType
Define the type of the uncalibrated measurement.
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