|
| 1 | +// This file is part of the ACTS project. |
| 2 | +// |
| 3 | +// Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/. |
| 8 | + |
| 9 | +#pragma once |
| 10 | + |
| 11 | +#include "Acts/Utilities/Logger.hpp" |
| 12 | +#include "ActsExamples/EventData/Cluster.hpp" |
| 13 | +#include "ActsExamples/EventData/IndexSourceLink.hpp" |
| 14 | +#include "ActsExamples/EventData/Measurement.hpp" |
| 15 | +#include "ActsExamples/EventData/ProtoTrack.hpp" |
| 16 | +#include "ActsExamples/EventData/Track.hpp" |
| 17 | +#include "ActsExamples/Framework/DataHandle.hpp" |
| 18 | +#include "ActsExamples/Framework/IAlgorithm.hpp" |
| 19 | +#include "ActsExamples/Framework/ProcessCode.hpp" |
| 20 | +#include "ActsExamples/TrackFitting/TrackFitterFunction.hpp" |
| 21 | + |
| 22 | +#include <memory> |
| 23 | +#include <string> |
| 24 | + |
| 25 | +namespace Acts { |
| 26 | +class TrackingGeometry; |
| 27 | +} |
| 28 | + |
| 29 | +namespace ActsExamples { |
| 30 | +class MeasurementCalibrator; |
| 31 | +class TrackFitterFunction; |
| 32 | +struct AlgorithmContext; |
| 33 | + |
| 34 | +class TrackFittingAlgorithm final : public IAlgorithm { |
| 35 | + public: |
| 36 | + struct Config { |
| 37 | + /// Input measurements collection. |
| 38 | + std::string inputMeasurements; |
| 39 | + /// Input proto tracks collection, i.e. groups of hit indices. |
| 40 | + std::string inputProtoTracks; |
| 41 | + /// Input initial track parameter estimates for for each proto track. |
| 42 | + std::string inputInitialTrackParameters; |
| 43 | + /// (optional) Input clusters for each measurement |
| 44 | + std::string inputClusters; |
| 45 | + /// Output fitted tracks collection. |
| 46 | + std::string outputTracks; |
| 47 | + /// Type erased fitter function. |
| 48 | + std::shared_ptr<TrackFitterFunction> fit; |
| 49 | + /// Pick a single track for debugging (-1 process all tracks) |
| 50 | + int pickTrack = -1; |
| 51 | + // Type erased calibrator for the measurements |
| 52 | + std::shared_ptr<MeasurementCalibrator> calibrator; |
| 53 | + }; |
| 54 | + |
| 55 | + /// Constructor of the fitting algorithm |
| 56 | + /// |
| 57 | + /// @param config is the config struct to configure the algorithm |
| 58 | + /// @param level is the logging level |
| 59 | + TrackFittingAlgorithm(Config config, Acts::Logging::Level level); |
| 60 | + |
| 61 | + /// Framework execute method of the fitting algorithm |
| 62 | + /// |
| 63 | + /// @param ctx is the algorithm context that holds event-wise information |
| 64 | + /// @return a process code to steer the algporithm flow |
| 65 | + ActsExamples::ProcessCode execute(const AlgorithmContext& ctx) const final; |
| 66 | + |
| 67 | + /// Get readonly access to the config parameters |
| 68 | + const Config& config() const { return m_cfg; } |
| 69 | + |
| 70 | + private: |
| 71 | + Config m_cfg; |
| 72 | + |
| 73 | + ReadDataHandle<MeasurementContainer> m_inputMeasurements{this, |
| 74 | + "InputMeasurements"}; |
| 75 | + ReadDataHandle<ProtoTrackContainer> m_inputProtoTracks{this, |
| 76 | + "InputProtoTracks"}; |
| 77 | + ReadDataHandle<TrackParametersContainer> m_inputInitialTrackParameters{ |
| 78 | + this, "InputInitialTrackParameters"}; |
| 79 | + |
| 80 | + ReadDataHandle<ClusterContainer> m_inputClusters{this, "InputClusters"}; |
| 81 | + |
| 82 | + WriteDataHandle<ConstTrackContainer> m_outputTracks{this, "OutputTracks"}; |
| 83 | +}; |
| 84 | + |
| 85 | +} // namespace ActsExamples |
0 commit comments