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 842 of file GsfMeasurementUpdator.cxx.

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

◆ 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 805 of file GsfMeasurementUpdator.cxx.

808 {
809 
810  // Check all components have associated error matrices
811  bool rebuildStateWithErrors = false;
812  // Perform initial check of state awaiting update. If all states have
813  // associated error matricies then no need to perform the rebuild
814  for (const Trk::ComponentParameters& component : stateBeforeUpdate) {
815  rebuildStateWithErrors =
816  rebuildStateWithErrors || invalidComponent(component.params.get());
817  }
818 
819  if (rebuildStateWithErrors) {
820  Trk::MultiComponentState stateWithInsertedErrors =
821  rebuildState(std::move(stateBeforeUpdate));
822  // Perform the measurement update with the modified state
823  Trk::MultiComponentState updatedState = calculateFilterStep(
824  std::move(stateWithInsertedErrors), measurement, fitQoS);
825  if (updatedState.empty()) {
826  return {};
827  }
828  return updatedState;
829  }
830 
831  // Perform the measurement update
832  Trk::MultiComponentState updatedState = calculateFilterStep(
833  std::move(stateBeforeUpdate), measurement, fitQoS);
834 
835  if (updatedState.empty()) {
836  return {};
837  }
838  return updatedState;
839 }
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