Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:11:48

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 Acts {
0018 class VectorMultiTrajectory;
0019 }  // namespace Acts
0020 
0021 void ActsExamples::PassThroughCalibrator::calibrate(
0022     const MeasurementContainer& measurements,
0023     const ClusterContainer* /*clusters*/, const Acts::GeometryContext& /*gctx*/,
0024     const Acts::CalibrationContext& /*cctx*/,
0025     const Acts::SourceLink& sourceLink,
0026     Acts::VectorMultiTrajectory::TrackStateProxy& trackState) const {
0027   trackState.setUncalibratedSourceLink(Acts::SourceLink{sourceLink});
0028   const IndexSourceLink& idxSourceLink = sourceLink.get<IndexSourceLink>();
0029 
0030   assert((idxSourceLink.index() < measurements.size()) &&
0031          "Source link index is outside the container bounds");
0032 
0033   const ConstVariableBoundMeasurementProxy measurement =
0034       measurements.getMeasurement(idxSourceLink.index());
0035 
0036   Acts::visit_measurement(measurement.size(), [&](auto N) -> void {
0037     constexpr std::size_t kMeasurementSize = decltype(N)::value;
0038     const ConstFixedBoundMeasurementProxy<kMeasurementSize> fixedMeasurement =
0039         static_cast<ConstFixedBoundMeasurementProxy<kMeasurementSize>>(
0040             measurement);
0041 
0042     trackState.allocateCalibrated(fixedMeasurement.parameters().eval(),
0043                                   fixedMeasurement.covariance().eval());
0044     trackState.setProjectorSubspaceIndices(fixedMeasurement.subspaceIndices());
0045   });
0046 }
0047 
0048 ActsExamples::MeasurementCalibratorAdapter::MeasurementCalibratorAdapter(
0049     const MeasurementCalibrator& calibrator,
0050     const MeasurementContainer& measurements, const ClusterContainer* clusters)
0051     : m_calibrator{calibrator},
0052       m_measurements{measurements},
0053       m_clusters{clusters} {}
0054 
0055 void ActsExamples::MeasurementCalibratorAdapter::calibrate(
0056     const Acts::GeometryContext& gctx, const Acts::CalibrationContext& cctx,
0057     const Acts::SourceLink& sourceLink,
0058     Acts::VectorMultiTrajectory::TrackStateProxy trackState) const {
0059   return m_calibrator.calibrate(m_measurements, m_clusters, gctx, cctx,
0060                                 sourceLink, trackState);
0061 }