Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:09:54

0001 // This file is part of the Acts project.
0002 //
0003 // Copyright (C) 2023 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 #include "Acts/EventData/SourceLink.hpp"
0010 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0011 #include "ActsExamples/EventData/Measurement.hpp"
0012 #include <ActsExamples/EventData/MeasurementCalibration.hpp>
0013 
0014 #include <cassert>
0015 #include <variant>
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(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   std::visit(
0034       [&trackState](const auto& meas) {
0035         trackState.allocateCalibrated(meas.size());
0036         trackState.setCalibrated(meas);
0037       },
0038       (measurements)[idxSourceLink.index()]);
0039 }
0040 
0041 ActsExamples::MeasurementCalibratorAdapter::MeasurementCalibratorAdapter(
0042     const MeasurementCalibrator& calibrator,
0043     const MeasurementContainer& measurements, const ClusterContainer* clusters)
0044     : m_calibrator{calibrator},
0045       m_measurements{measurements},
0046       m_clusters{clusters} {}
0047 
0048 void ActsExamples::MeasurementCalibratorAdapter::calibrate(
0049     const Acts::GeometryContext& gctx, const Acts::CalibrationContext& cctx,
0050     const Acts::SourceLink& sourceLink,
0051     Acts::VectorMultiTrajectory::TrackStateProxy trackState) const {
0052   return m_calibrator.calibrate(m_measurements, m_clusters, gctx, cctx,
0053                                 sourceLink, trackState);
0054 }