45 #include <string_view>
51 class MagneticFieldProvider;
57 using namespace ActsExamples;
76 DirectFitter directFitter;
80 std::size_t maxComponents = 0;
81 double weightCutoff = 0;
82 bool abortOnError =
false;
83 bool disableAllMaterialHandling =
false;
85 Acts::MixtureReductionMethod::eMaxWeight;
89 GsfFitterFunctionImpl(Fitter&&
f, DirectFitter&&
df,
91 : fitter(std::
move(
f)),
92 directFitter(std::
move(
df)),
93 m_slSurfaceAccessor{trkGeo} {}
95 template <
typename calibrator_t>
96 auto makeGsfOptions(
const GeneralFitterOptions&
options,
97 const calibrator_t& calibrator)
const {
105 options.magFieldContext,
106 options.calibrationContext,
109 &(*options.referenceSurface),
113 disableAllMaterialHandling};
114 gsfOptions.stateReductionMethod = reductionMethod;
116 gsfOptions.extensions.calibrator.connect<&calibrator_t::calibrate>(
119 .connect<&IndexSourceLink::SurfaceAccessor::operator()>(
120 &m_slSurfaceAccessor);
127 TrackFitterResult operator()(
const std::vector<Acts::SourceLink>& sourceLinks,
129 const GeneralFitterOptions& options,
132 const auto gsfOptions = makeGsfOptions(options, calibrator);
134 using namespace Acts::GsfConstants;
135 if (not tracks.hasColumn(
138 tracks.template addColumn<FinalMultiComponentState>(key);
141 return fitter.fit(sourceLinks.begin(), sourceLinks.end(), initialParameters,
145 TrackFitterResult operator()(
146 const std::vector<Acts::SourceLink>& sourceLinks,
148 const GeneralFitterOptions& options,
150 const std::vector<const Acts::Surface*>& surfaceSequence,
152 const auto gsfOptions = makeGsfOptions(options, calibrator);
154 using namespace Acts::GsfConstants;
155 if (not tracks.hasColumn(
158 tracks.template addColumn<FinalMultiComponentState>(key);
161 return directFitter.fit(sourceLinks.begin(), sourceLinks.end(),
162 initialParameters,
gsfOptions, surfaceSequence,
171 std::shared_ptr<const Acts::MagneticFieldProvider>
magneticField,
174 bool abortOnError,
bool disableAllMaterialHandling,
180 cfg.resolvePassive =
false;
181 cfg.resolveMaterial =
true;
182 cfg.resolveSensitive =
true;
186 Fitter trackFitter(
std::move(propagator),
191 MultiStepper directStepper(
std::move(magneticField),
198 DirectFitter directTrackFitter(
std::move(directPropagator),
203 auto fitterFunction = std::make_shared<GsfFitterFunctionImpl>(
205 fitterFunction->maxComponents = maxComponents;
206 fitterFunction->weightCutoff = weightCutoff;
207 fitterFunction->abortOnError = abortOnError;
208 fitterFunction->disableAllMaterialHandling = disableAllMaterialHandling;
209 fitterFunction->reductionMethod = finalReductionMethod;
211 return fitterFunction;