5 #ifndef MEASUREMENTCALIBRATOR_H
6 #define MEASUREMENTCALIBRATOR_H
14 #include "Acts/EventData/MultiTrajectory.hpp"
15 #include "Acts/Geometry/GeometryIdentifier.hpp"
16 #include "Acts/Surfaces/Surface.hpp"
17 #include "Acts/Surfaces/SurfaceBounds.hpp"
18 #include "Acts/Definitions/TrackParametrization.hpp"
19 #include "Acts/Utilities/AlgebraHelpers.hpp"
36 template <
typename Derived>
38 constexpr
int rows = Eigen::MatrixBase<Derived>::RowsAtCompileTime;
39 constexpr
int cols = Eigen::MatrixBase<Derived>::ColsAtCompileTime;
41 Acts::TrackStateTraits<Acts::MultiTrajectoryTraits::MeasurementSizeMax>::Projector fullProjector =
42 decltype(fullProjector)::Zero();
44 fullProjector.template topLeftCorner<rows, cols>() =
proj;
46 return Acts::matrixToBitset(fullProjector).to_ullong();
50 Acts::ActsMatrix<Acts::MultiTrajectoryTraits::MeasurementSizeMax, 2>
proj;
54 proj(Acts::eBoundLoc0, Acts::eBoundLoc1) = 1;
56 proj(Acts::eBoundLoc0, Acts::eBoundLoc0) = 1;
67 Acts::ActsMatrix<Acts::MultiTrajectoryTraits::MeasurementSizeMax, 2>
proj;
69 proj(Acts::eBoundLoc0, Acts::eBoundLoc0) = 1;
70 proj(Acts::eBoundLoc1, Acts::eBoundLoc1) = 1;
86 template <
typename state_t>
88 Acts::SurfaceBounds::BoundsType boundType,
89 state_t &trackState )
const {
92 const std::size_t projector_idx = boundType == Acts::SurfaceBounds::eAnnulus;
101 throw std::domain_error(
"Can only handle measurement type pixel or strip");
105 template <
size_t Dim,
typename pos_t,
typename cov_t,
typename state_t>
109 Acts::SurfaceBounds::BoundsType boundType,
110 state_t &trackState)
const {
111 trackState.allocateCalibrated(Dim);
113 trackState.template calibrated<Dim>() = locpos.template cast<Acts::ActsScalar>();
114 trackState.template calibratedCovariance<Dim>() =
cov.template cast<Acts::ActsScalar>();
118 template <
class measurement_t,
typename trajectory_t>
120 Acts::SurfaceBounds::BoundsType bound_type,
121 typename Acts::MultiTrajectory<trajectory_t>::TrackStateProxy &trackState )
const {
122 switch (measurement.type()) {
126 measurement.template localPosition<1>(),
127 measurement.template localCovariance<1>().template topLeftCorner<1, 1>(),
135 measurement.template localPosition<2>(),
136 measurement.template localCovariance<2>().template topLeftCorner<2, 2>(),
142 throw std::domain_error(
"Can only handle measurement type pixel or strip");
166 template <std::
size_t DIM>
171 template <std::
size_t DIM>
183 template <
typename trajectory_t>
184 void calibrate([[maybe_unused]]
const Acts::GeometryContext &gctx,
185 [[maybe_unused]]
const Acts::CalibrationContext & cctx,
186 const Acts::SourceLink& sl,
187 typename Acts::MultiTrajectory<trajectory_t>::TrackStateProxy trackState)
const {
188 auto sourceLink = sl.template get<ATLASSourceLink>();
189 trackState.setUncalibratedSourceLink(sl);
192 this->setStateFromMeasurement<MeasurementAdapter, trajectory_t>(
MeasurementAdapter(*sourceLink),
193 surface.bounds().
type(),