1#include "VertexFit/FastVertexFit.h"
2#include "VertexFit/BField.h"
4const double alpha = -0.00299792458;
10 if(m_pointer)
return m_pointer;
17FastVertexFit::FastVertexFit() {;}
25 m_Vx = HepVector(3, 0);
26 m_Evx = HepSymMatrix(3,0);
34 HepSymMatrix Wc(2, 0);
36 Wc[0][1] = Wc[1][0] = err[0][3];
38 Wc = Wc.inverse(ifail);
40 HepVector p0(3, 0), v0(3, 0);
41 double pxy = 1./fabs(helix[2]);
42 p0[0] = 0 - pxy*
sin(helix[1]);
43 p0[1] = pxy*
cos(helix[1]);
44 p0[2] = pxy * helix[4];
45 v0[0] = helix[0]*
cos(helix[1]);
46 v0[1] = helix[0]*
sin(helix[1]);
52 int charge = (helix[2]>0 ? +1 :-1);
54 double T0 = sqrt((p0[0]+a*p0[1])*(p0[0]+a*p0[1])+(p0[1]-a*p0[0])*(p0[1]-a*p0[0]));
56 HepMatrix Dc(2, 3, 0);
57 Dc[0][0] = (p0[1] - a*v0[0])/T0;
58 Dc[0][1] = 0 - (p0[0] + a*v0[1])/T0;
59 Dc[1][0] = 0 - (p0[2]/T0) * (p0[0] + a*v0[1])/T0;
60 Dc[1][1] = 0 - (p0[2]/T0) * (p0[1] - a*v0[0])/T0;
66 HepSymMatrix DTWD(3, 0);
67 DTWD = Wc.similarity(Dc.T());
73 m_DTWD.push_back(DTWD);
78 bool fitResult =
false;
81 HepSymMatrix total_DTWD(3, 0);
82 HepVector total_xp(3, 0);
84 for(
int i = 0; i < m_DTWD.size(); i++) {
85 total_DTWD += m_DTWD[i];
86 total_xp += m_DTWD[i]*m_xp[i];
88 m_Vx = total_DTWD.inverse(ifail) * total_xp;
89 m_Evx = total_DTWD.inverse(ifail);
92 for(
int i = 0; i < m_xp.size(); i++) {
93 double chi2 = (m_DTWD[i].similarity((m_xp[i] - m_Vx).T()))[0][0];
103 HepVector pull(3, 0);
104 pull[0] = m_Vx[0]/sqrt(m_Evx[0][0]);
105 pull[1] = m_Vx[1]/sqrt(m_Evx[1][1]);
106 pull[2] = m_Vx[2]/sqrt(m_Evx[2][2]);
double sin(const BesAngle a)
double cos(const BesAngle a)
static FastVertexFit * instance()
void addTrack(const int number, const HepVector helix, const HepSymMatrix err)
static VertexFitBField * instance()