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
tmtt::KalmanState::matrixC
const TMatrixD & matrixC() const
Definition: KalmanState.h:51
tmtt::KalmanState::chi2rz
double chi2rz() const
Definition: KalmanState.h:64
tmtt::KalmanState::matV_
TMatrixD matV_
Definition: KalmanState.h:87
tmtt::KalmanState::layer
int layer() const
Definition: KalmanState.h:41
tmtt::KalmanState::settings_
const Settings * settings_
Definition: KalmanState.h:79
tmtt::KalmanState::kalmanChi2RphiScale_
unsigned int kalmanChi2RphiScale_
Definition: KalmanState.h:91
tmtt::KalmanState::matrixK
const TMatrixD & matrixK() const
Definition: KalmanState.h:53
tmtt::KalmanState::n_stubs_
unsigned n_stubs_
Definition: KalmanState.h:92
tmtt::KalmanState::l1track3D_
L1track3D l1track3D_
Definition: KalmanState.h:95
Stub.h
tmtt::KalmanState::good
bool good(const TP *tp) const
Definition: KalmanState.cc:58
tmtt::KalmanState::chi2
double chi2() const
Definition: KalmanState.h:61
tmtt::TP
Definition: TP.h:23
tmtt::KalmanState::chi2rphi
double chi2rphi() const
Definition: KalmanState.h:63
tmtt::KalmanState::chi2rz_
double chi2rz_
Definition: KalmanState.h:90
tmtt::KalmanState::last_state
const KalmanState * last_state() const
Definition: KalmanState.h:47
tmtt::KalmanState::z_
double z_
Definition: KalmanState.h:82
tmtt::KalmanState::chi2scaled
double chi2scaled() const
Definition: KalmanState.h:62
tmtt::KalmanState::KalmanState
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
tmtt::KalmanState::reducedChi2
double reducedChi2() const
Definition: KalmanState.cc:72
tmtt::KalmanState::stubs
std::vector< Stub * > stubs() const
Definition: KalmanState.cc:89
tmtt::KalmanState::nSkippedLayers
unsigned nSkippedLayers() const
Definition: KalmanState.h:43
tmtt::KalmanState::matrixV
const TMatrixD & matrixV() const
Definition: KalmanState.h:55
tmtt::KalmanState::chi2rphi_
double chi2rphi_
Definition: KalmanState.h:89
tmtt::KalmanState::barrel
bool barrel() const
Definition: KalmanState.h:42
cmsswSequenceInfo.tp
tp
Definition: cmsswSequenceInfo.py:17
tmtt::KalmanState::setChi2
void setChi2(double chi2rphi, double chi2rz)
Definition: KalmanState.h:73
tmtt::KalmanState::r_
double r_
Definition: KalmanState.h:81
tmtt::KalmanState::candidate
const L1track3D & candidate() const
Definition: KalmanState.h:59
tmtt::KalmanState::matK_
TMatrixD matK_
Definition: KalmanState.h:86
tmtt::KalmanState::z
double z() const
Definition: KalmanState.h:46
tmtt::KalmanState
Definition: KalmanState.h:22
tmtt::KalmanState::settings
const Settings * settings() const
Definition: KalmanState.h:37
tmtt::KalmanState::vectorX
const TVectorD & vectorX() const
Definition: KalmanState.h:49
tmtt::Settings
Definition: Settings.h:17
tmtt::KalmanState::hitPattern_
unsigned int hitPattern_
Definition: KalmanState.h:96
tmtt::KalmanState::vecX_
TVectorD vecX_
Definition: KalmanState.h:84
tmtt::KalmanState::r
double r() const
Definition: KalmanState.h:45
tmtt::KalmanState::barrel_
bool barrel_
Definition: KalmanState.h:93
tmtt::KalmanState::nextLayer
unsigned nextLayer() const
Definition: KalmanState.h:39
tmtt::KalmanState::last_update_state
const KalmanState * last_update_state() const
Definition: KalmanState.cc:79
tmtt::KalmanState::stub
Stub * stub() const
Definition: KalmanState.h:57
tmtt::KalmanState::hitPattern
unsigned int hitPattern() const
Definition: KalmanState.h:66
tmtt::KalmanState::kLayer_
int kLayer_
Definition: KalmanState.h:80
KFbase.h
tmtt::KalmanState::last_state_
const KalmanState * last_state_
Definition: KalmanState.h:83
tmtt::KalmanState::nSkipped_
unsigned nSkipped_
Definition: KalmanState.h:94
tmtt::KalmanState::nStubLayers
unsigned nStubLayers() const
Definition: KalmanState.h:65
tmtt::Stub
Definition: Stub.h:43
tmtt::KalmanState::matC_
TMatrixD matC_
Definition: KalmanState.h:85
tmtt::L1track3D
Definition: L1track3D.h:24
tmtt
=== This is the base class for the linearised chi-squared track fit algorithms.
Definition: Array2D.h:16
kLayer
static const std::string kLayer("layer")
tmtt::KalmanState::stub_
Stub * stub_
Definition: KalmanState.h:88