4#ifndef MEASUREMENTCALIBRATOR2_H
5#define MEASUREMENTCALIBRATOR2_H
7#include "Acts/EventData/Types.hpp"
16#include "Acts/EventData/MultiTrajectory.hpp"
17#include "Acts/EventData/BoundTrackParameters.hpp"
18#include "Acts/Geometry/GeometryIdentifier.hpp"
19#include "Acts/Surfaces/Surface.hpp"
20#include "Acts/Surfaces/SurfaceBounds.hpp"
21#include "Acts/Definitions/TrackParametrization.hpp"
22#include "Acts/Utilities/AlgebraHelpers.hpp"
31#include "boost/container/static_vector.hpp"
44 unsigned char shift = (volume_id%2) ? 4 : 0;
45 unsigned char idx = volume_id/2;
50 unsigned char shift = (volume_id%2) ? 4 : 0;
51 unsigned char idx = volume_id/2;
56 std::vector<unsigned int> pixel_vol {16, 15, 9, 20, 19, 18, 10, 14, 13, 8};
57 for (
unsigned int vol_id : pixel_vol) {
60 std::vector<unsigned int> strip_vol {23, 22, 24};
61 for (
unsigned int vol_id : strip_vol) {
64 std::vector<unsigned int> hgtd_vol {2, 25};
65 for (
unsigned int vol_id : hgtd_vol) {
70 template <std::
size_t DIM>
71 Acts::SubspaceIndices<DIM>
parameterMap([[maybe_unused]]
const Acts::GeometryContext&,
72 [[maybe_unused]]
const Acts::CalibrationContext&,
73 const Acts::Surface &surface)
const {
75 if constexpr(DIM==3) {
79 else if constexpr(DIM==2) {
83 else if constexpr(DIM==1) {
85 auto boundType = surface.bounds().type();
86 const std::size_t projector_idx = boundType == Acts::SurfaceBounds::eAnnulus;
90 throw std::runtime_error(
"Unsupported dimension");
100 Acts::eBoundLoc0, Acts::eBoundLoc1
103 Acts::eBoundLoc0, Acts::eBoundLoc1, Acts::eBoundTime
108 template <
typename traj_t>
113 template <
typename T_Cluster, std::
size_t NDIM>
116 const Acts::CalibrationContext&,
117 const Acts::Surface&,
119 const Acts::BoundTrackParameters &)>;
121 template <
typename T_Cluster, std::
size_t NDIM>
123 void(
const Acts::GeometryContext&,
124 const Acts::CalibrationContext&,
126 typename traj_t::TrackStateProxy &)>;
146 boost::container::static_vector<std::unique_ptr<ClusterCalibratorBase >, 3>
m_calibrators;
148 template <
typename T_CalibratorTool,
typename T_PreDelegate,
typename T_PostDelegate>
150 const T_CalibratorTool *calibrator_tool,
151 T_PreDelegate &pre_calibrator,
152 T_PostDelegate &post_calibrator) {
153 bool calibrate_after_measurement_selection=
true;
154 if (calibrator_tool) {
155 calibrate_after_measurement_selection = calibrator_tool->calibrateAfterMeasurementSelection();
156 auto calibrator = calibrator_tool->createOnTrackCalibrator(ctx);
157 if (calibrate_after_measurement_selection) {
158 calibrator->connectOnTrackCalibrator( post_calibrator);
161 calibrator->connectCalibrator( pre_calibrator );
165 if (calibrate_after_measurement_selection) {
166 using CalibratorBase_t =
typename decltype( calibrator_tool->create(ctx) )::element_type;
168 typename CalibratorBase_t::ClusterType>>(
this);
191 template <std::
size_t Dim,
typename Cluster>
194 [[maybe_unused]]
const Acts::CalibrationContext& cctx,
195 [[maybe_unused]]
const Acts::Surface& surface,
196 const Cluster &cluster,
197 const Acts::BoundTrackParameters &)
const
199 auto ret = std::make_tuple<xAOD::MeasVector<Dim>,
xAOD::MeasMatrix<Dim>,
unsigned int>(cluster.template localPosition<Dim>(),
200 cluster.template localCovariance<Dim>(),
202 if constexpr(std::is_same_v<xAOD::HGTDCluster, std::remove_cvref_t<Cluster> >) {
204 assert(std::get<1>(ret)(2,1)==0. && std::get<1>(ret)(2,0)==0.);
Wrapper to avoid constant divisions when using units.
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
constexpr auto timeCovToActs(T athenaTCov)
Converts a time covariance element from Athena to Acts units.
constexpr auto timeToActs(T athenaT)
Converts a time unit from Athena to Acts units.
Eigen::Matrix< float, N, N > MeasMatrix
Eigen::Matrix< float, N, 1 > MeasVector
Abrivation of the Matrix & Covariance definitions.
UncalibMeasType
Define the type of the uncalibrated measurement.
const PixelPreCalibrator & pixelPreCalibrator() const
const StripCalibrator & stripPostCalibrator() const
std::tuple< xAOD::MeasVector< Dim >, xAOD::MeasMatrix< Dim >, unsigned int > passthrough(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::Surface &surface, const Cluster &cluster, const Acts::BoundTrackParameters &) const
xAOD::MeasVector< 3 > hgtdPos
xAOD::MeasMatrix< 3 > hgtdCov
Acts::Delegate< std::tuple< xAOD::MeasVector< NDIM >, xAOD::MeasMatrix< NDIM >, unsigned int >(const Acts::GeometryContext &, const Acts::CalibrationContext &, const Acts::Surface &, const T_Cluster &, const Acts::BoundTrackParameters &)> PreCalibratorDelegate
HGTDCalibrator hgtd_postCalibrator
PixelCalibrator pixel_postCalibrator
CalibratorDelegate< xAOD::HGTDCluster, 3 > HGTDCalibrator
StripCalibrator strip_postCalibrator
PreCalibratorDelegate< xAOD::HGTDCluster, 3 > HGTDPreCalibrator
CalibratorDelegate< xAOD::StripCluster, 1 > StripCalibrator
const HGTDCalibrator & hgtdPostCalibrator() const
HGTDPreCalibrator hgtd_preCalibrator
const HGTDPreCalibrator & hgtdPreCalibrator() const
StripPreCalibrator strip_preCalibrator
Acts::Delegate< void(const Acts::GeometryContext &, const Acts::CalibrationContext &, const T_Cluster &, typename traj_t::TrackStateProxy &)> CalibratorDelegate
void connect(const EventContext &ctx, const T_CalibratorTool *calibrator_tool, T_PreDelegate &pre_calibrator, T_PostDelegate &post_calibrator)
CalibratorDelegate< xAOD::PixelCluster, 2 > PixelCalibrator
xAOD::MeasVector< 1 > StripPos
const StripPreCalibrator & stripPreCalibrator() const
PreCalibratorDelegate< xAOD::StripCluster, 1 > StripPreCalibrator
MeasurementCalibrator(const EventContext &ctx, const ActsTrk::IPixelOnTrackCalibratorTool< traj_t > *pixelCalibratorTool, const ActsTrk::IStripOnTrackCalibratorTool< traj_t > *stripCalibratorTool, const ActsTrk::IHGTDOnTrackCalibratorTool< traj_t > *hgtdCalibratorTool)
xAOD::MeasVector< 2 > PixelPos
xAOD::MeasMatrix< 2 > PixelCov
boost::container::static_vector< std::unique_ptr< ClusterCalibratorBase >, 3 > m_calibrators
xAOD::MeasMatrix< 1 > StripCov
PixelPreCalibrator pixel_preCalibrator
const PixelCalibrator & pixelPostCalibrator() const
PreCalibratorDelegate< xAOD::PixelCluster, 2 > PixelPreCalibrator
void setMeasurementTypeForVolumeId(unsigned int volume_id, xAOD::UncalibMeasType type)
static constexpr Acts::SubspaceIndices< 2 > s_pixelSubspaceIndices
static constexpr std::array< Acts::SubspaceIndices< 1 >, 2 > s_stripSubspaceIndices
Acts::SubspaceIndices< DIM > parameterMap(const Acts::GeometryContext &, const Acts::CalibrationContext &, const Acts::Surface &surface) const
std::array< unsigned char, 128 > m_volumeIdToMeasurementType
static constexpr Acts::SubspaceIndices< 3 > s_hgtdSubspaceIndices
xAOD::UncalibMeasType measurementTypeFromVolumeId(unsigned int volume_id) const
MeasurementParameterMap()