Belle II Software  release-05-02-19
KalmanFilter.h
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 #pragma once
11 
12 #include <tracking/trackFindingCDC/filters/base/Filter.dcl.h>
13 #include <tracking/trackFindingCDC/numerics/WithWeight.h>
14 #include <genfit/MeasuredStateOnPlane.h>
15 
16 #include <vector>
17 #include <framework/logging/Logger.h>
18 
19 namespace Belle2 {
32  template <class AState, class AKalmanStepper>
33  class KalmanFilter : public
34  TrackFindingCDC::Filter<std::pair<const std::vector<TrackFindingCDC::WithWeight<const AState*>>, AState*>> {
35  public:
37  TrackFindingCDC::Weight operator()(const std::pair<const std::vector<TrackFindingCDC::WithWeight<const AState*>>, AState*>& pair)
38  override
39  {
40  AState* currentState = pair.second;
41 
42  B2ASSERT("Can not update with nothing", currentState->mSoPSet());
43  genfit::MeasuredStateOnPlane measuredStateOnPlane = currentState->getMeasuredStateOnPlane();
44 
45  const double chi2 = m_kalmanStepper.kalmanStep(measuredStateOnPlane, *currentState);
46 
47  currentState->setChi2(chi2);
48  currentState->setMeasuredStateOnPlane(measuredStateOnPlane);
49 
50  return chi2;
51  }
52 
53  private:
55  AKalmanStepper m_kalmanStepper;
56  };
58 }
genfit::MeasuredStateOnPlane
#StateOnPlane with additional covariance matrix.
Definition: MeasuredStateOnPlane.h:39
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::KalmanFilter::m_kalmanStepper
AKalmanStepper m_kalmanStepper
The used stepper algorithm.
Definition: KalmanFilter.h:63
Belle2::KalmanFilter::operator()
TrackFindingCDC::Weight operator()(const std::pair< const std::vector< TrackFindingCDC::WithWeight< const AState * >>, AState * > &pair) override
Call the kalmanStep and update the new state and its chi2.
Definition: KalmanFilter.h:45