ATLAS Offline Software
Functions
Trk::MultiComponentStateHelpers Namespace Reference

Functions

MultiComponentState clone (const MultiComponentState &in)
 Clone TrackParameters method. More...
 
MultiComponentState WithScaledError (MultiComponentState &&in, double errorScaleLocX, double errorScaleLocY, double errorScalePhi, double errorScaleTheta, double errorScaleQoverP)
 Scale the covariance matrix components by individual factors. More...
 
bool allHaveCovariance (const MultiComponentState &in)
 Check to see if all components have covariance Matrix. More...
 
void renormaliseState (MultiComponentState &, double norm=1)
 Performing renormalisation of total state weighting to one. More...
 

Function Documentation

◆ allHaveCovariance()

bool Trk::MultiComponentStateHelpers::allHaveCovariance ( const MultiComponentState in)

Check to see if all components have covariance Matrix.

Definition at line 66 of file ComponentParameters.cxx.

67 {
68  bool allHaveCovariance = true;
69  for (const ComponentParameters& component : in) {
70  const AmgSymMatrix(5)* originalMatrix = component.params->covariance();
71  if (!originalMatrix) {
72  allHaveCovariance = false;
73  break;
74  }
75  }
76  return allHaveCovariance;
77 }

◆ clone()

Trk::MultiComponentState Trk::MultiComponentStateHelpers::clone ( const MultiComponentState in)

Clone TrackParameters method.

Definition at line 15 of file ComponentParameters.cxx.

16 {
17  auto clonedState = Trk::MultiComponentState();
18  clonedState.reserve(in.size());
19  for (const ComponentParameters& component : in) {
20  clonedState.push_back({component.params->uniqueClone(), component.weight});
21  }
22  return clonedState;
23 }

◆ renormaliseState()

void Trk::MultiComponentStateHelpers::renormaliseState ( Trk::MultiComponentState in,
double  norm = 1 
)

Performing renormalisation of total state weighting to one.

Definition at line 80 of file ComponentParameters.cxx.

82 {
83  // Determine total weighting of state
84  double sumWeights = 0.;
85  for (const ComponentParameters& component : in) {
86  sumWeights += component.weight;
87  }
88  if (sumWeights == 0) {
89  return;
90  }
91  double normalise = norm / sumWeights;
92  for (ComponentParameters& component : in) {
93  component.weight = component.weight * normalise;
94  }
95 }

◆ WithScaledError()

Trk::MultiComponentState Trk::MultiComponentStateHelpers::WithScaledError ( Trk::MultiComponentState &&  in,
double  errorScaleLocX,
double  errorScaleLocY,
double  errorScalePhi,
double  errorScaleTheta,
double  errorScaleQoverP 
)

Scale the covariance matrix components by individual factors.

Definition at line 26 of file ComponentParameters.cxx.

32 {
33  AmgSymMatrix(5) coefficients;
34  coefficients(0, 0) = (errorScaleLocX * errorScaleLocX);
35  coefficients(1, 1) = (errorScaleLocY * errorScaleLocY);
36  coefficients(2, 2) = (errorScalePhi * errorScalePhi);
37  coefficients(3, 3) = (errorScaleTheta * errorScaleTheta);
38  coefficients(4, 4) = (errorScaleQoverP * errorScaleQoverP);
39  coefficients.fillSymmetric(0, 1, (errorScaleLocX * errorScaleLocY));
40  coefficients.fillSymmetric(0, 2, (errorScaleLocX * errorScalePhi));
41  coefficients.fillSymmetric(0, 3, (errorScaleLocX * errorScaleTheta));
42  coefficients.fillSymmetric(0, 4, (errorScaleLocX * errorScaleQoverP));
43  coefficients.fillSymmetric(1, 2, (errorScaleLocY * errorScalePhi));
44  coefficients.fillSymmetric(1, 3, (errorScaleLocY * errorScaleTheta));
45  coefficients.fillSymmetric(1, 4, (errorScaleLocY * errorScaleQoverP));
46  coefficients.fillSymmetric(2, 3, (errorScalePhi * errorScaleTheta));
47  coefficients.fillSymmetric(2, 4, (errorScalePhi * errorScaleQoverP));
48  coefficients.fillSymmetric(3, 4, (errorScaleTheta * errorScaleQoverP));
49 
50  for (ComponentParameters& component : in) {
51  Trk::TrackParameters* trackParameters = component.params.get();
52  const AmgSymMatrix(5)* originalMatrix = trackParameters->covariance();
53  // If no covariance skip
54  if (!originalMatrix) {
55  continue;
56  }
57  AmgSymMatrix(5) newCovarianceMatrix =
58  (*originalMatrix).cwiseProduct(coefficients);
59  trackParameters->updateParameters(trackParameters->parameters(),
60  newCovarianceMatrix);
61  }
62  return { std::move(in) };
63 }
Trk::MultiComponentStateHelpers::allHaveCovariance
bool allHaveCovariance(const MultiComponentState &in)
Check to see if all components have covariance Matrix.
Definition: ComponentParameters.cxx:66
PlotCalibFromCool.norm
norm
Definition: PlotCalibFromCool.py:100
AmgSymMatrix
#define AmgSymMatrix(dim)
Definition: EventPrimitives.h:50
Trk::MultiComponentState
std::vector< ComponentParameters > MultiComponentState
Definition: ComponentParameters.h:27
Trk::ParametersBase
Definition: ParametersBase.h:55
physics_parameters.parameters
parameters
Definition: physics_parameters.py:144
fillSymmetric
void fillSymmetric(size_t i, size_t j, Scalar value)
method to fill elements for a symmetric matrix
Definition: AmgMatrixBasePlugin.h:124