Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-03-29 07:47:13

0001 // This file is part of the ACTS project.
0002 //
0003 // Copyright (C) 2016 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 https://mozilla.org/MPL/2.0/.
0008 
0009 #include "ActsExamples/EventData/MeasurementCalibration.hpp"
0010 
0011 #include "Acts/EventData/SourceLink.hpp"
0012 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0013 #include "ActsExamples/EventData/Measurement.hpp"
0014 
0015 #include <cassert>
0016 
0017 namespace ActsExamples {
0018 
0019 void PassThroughCalibrator::calibrate(
0020     const MeasurementContainer& measurements,
0021     const ClusterContainer* /*clusters*/, const Acts::GeometryContext& /*gctx*/,
0022     const Acts::CalibrationContext& /*cctx*/,
0023     const Acts::SourceLink& sourceLink,
0024     Acts::VectorMultiTrajectory::TrackStateProxy& trackState) const {
0025   trackState.setUncalibratedSourceLink(Acts::SourceLink{sourceLink});
0026   const IndexSourceLink& idxSourceLink = sourceLink.get<IndexSourceLink>();
0027 
0028   assert((idxSourceLink.index() < measurements.size()) &&
0029          "Source link index is outside the container bounds");
0030 
0031   const ConstVariableBoundMeasurementProxy measurement =
0032       measurements.getMeasurement(idxSourceLink.index());
0033 
0034   Acts::visit_measurement(measurement.size(), [&](auto N) -> void {
0035     constexpr std::size_t kMeasurementSize = decltype(N)::value;
0036     const ConstFixedBoundMeasurementProxy<kMeasurementSize> fixedMeasurement =
0037         static_cast<ConstFixedBoundMeasurementProxy<kMeasurementSize>>(
0038             measurement);
0039 
0040     trackState.allocateCalibrated(fixedMeasurement.parameters().eval(),
0041                                   fixedMeasurement.covariance().eval());
0042     trackState.setProjectorSubspaceIndices(fixedMeasurement.subspaceIndices());
0043   });
0044 }
0045 
0046 MeasurementCalibratorAdapter::MeasurementCalibratorAdapter(
0047     const MeasurementCalibrator& calibrator,
0048     const MeasurementContainer& measurements, const ClusterContainer* clusters)
0049     : m_calibrator{calibrator},
0050       m_measurements{measurements},
0051       m_clusters{clusters} {}
0052 
0053 void MeasurementCalibratorAdapter::calibrate(
0054     const Acts::GeometryContext& gctx, const Acts::CalibrationContext& cctx,
0055     const Acts::SourceLink& sourceLink,
0056     Acts::VectorMultiTrajectory::TrackStateProxy trackState) const {
0057   return m_calibrator.calibrate(m_measurements, m_clusters, gctx, cctx,
0058                                 sourceLink, trackState);
0059 }
0060 
0061 }  // namespace ActsExamples