24 const EventContext& ctx,
25 AlignmentCache& alignCache,
const Track& trk,
30 alignCache.m_derivMatrix.reset();
31 alignCache.m_fullCovarianceMatrix.reset();
32 alignCache.m_iterationsOfLastFit = 0;
34 auto [refittedTrack, fitState] =
35 fitWithState(ctx, trk, runOutlier, matEffects);
42 return refittedTrack.release();
46 const FitState& fitState)
const {
48 if (!fitState.hasMeasurements() || !fitState.parameters) {
52 int numberParameters = 5;
54 numberParameters = fitState.parameters->numberParameters();
59 if (!m->isPositionMeasurement()) {
62 rows += m->numberDoF();
65 if (!numberParameters || !rows) {
70 <<
" measurement objects giving " << rows
71 <<
" rows and " << numberParameters
72 <<
" columns (parameters)");
74 auto derivativeMatrix =
75 std::make_unique<Amg::MatrixX>(rows, numberParameters);
78 if (!m->numberDoF() || !m->isPositionMeasurement()) {
82 if (m->weight() > 0.) {
83 norm = 1. / m->weight();
86 for (
int col = 0; col < numberParameters; ++col) {
87 (*derivativeMatrix)(row, col) = norm * m->derivative(col);
91 (*derivativeMatrix)(row, 4) *= Gaudi::Units::TeV;
92 if (fitState.parameters->fitEnergyDeposit()) {
93 (*derivativeMatrix)(row, 5) *= Gaudi::Units::TeV;
96 if (m->numberDoF() < 2) {
102 if (m->weight2() > 0.)
103 norm = 1. / m->weight2();
104 for (
int col = 0; col < numberParameters; ++col) {
105 (*derivativeMatrix)(row, col) = norm * m->derivative2(col);
107 (*derivativeMatrix)(row, 4) *= Gaudi::Units::TeV;
108 if (fitState.parameters->fitEnergyDeposit()) {
109 (*derivativeMatrix)(row, 5) *= Gaudi::Units::TeV;
115 ATH_MSG_WARNING(
"iPatGlobalFitter: inconsistent #rows in deriv matrix ");
118 return derivativeMatrix;