Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:27:52

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2019-2024 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 #pragma once
0010 
0011 #include "Acts/Definitions/TrackParametrization.hpp"
0012 #include "Acts/EventData/Measurement.hpp"
0013 #include "Acts/EventData/MeasurementHelpers.hpp"
0014 #include "Acts/EventData/MultiTrajectory.hpp"
0015 #include "Acts/EventData/TrackParameters.hpp"
0016 #include "Acts/Geometry/GeometryHierarchyMap.hpp"
0017 #include "Acts/Geometry/GeometryIdentifier.hpp"
0018 #include "Acts/TrackFinding/CombinatorialKalmanFilterError.hpp"
0019 #include "Acts/Utilities/Logger.hpp"
0020 #include "Acts/Utilities/Result.hpp"
0021 #include "Acts/Utilities/TypeTraits.hpp"
0022 
0023 #include <cassert>
0024 #include <cstddef>
0025 #include <iterator>
0026 #include <limits>
0027 #include <utility>
0028 #include <vector>
0029 
0030 namespace Acts {
0031 
0032 /// Selection cuts for associating measurements with predicted track
0033 /// parameters on a surface.
0034 ///
0035 /// The default configuration only takes the best matching measurement without a
0036 /// cut on the local chi2.
0037 struct MeasurementSelectorCuts {
0038   /// bins in |eta| to specify variable selections
0039   std::vector<double> etaBins{};
0040   /// Maximum local chi2 contribution.
0041   std::vector<double> chi2CutOff{15};
0042   /// Maximum number of associated measurements on a single surface.
0043   std::vector<std::size_t> numMeasurementsCutOff{1};
0044 };
0045 
0046 /// @brief Measurement selection struct selecting those measurements compatible
0047 /// with the given track parameter against provided criteria on one surface
0048 ///
0049 /// The selection criteria could be allowed maximum chi2
0050 /// and allowed maximum number of measurements on one surface
0051 ///
0052 /// If there is no compatible measurement, the measurement with the minimum
0053 /// chi2 will be selected and the status will be tagged as an outlier
0054 ///
0055 class MeasurementSelector {
0056  public:
0057   /// Geometry-dependent cut configuration.
0058   ///
0059   /// Different components on the geometry can require different cut settings.
0060   /// The configuration must either contain explicit settings for all geometry
0061   /// components that are used or contain a global default.
0062   using Config = Acts::GeometryHierarchyMap<MeasurementSelectorCuts>;
0063 
0064   /// @brief Default constructor
0065   ///
0066   /// This will use the default configuration for the cuts.
0067   MeasurementSelector();
0068 
0069   /// @brief Constructor with cuts
0070   ///
0071   /// @param cuts The cuts to use
0072   explicit MeasurementSelector(const MeasurementSelectorCuts& cuts);
0073 
0074   /// @brief Constructor with config
0075   ///
0076   /// @param config a config instance
0077   explicit MeasurementSelector(Config config);
0078 
0079   /// @brief Function that select the measurements compatible with
0080   /// the given track parameter on a surface
0081   ///
0082   /// @param candidates The track state candidates which already contain predicted parameters
0083   /// @param isOutlier The indicator for outlier or not
0084   /// @param logger The logger wrapper
0085   ///
0086   /// @return Pair of iterators into @a candidates marking the range of selected candidates
0087   ///
0088 
0089   template <typename traj_t>
0090   Result<std::pair<
0091       typename std::vector<typename traj_t::TrackStateProxy>::iterator,
0092       typename std::vector<typename traj_t::TrackStateProxy>::iterator>>
0093   select(std::vector<typename traj_t::TrackStateProxy>& candidates,
0094          bool& isOutlier, const Logger& logger) const;
0095 
0096  private:
0097   template <typename traj_t, typename cut_value_t>
0098   static cut_value_t getCut(
0099       const typename traj_t::TrackStateProxy& trackState,
0100       const Acts::MeasurementSelector::Config::Iterator selector,
0101       const std::vector<cut_value_t>& cuts, const Logger& logger);
0102 
0103   double calculateChi2(
0104       const double* fullCalibrated, const double* fullCalibratedCovariance,
0105       TrackStateTraits<MultiTrajectoryTraits::MeasurementSizeMax,
0106                        false>::Parameters predicted,
0107       TrackStateTraits<MultiTrajectoryTraits::MeasurementSizeMax,
0108                        false>::Covariance predictedCovariance,
0109       TrackStateTraits<MultiTrajectoryTraits::MeasurementSizeMax,
0110                        false>::Projector projector,
0111       unsigned int calibratedSize) const;
0112 
0113   Config m_config;
0114 };
0115 
0116 }  // namespace Acts
0117 
0118 #include "MeasurementSelector.ipp"