ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::iPatGlobalFitter Class Reference

GlobalTrackFitter tool providing methods used during alignment. More...

#include <iPatGlobalFitter.h>

Inheritance diagram for Trk::iPatGlobalFitter:
Collaboration diagram for Trk::iPatGlobalFitter:

Public Member Functions

TrackalignmentFit (const EventContext &ctx, AlignmentCache &, const Track &, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting) const

Private Member Functions

std::unique_ptr< Amg::MatrixXderivMatrix (const FitState &fitState) const
 GlobalTrackFitter methods: access to the matrix of derivatives used during the latest track fit.
std::unique_ptr< Amg::MatrixXfullCovarianceMatrix (const FitState &fitState) const
 access to the global fitter's full covariance matrix
void setMinIterations (int minIterations)
 set method for the minimum number of iterations for (alignment) friend

Static Private Member Functions

static int iterationsOfLastFit (const FitState &fitState)
 access to the number of iterations taken by the latest track fit

Private Attributes

Gaudi::Property< bool > m_allParameters

Detailed Description

GlobalTrackFitter tool providing methods used during alignment.

Definition at line 26 of file iPatGlobalFitter.h.

Member Function Documentation

◆ alignmentFit()

Track * Trk::iPatGlobalFitter::alignmentFit ( const EventContext & ctx,
AlignmentCache & alignCache,
const Track & trk,
const RunOutlierRemoval runOutlier = false,
const ParticleHypothesis matEffects = Trk::nonInteracting ) const

Definition at line 22 of file iPatGlobalFitter.cxx.

26 {
27 // @TODO ensure the number of iterations is passed through to the fitter
28 // setMinIterations (alignCache.m_minIterations);
29 alignCache.m_derivMatrix.reset();
30 alignCache.m_fullCovarianceMatrix.reset();
31 alignCache.m_iterationsOfLastFit = 0;
32
33 auto [refittedTrack, fitState] =
34 fitWithState(ctx, trk, runOutlier, matEffects);
35
36 if (refittedTrack) {
37 alignCache.m_derivMatrix = derivMatrix(*fitState);
38 alignCache.m_fullCovarianceMatrix = fullCovarianceMatrix(*fitState);
39 alignCache.m_iterationsOfLastFit = iterationsOfLastFit(*fitState);
40 }
41 return refittedTrack.release();
42}
std::unique_ptr< Amg::MatrixX > derivMatrix(const FitState &fitState) const
GlobalTrackFitter methods: access to the matrix of derivatives used during the latest track fit.
static int iterationsOfLastFit(const FitState &fitState)
access to the number of iterations taken by the latest track fit
std::unique_ptr< Amg::MatrixX > fullCovarianceMatrix(const FitState &fitState) const
access to the global fitter's full covariance matrix

◆ derivMatrix()

std::unique_ptr< Amg::MatrixX > Trk::iPatGlobalFitter::derivMatrix ( const FitState & fitState) const
private

GlobalTrackFitter methods: access to the matrix of derivatives used during the latest track fit.

Definition at line 44 of file iPatGlobalFitter.cxx.

45 {
46 // copy derivatives to a new HepMatrix
47 if (!fitState.hasMeasurements() || !fitState.parameters) {
48 return nullptr;
49 }
50
51 int numberParameters = 5;
52 if (m_allParameters) {
53 numberParameters = fitState.parameters->numberParameters();
54 }
55 int rows = 0;
56
57 for (const FitMeasurement* m : fitState.getMeasurements()) {
58 if (!m->isPositionMeasurement()) {
59 continue;
60 }
61 rows += m->numberDoF();
62 }
63
64 if (!numberParameters || !rows) {
65 return nullptr;
66 }
67
68 ATH_MSG_VERBOSE(" DerivMatrix : " << fitState.getMeasurements().size()
69 << " measurement objects giving " << rows
70 << " rows and " << numberParameters
71 << " columns (parameters)");
72
73 auto derivativeMatrix =
74 std::make_unique<Amg::MatrixX>(rows, numberParameters);
75 int row = 0;
76 for (const FitMeasurement* m : fitState.getMeasurements()) {
77 if (!m->numberDoF() || !m->isPositionMeasurement()) {
78 continue;
79 }
80 double norm = 0.;
81 if (m->weight() > 0.) {
82 norm = 1. / m->weight();
83 }
84
85 for (int col = 0; col < numberParameters; ++col) {
86 (*derivativeMatrix)(row, col) = norm * m->derivative(col);
87 }
88
89 // take care of units for momentum derivs
90 (*derivativeMatrix)(row, 4) *= Gaudi::Units::TeV;
91 if (fitState.parameters->fitEnergyDeposit()) {
92 (*derivativeMatrix)(row, 5) *= Gaudi::Units::TeV;
93 }
94 ++row;
95 if (m->numberDoF() < 2) {
96 continue;
97 }
98
99 // pixel measurements
100 norm = 0.;
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);
105 }
106 (*derivativeMatrix)(row, 4) *= Gaudi::Units::TeV;
107 if (fitState.parameters->fitEnergyDeposit()) {
108 (*derivativeMatrix)(row, 5) *= Gaudi::Units::TeV;
109 }
110 ++row;
111 }
112
113 if (row != rows) {
114 ATH_MSG_WARNING("iPatGlobalFitter: inconsistent #rows in deriv matrix ");
115 }
116
117 return derivativeMatrix;
118}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Gaudi::Property< bool > m_allParameters
row
Appending html table to final .html summary file.

◆ fullCovarianceMatrix()

std::unique_ptr< Amg::MatrixX > Trk::iPatGlobalFitter::fullCovarianceMatrix ( const FitState & fitState) const
private

access to the global fitter's full covariance matrix

Definition at line 120 of file iPatGlobalFitter.cxx.

121 {
122 int numberParameters = 5;
123
124 if (m_allParameters) {
125 numberParameters = fitState.parameters->numberParameters();
126 }
127 ATH_MSG_VERBOSE(" FullCovarianceMatrix for " << numberParameters
128 << " parameters");
129
130 return std::make_unique<Amg::MatrixX>(Trk::FitProcedure::fullCovariance()->block(
131 0, 0, numberParameters, numberParameters));
132}
static Amg::MatrixX * fullCovariance()

◆ iterationsOfLastFit()

int Trk::iPatGlobalFitter::iterationsOfLastFit ( const FitState & fitState)
staticprivate

access to the number of iterations taken by the latest track fit

Definition at line 134 of file iPatGlobalFitter.cxx.

134 {
135 return fitState.iterations;
136}

◆ setMinIterations()

void Trk::iPatGlobalFitter::setMinIterations ( int minIterations)
private

set method for the minimum number of iterations for (alignment) friend

Definition at line 138 of file iPatGlobalFitter.cxx.

138 {
139 m_fitProcedure->setMinIterations(minIterations);
140}

Member Data Documentation

◆ m_allParameters

Gaudi::Property<bool> Trk::iPatGlobalFitter::m_allParameters
private
Initial value:
{
this, "AllParameters", false, "all or 5 parameters for matrix methods"}

Definition at line 51 of file iPatGlobalFitter.h.

51 {
52 this, "AllParameters", false, "all or 5 parameters for matrix methods"};

The documentation for this class was generated from the following files: