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