2 Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
5 #ifndef ONTRACKCALIBRATOR_ICC
6 #define ONTRACKCALIBRATOR_ICC
10 template <typename traj_t>
11 OnTrackCalibrator<traj_t> OnTrackCalibrator<traj_t>::NoCalibration(
12 const ActsTrk::IActsToTrkConverterTool &converter_tool,
13 const TrackingSurfaceHelper &surface_helper)
15 ToolHandle<IOnTrackCalibratorTool<traj_t>> null(nullptr);
16 return OnTrackCalibrator(converter_tool, surface_helper, null, null);
19 template <typename traj_t>
20 OnTrackCalibrator<traj_t>::OnTrackCalibrator(
21 const ActsTrk::IActsToTrkConverterTool &converter_tool,
22 const TrackingSurfaceHelper &surface_helper,
23 const ToolHandle<IOnTrackCalibratorTool<traj_t>>& pixelTool,
24 const ToolHandle<IOnTrackCalibratorTool<traj_t>>& stripTool)
25 : MeasurementCalibratorBase(converter_tool),
26 m_surfaceHelper(&surface_helper)
28 if (pixelTool.isEnabled()) {
29 pixelTool->connect(*this);
31 pixel_calibrator.template connect<&OnTrackCalibrator<traj_t>::passthrough<2, xAOD::PixelCluster>>(this);
34 if (stripTool.isEnabled()) {
35 stripTool->connect(*this);
37 // cppcheck-suppress missingReturn; false positive
38 strip_calibrator.template connect<&OnTrackCalibrator<traj_t>::passthrough<1, xAOD::StripCluster>>(this);
42 template <typename traj_t>
43 void OnTrackCalibrator<traj_t>::calibrate(
44 const Acts::GeometryContext& geoctx,
45 const Acts::CalibrationContext& cctx,
46 const Acts::SourceLink& link,
47 TrackStateProxy state) const
49 state.setUncalibratedSourceLink(link);
50 ATLASUncalibSourceLink sourceLink = link.template get<ATLASUncalibSourceLink>();
51 assert(sourceLink!=nullptr);
52 const xAOD::UncalibratedMeasurement &measurement = getUncalibratedMeasurement(sourceLink);
53 const Acts::Surface &surface = m_surfaceHelper->associatedActsSurface(measurement);
55 switch (measurement.type()) {
56 case xAOD::UncalibMeasType::PixelClusterType: {
57 assert(pixel_calibrator.connected());
58 auto [pos, cov] = pixel_calibrator(
61 *dynamic_cast<const xAOD::PixelCluster*>(&measurement),
64 xAOD::UncalibMeasType::PixelClusterType,
67 surface.bounds().type(),
71 case xAOD::UncalibMeasType::StripClusterType: {
72 assert(strip_calibrator.connected());
73 auto [pos, cov] = strip_calibrator(
76 *dynamic_cast<const xAOD::StripCluster*>(&measurement),
79 xAOD::UncalibMeasType::StripClusterType,
82 surface.bounds().type(),
87 throw std::domain_error("OnTrackCalibrator can only handle Pixel or Strip measurements");
91 template <typename traj_t>
92 template <std::size_t Dim, typename Cluster>
93 std::pair<xAOD::MeasVector<Dim>, xAOD::MeasMatrix<Dim>>
94 OnTrackCalibrator<traj_t>::passthrough(
95 const Acts::GeometryContext& /*gctx*/,
96 const Acts::CalibrationContext& /*cctx*/,
97 const Cluster& cluster,
98 const TrackStateProxy& /*state*/) const
100 return std::make_pair(cluster.template localPosition<Dim>(),
101 cluster.template localCovariance<Dim>());
105 } // namespace ActsTrk