ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::MultiComponentStateCombiner Namespace Reference

Functions

std::unique_ptr< Trk::TrackParameterscombineToSingle (const MultiComponentState &, const bool useMode=false)
 @bried Calculate combined state of many components
void combineParametersWithWeight (AmgVector(5) &firstParameters, double &firstWeight, const AmgVector(5) &secondParameters, const double secondWeight)
 Combine parameters based on their relevant weigths.
void combineCovWithWeight (const AmgVector(5) &firstParameters, AmgSymMatrix(5) &firstMeasuredCov, const double firstWeight, const AmgVector(5) &secondParameters, const AmgSymMatrix(5) &secondMeasuredCov, const double secondWeight)
 Combine cov matrices based on their relevant weights.

Function Documentation

◆ combineCovWithWeight()

ATH_FLATTEN void Trk::MultiComponentStateCombiner::combineCovWithWeight ( const AmgVector(5) & firstParameters,
AmgSymMatrix(5) & firstMeasuredCov,
const double firstWeight,
const AmgVector(5) & secondParameters,
const AmgSymMatrix(5) & secondMeasuredCov,
const double secondWeight )

Combine cov matrices based on their relevant weights.

Definition at line 227 of file MultiComponentStateCombiner.cxx.

234{
235 double const invTotalWeight = 1.0/(firstWeight + secondWeight);
236 AmgVector(5) parameterDifference = firstParameters - secondParameters;
237 parameterDifference[2] = CxxUtils::wrapToPi(parameterDifference[2]);
238 parameterDifference *= invTotalWeight;
239 firstMeasuredCov = (firstWeight * firstMeasuredCov + secondWeight * secondMeasuredCov) * invTotalWeight;
240 firstMeasuredCov += firstWeight * secondWeight * parameterDifference * parameterDifference.transpose();
241}
#define AmgVector(rows)

◆ combineParametersWithWeight()

ATH_FLATTEN void Trk::MultiComponentStateCombiner::combineParametersWithWeight ( AmgVector(5) & firstParameters,
double & firstWeight,
const AmgVector(5) & secondParameters,
const double secondWeight )

Combine parameters based on their relevant weigths.

Definition at line 201 of file MultiComponentStateCombiner.cxx.

206{
207 double const totalWeight = firstWeight + secondWeight;
208 double const invTotalWeight = 1.0/totalWeight;
209 double const deltaPhi = firstParameters[2] - secondParameters[2];
210 if (deltaPhi > M_PI) {
211 firstParameters[2] -= 2 * M_PI;
212 } else if (deltaPhi < -M_PI) {
213 firstParameters[2] += 2 * M_PI;
214 }
215 firstParameters =
216 (firstWeight * firstParameters + secondWeight * secondParameters) *
217 invTotalWeight;
218 // Ensure that phi is between -pi and pi
219 firstParameters[2] = CxxUtils::wrapToPi(firstParameters[2]);
220 firstWeight = totalWeight;
221}
#define M_PI
Scalar deltaPhi(const MatrixBase< Derived > &vec) const
T wrapToPi(T phi)
Wrap angle in radians to [-pi, pi].
Definition phihelper.h:24

◆ combineToSingle()

std::unique_ptr< Trk::TrackParameters > Trk::MultiComponentStateCombiner::combineToSingle ( const MultiComponentState & uncombinedState,
const bool useMode = false )

@bried Calculate combined state of many components

Definition at line 190 of file MultiComponentStateCombiner.cxx.

191 {
192 Trk::ComponentParameters combinedComponent = combineToSingleImpl(uncombinedState, useMode);
193 return std::move(combinedComponent.params);
194}
std::unique_ptr< Trk::TrackParameters > params