Belle II Software  release-08-01-10
KalmanFilter.h
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 #pragma once
9 
10 #include <tracking/trackFindingCDC/filters/base/Filter.dcl.h>
11 #include <tracking/trackFindingCDC/numerics/WithWeight.h>
12 #include <genfit/MeasuredStateOnPlane.h>
13 
14 #include <vector>
15 #include <framework/logging/Logger.h>
16 
17 namespace Belle2 {
30  template <class AState, class AKalmanStepper>
31  class KalmanFilter : public
32  TrackFindingCDC::Filter<std::pair<const std::vector<TrackFindingCDC::WithWeight<const AState*>>, AState*>> {
33  public:
35  TrackFindingCDC::Weight operator()(const std::pair<const std::vector<TrackFindingCDC::WithWeight<const AState*>>, AState*>& pair)
36  override
37  {
38  AState* currentState = pair.second;
39 
40  B2ASSERT("Can not update with nothing", currentState->mSoPSet());
41  genfit::MeasuredStateOnPlane measuredStateOnPlane = currentState->getMeasuredStateOnPlane();
42 
43  const double chi2 = m_kalmanStepper.kalmanStep(measuredStateOnPlane, *currentState);
44 
45  currentState->setChi2(chi2);
46  currentState->setMeasuredStateOnPlane(measuredStateOnPlane);
47 
48  return chi2;
49  }
50 
51  private:
53  AKalmanStepper m_kalmanStepper;
54  };
56 }
Filter which can be used on a pair of path (vector of states) and states, which will call the kalmanS...
Definition: KalmanFilter.h:32
AKalmanStepper m_kalmanStepper
The used stepper algorithm.
Definition: KalmanFilter.h:53
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:35
Base class for filters on a generic object type.
Definition: Filter.dcl.h:29
A mixin class to attach a weight to an object.
Definition: WithWeight.h:24
#StateOnPlane with additional covariance matrix.
Abstract base class for different kinds of events.