23 const EventContext& ctx,
24 AlignmentCache& alignCache,
const Track& trk,
29 alignCache.m_derivMatrix.reset();
30 alignCache.m_fullCovarianceMatrix.reset();
31 alignCache.m_iterationsOfLastFit = 0;
33 auto [refittedTrack, fitState] =
34 fitWithState(ctx, trk, runOutlier, matEffects);
41 return refittedTrack.release();
45 const FitState& fitState)
const {
47 if (!fitState.hasMeasurements() || !fitState.parameters) {
51 int numberParameters = 5;
53 numberParameters = fitState.parameters->numberParameters();
58 if (!m->isPositionMeasurement()) {
61 rows += m->numberDoF();
64 if (!numberParameters || !rows) {
69 <<
" measurement objects giving " << rows
70 <<
" rows and " << numberParameters
71 <<
" columns (parameters)");
73 auto derivativeMatrix =
74 std::make_unique<Amg::MatrixX>(rows, numberParameters);
77 if (!m->numberDoF() || !m->isPositionMeasurement()) {
81 if (m->weight() > 0.) {
82 norm = 1. / m->weight();
85 for (
int col = 0; col < numberParameters; ++col) {
86 (*derivativeMatrix)(row, col) = norm * m->derivative(col);
90 (*derivativeMatrix)(row, 4) *= Gaudi::Units::TeV;
91 if (fitState.parameters->fitEnergyDeposit()) {
92 (*derivativeMatrix)(row, 5) *= Gaudi::Units::TeV;
95 if (m->numberDoF() < 2) {
101 if (m->weight2() > 0.)
102 norm = 1. / m->weight2();
103 for (
int col = 0; col < numberParameters; ++col) {
104 (*derivativeMatrix)(row, col) = norm * m->derivative2(col);
106 (*derivativeMatrix)(row, 4) *= Gaudi::Units::TeV;
107 if (fitState.parameters->fitEnergyDeposit()) {
108 (*derivativeMatrix)(row, 5) *= Gaudi::Units::TeV;
114 ATH_MSG_WARNING(
"iPatGlobalFitter: inconsistent #rows in deriv matrix ");
117 return derivativeMatrix;