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 23 of file iPatGlobalFitter.cxx.

27 {
28 // @TODO ensure the number of iterations is passed through to the fitter
29 // setMinIterations (alignCache.m_minIterations);
30 alignCache.m_derivMatrix.reset();
31 alignCache.m_fullCovarianceMatrix.reset();
32 alignCache.m_iterationsOfLastFit = 0;
33
34 auto [refittedTrack, fitState] =
35 fitWithState(ctx, trk, runOutlier, matEffects);
36
37 if (refittedTrack) {
38 alignCache.m_derivMatrix = derivMatrix(*fitState);
39 alignCache.m_fullCovarianceMatrix = fullCovarianceMatrix(*fitState);
40 alignCache.m_iterationsOfLastFit = iterationsOfLastFit(*fitState);
41 }
42 return refittedTrack.release();
43}
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 45 of file iPatGlobalFitter.cxx.

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

122 {
123 int numberParameters = 5;
124
125 if (m_allParameters) {
126 numberParameters = fitState.parameters->numberParameters();
127 }
128 ATH_MSG_VERBOSE(" FullCovarianceMatrix for " << numberParameters
129 << " parameters");
130
131 return std::make_unique<Amg::MatrixX>(Trk::FitProcedure::fullCovariance()->block(
132 0, 0, numberParameters, numberParameters));
133}
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 135 of file iPatGlobalFitter.cxx.

135 {
136 return fitState.iterations;
137}

◆ setMinIterations()

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

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

Definition at line 139 of file iPatGlobalFitter.cxx.

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

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: