ATLAS Offline Software
Functions
Trk::GsfMeasurementUpdator Namespace Reference

Functions

MultiComponentState update (Trk::MultiComponentState &&, const Trk::MeasurementBase &, FitQualityOnSurface &fitQoS)
 Method for updating the multi-state with a new measurement and calculate the fit qaulity at the same time. More...
 
FitQualityOnSurface fitQuality (const MultiComponentState &, const MeasurementBase &)
 Method for determining the chi2 of the multi-component state and the number of degrees of freedom. More...
 

Function Documentation

◆ fitQuality()

Trk::FitQualityOnSurface Trk::GsfMeasurementUpdator::fitQuality ( const MultiComponentState updatedState,
const MeasurementBase measurement 
)

Method for determining the chi2 of the multi-component state and the number of degrees of freedom.

Definition at line 847 of file GsfMeasurementUpdator.cxx.

849 {
850  double chi2 = 0;
851  Trk::FitQualityOnSurface componentFitQuality;
852  for (const Trk::ComponentParameters& component: updatedState) {
853  stateFitQuality(componentFitQuality,
854  *component.params.get(),
855  measurement.localParameters(),
856  measurement.localCovariance());
857 
858  chi2 += component.weight * componentFitQuality.chiSquared();
859  }
860 
861  //The same measurement is included
862  return { chi2, componentFitQuality.numberDoF() };
863 }

◆ update()

Trk::MultiComponentState Trk::GsfMeasurementUpdator::update ( Trk::MultiComponentState &&  stateBeforeUpdate,
const Trk::MeasurementBase measurement,
FitQualityOnSurface fitQoS 
)

Method for updating the multi-state with a new measurement and calculate the fit qaulity at the same time.

Definition at line 810 of file GsfMeasurementUpdator.cxx.

813 {
814 
815  // Check all components have associated error matrices
816  bool rebuildStateWithErrors = false;
817  // Perform initial check of state awaiting update. If all states have
818  // associated error matricies then no need to perform the rebuild
819  for (const Trk::ComponentParameters& component : stateBeforeUpdate) {
820  rebuildStateWithErrors =
821  rebuildStateWithErrors || invalidComponent(component.params.get());
822  }
823 
824  if (rebuildStateWithErrors) {
825  Trk::MultiComponentState stateWithInsertedErrors =
826  rebuildState(std::move(stateBeforeUpdate));
827  // Perform the measurement update with the modified state
828  Trk::MultiComponentState updatedState = calculateFilterStep(
829  std::move(stateWithInsertedErrors), measurement, fitQoS);
830  if (updatedState.empty()) {
831  return {};
832  }
833  return updatedState;
834  }
835 
836  // Perform the measurement update
837  Trk::MultiComponentState updatedState = calculateFilterStep(
838  std::move(stateBeforeUpdate), measurement, fitQoS);
839 
840  if (updatedState.empty()) {
841  return {};
842  }
843  return updatedState;
844 }
Trk::FitQualityOnSurface
Definition: FitQualityOnSurface.h:19
chi2
double chi2(TH1 *h0, TH1 *h1)
Definition: comparitor.cxx:525
Trk::MultiComponentState
std::vector< ComponentParameters > MultiComponentState
Definition: ComponentParameters.h:27
Trk::FitQualityOnSurface::numberDoF
int numberDoF() const
returns the number of degrees of freedom of the overall track or vertex fit as integer
Definition: FitQuality.h:60
Trk::ComponentParameters
Definition: ComponentParameters.h:22
Trk::FitQualityOnSurface::chiSquared
double chiSquared() const
returns the of the overall track fit
Definition: FitQuality.h:56