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

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

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

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