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