~jan.greis/maus/1811

« back to all changes in this revision

Viewing changes to src/common_cpp/Recon/.Kalman_old/KalmanFilter.hh

Merging start

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
 
2
 *
 
3
 * MAUS is free software: you can redistribute it and/or modify
 
4
 * it under the terms of the GNU General Public License as published by
 
5
 * the Free Software Foundation, either version 3 of the License, or
 
6
 * (at your option) any later version.
 
7
 *
 
8
 * MAUS is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU General Public License
 
14
 * along with MAUS.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 */
 
17
 
 
18
 
 
19
#ifndef KALMANSMOOTHER_HH
 
20
#define KALMANSMOOTHER_HH
 
21
 
 
22
// C headers
 
23
#include <assert.h>
 
24
 
 
25
// C++ headers
 
26
#include <string>
 
27
#include <vector>
 
28
#include <cmath>
 
29
 
 
30
#include "TMath.h"
 
31
#include "TMatrixD.h"
 
32
 
 
33
#include "Utils/Exception.hh"
 
34
#include "src/common_cpp/Recon/Kalman/KalmanState.hh"
 
35
#include "src/common_cpp/DataStructure/SciFiTrack.hh"
 
36
#include "src/common_cpp/DataStructure/ThreeVector.hh"
 
37
 
 
38
namespace MAUS {
 
39
 
 
40
class KalmanFilter {
 
41
 public:
 
42
  /** @brief  Default constructor.
 
43
   */
 
44
  KalmanFilter();
 
45
 
 
46
  /** @brief  Constructor accepting dimension of member matrices.
 
47
   */
 
48
  explicit KalmanFilter(int dim);
 
49
 
 
50
  /** @brief  Destructor.
 
51
   */
 
52
  ~KalmanFilter();
 
53
 
 
54
  /** @brief  Runs the filter stage by calling the other member functions.
 
55
   */
 
56
  void Process(KalmanState *a_site);
 
57
 
 
58
  /** @brief  Computes the filtered state.
 
59
   */
 
60
  void CalculateFilteredState(KalmanState *a_site);
 
61
 
 
62
  /** @brief  Computes the filtered covariance matrix.
 
63
   */
 
64
  void UpdateCovariance(KalmanState *a_site);
 
65
 
 
66
  TMatrixD SolveMeasurementEquation(const TMatrixD &a, const TMatrixD &s);
 
67
 
 
68
  /** @brief  Computes the difference between the estimation and measurement for different stages.
 
69
   */
 
70
  void ComputeResidual(KalmanState *a_site, KalmanState::State kalman_state);
 
71
 
 
72
  void ComputeChi2(KalmanState *a_site);
 
73
 
 
74
  void UpdateV(const KalmanState *a_site);
 
75
 
 
76
  void UpdateH(const KalmanState *a_site);
 
77
 
 
78
  void UpdateW(const KalmanState *a_site);
 
79
 
 
80
  void UpdateK(const KalmanState *a_site);
 
81
 
 
82
  void ComputePull(KalmanState *a_site);
 
83
 
 
84
  TMatrixD H() const { return _H; }
 
85
 
 
86
 private:
 
87
  int _n_parameters;
 
88
 
 
89
  int _measurement_dim;
 
90
 
 
91
  TMatrixD _V;
 
92
 
 
93
  TMatrixD _H;
 
94
 
 
95
  TMatrixD _S;
 
96
 
 
97
  TMatrixD _W;
 
98
 
 
99
  TMatrixD _K;
 
100
 
 
101
  MaterialParams FibreParameters;
 
102
 
 
103
  double _sigma_alpha;
 
104
};
 
105
 
 
106
} // ~namespace MAUS
 
107
 
 
108
#endif
 
109