Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:48

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2021 CERN for the benefit of the Acts project
0004 //
0005 // This Source Code Form is subject to the terms of the Mozilla Public
0006 // License, v. 2.0. If a copy of the MPL was not distributed with this
0007 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
0008 
0009 #include "Acts/Definitions/Direction.hpp"
0010 #include "Acts/EventData/MultiTrajectory.hpp"
0011 #include "Acts/EventData/TrackContainer.hpp"
0012 #include "Acts/EventData/TrackStatePropMask.hpp"
0013 #include "Acts/EventData/VectorMultiTrajectory.hpp"
0014 #include "Acts/EventData/VectorTrackContainer.hpp"
0015 #include "Acts/Propagator/EigenStepper.hpp"
0016 #include "Acts/Propagator/Navigator.hpp"
0017 #include "Acts/Propagator/Propagator.hpp"
0018 #include "Acts/TrackFinding/CombinatorialKalmanFilter.hpp"
0019 #include "Acts/TrackFitting/GainMatrixSmoother.hpp"
0020 #include "Acts/TrackFitting/GainMatrixUpdater.hpp"
0021 #include "Acts/Utilities/Logger.hpp"
0022 #include "ActsExamples/EventData/Track.hpp"
0023 #include "ActsExamples/TrackFinding/TrackFindingAlgorithm.hpp"
0024 
0025 #include <algorithm>
0026 #include <map>
0027 #include <memory>
0028 #include <utility>
0029 #include <vector>
0030 
0031 namespace Acts {
0032 class MagneticFieldProvider;
0033 class TrackingGeometry;
0034 }  // namespace Acts
0035 
0036 namespace {
0037 
0038 using Updater = Acts::GainMatrixUpdater;
0039 using Smoother = Acts::GainMatrixSmoother;
0040 
0041 using Stepper = Acts::EigenStepper<>;
0042 using Navigator = Acts::Navigator;
0043 using Propagator = Acts::Propagator<Stepper, Navigator>;
0044 using CKF =
0045     Acts::CombinatorialKalmanFilter<Propagator, Acts::VectorMultiTrajectory>;
0046 
0047 using TrackContainer =
0048     Acts::TrackContainer<Acts::VectorTrackContainer,
0049                          Acts::VectorMultiTrajectory, std::shared_ptr>;
0050 
0051 struct TrackFinderFunctionImpl
0052     : public ActsExamples::TrackFindingAlgorithm::TrackFinderFunction {
0053   CKF trackFinder;
0054 
0055   TrackFinderFunctionImpl(CKF&& f) : trackFinder(std::move(f)) {}
0056 
0057   ActsExamples::TrackFindingAlgorithm::TrackFinderResult operator()(
0058       const ActsExamples::TrackParameters& initialParameters,
0059       const ActsExamples::TrackFindingAlgorithm::TrackFinderOptions& options,
0060       TrackContainer& tracks) const override {
0061     return trackFinder.findTracks(initialParameters, options, tracks);
0062   };
0063 };
0064 
0065 }  // namespace
0066 
0067 std::shared_ptr<ActsExamples::TrackFindingAlgorithm::TrackFinderFunction>
0068 ActsExamples::TrackFindingAlgorithm::makeTrackFinderFunction(
0069     std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
0070     std::shared_ptr<const Acts::MagneticFieldProvider> magneticField,
0071     const Acts::Logger& logger) {
0072   Stepper stepper(std::move(magneticField));
0073   Navigator::Config cfg{std::move(trackingGeometry)};
0074   cfg.resolvePassive = false;
0075   cfg.resolveMaterial = true;
0076   cfg.resolveSensitive = true;
0077   Navigator navigator(cfg, logger.cloneWithSuffix("Navigator"));
0078   Propagator propagator(std::move(stepper), std::move(navigator),
0079                         logger.cloneWithSuffix("Propagator"));
0080   CKF trackFinder(std::move(propagator), logger.cloneWithSuffix("Finder"));
0081 
0082   // build the track finder functions. owns the track finder object.
0083   return std::make_shared<TrackFinderFunctionImpl>(std::move(trackFinder));
0084 }