![]() |
|
|||
File indexing completed on 2024-06-26 07:06:33
0001 // Copyright (C) 2020 CERN for the benefit of the Acts project 0002 // 0003 // This Source Code Form is subject to the terms of the Mozilla Public 0004 // License, v. 2.0. If a copy of the MPL was not distributed with this 0005 // file, You can obtain one at http://mozilla.org/MPL/2.0/. 0006 0007 #pragma once 0008 0009 #include "Acts/EventData/Measurement.hpp" 0010 #include "JugReco/IndexSourceLink.hpp" 0011 0012 #include <cassert> 0013 #include <vector> 0014 0015 namespace Jug { 0016 0017 /// Variable measurement type that can contain all possible combinations. 0018 using Measurement = ::Acts::BoundVariantMeasurement<IndexSourceLink>; 0019 /// Container of measurements. 0020 /// 0021 /// In contrast to the source links, the measurements themself must not be 0022 /// orderable. The source links stored in the measurements are treated 0023 /// as opaque here and no ordering is enforced on the stored measurements. 0024 using MeasurementContainer = std::vector<Measurement>; 0025 0026 /// Calibrator to convert an index source link to a measurement. 0027 class MeasurementCalibrator { 0028 public: 0029 /// Construct an invalid calibrator. Required to allow copying. 0030 MeasurementCalibrator() = default; 0031 /// Construct using a user-provided container to chose measurements from. 0032 MeasurementCalibrator(const MeasurementContainer& measurements) : m_measurements(&measurements) {} 0033 0034 /// Find the measurement corresponding to the source link. 0035 /// 0036 /// @tparam parameters_t Track parameters type 0037 /// @param sourceLink Input source link 0038 /// @param parameters Input track parameters (unused) 0039 template <typename parameters_t> 0040 const Measurement& operator()(const IndexSourceLink& sourceLink, const parameters_t& /* parameters */) const 0041 { 0042 assert(m_measurements and "Undefined measurement container in DigitizedCalibrator"); 0043 assert((sourceLink.index() < m_measurements->size()) and "Source link index is outside the container bounds"); 0044 return (*m_measurements)[sourceLink.m_index]; 0045 } 0046 0047 private: 0048 // use pointer so the calibrator is copyable and default constructible. 0049 const MeasurementContainer* m_measurements = nullptr; 0050 }; 0051 0052 } // namespace Jug
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.5 LXR engine. The LXR team |
![]() ![]() |