Belle II Software  release-05-01-25
PXDKalmanStepper.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/pxd/utilities/PXDKalmanStepper.h>
12 
13 #include <tracking/ckf/pxd/entities/CKFToPXDState.h>
14 #include <pxd/reconstruction/PXDRecoHit.h>
15 
16 using namespace Belle2;
17 
18 double PXDKalmanStepper::kalmanStep(genfit::MeasuredStateOnPlane& measuredStateOnPlane, const CKFToPXDState& state)
19 {
20  double chi2 = 0;
21  for (const PXDRecoHit& pxdRecoHit : state.getRecoHits()) {
22  const std::vector<genfit::MeasurementOnPlane*>& measurementsOnPlane = pxdRecoHit.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 PXDRecoHit& pxdRecoHit : state.getRecoHits()) {
39  const std::vector<genfit::MeasurementOnPlane*>& measurementsOnPlane = pxdRecoHit.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::PXDKalmanStepper::calculateResidual
double calculateResidual(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const CKFToPXDState &state)
Calculate the residual between the mSoP and the measurement in the state.
Definition: PXDKalmanStepper.cc:35
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::CKFToPXDState
Specialized CKF State for extrapolating into the PXD.
Definition: CKFToPXDState.h:29
Belle2::PXDKalmanStepper::kalmanStep
double kalmanStep(genfit::MeasuredStateOnPlane &measuredStateOnPlane, const CKFToPXDState &state)
Do a kalman step of the mSoP to the measurement in the state. Returns the chi2.
Definition: PXDKalmanStepper.cc:18
Belle2::PXDRecoHit
PXDRecoHit - an extended form of PXDCluster containing geometry information.
Definition: PXDRecoHit.h:61
Belle2::PXDKalmanStepper::m_kalmanStepper
KalmanStepper< 2 > m_kalmanStepper
Implementation using the general kalman stepper.
Definition: PXDKalmanStepper.h:36
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
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::CKFToPXDState::getRecoHits
const std::vector< PXDRecoHit > & getRecoHits() const
Helper function for getting the already created reco hits (runtime reasons)
Definition: CKFToPXDState.cc:56
genfit::MeasurementOnPlane
Measured coordinates on a plane.
Definition: MeasurementOnPlane.h:46