forked from sPHENIX-Collaboration/acts
/
TrkrClusterFindingAlgorithmFinderFunction.cpp
66 lines (59 loc) · 2.55 KB
/
TrkrClusterFindingAlgorithmFinderFunction.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#include "ActsExamples/TrackFinding/TrkrClusterFindingAlgorithm.hpp"
/**
* Struct that calls the finding algorithm to get the result of the track
* propagation/finding
*/
namespace {
template <typename Finder>
struct TrkrFindingFunctionImpl
{
Finder finder;
TrkrFindingFunctionImpl(Finder&& f) : finder(std::move(f)) {}
ActsExamples::TrkrClusterFindingAlgorithm::FinderResult
operator()(
const std::vector<SourceLink>& sourceLinks,
const ActsExamples::TrackParameters& initialParameters,
const Acts::CombinatorialKalmanFilterOptions<Acts::CKFSourceLinkSelector>& options) const
{
/// Call CombinatorialKalmanFilter findTracks
return finder.findTracks(sourceLinks, initialParameters, options);
};
};
} // namespace
/**
* Function that actually makes the track finding function to be used
*/
ActsExamples::TrkrClusterFindingAlgorithm::FinderFunction
ActsExamples::TrkrClusterFindingAlgorithm::makeFinderFunction(
std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
Options::BFieldVariant magneticField)
{
using Updater = Acts::GainMatrixUpdater;
using Smoother = Acts::GainMatrixSmoother;
/// Return a new instance of the finder with the given magnetic field
/// need to unpack the magnetic field and return the finder
return std::visit(
[trackingGeometry](auto&& inputField) -> FinderFunction {
/// Construct some aliases for the components below
using InputMagneticField = typename std::decay_t<decltype(inputField)>::element_type;
using MagneticField = Acts::SharedBField<InputMagneticField>;
using Stepper = Acts::EigenStepper<MagneticField>;
using Navigator = Acts::Navigator;
using Propagator = Acts::Propagator<Stepper, Navigator>;
using SourceLinkSelector = Acts::CKFSourceLinkSelector;
using Finder = Acts::CombinatorialKalmanFilter
<Propagator, Updater, Smoother, SourceLinkSelector>;
/// Make the components for the fitter
MagneticField field(std::move(inputField));
Stepper stepper(std::move(field));
Navigator navigator(trackingGeometry);
navigator.resolvePassive = false;
navigator.resolveMaterial = true;
navigator.resolveSensitive = true;
Propagator propagator(std::move(stepper), std::move(navigator));
Finder finder(std::move(propagator));
/// Build the fitter function
return TrkrFindingFunctionImpl<Finder>(std::move(finder));
},
std::move(magneticField));
}