2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
5#include "Acts/EventData/ParticleHypothesis.hpp"
6namespace ActsTrk::detail {
7 template <Acts::TrackStateProxyConcept proxy_t>
8 std::unique_ptr<Trk::RIO_OnTrack>
9 TrkPrepRawDataCalibrator::createROT(const Acts::GeometryContext &/*tgContext*/,
10 const Acts::CalibrationContext & cctx,
11 const Acts::SourceLink& sl,
12 const proxy_t& trackState) const {
14 const Trk::PrepRawData* prd = unpack(sl);
15 /** @todo Check how the particle hypothesis can be retrieved from the track state */
16 const Acts::BoundTrackParameters actsParam{trackState.referenceSurface().getSharedPtr(),
17 trackState.predicted(),
18 trackState.predictedCovariance(),
19 Acts::ParticleHypothesis::pion()};
20 // Check that the conversion tool is set
21 assert(m_convTool != nullptr);
22 const EventContext* ctx = cctx.get<const EventContext*>();
23 const auto trkParam = m_convTool->convertTrackParametersToTrk(*ctx, actsParam);
25 /// Check that the ROT creator has been defined
26 assert(m_rotCreator != nullptr);
27 return std::unique_ptr<Trk::RIO_OnTrack>{m_rotCreator->correct(*prd, *trkParam, *ctx)};
29 template <Acts::TrackStateProxyConcept proxy_t>
30 inline void TrkPrepRawDataCalibrator::calibrate(const Acts::GeometryContext &gctx,
31 const Acts::CalibrationContext& cctx,
32 const Acts::SourceLink& sl,
33 proxy_t trackState) const {
34 /// Calibrate the measurement
35 auto rot = createROT(gctx, cctx, sl, trackState);
36 /// Ensure that the rot is actually created.
38 /// copy the rot information onto the track state
39 m_rotCalib.calibrate(gctx, cctx, m_rotCalib.pack(rot.get()), trackState);
40 /// Overwrite the source link as the ROT leaves scope at the end of the method & is deleted
41 trackState.setUncalibratedSourceLink(pack(unpack(sl)));