BOSS 7.0.2
BESIII Offline Software System
Loading...
Searching...
No Matches
Analysis/VertexFit/VertexFit-00-02-78/VertexFit/KalmanVertexFit.h
Go to the documentation of this file.
1#ifndef Kalman_Vertex_Fit_H
2#define Kalman_Vertex_Fit_H
3
4#include <vector>
5#include "VertexFit/HTrackParameter.h"
6#include "VertexFit/VertexParameter.h"
7#include "VertexFit/WTrackParameter.h"
8
9using namespace std;
10//
11// Kalman vertex fit interface
12//
13// Apr. 13, 2007, K.L. He created
14//
15
17
18 public:
19
20 static KalmanVertexFit *instance();
22
23 //
24 // initialization
25 void init();
26 //
27 // initial vertex parameter
28 //
29 void initVertex(const VertexParameter vtx);
30 //
31 // track interface
32 //
33 void addTrack(const HTrackParameter);
34 //
35 // an interface for magnetic field
36 //
37
38 /* will in added in the future */
39
40 //
41 // the method of filter
42 //
43 int filter(const int k); // iteration for track k;
44 void filter();
45 //
46 // the method of inverse filter
47 //
48 void inverse(const int k); // inverse kalman filter
49 //
50 // the method of smooth
51 //
52 void smooth(const int k);
53 void smooth();
54 //
55 // remove track k
56 //
57 void remove(const int k); // remove track k from vertex, done by user
58
59 // xum
60 HepVector pull(const int k);
61 double pullmomentum(const int k);
62 //
63 // output of Kalman vertex fit
64 //
65
66 // updated vertex information
67 VertexParameter vtx() const;
68 HepVector x() const {return m_x;}
69 HepSymMatrix Ex() const;
70
71 //
72 // number of track, chi-square, etc
73 //
74 int numTrack() const;
75 int ndof() const {return m_ndof;}
76 double chisq() {return m_chisq;}
77 int trackID(const int k) const {return m_hTrkOrigin[k].trackID();}
78 std::vector<int> trackIDList() const; // ID of tracks constribute to vertex fitting
79
80 //
81 // chi-square of filter and smooth
82 //
83 double chiF(const int k) const {return m_chiF[k];} // chi-square of filter for track k
84 double chiS(const int k) const; // chi-square of smooth for track k
85
86 //
87 // updated helix parameter after fit
88 //
89 HTrackParameter hTrack(const int k) const; // at cloest point approach to origin
90 WTrackParameter wTrack(const int k, const double mass) const; // at the vertex position
91
92 //
93 // set the number of iteration, chi-square cut for tracks
94 //
95 void setVertexIteration(const int num) {m_maxVertexIteration = num;}
96 void setTrackIteration(const int num) {m_maxTrackIteration = num;}
97 void setChisqCut(const double chicut) {m_chisqCutforTrack = chicut;}
98 void setTrackIterationCut(const double chicut) {m_chisqCutforTrackIteration = chicut;} //xum
99 //
100 // set input vector<HTrackParameter>, wait for some days
101 //
102
103 private:
104 void updateMatrices(const int k); // update derivative matrices during filter
105 void updateMatrices(const int k, const HepVector p, const HepVector x); // update derivative matrices during filter
106 KalmanVertexFit(); // constructor
107 static KalmanVertexFit *m_pointer; // pointer
108
109 private:
110 HepVector m_x; // vertex position
111 HepSymMatrix m_C0; // Initial inverse covariance matrix of vertex
112 HepSymMatrix m_C; // current inverse covariance matrix of vertex
113 int m_ndof; // number of degree of freedom = 2 * nTrk -3
114 double m_chisq; // total chisq of vertex fit
115 private:
116 std::vector<int> m_flag; // remove flag for track k;
117 std::vector<HepVector> m_p; // 3-momentum at vertex position for track k
118 std::vector<HTrackParameter> m_hTrkOrigin; // measured helix parameter for track k
119 std::vector<HTrackParameter> m_hTrkInfit; // xum add
120 private:
121 std::vector<HepSymMatrix> m_G; // 5x5 matrix G=V^{-1}, inversion of error matrix for track k, do not change during fitting
122 std::vector<HepMatrix> m_A; // 5x3 derivative matrix da/dx for track k
123 std::vector<HepMatrix> m_B; // 5x3 derivative matrix da/dp for track k
124 std::vector<HepVector> m_c; // c0 vector for track k
125 std::vector<HepSymMatrix> m_W; // 3x3 matrix (BT * G * B)^{-1}
126 std::vector<HepSymMatrix> m_GB; // 5x5 matrix
127 std::vector<double> m_chiF; // chisq of filter
128
129 private: //xum
130 double calculationP(const double kappa, const double lamb);
131 double calculationSigmaP(const double kappa, const double lamb, const double Vkappa,
132 const double Vlamb, const double Vkappa_lamb);
133
134 private:
135 double m_chisqCutforTrack; // chisq cut
136 int m_maxVertexIteration; // number of iteration, 3 times are enough
137 int m_maxTrackIteration;
138 double m_chisqCutforTrackIteration;
139};
140#endif
double mass
double pullmomentum(const int k)
HepSymMatrix Ex() const
void addTrack(const HTrackParameter)
HTrackParameter hTrack(const int k) const
WTrackParameter wTrack(const int k, const double mass) const
VertexParameter vtx() const
std::vector< int > trackIDList() const
double chiS(const int k) const
void initVertex(const VertexParameter vtx)
int numTrack() const
HepVector pull(const int k)
static KalmanVertexFit * instance()
void inverse(const int k)
void remove(const int k)