Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:32:31

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 #pragma once
0010 
0011 #include "Acts/EventData/MultiTrajectory.hpp"
0012 #include "Acts/EventData/SourceLink.hpp"
0013 #include "Acts/EventData/VectorMultiTrajectory.hpp"
0014 #include "Acts/Geometry/GeometryContext.hpp"
0015 #include "Acts/Utilities/CalibrationContext.hpp"
0016 #include "ActsExamples/EventData/Cluster.hpp"
0017 #include "ActsExamples/EventData/IndexSourceLink.hpp"
0018 #include <ActsExamples/EventData/Measurement.hpp>
0019 
0020 #include <cassert>
0021 
0022 namespace Acts {
0023 class VectorMultiTrajectory;
0024 }  // namespace Acts
0025 
0026 namespace ActsExamples {
0027 
0028 /// Abstract base class for measurement-based calibration
0029 class MeasurementCalibrator {
0030  public:
0031   virtual void calibrate(
0032       const MeasurementContainer& measurements,
0033       const ClusterContainer* clusters, const Acts::GeometryContext& gctx,
0034       const Acts::CalibrationContext& cctx, const Acts::SourceLink& sourceLink,
0035       Acts::VectorMultiTrajectory::TrackStateProxy& trackState) const = 0;
0036 
0037   virtual ~MeasurementCalibrator() = default;
0038   virtual bool needsClusters() const { return false; }
0039 };
0040 
0041 // Calibrator to convert an index source link to a measurement as-is
0042 class PassThroughCalibrator : public MeasurementCalibrator {
0043  public:
0044   /// Find the measurement corresponding to the source link.
0045   ///
0046   /// @tparam parameters_t Track parameters type
0047   /// @param gctx The geometry context (unused)
0048   /// @param trackState The track state to calibrate
0049   void calibrate(
0050       const MeasurementContainer& measurements,
0051       const ClusterContainer* clusters, const Acts::GeometryContext& gctx,
0052       const Acts::CalibrationContext& cctx, const Acts::SourceLink& sourceLink,
0053       Acts::VectorMultiTrajectory::TrackStateProxy& trackState) const override;
0054 };
0055 
0056 // Adapter class that wraps a MeasurementCalibrator to conform to the
0057 // core ACTS calibration interface
0058 class MeasurementCalibratorAdapter {
0059  public:
0060   MeasurementCalibratorAdapter(const MeasurementCalibrator& calibrator,
0061                                const MeasurementContainer& measurements,
0062                                const ClusterContainer* clusters = nullptr);
0063 
0064   MeasurementCalibratorAdapter() = delete;
0065 
0066   void calibrate(const Acts::GeometryContext& gctx,
0067                  const Acts::CalibrationContext& cctx,
0068                  const Acts::SourceLink& sourceLink,
0069                  Acts::VectorMultiTrajectory::TrackStateProxy trackState) const;
0070 
0071  private:
0072   const MeasurementCalibrator& m_calibrator;
0073   const MeasurementContainer& m_measurements;
0074   const ClusterContainer* m_clusters;
0075 };
0076 
0077 }  // namespace ActsExamples