Belle II Software  release-05-01-25
SVDKalmanStepper.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <tracking/ckf/svd/utilities/SVDKalmanStepper.h>
12 
13 #include <tracking/ckf/svd/entities/CKFToSVDState.h>
14 #include <svd/reconstruction/SVDRecoHit.h>
15 
16 using namespace Belle2;
17 
18 double SVDKalmanStepper::kalmanStep(genfit::MeasuredStateOnPlane& measuredStateOnPlane, const CKFToSVDState& state)
19 {
20  double chi2 = 0;
21  for (const SVDRecoHit& svdRecoHit : state.getRecoHits()) {
22  const std::vector<genfit::MeasurementOnPlane*>& measurementsOnPlane = svdRecoHit.constructMeasurementsOnPlane(
23  measuredStateOnPlane);
24 
25  B2ASSERT("I expect exactly one measurement here", measurementsOnPlane.size() == 1);
26  const genfit::MeasurementOnPlane* measurementOnPlane = measurementsOnPlane.front();
27 
28  chi2 += m_kalmanStepper.kalmanStep(measuredStateOnPlane, *measurementOnPlane);
29 
30  delete measurementOnPlane;
31  }
32  return chi2;
33 }
34 
36 {
37  double residual = 0;
38  for (const SVDRecoHit& svdRecoHit : state.getRecoHits()) {
39  const std::vector<genfit::MeasurementOnPlane*>& measurementsOnPlane = svdRecoHit.constructMeasurementsOnPlane(
40  measuredStateOnPlane);
41 
42  B2ASSERT("I expect exactly one measurement here", measurementsOnPlane.size() == 1);
43  const genfit::MeasurementOnPlane* measurementOnPlane = measurementsOnPlane.front();
44 
45  residual += m_kalmanStepper.calculateResidual(measuredStateOnPlane, *measurementOnPlane);
46 
47  delete measurementOnPlane;
48  }
49  return residual;
50 }
Belle2::SVDRecoHit
SVDRecoHit - an extended form of SVDHit containing geometry information.
Definition: SVDRecoHit.h:57
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2::KalmanStepper::kalmanStep
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:58
Belle2::CKFToSVDState::getRecoHits
const std::vector< SVDRecoHit > & getRecoHits() const
Helper function for getting the already created reco hits (runtime reasons)
Definition: CKFToSVDState.cc:56
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::SVDKalmanStepper::calculateResidual
double calculateResidual(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const CKFToSVDState &state)
Calculate the residual between the mSoP and the measurement in the state.
Definition: SVDKalmanStepper.cc:35
Belle2::SVDKalmanStepper::kalmanStep
double kalmanStep(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const CKFToSVDState &state)
Do a kalman step of the mSoP to the measurement in the state. Returns the chi2.
Definition: SVDKalmanStepper.cc:18
Belle2::KalmanStepper::calculateResidual
double calculateResidual(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const genfit::MeasurementOnPlane &measurementOnPlane) const
Helper function to calculate a residual between the mSoP and the measurement.
Definition: KalmanStepper.h:80
Belle2::SVDKalmanStepper::m_kalmanStepper
KalmanStepper< 1 > m_kalmanStepper
Implementation using the general kalman stepper.
Definition: SVDKalmanStepper.h:36
Belle2::CKFToSVDState
Specialized CKF State for extrapolating into the SVD.
Definition: CKFToSVDState.h:29
genfit::MeasurementOnPlane
Measured coordinates on a plane.
Definition: MeasurementOnPlane.h:46