EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TrackFindingAlgorithmTrackFinderFunction.cpp
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file TrackFindingAlgorithmTrackFinderFunction.cpp
1 // This file is part of the Acts project.
2 //
3 // Copyright (C) 2020 CERN for the benefit of the Acts project
4 //
5 // This Source Code Form is subject to the terms of the Mozilla Public
6 // License, v. 2.0. If a copy of the MPL was not distributed with this
7 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 
19 
20 #include <random>
21 #include <stdexcept>
22 
23 namespace {
24 template <typename TrackFinder>
25 struct TrackFinderFunctionImpl {
26  TrackFinder trackFinder;
27 
28  TrackFinderFunctionImpl(TrackFinder&& f) : trackFinder(std::move(f)) {}
29 
31  const ActsExamples::SimSourceLinkContainer& sourceLinks,
32  const ActsExamples::TrackParameters& initialParameters,
34  options) const {
35  return trackFinder.findTracks(sourceLinks, initialParameters, options);
36  };
37 };
38 } // namespace
39 
42  std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
44  using Updater = Acts::GainMatrixUpdater;
45  using Smoother = Acts::GainMatrixSmoother;
46 
47  // unpack the magnetic field variant and instantiate the corresponding track
48  // finder.
49  return std::visit(
50  [trackingGeometry](auto&& inputField) -> TrackFinderFunction {
51  // each entry in the variant is already a shared_ptr
52  // need ::element_type to get the real magnetic field type
53  using InputMagneticField =
54  typename std::decay_t<decltype(inputField)>::element_type;
55  using MagneticField = Acts::SharedBField<InputMagneticField>;
57  using Navigator = Acts::Navigator;
59  using SourceLinkSelector = Acts::CKFSourceLinkSelector;
60  using CKF =
62  SourceLinkSelector>;
63 
64  // construct all components for the track finder
65  MagneticField field(std::move(inputField));
66  Stepper stepper(std::move(field));
67  Navigator navigator(trackingGeometry);
68  navigator.resolvePassive = false;
69  navigator.resolveMaterial = true;
70  navigator.resolveSensitive = true;
71  Propagator propagator(std::move(stepper), std::move(navigator));
72  CKF trackFinder(std::move(propagator));
73 
74  // build the track finder functions. owns the track finder object.
75  return TrackFinderFunctionImpl<CKF>(std::move(trackFinder));
76  },
77  std::move(magneticField));
78 }