41 class MagneticFieldProvider;
60 struct SimpleReverseFilteringLogic {
61 double momentumThreshold = 0;
63 bool doBackwardFiltering(
66 return (
momentum <= momentumThreshold);
70 using namespace ActsExamples;
74 DirectFitter directFitter;
78 SimpleReverseFilteringLogic reverseFilteringLogic;
80 bool multipleScattering =
false;
81 bool energyLoss =
false;
86 KalmanFitterFunctionImpl(Fitter&&
f, DirectFitter&&
df,
88 : fitter(std::
move(
f)),
89 directFitter(std::
move(
df)),
90 slSurfaceAccessor{trkGeo} {}
92 template <
typename calibrator_t>
93 auto makeKfOptions(
const GeneralFitterOptions&
options,
94 const calibrator_t& calibrator)
const {
103 .connect<&SimpleReverseFilteringLogic::doBackwardFiltering>(
104 &reverseFilteringLogic);
107 options.geoContext, options.magFieldContext, options.calibrationContext,
108 extensions, options.propOptions, &(*options.referenceSurface));
110 kfOptions.referenceSurfaceStrategy =
111 Acts::KalmanFitterTargetSurfaceStrategy::first;
112 kfOptions.multipleScattering = multipleScattering;
113 kfOptions.energyLoss = energyLoss;
114 kfOptions.freeToBoundCorrection = freeToBoundCorrection;
115 kfOptions.extensions.calibrator.connect<&calibrator_t::calibrate>(
117 kfOptions.extensions.surfaceAccessor
118 .connect<&IndexSourceLink::SurfaceAccessor::operator()>(
124 TrackFitterResult operator()(
const std::vector<Acts::SourceLink>& sourceLinks,
126 const GeneralFitterOptions&
options,
129 const auto kfOptions = makeKfOptions(options, calibrator);
130 return fitter.fit(sourceLinks.begin(), sourceLinks.end(), initialParameters,
134 TrackFitterResult operator()(
135 const std::vector<Acts::SourceLink>& sourceLinks,
137 const GeneralFitterOptions& options,
139 const std::vector<const Acts::Surface*>& surfaceSequence,
141 const auto kfOptions = makeKfOptions(options, calibrator);
142 return directFitter.fit(sourceLinks.begin(), sourceLinks.end(),
143 initialParameters, kfOptions, surfaceSequence,
150 std::shared_ptr<ActsExamples::TrackFitterFunction>
153 std::shared_ptr<const Acts::MagneticFieldProvider>
magneticField,
154 bool multipleScattering,
bool energyLoss,
155 double reverseFilteringMomThreshold,
164 cfg.resolvePassive =
false;
165 cfg.resolveMaterial =
true;
166 cfg.resolveSensitive =
true;
177 DirectFitter directTrackFitter(
std::move(directPropagator),
181 auto fitterFunction = std::make_shared<KalmanFitterFunctionImpl>(
183 fitterFunction->multipleScattering = multipleScattering;
184 fitterFunction->energyLoss = energyLoss;
185 fitterFunction->reverseFilteringLogic.momentumThreshold =
186 reverseFilteringMomThreshold;
187 fitterFunction->freeToBoundCorrection = freeToBoundCorrection;
189 return fitterFunction;