CMS 3D CMS Logo

KalmanState.h
Go to the documentation of this file.
1 #ifndef L1Trigger_TrackFindingTMTT_KalmanState_h
2 #define L1Trigger_TrackFindingTMTT_KalmanState_h
3 
6 #include <TMatrixD.h>
7 #include <TVectorD.h>
8 
9 #include <map>
10 
14 
15 namespace tmtt {
16 
17  class KFbase;
18  class KalmanState;
19  class Stub;
20  class Settings;
21 
22  class KalmanState {
23  public:
25  const L1track3D &candidate,
26  unsigned nSkipped,
27  int kLayer,
28  const KalmanState *last_state,
29  const TVectorD &vecX,
30  const TMatrixD &matC,
31  const TMatrixD &matK,
32  const TMatrixD &matV,
33  Stub *stub,
34  double chi2rphi,
35  double chi2rz);
36 
37  const Settings *settings() const { return settings_; }
38  // KF layer where next stub to extend this state should be sought.
39  unsigned nextLayer() const { return (1 + kLayer_); }
40  // KF layer of last added stub. (-1 if no stubs yet).
41  int layer() const { return kLayer_; }
42  bool barrel() const { return barrel_; }
43  unsigned nSkippedLayers() const { return nSkipped_; }
44  // Hit coordinates.
45  double r() const { return r_; }
46  double z() const { return z_; }
47  const KalmanState *last_state() const { return last_state_; }
48  // Helix parameters (1/2R, phi relative to sector, z0, tanLambda)
49  const TVectorD &vectorX() const { return vecX_; }
50  // Covariance matrix on helix params.
51  const TMatrixD &matrixC() const { return matC_; }
52  // Kalman Gain matrix
53  const TMatrixD &matrixK() const { return matK_; }
54  // Hit position covariance matrix.
55  const TMatrixD &matrixV() const { return matV_; }
56  // Last added stub
57  Stub *stub() const { return stub_; }
58  // Track used to seed KF.
59  const L1track3D &candidate() const { return l1track3D_; }
60 
61  double chi2() const { return chi2rphi_ + chi2rz_; }
62  double chi2scaled() const { return chi2rphi_ / kalmanChi2RphiScale_ + chi2rz_; } // Improves electron performance.
63  double chi2rphi() const { return chi2rphi_; }
64  double chi2rz() const { return chi2rz_; }
65  unsigned nStubLayers() const { return n_stubs_; }
66  unsigned int hitPattern() const { return hitPattern_; } // Bit-encoded KF layers the fitted track has stubs in.
67 
68  bool good(const TP *tp) const;
69  double reducedChi2() const;
70  const KalmanState *last_update_state() const;
71  std::vector<Stub *> stubs() const;
72 
73  void setChi2(double chi2rphi, double chi2rz) {
75  chi2rz_ = chi2rz;
76  }
77 
78  private:
80  int kLayer_;
81  double r_;
82  double z_;
84  TVectorD vecX_;
85  TMatrixD matC_;
86  TMatrixD matK_;
87  TMatrixD matV_;
89  double chi2rphi_;
90  double chi2rz_;
91  unsigned int kalmanChi2RphiScale_;
92  unsigned n_stubs_;
93  bool barrel_;
94  unsigned nSkipped_;
96  unsigned int hitPattern_;
97  };
98 
99 } // namespace tmtt
100 
101 #endif
double reducedChi2() const
Definition: KalmanState.cc:72
unsigned nextLayer() const
Definition: KalmanState.h:39
unsigned nSkippedLayers() const
Definition: KalmanState.h:43
const Settings * settings() const
Definition: KalmanState.h:37
const TVectorD & vectorX() const
Definition: KalmanState.h:49
const KalmanState * last_state() const
Definition: KalmanState.h:47
double chi2rz() const
Definition: KalmanState.h:64
const TMatrixD & matrixK() const
Definition: KalmanState.h:53
double z() const
Definition: KalmanState.h:46
std::vector< Stub * > stubs() const
Definition: KalmanState.cc:89
Stub * stub() const
Definition: KalmanState.h:57
const KalmanState * last_state_
Definition: KalmanState.h:83
bool barrel() const
Definition: KalmanState.h:42
unsigned nStubLayers() const
Definition: KalmanState.h:65
const Settings * settings_
Definition: KalmanState.h:79
Definition: TP.h:23
const KalmanState * last_update_state() const
Definition: KalmanState.cc:79
bool good(const TP *tp) const
Definition: KalmanState.cc:58
unsigned nSkipped_
Definition: KalmanState.h:94
double r() const
Definition: KalmanState.h:45
unsigned int kalmanChi2RphiScale_
Definition: KalmanState.h:91
const TMatrixD & matrixV() const
Definition: KalmanState.h:55
double chi2() const
Definition: KalmanState.h:61
static const std::string kLayer("layer")
double chi2scaled() const
Definition: KalmanState.h:62
L1track3D l1track3D_
Definition: KalmanState.h:95
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
const TMatrixD & matrixC() const
Definition: KalmanState.h:51
int layer() const
Definition: KalmanState.h:41
unsigned int hitPattern_
Definition: KalmanState.h:96
double chi2rphi() const
Definition: KalmanState.h:63
unsigned n_stubs_
Definition: KalmanState.h:92
KalmanState(const Settings *settings, const L1track3D &candidate, unsigned nSkipped, int kLayer, const KalmanState *last_state, const TVectorD &vecX, const TMatrixD &matC, const TMatrixD &matK, const TMatrixD &matV, Stub *stub, double chi2rphi, double chi2rz)
Definition: KalmanState.cc:9
void setChi2(double chi2rphi, double chi2rz)
Definition: KalmanState.h:73
const L1track3D & candidate() const
Definition: KalmanState.h:59
unsigned int hitPattern() const
Definition: KalmanState.h:66