2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
5 #include "ActsGeometry/ATLASSourceLink.h"
6 #include "TrkSurfaces/Surface.h"
7 #include "TrkSurfaces/SurfaceBounds.h"
9 #include "InDetMeasurementUtilities/ClusterConversionUtilities.h"
10 #include "TrkRIO_OnTrack/RIO_OnTrack.h"
11 #include "InDetRIO_OnTrack/SCT_ClusterOnTrack.h"
14 namespace ActsTrk::detail {
16 template <typename trajectory_t>
17 void TrkMeasurementCalibrator::calibrate(const Acts::GeometryContext& /*gctx*/,
18 const Acts::CalibrationContext& /*cctx*/,
19 const Acts::SourceLink& sl,
20 TrackState_t<trajectory_t> trackState) const {
21 const SourceLink_t sourceLink = unpack(sl);
22 switch (sourceLink->localParameters().dimension()) {
24 ProjectorType projector{ProjectorType::e1DimNoTime};
25 /// Hack to make the coordinate systems between Acts & Trk match for the SCT endcap hits
26 if (sourceLink->associatedSurface().bounds().type() == Trk::SurfaceBounds::Annulus) {
27 projector = ProjectorType::e1DimRotNoTime;
28 if (sourceLink->type(Trk::MeasurementBaseType::Type::RIO_OnTrack)) {
29 const auto* rot = static_cast<const Trk::RIO_OnTrack*>(sourceLink);
30 if (rot->prepRawData()->type(Trk::PrepRawDataType::SCT_Cluster)) {
31 const auto* clust = static_cast<const InDet::SCT_ClusterOnTrack*>(rot);
32 const auto [pos, cov] = TrackingUtilities::convertSCT_LocalPosCov(*clust->prepRawData());
33 setState<1, trajectory_t>(projector, pos, cov, sl, trackState);
38 setState<1, trajectory_t>(projector, sourceLink->localParameters(), sourceLink->localCovariance(),
42 setState<2, trajectory_t>(ProjectorType::e2DimNoTime, sourceLink->localParameters(),
43 sourceLink->localCovariance(), sl, trackState);
47 setState<3, trajectory_t>(ProjectorType::e2DimWithTime, sourceLink->localParameters(),
48 sourceLink->localCovariance(), sl, trackState);
52 std::stringstream linkDump{};
53 sourceLink->dump(linkDump);
54 throw std::domain_error(std::format("TrkMeasurementCalibrator::calibrate() - Invalid dimension {:d} for measurement {:} ",
55 sourceLink->localParameters().dimension(), linkDump.str()));
59 } // namespace ActsTrk::detail