1#include "VertexFit/SecondVertexFit.h"
2#include "VertexFit/BField.h"
53SecondVertexFit::SecondVertexFit()
56 m_vpar_primary.
setVx(vx);
57 HepSymMatrix evx(3,0);
58 evx[0][0] = 0.1 * 0.1;
59 evx[1][1] = 0.1 * 0.1;
60 evx[2][2] = 1.5 * 1.5;
61 m_vpar_primary.
setEvx(evx);
77 m_p4par = HepLorentzVector(0, 0, 0, 0);
78 m_crxyz = HepVector(3, 0);
91 HepVector aOrigin(10, 0);
92 HepVector aInfit(10, 0);
93 HepSymMatrix VaOrigin(10, 0);
94 HepSymMatrix VaInfit(10, 0);
96 aOrigin.sub(8, m_vpar_primary.
Vx());
98 VaOrigin.sub(8, m_vpar_primary.
Evx());
99 HepVector ctOrigin(1, 0);
100 HepVector ctInfit(1, 0);
101 HepSymMatrix Vct(1, 0);
105 std::vector<double>
chisq;
108 for(
int it = 0; it < m_niter; it++)
110 HepMatrix D(3, 10, 0);
111 HepLorentzVector
p4par = HepLorentzVector(aInfit[0], aInfit[1], aInfit[2], aInfit[3]);
127 d[0] = aInfit[7]-aInfit[4]+ctInfit[0]*
p4par.px()/
p4par.m();
128 d[1] = aInfit[8]-aInfit[5]+ctInfit[0]*
p4par.py()/
p4par.m();
129 d[2] = aInfit[9]-aInfit[6]+ctInfit[0]*
p4par.pz()/
p4par.m();
149 d[2] = aInfit[9] - aInfit[6]+ctInfit[0]*
p4par.pz()/
p4par.m();
152 HepSymMatrix VD(3, 0);
153 HepVector dela0(10, 0);
154 HepVector lambda0(3, 0);
155 HepVector delct(1, 0);
156 HepVector lambda(3, 0);
159 VD = (VaOrigin.similarity(D)).inverse(ifail);
160 dela0 = aOrigin - aInfit;
161 lambda0 = VD*(D*dela0 + d);
162 Vct = (VD.similarity(E.T())).inverse(ifail);
163 delct = -(Vct * E.T()) * lambda0;
164 ctInfit = ctInfit + delct;
165 lambda = lambda0 + (VD * E) * delct;
166 aInfit = aOrigin - (VaOrigin * D.T()) * lambda;
167 chi2 = dot(lambda, D*dela0 + d);
168 VaInfit = VaOrigin - (VD.similarity(D.T())).similarity(VaOrigin);
169 VaInfit = VaInfit + (((Vct.similarity(E)).similarity(VD)).similarity(D.T())).similarity(VaOrigin);
171 chisq.push_back(chi2);
176 if (fabs(delchi) < m_chiter)
break;
179 if (chi2 < 0 || chi2 > m_chicut)
182 HepLorentzVector
p4par = HepLorentzVector(aInfit[0], aInfit[1], aInfit[2], aInfit[3]);
184 m_ctau_error = sqrt(Vct[0][0]);
185 m_lxyz = ctInfit[0] *
p4par.rho() /
p4par.m();
186 m_lxyz_error = sqrt(Vct[0][0]) *
p4par.rho() /
p4par.m();
189 for(
int i = 0; i < 3; i++)
190 m_crxyz[i] = aInfit[4+i];
192 HepSymMatrix Ew(7, 0);
193 for(
int i = 0; i < 7; i++)
196 for(
int j = 0; j < 7; j++)
198 Ew[i][j] = VaInfit[i][j];
double sin(const BesAngle a)
double cos(const BesAngle a)
HepLorentzVector p4par() const
static SecondVertexFit * instance()
std::vector< WTrackParameter > wTrackOrigin() const
double getCBz(const HepVector &vtx, const HepVector &trackPosition)
static VertexFitBField * instance()
void setEvx(const HepSymMatrix &eVx)
void setVx(const HepPoint3D &vx)
void setEw(const HepSymMatrix &Ew)
void setCharge(const int charge)
void setW(const HepVector &w)