ATLAS Offline Software
Loading...
Searching...
No Matches
xAODUncalibMeasCalibrator.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
6#include "GeoModelKernel/throwExcept.h"
7
8namespace ActsTrk::detail{
10 const SourceLink_t& meas = sl.template get<SourceLink_t>();
11 return std::holds_alternative<const xAOD::UncalibratedMeasurement*>(meas) ?
12 std::get<const xAOD::UncalibratedMeasurement*>(meas) : nullptr;
13 }
21
22 void xAODUncalibMeasCalibrator::invalidCalibrator(const Acts::GeometryContext& /*gctx*/,
23 const Acts::CalibrationContext& /*cctx*/,
24 const Acts::SourceLink& sl,
25 MutableTrackStateBackend::TrackStateProxy /*trackState*/) const {
26 THROW_EXCEPTION("Calibrator is not configured for measurement type "<<unpack(sl)->type());
27 }
28
29 void xAODUncalibMeasCalibrator::auxillaryCalibrator(const Acts::GeometryContext& /*gctx*/,
30 const Acts::CalibrationContext& /*cctx*/,
31 const Acts::SourceLink& sl,
32 MutableTrackStateBackend::TrackStateProxy trackState) const {
33 const xAOD::UncalibratedMeasurement* meas = unpack(sl);
34 assert(meas->type() == xAOD::UncalibMeasType::Other);
35
36 const auto* pMeas = dynamic_cast<const xAOD::AuxiliaryMeasurement*>(meas);
37 switch(pMeas->numDimensions()) {
38 case 1:
39 setState<1>(pMeas->calibProjector(), pMeas->localPosition<1>(),
40 pMeas->localCovariance<1>(), sl, trackState);
41 break;
42 case 2:
43 setState<2>(pMeas->calibProjector(), pMeas->localPosition<2>(),
44 pMeas->localCovariance<2>(), sl, trackState);
45 break;
46 case 3:
47 setState<3>(pMeas->calibProjector(), pMeas->localPosition<3>(),
48 pMeas->localCovariance<3>(), sl, trackState);
49 break;
50 default:
51 break;
52 }
53
54 }
55 void xAODUncalibMeasCalibrator::calibrate(const Acts::GeometryContext &gctx,
56 const Acts::CalibrationContext & cctx,
57 const Acts::SourceLink& sl,
58 const MutableTrackStateBackend::TrackStateProxy trackState) const {
59 const xAOD::UncalibratedMeasurement* meas = unpack(sl);
60 assert(meas->type() != xAOD::UncalibMeasType::nTypes);
61
62 const CalibDelegate& delegate = m_calibrators[Acts::toUnderlying(meas->type())];
63 delegate(gctx, cctx, sl, trackState);
64 }
65
66}
std::variant< std::monostate, const xAOD::UncalibratedMeasurement *, const Trk::PrepRawData *, const Trk::MeasurementBase * > SourceLink_t
Encode the source links supported by the Calibrator class as a variant of the measurement class type ...
void setState(const ProjectorType projector, const pos_t &locpos, const cov_t &cov, Acts::SourceLink link, proxy_t &trackState) const
Copy the local position & covariance into the Acts track state proxy.
std::array< CalibDelegate, s_nMeasTypes > m_calibrators
Dispatch table of the calibrators per measurement type.
Acts::Experimental::Gx2FitterExtensions< MutableTrackStateBackend >::Calibrator CalibDelegate
Abrivation for the calibrator delegate.
void auxillaryCalibrator(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, MutableTrackStateBackend::TrackStateProxy trackState) const
Delegate method for the Auxiliary measurements.
void calibrate(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, const MutableTrackStateBackend::TrackStateProxy trackState) const
: Interface method for the Acts fitter to calibrate the trajectory track states from the source link ...
static const xAOD::UncalibratedMeasurement * unpack(const Acts::SourceLink &sl)
Helper method to unpack an Acts source link to an uncalibrated measurement.
void connect(const xAOD::UncalibMeasType type, const Type *instance)
Register a calibrator implementation instance for a given measurement type.
void invalidCalibrator(const Acts::GeometryContext &gctx, const Acts::CalibrationContext &cctx, const Acts::SourceLink &sl, MutableTrackStateBackend::TrackStateProxy trackState) const
Delegate method that's assigned during the construction phase of this class.
virtual xAOD::UncalibMeasType type() const =0
Returns the type of the measurement type as a simple enumeration.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132
Hash functions to pack the source link into unordered_maps / unordered_sets.
AuxiliaryMeasurement_v1 AuxiliaryMeasurement
UncalibratedMeasurement_v1 UncalibratedMeasurement
Define the version of the uncalibrated measurement class.
UncalibMeasType
Define the type of the uncalibrated measurement.
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10