Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ActsGsfTrackFittingAlgorithm.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file ActsGsfTrackFittingAlgorithm.h
3 
4 #pragma GCC diagnostic push
5 #pragma GCC diagnostic ignored "-Wunused-local-typedefs"
6 #pragma GCC diagnostic ignored "-Wunused-value"
7 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
9 #pragma GCC diagnostic ignored "-Wshadow"
11 #pragma GCC diagnostic pop
12 
22 
24 
25 namespace
26 {
28  using MultiStepper = Acts::MultiEigenStepperLoop<>;
31 
32  using Fitter =
36  using DirectFitter =
39  Acts::VectorMultiTrajectory>;
40  using TrackContainer =
42  Acts::VectorMultiTrajectory, std::shared_ptr>;
43 
44  struct GsfFitterFunctionImpl
46  {
47  Fitter fitter;
48 
50 
51  std::size_t maxComponents = 0;
52  double weightCutoff = 0;
53  bool abortOnError = false;
54  bool disableAllMaterialHandling = false;
55  Acts::MixtureReductionMethod reductionMethod =
56  Acts::MixtureReductionMethod::eMaxWeight;
57 
58  ActsSourceLink::SurfaceAccessor m_slSurfaceAccessor;
59 
60  GsfFitterFunctionImpl(Fitter&& f,
61  const Acts::TrackingGeometry& trkGeo)
62  : fitter(std::move(f))
63  , m_slSurfaceAccessor{trkGeo}
64  {
65  }
66 
67  template <typename calibrator_t>
68  auto makeGsfOptions(
70  const calibrator_t& calibrator)
71  const
72  {
74  // cppcheck-suppress constStatement
75  extensions.updater.connect<&Acts::GainMatrixUpdater::operator()<Acts::VectorMultiTrajectory>>(&updater);
76 
78  options.geoContext,
79  options.magFieldContext,
80  options.calibrationContext,
81  extensions,
82  options.propOptions,
83  &(*options.referenceSurface),
84  maxComponents,
85  weightCutoff,
86  abortOnError,
87  disableAllMaterialHandling};
88 
89  gsfOptions.extensions.calibrator.connect<&calibrator_t::calibrate>(
90  &calibrator);
91  gsfOptions.extensions.surfaceAccessor.connect<&ActsSourceLink::SurfaceAccessor::operator()>(&m_slSurfaceAccessor);
92  gsfOptions.extensions.mixtureReducer.connect<&Acts::reduceMixtureWithKLDistance>();
93 
94  return gsfOptions;
95  }
96 
98  const std::vector<Acts::SourceLink>& sourceLinks,
99  const ActsTrackFittingAlgorithm::TrackParameters& initialParameters,
101  const CalibratorAdapter& calibrator,
103  {
104  const auto gsfOptions = makeGsfOptions(options, calibrator);
105  using namespace Acts::GsfConstants;
106  if (not tracks.hasColumn(Acts::hashString(kFinalMultiComponentStateColumn)))
107  {
109  tracks.template addColumn<FinalMultiComponentState>(key);
110  }
111 
112  return fitter.fit(sourceLinks.begin(), sourceLinks.end(), initialParameters,
113  gsfOptions, tracks);
114  }
115  };
116 
117 } // namespace
118 
119 // Have a separate class befriend the main class to ensure that GSF specific
120 // track fitting headers only stay here to avoid library clashes
122 {
123  public:
125 
126  std::shared_ptr<ActsTrackFittingAlgorithm::TrackFitterFunction>
128  std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
129  std::shared_ptr<const Acts::MagneticFieldProvider> magneticField,
130  BetheHeitlerApprox betheHeitlerApprox, std::size_t maxComponents,
131  double weightCutoff,
132  Acts::MixtureReductionMethod finalReductionMethod, bool abortOnError,
133  bool disableAllMaterialHandling, const Acts::Logger& logger = *Acts::getDefaultLogger("GSF", Acts::Logging::FATAL));
134 };