Belle II Software development
SVDKalmanStepper.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <tracking/ckf/svd/utilities/SVDKalmanStepper.h>
10
11#include <tracking/ckf/svd/entities/CKFToSVDState.h>
12#include <svd/reconstruction/SVDRecoHit.h>
13
14using namespace Belle2;
15
16double SVDKalmanStepper::kalmanStep(genfit::MeasuredStateOnPlane& measuredStateOnPlane, const CKFToSVDState& state)
17{
18 double chi2 = 0;
19 for (const SVDRecoHit& svdRecoHit : state.getRecoHits()) {
20 const std::vector<genfit::MeasurementOnPlane*>& measurementsOnPlane = svdRecoHit.constructMeasurementsOnPlane(
21 measuredStateOnPlane);
22
23 B2ASSERT("I expect exactly one measurement here", measurementsOnPlane.size() == 1);
24 const genfit::MeasurementOnPlane* measurementOnPlane = measurementsOnPlane.front();
25
26 chi2 += m_kalmanStepper.kalmanStep(measuredStateOnPlane, *measurementOnPlane);
27
28 delete measurementOnPlane;
29 }
30 return chi2;
31}
32
33double SVDKalmanStepper::calculateResidual(genfit::MeasuredStateOnPlane& measuredStateOnPlane, const CKFToSVDState& state)
34{
35 double residual = 0;
36 for (const SVDRecoHit& svdRecoHit : state.getRecoHits()) {
37 const std::vector<genfit::MeasurementOnPlane*>& measurementsOnPlane = svdRecoHit.constructMeasurementsOnPlane(
38 measuredStateOnPlane);
39
40 B2ASSERT("I expect exactly one measurement here", measurementsOnPlane.size() == 1);
41 const genfit::MeasurementOnPlane* measurementOnPlane = measurementsOnPlane.front();
42
43 residual += m_kalmanStepper.calculateResidual(measuredStateOnPlane, *measurementOnPlane);
44
45 delete measurementOnPlane;
46 }
47 return residual;
48}
Specialized CKF State for extrapolating into the SVD.
Definition: CKFToSVDState.h:27
const std::vector< SVDRecoHit > & getRecoHits() const
Helper function for getting the already created reco hits (runtime reasons)
double kalmanStep(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const genfit::MeasurementOnPlane &measurementOnPlane) const
Kalman update of the mSoP using the measurement. Is just a wrapper around the other kalmanStepper wor...
Definition: KalmanStepper.h:48
double calculateResidual(const genfit::MeasuredStateOnPlane &measuredStateOnPlane, const genfit::MeasurementOnPlane &measurementOnPlane) const
Helper function to calculate a residual between the mSoP and the measurement.
Definition: KalmanStepper.h:70
double kalmanStep(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const CKFToSVDState &state)
Do a kalman step of the mSoP to the measurement in the state. Returns the chi2.
double calculateResidual(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const CKFToSVDState &state)
Calculate the residual between the mSoP and the measurement in the state.
KalmanStepper< 1 > m_kalmanStepper
Implementation using the general kalman stepper.
SVDRecoHit - an extended form of SVDHit containing geometry information.
Definition: SVDRecoHit.h:47
Abstract base class for different kinds of events.